Function rgsl::fft::real_radix2::unpack
[−]
[src]
pub fn unpack(halfcomplex_coefficient: &mut [f64], complex_coefficient: &mut [f64], stride: usize, n: usize) -> Value
This function converts halfcomplex_coefficient, an array of half-complex coefficients as returned by gsl_fft_real_radix2_transform, into an ordinary complex array, complex_coefficient. It fills in the complex array using the symmetry z_k = z_{n-k}* to reconstruct the redundant elements. The algorithm for the conversion is,
complex_coefficient[0].real
= halfcomplex_coefficient[0];
complex_coefficient[0].imag
= 0.0;
for (i = 1; i < n - i; i++)
{
double hc_real
= halfcomplex_coefficient[i*stride];
double hc_imag
= halfcomplex_coefficient[(n-i)*stride];
complex_coefficient[i*stride].real = hc_real;
complex_coefficient[i*stride].imag = hc_imag;
complex_coefficient[(n - i)*stride].real = hc_real;
complex_coefficient[(n - i)*stride].imag = -hc_imag;
}
if (i == n - i)
{
complex_coefficient[i*stride].real
= halfcomplex_coefficient[(n - 1)*stride];
complex_coefficient[i*stride].imag
= 0.0;
}