diff --git a/src/Numerics/IntegralTransforms/Fourier.cs b/src/Numerics/IntegralTransforms/Fourier.cs
index e3fa9ed7..b853ca30 100644
--- a/src/Numerics/IntegralTransforms/Fourier.cs
+++ b/src/Numerics/IntegralTransforms/Fourier.cs
@@ -30,6 +30,7 @@
using System;
using MathNet.Numerics.LinearAlgebra;
using MathNet.Numerics.LinearAlgebra.Storage;
+using MathNet.Numerics.Properties;
using MathNet.Numerics.Providers.FourierTransform;
namespace MathNet.Numerics.IntegralTransforms
@@ -78,6 +79,37 @@ namespace MathNet.Numerics.IntegralTransforms
}
}
+ ///
+ /// Applies the forward Fast Fourier Transform (FFT) to arbitrary-length sample vectors.
+ ///
+ /// Real part of the sample vector, where the FFT is evaluated in place.
+ /// Imaginary part of the sample vector, where the FFT is evaluated in place.
+ /// Fourier Transform Convention Options.
+ public static void Forward(double[] real, double[] imaginary, FourierOptions options = FourierOptions.Default)
+ {
+ if (real.Length != imaginary.Length)
+ {
+ throw new ArgumentException(Resources.ArgumentArraysSameLength);
+ }
+
+ // TODO: consider to support this natively by the provider, without the need for copying
+ // TODO: otherwise, consider ArrayPool
+
+ Complex[] data = new Complex[real.Length];
+ for (int i = 0; i < data.Length; i++)
+ {
+ data[i] = new Complex(real[i], imaginary[i]);
+ }
+
+ Forward(data, options);
+
+ for (int i = 0; i < data.Length; i++)
+ {
+ real[i] = data[i].Real;
+ imaginary[i] = data[i].Imaginary;
+ }
+ }
+
///
/// Applies the forward Fast Fourier Transform (FFT) to multiple dimensional sample data.
///
@@ -182,6 +214,37 @@ namespace MathNet.Numerics.IntegralTransforms
}
}
+ ///
+ /// Applies the inverse Fast Fourier Transform (iFFT) to arbitrary-length sample vectors.
+ ///
+ /// Real part of the sample vector, where the iFFT is evaluated in place.
+ /// Imaginary part of the sample vector, where the iFFT is evaluated in place.
+ /// Fourier Transform Convention Options.
+ public static void Inverse(double[] real, double[] imaginary, FourierOptions options = FourierOptions.Default)
+ {
+ if (real.Length != imaginary.Length)
+ {
+ throw new ArgumentException(Resources.ArgumentArraysSameLength);
+ }
+
+ // TODO: consider to support this natively by the provider, without the need for copying
+ // TODO: otherwise, consider ArrayPool
+
+ Complex[] data = new Complex[real.Length];
+ for (int i = 0; i < data.Length; i++)
+ {
+ data[i] = new Complex(real[i], imaginary[i]);
+ }
+
+ Inverse(data, options);
+
+ for (int i = 0; i < data.Length; i++)
+ {
+ real[i] = data[i].Real;
+ imaginary[i] = data[i].Imaginary;
+ }
+ }
+
///
/// Applies the inverse Fast Fourier Transform (iFFT) to multiple dimensional sample data.
///