realInverseFft method

Float64List realInverseFft(
  1. Float64x2List complexArray
)

Real-valued inverse FFT.

Performs an inverse FFT and discards the imaginary components of the result. Returns a newly allocated Float64List.

This method expects the full result of realFft, so if you use ComplexArray.discardConjugates, remember to use ComplexArray.createConjugates before calling realInverseFft.

WARINING: For efficiency reasons, this modifies complexArray. If you need the original values in complexArray to remain unmodified, make a copy of it first: realInverseFft(complexArray.sublist(0))

Implementation

Float64List realInverseFft(Float64x2List complexArray) {
  inPlaceFft(complexArray);
  final len = complexArray.length;
  final scale = len.toDouble();
  final r = Float64List(len);
  r[0] = complexArray[0].x / scale;
  if (len <= 1) return r;
  for (int i = 1; i < len; ++i) {
    r[i] = complexArray[len - i].x / scale;
  }
  return r;
}