symmetrize

Functions

int main(int argc, char *argv[])

symmetrize [ option ] [ infile ]

  • -l int

    • FFT length \((2 \le L)\)

  • -q int

    • input format \((0 \le Q \le 3)\)

  • -o int

    • output format \((0 \le O \le 3)\)

  • infile str

    • double-type data sequence

  • stdout

    • double-type symmetrized data sequence

ramp -l 3 | x2x +da
# 0, 1, 2
ramp -l 3 | symmetrize -l 4 -q 0 -o 1 | x2x +da
# 0, 1, 2, 1 (used for shaping fourier transform input)
ramp -l 3 | symmetrize -l 4 -q 0 -o 2 | x2x +da
# 1, 1, 0, 1, 1 (used for shaping frequency response)
ramp -l 4 | symmetrize -l 6 -q 0 -o 3 | x2x +da
# 2, 1, 0, 1, 2 (used for shaping frequency response)
Parameters:
  • argc[in] Number of arguments.

  • argv[in] Argument vector.

Returns:

0 on success, 1 on failure.

See also

transpose

class DataSymmetrizing

Symmetrize/desymmetrize data sequence.

The input and output takes one of the following forms.

Type 0:

\[ \begin{array}{cccc} x(0), & x(1), & \ldots, & x(L/2). \end{array} \]
Type 1:
\[ \begin{array}{ccccccc} x(0), & x(1), & \ldots, & x(L/2), & x(L/2-1), & \ldots, & x(1). \end{array} \]
Type 2:
\[ \begin{array}{cccccccc} \frac{1}{2} x(L/2), & x(L/2-1), & \ldots, & x(0), & x(1), & \ldots, & x(L/2-1), & \frac{1}{2} x(L/2). \end{array} \]
Type 3:
\[ \begin{array}{cccccccc} x(L/2), & x(L/2-1), & \ldots, & x(0), & x(1), & \ldots, & x(L/2-1), & x(L/2), \end{array} \]
where \(L\) must be even.

Public Types

enum InputOutputFormats

Input and output format.

Values:

enumerator kStandard
enumerator kSymmetricForApplyingFourierTransform
enumerator kSymmetricForPreservingFrequencyResponse
enumerator kSymmetricForPlottingFrequencyResponse
enumerator kNumInputOutputFormats

Public Functions

DataSymmetrizing(int fft_length, InputOutputFormats input_format, InputOutputFormats output_format)
Parameters:
  • fft_length[in] FFT length, \(L\).

  • input_format[in] Input format.

  • output_format[in] Output format.

inline int GetFftLength() const
Returns:

FFT length.

inline InputOutputFormats GetInputFormat() const
Returns:

Input format.

inline InputOutputFormats GetOutputFormat() const
Returns:

Output format.

inline int GetInputLength() const
Returns:

Expected input length.

inline int GetOutputLength() const
Returns:

Expected output length.

inline bool IsValid() const
Returns:

True if this object is valid.

bool Run(const std::vector<double> &data_sequence, std::vector<double> *symmetrized_data_sequence) const
Parameters:
  • data_sequence[in] Input data.

  • symmetrized_data_sequence[out] Output data.

Returns:

True on success, false on failure.