/// /// This file is part of ILNumerics Community Edition. /// /// ILNumerics Community Edition - high performance computing for applications. /// Copyright (C) 2006 - 2012 Haymo Kutschbach, http://ilnumerics.net /// /// ILNumerics Community Edition is free software: you can redistribute it and/or modify /// it under the terms of the GNU General Public License version 3 as published by /// the Free Software Foundation. /// /// ILNumerics Community Edition is distributed in the hope that it will be useful, /// but WITHOUT ANY WARRANTY; without even the implied warranty of /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /// GNU General Public License for more details. /// /// You should have received a copy of the GNU General Public License /// along with ILNumerics Community Edition. See the file License.txt in the root /// of your distribution package. If not, see . /// /// In addition this software uses the following components and/or licenses: /// /// ================================================================================= /// The Open Toolkit Library License /// /// Copyright (c) 2006 - 2009 the Open Toolkit library. /// /// Permission is hereby granted, free of charge, to any person obtaining a copy /// of this software and associated documentation files (the "Software"), to deal /// in the Software without restriction, including without limitation the rights to /// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of /// the Software, and to permit persons to whom the Software is furnished to do /// so, subject to the following conditions: /// /// The above copyright notice and this permission notice shall be included in all /// copies or substantial portions of the Software. /// /// ================================================================================= /// using System; using ILNumerics.Exceptions; using ILNumerics.Misc; namespace ILNumerics { public partial class ILMath { #region fft(A) /// /// Fast fourier transform (1D) /// /// Input array /// Transformed output array /// The transformation is computed along the first /// non singleton dimension. /// The output array returned will be complex hermitian. I.e. the real /// part being even and the imaginary part being odd symmetrical. /// The forward fourier transform and the inverse fourier transform of /// a given data array A are mathematically equivalent. It's only a /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That /// scaling is introduced in the inverse transform. /// The transformation is computed by use of the native library /// which currently is set up for your processor and OS version. The underlying /// library is automatically choosen at ILNumerics startup and accessed via the /// static member ILMath.FFT. See the online documentation for more /// details in how to tune/configure and select dedicated native libraries. /// Currently supported libraries are: Intel MKL /// (included), AMD ACML and FFTW3 (prepared, optional modules, not included due to licensing conflicts). /// public static ILRetArray< complex> fft(ILInArray< double> A) { using (ILScope.Enter(A)) { if (A.IsEmpty) return empty< complex>(A.Size); if (A.IsScalar) return new complex(A.GetValue(0), 0); int fnsd = A.Size.WorkingDimension(); return ILMath.FFTImplementation.FFTForward1D(A, fnsd); } } /// /// Fast fourier transform (1D) /// /// Input array /// Transformed output array /// /// The transformation is computed along the first non /// singleton dimension. /// The forward fourier transform and the inverse fourier transform of /// a given data array A are mathematically equivalent. It's only a /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That /// scaling is introduced in the inverse transform. /// The transformation is computed by use of the native library /// which currently is set up for your processor and OS version. The underlying /// library is automatically choosen at ILNumerics startup and accessed via the /// static member ILMath.FFT. See the online documentation for more /// details in how to tune/configure and select dedicated native libraries. /// Currently supported libraries are: Intel MKL /// (included), AMD ACML and FFTW3 (prepared, optional modules, not included due to licensing conflicts). /// public static ILRetArray< complex > fft(ILInArray< complex > A) { using (ILScope.Enter(A)) { if (A.IsEmpty) return empty< complex>(A.Size); if (A.IsScalar) return A.C; int fnsd = A.Size.WorkingDimension(); return ILMath.FFTImplementation.FFTForward1D(A, fnsd); } } /// /// Fast inverse fourier transform (1D) /// /// Input (frequency domain) /// Inverse transformed output array /// /// The transformation is computed along the first non /// singleton dimension. /// The forward fourier transform and the inverse fourier transform of /// a given data array A are mathematically equivalent. It's only a /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That /// scaling is introduced in the inverse transform. /// The transformation is computed by use of the native library /// which currently is set up for your processor and OS version. The underlying /// library is automatically choosen at ILNumerics startup and accessed via the /// static member ILMath.FFT. See the online documentation for more /// details in how to tune/configure and select dedicated native libraries. /// Currently supported libraries are: Intel MKL /// (included), AMD ACML and FFTW3 (prepared, optional modules, not included due to licensing conflicts). /// public static ILRetArray ifft(ILInArray A) { using (ILScope.Enter(A)) { if (A.IsEmpty) return empty< complex>(A.Size); if (A.IsScalar) return A.C; int fnsd = A.Size.WorkingDimension(); return ILMath.FFTImplementation.FFTBackward1D(A, fnsd); } } /// /// Inverse fast fourier transform, complex hermitian input /// /// Complex hermitian input array /// Real output array, same size as A /// /// Since a transform of complex hermitian input data results in /// the output having all imaginary part equal zero, only the real part is /// returned for convenience reasons. /// No check is made for A being hermitian! If A is not hermitian (by means /// of round-off errors), the result will be wrong! /// The transformation is computed along the first non /// singleton dimension. /// The forward fourier transform and the inverse fourier transform of /// a given data array A are mathematically equivalent. It's only a /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That /// scaling is introduced in the inverse transform. /// The transformation is computed by use of the native library /// which currently is set up for your processor and OS version. The underlying /// library is automatically choosen at ILNumerics startup and accessed via the /// static member ILMath.FFT. See the online documentation for more /// details in how to tune/configure and select dedicated native libraries. /// Currently supported libraries are: Intel MKL /// (included), AMD ACML and FFTW3 (prepared, optional modules, not included due to licensing conflicts). /// public static ILRetArray< double > ifftsym(ILInArray< complex > A) { using (ILScope.Enter(A)) { if (A.IsEmpty) return empty< double>(A.Size); if (A.IsScalar) return real(A); int fnsd = A.Size.WorkingDimension(); return ILMath.FFTImplementation.FFTBackwSym1D(A, fnsd); } } #endregion #region fft(A, dim) /// /// Fast fourier transform along specific dimension /// /// Real input array /// Dimension to compute FFT along. This parameter must be non-negative. /// Transformation result /// /// The output array returned will be complex hermitian. I.e. the real /// part being even and the imaginary part being odd symmetrical. /// The forward fourier transform and the inverse fourier transform of /// a given data array A are mathematically equivalent. It's only a /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That /// scaling is introduced in the inverse transform. /// The transformation is computed by use of the native library /// which currently is set up for your processor and OS version. The underlying /// library is automatically choosen at ILNumerics startup and accessed via the /// static member ILMath.FFT. See the online documentation for more /// details in how to tune/configure and select dedicated native libraries. /// Currently supported libraries are: Intel MKL /// (included), AMD ACML and FFTW3 (prepared, optional modules, not included due to licensing conflicts). /// /// is thrown if /// the dim parameter is negative public static ILRetArray< complex > fft(ILInArray< double > A, int dim) { using (ILScope.Enter(A)) { if (dim < 0) throw new ILArgumentException("the 'dim' parameter must point to an existing dimension index of A"); if (A.IsEmpty) return empty< complex>(A.Size); if (A.IsScalar) return new complex(A.GetValue(0), 0); return ILMath.FFTImplementation.FFTForward1D(A, dim); } } /// /// Fast fourier transform along specific dimension /// /// Input array /// Dimension to compute FFT along. This parameter /// must be non-negative. /// Transformation result /// /// The forward fourier transform and the inverse fourier transform of /// a given data array A are mathematically equivalent. It's only a /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That /// scaling is introduced in the inverse transform. /// The transformation is computed by use of the native library /// which currently is set up for your processor and OS version. The underlying /// library is automatically choosen at ILNumerics startup and accessed via the /// static member ILMath.FFT. See the online documentation for more /// details in how to tune/configure and select dedicated native libraries. /// Currently supported libraries are: Intel MKL /// (included), AMD ACML and FFTW3 (prepared, optional modules, not included due to licensing conflicts). /// /// is thrown if /// the dim parameter is negative public static ILRetArray< complex > fft(ILInArray< complex > A, int dim) { using (ILScope.Enter(A)) { if (dim < 0) throw new ILArgumentException("the 'dim' parameter must point to an existing dimension index of A"); if (A.IsEmpty) return empty< complex>(A.Size); if (A.IsScalar) return A.C; return ILMath.FFTImplementation.FFTForward1D(A, dim); } } /// /// Inverse fast fourier transform along specific dimension /// /// Input array /// Dimension to compute FFT along. This parameter /// must be non-negative. /// Transformation result /// /// The forward fourier transform and the inverse fourier transform of /// a given data array A are mathematically equivalent. It's only a /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That /// scaling is introduced in the inverse transform. /// The transformation is computed by use of the native library /// which currently is set up for your processor and OS version. The underlying /// library is automatically choosen at ILNumerics startup and accessed via the /// static member ILMath.FFT. See the online documentation for more /// details in how to tune/configure and select dedicated native libraries. /// Currently supported libraries are: Intel MKL /// (included), AMD ACML and FFTW3 (prepared, optional modules, not included due to licensing conflicts). /// /// is thrown if the dim parameter is negative public static ILRetArray< complex> ifft(ILInArray< complex> A, int dim) { using (ILScope.Enter(A)) { if (dim < 0) throw new ILArgumentException("the 'dim' parameter must point to an existing dimension index of A"); if (A.IsEmpty) return empty< complex>(A.Size); if (A.IsScalar) return A.C; return ILMath.FFTImplementation.FFTBackward1D(A, dim); } } /// /// Inverse fast fourier transform, complex hermitian input /// /// Complex hermitian input array (frequency domain) /// Dimension to compute FFT along. This parameter /// must be non-negative. /// Real output array, same size as A /// /// Since a transform of complex hermitian input data results in the /// output having the imaginary part equals zero, only the real part is /// returned for convenience reasons. /// No check is made for A being hermitian! If A is not hermitian (by means /// of round-off errors), the result will be wrong! /// The forward fourier transform and the inverse fourier transform of /// a given data array A are mathematically equivalent. It's only a /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That /// scaling is introduced in the inverse transform. /// The transformation is computed by use of the native library /// which currently is set up for your processor and OS version. The underlying /// library is automatically choosen at ILNumerics startup and accessed via the /// static member ILMath.FFT. See the online documentation for more /// details in how to tune/configure and select dedicated native libraries. /// Currently supported libraries are: Intel MKL (included), AMD ACML /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts). /// /// is thrown if the dim parameter is negative public static ILRetArray< double > ifftsym(ILInArray< complex > A, int dim) { using (ILScope.Enter(A)) { if (dim < 0) throw new ILArgumentException("the 'dim' parameter must point to an existing dimension index of A"); if (A.IsEmpty) return empty< double>(A.Size); if (A.IsScalar) return real(A); return ILMath.FFTImplementation.FFTBackwSym1D(A, dim); } } #endregion #region fft2(A) /// /// Fast fourier transform (2D) /// /// Input array /// Transformation result /// /// The 2D transformation is computed for the first 2 dimensions, regardless /// of those dimensions being singleton or non-singleton. If A is an n-d array, /// the transformation is repeated for trailing dimensions of A respectively. /// The output array returned will be complex hermitian. /// The two dimensional transformation is equivalent to repeatedly transforming /// the columns and after that transforming the rows of A. However, using this /// function may be of magnitudes faster than using 1D transformations. This /// depends on the algorithm and API provided by the underlying native library. /// The forward fourier transform and the inverse fourier transform of /// a given data array A are mathematically equivalent. It's only a /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That /// scaling is introduced in the inverse transform. /// The transformation is computed by use of the native library /// which currently is set up for your processor and OS version. The underlying /// library is automatically choosen at ILNumerics startup and accessed via the /// static member ILMath.FFT. See the online documentation for more /// details in how to tune/configure and select dedicated native libraries. /// Currently supported libraries are: Intel MKL (included), AMD ACML /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts). /// public static ILRetArray< complex > fft2(ILInArray< double > A) { using (ILScope.Enter(A)) { if (A.IsEmpty) return empty< complex>(A.Size); if (A.IsScalar) return new complex(A.GetValue(0), 0); return FFTImplementation.FFTForward(A, 2); } } /// /// Fast fourier transform (2D) /// /// Input array /// Transformation result /// /// The transformation is computed for the first 2 dimensions, regardless /// of those dimensions being singleton or non-singleton. If A is an n-d array, /// the transformation is repeated for trailing dimensions of A respectively. /// The two dimensional transformation is equivalent to repeatedly transforming /// the columns and after that transforming the rows of A. However, using this /// function may be of magnitudes faster than using 1D transformations. This /// depends on the algorithm and API provided by the underlying native library. /// The forward fourier transform and the inverse fourier transform of /// a given data array A are mathematically equivalent. It's only a /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That /// scaling is introduced in the inverse transform. /// The transformation is computed by use of the native library /// which currently is set up for your processor and OS version. The underlying /// library is automatically choosen at ILNumerics startup and accessed via the /// static member ILMath.FFT. See the online documentation for more /// details in how to tune/configure and select dedicated native libraries. /// Currently supported libraries are: Intel MKL (included), AMD ACML /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts). /// public static ILRetArray< complex> fft2(ILInArray< complex> A) { using (ILScope.Enter(A)) { if (A.IsEmpty) return empty< complex>(A.Size); if (A.IsScalar) return A.C; return FFTImplementation.FFTForward(A, 2); } } /// /// Inverse fast fourier transform (2D) /// /// Input array /// Transformation result /// /// The transformation is computed for the first 2 dimensions, regardless /// of those dimensions being singleton or non-singleton. If A is an n-d array, /// the transformation is repeated for trailing dimensions of A respectively. /// The two dimensional transformation is equivalent to repeatedly transforming /// the columns and after that transforming the rows of A. However, using this /// function may be of magnitudes faster than using 1D transformations. This /// depends on the algorithm and API provided by the underlying native library. /// The forward fourier transform and the inverse fourier transform of /// a given data array A are mathematically equivalent. It's only a /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That /// scaling is introduced in the inverse transform. /// The transformation is computed by use of the native library /// which currently is set up for your processor and OS version. The underlying /// library is automatically choosen at ILNumerics startup and accessed via the /// static member ILMath.FFT. See the online documentation for more /// details in how to tune/configure and select dedicated native libraries. /// Currently supported libraries are: Intel MKL (included), AMD ACML /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts). /// public static ILRetArray< complex> ifft2(ILInArray< complex> A) { using (ILScope.Enter(A)) { if (A.IsEmpty) return empty< complex>(A.Size); if (A.IsScalar) return A.C; return FFTImplementation.FFTBackward(A, 2); } } /// /// Inverse fast fourier transform (2D, hermitian input) /// /// Complex hermitian input array (frequency domain) /// Transformation result /// /// Since a transform of complex hermitian input data results in the /// output having the imaginary part equals zero, only the real part is /// returned for convenience reasons. /// No check is made for A being hermitian! If A is not hermitian (by means /// of round-off errors), the result will be wrong! /// The transformation is computed for the first 2 dimensions, regardless /// of those dimensions being singleton or non-singleton. If A is an n-d array, /// the transformation is repeated for trailing dimensions of A respectively. /// The two dimensional transformation is equivalent to repeatedly transforming /// the columns and after that transforming the rows of A. However, using this /// function may be of magnitudes faster than using 1D transformations. This /// depends on the algorithm and API provided by the underlying native library. /// The forward fourier transform and the inverse fourier transform of /// a given data array A are mathematically equivalent. It's only a /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That /// scaling is introduced in the inverse transform. /// The transformation is computed by use of the native library /// which currently is set up for your processor and OS version. The underlying /// library is automatically choosen at ILNumerics startup and accessed via the /// static member ILMath.FFT. See the online documentation for more /// details in how to tune/configure and select dedicated native libraries. /// Currently supported libraries are: Intel MKL (included), AMD ACML /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts). /// public static ILRetArray< double> ifft2sym(ILInArray< complex> A) { using (ILScope.Enter(A)) { if (A.IsEmpty) return empty< double>(A.Size); if (A.IsScalar) return real(A); return FFTImplementation.FFTBackwSym(A, 2); } } #endregion #region fft2(A,m,n) /// /// Fast fourier transform (2D) /// /// Input array /// Transformation column length /// Transformation row length /// Transformation result, complex hermitian /// /// The transformation is computed for the first 2 dimensions, regardless /// of those dimensions being singleton or non-singleton. If A is an n-d array, /// the transformation is repeated for trailing dimensions of A respectively. /// The data to be transformed (based on the A array) are resized according to /// the length parameter m and n. If m or n is larger then the length of the corresponding /// dimension of A, zeros will be padded, otherwise the dimensions are truncated respectively. /// The two dimensional transformation is equivalent to repeatedly transforming /// the columns and after that transforming the rows of A. However, using this /// function may be of magnitudes faster than using 1D transformations. This /// depends on the algorithm and API provided by the underlying native library. /// The forward fourier transform and the inverse fourier transform of /// a given data array A are mathematically equivalent. It's only a /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That /// scaling is introduced in the inverse transform. /// The transformation is computed by use of the native library /// which currently is set up for your processor and OS version. The underlying /// library is automatically choosen at ILNumerics startup and accessed via the /// static member ILMath.FFT. See the online documentation for more /// details in how to tune/configure and select dedicated native libraries. /// Currently supported libraries are: Intel MKL (included), AMD ACML /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts). /// /// is thrown if one of n or m is negative public static ILRetArray< complex> fft2(ILInArray< double> A, int m, int n) { using (ILScope.Enter(A)) { if (m < 0 || n < 0) throw new ILArgumentException("dimension length specifier 'm' and 'n' must be non-negative!"); if (A.IsEmpty) return empty< complex>(A.Size); int[] Asize = A.Size.ToIntArray(); Asize[0] = m; Asize[1] = n; ILArray< double> resizedA = resize4Transform(A, Asize); return FFTImplementation.FFTForward(resizedA, 2); } } /// /// Fast fourier transform (2D) /// /// input array /// Transformation column length /// Transformation row length /// Transformation result /// /// The transformation is computed for the first 2 dimensions, regardless /// of those dimensions being singleton or non-singleton. If A is an n-d array, /// the transformation is repeated for trailing dimensions of A respectively. /// The data to be transformed (based on the A array) are resized according to /// the length parameter m and n. If m or n is larger then the length of the corresponding /// dimension of A, zeros will be padded, otherwise the dimensions are truncated respectively. /// The two dimensional transformation is equivalent to repeatedly transforming /// the columns and after that transforming the rows of A. However, using this /// function may be of magnitudes faster than using 1D transformations. This /// depends on the algorithm and API provided by the underlying native library. /// The forward fourier transform and the inverse fourier transform of /// a given data array A are mathematically equivalent. It's only a /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That /// scaling is introduced in the inverse transform. /// The transformation is computed by use of the native library /// which currently is set up for your processor and OS version. The underlying /// library is automatically choosen at ILNumerics startup and accessed via the /// static member ILMath.FFT. See the online documentation for more /// details in how to tune/configure and select dedicated native libraries. /// Currently supported libraries are: Intel MKL (included), AMD ACML /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts). /// /// is thrown if one of n or m is negative public static ILRetArray< complex> fft2(ILInArray< complex> A, int m, int n) { using (ILScope.Enter(A)) { if (m < 0 || n < 0) throw new ILArgumentException("dimension length specifier 'm' and 'n' must be non-negative!"); if (A.IsEmpty) return empty< complex>(A.Size); int[] Asize = A.Size.ToIntArray(); Asize[0] = m; Asize[1] = n; ILRetArray< complex> resizedA = resize4Transform(A, Asize); return FFTImplementation.FFTForward(resizedA, 2); } } /// /// Inverse fast fourier transform (2D) /// /// Input array /// Transformation column length /// Transformation row length /// Transformation result /// /// The transformation is computed for the first 2 dimensions, regardless /// of those dimensions being singleton or non-singleton. If A is an n-d array, /// the transformation is repeated for trailing dimensions of A respectively. /// The data to be transformed (based on the array A) are resized according to /// the length parameter m and n. If m or n is larger then the length of the corresponding /// dimension of A, zeros will be padded, otherwise the dimensions are truncated respectively. /// The two dimensional transformation is equivalent to repeatedly transforming /// the columns and after that transforming the rows of A. However, using this /// function may be of magnitudes faster than using 1D transformations. This /// depends on the algorithm and API provided by the underlying native library. /// The forward fourier transform and the inverse fourier transform of /// a given data array A are mathematically equivalent. It's only a /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That /// scaling is introduced in the inverse transform. /// The transformation is computed by use of the native library /// which currently is set up for your processor and OS version. The underlying /// library is automatically choosen at ILNumerics startup and accessed via the /// static member ILMath.FFT. See the online documentation for more /// details in how to tune/configure and select dedicated native libraries. /// Currently supported libraries are: Intel MKL (included), AMD ACML /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts). /// /// is thrown if one of n or m is negative public static ILRetArray< complex> ifft2(ILInArray< complex> A, int m, int n) { using (ILScope.Enter(A)) { if (m < 0 || n < 0) throw new ILArgumentException("dimension length specifier 'm' and 'n' must be non-negative!"); if (A.IsEmpty) return empty< complex>(A.Size); int[] Asize = A.Size.ToIntArray(); Asize[0] = m; Asize[1] = n; ILRetArray< complex> resizedA = resize4Transform(A, Asize); return FFTImplementation.FFTBackward(resizedA, 2); } } /// /// Inverse fast fourier transform (2D) /// /// Complex hermitian input array, symmetric in first 2 dimensions /// Transformation column length /// Transformation row length /// Transformation result /// /// The transformation is computed for the first 2 dimensions, regardless /// of those dimensions being singleton or non-singleton. If A is an n-d array, /// the transformation is repeated for trailing dimensions of A respectively. The /// lengths of those trailing dimensions are not altered. /// Since a transform of complex hermitian input data results in the /// output having the imaginary part equals zero, only the real part is /// returned for convenience reasons. /// No check is made for A being hermitian! If A is not hermitian (by means /// of round-off errors), the result will be wrong! /// The data to be transformed (based on the array A) are resized according to /// the length parameter m and n. If m or n is larger then the length of the corresponding /// dimension of A, zeros will be padded, otherwise the dimensions are truncated respectively. /// The two dimensional transformation is equivalent to repeatedly transforming /// the columns and after that transforming the rows of A. However, using this /// function may be of magnitudes faster than using 1D transformations. This /// depends on the algorithm and API provided by the underlying native library. /// The forward fourier transform and the inverse fourier transform of /// a given data array A are mathematically equivalent. It's only a /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That /// scaling is introduced in the inverse transform. /// The transformation is computed by use of the native library /// which currently is set up for your processor and OS version. The underlying /// library is automatically choosen at ILNumerics startup and accessed via the /// static member ILMath.FFT. See the online documentation for more /// details in how to tune/configure and select dedicated native libraries. /// Currently supported libraries are: Intel MKL (included), AMD ACML /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts). /// /// is thrown if one of n or m is negative public static ILRetArray< double> ifft2sym(ILInArray< complex> A, int m, int n) { using (ILScope.Enter(A)) { if (m < 0 || n < 0) throw new ILArgumentException("dimension length specifier 'm' and 'n' must be non-negative!"); if (A.IsEmpty) return empty< double>(A.Size); int[] Asize = A.Size.ToIntArray(); Asize[0] = m; Asize[1] = n; ILRetArray< complex> resizedA = resize4Transform(A, Asize); return FFTImplementation.FFTBackwSym(resizedA, 2); } } #endregion #region fftn(A) /// /// Fast fourier transform (n-D) /// /// Input array, n-D /// Transformation result, complex hermitian /// /// The n-dimensional transformation is computed for the n-dimensional array A. /// This is equivalent to repeatedly (inplace) /// computing one dimensional transformations along all dimensions of A. /// However, using this /// function may be of magnitudes faster than using 1D transformations. This /// depends on the algorithm and API provided by the underlying native library. /// The forward fourier transform and the inverse fourier transform of /// a given data array A are mathematically equivalent. It's only a /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That /// scaling is introduced in the inverse transform. /// The transformation is computed by use of the native library /// which currently is set up for your processor and OS version. The underlying /// library is automatically choosen at ILNumerics startup and accessed via the /// static member ILMath.FFT. See the online documentation for more /// details in how to tune/configure and select dedicated native libraries. /// Currently supported libraries are: Intel MKL (included), AMD ACML /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts). /// public static ILRetArray< complex> fftn(ILInArray< double> A) { using (ILScope.Enter(A)) { if (A.IsEmpty) return empty< complex>(A.Size); return FFTImplementation.FFTForward(A, A.Size.NumberOfDimensions); } } /// /// Fast fourier transform (n-D) /// /// Input array, n-D /// Transformation result /// /// The n-dimensional transformation is computed for the n-dimensional array A. /// This is equivalent to repeatedly (inplace) /// computing one dimensional transformations along all dimensions of A. /// However, using this /// function may be of magnitudes faster than using 1D transformations. This /// depends on the algorithm and API provided by the underlying native library. /// The forward fourier transform and the inverse fourier transform of /// a given data array A are mathematically equivalent. It's only a /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That /// scaling is introduced in the inverse transform. /// The transformation is computed by use of the native library /// which currently is set up for your processor and OS version. The underlying /// library is automatically choosen at ILNumerics startup and accessed via the /// static member ILMath.FFT. See the online documentation for more /// details in how to tune/configure and select dedicated native libraries. /// Currently supported libraries are: Intel MKL (included), AMD ACML /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts). /// public static ILRetArray< complex> fftn(ILInArray< complex> A) { using (ILScope.Enter(A)) { if (A.IsEmpty) return empty< complex>(A.Size); return FFTImplementation.FFTForward(A, A.Size.NumberOfDimensions); } } /// /// Inverse fast fourier transform (n-D) /// /// Input array, n-D (frequency domain) /// Transformation result /// /// The n-dimensional inverse transformation is computed for the n-dimensional array A. /// This is equivalent to repeatedly (inplace) /// computing one dimensional transformations along all dimensions of A. /// However, using this /// function may be of magnitudes faster than using 1D transformations. This /// depends on the algorithm and API provided by the underlying native library. /// The forward fourier transform and the inverse fourier transform of /// a given data array A are mathematically equivalent. It's only a /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That /// scaling is introduced in the inverse transform. /// The transformation is computed by use of the native library /// which currently is set up for your processor and OS version. The underlying /// library is automatically choosen at ILNumerics startup and accessed via the /// static member ILMath.FFT. See the online documentation for more /// details in how to tune/configure and select dedicated native libraries. /// Currently supported libraries are: Intel MKL (included), AMD ACML /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts). /// public static ILRetArray< complex> ifftn(ILInArray< complex> A) { using (ILScope.Enter(A)) { if (A.IsEmpty) return empty< complex>(A.Size); return FFTImplementation.FFTBackward(A, A.Size.NumberOfDimensions); } } /// /// Inverse fast fourier transform (n-D) /// /// Input array, n-D, complex hermitian (frequency domain) /// Transformation result /// /// The n-dimensional inverse transformation is computed for the n-dimensional array A. /// This is equivalent to repeatedly (inplace) /// computing one dimensional transformations along all dimensions of A. /// However, using this /// function may be of magnitudes faster than using 1D transformations. This /// depends on the algorithm and API provided by the underlying native library. /// Since a transform of complex hermitian input data results in the /// output having the imaginary part equals zero, only the real part is /// returned for convenience reasons. /// No check is made for A being hermitian! If A is not hermitian (by means /// of round-off errors), the result will be wrong! /// The forward fourier transform and the inverse fourier transform of /// a given data array A are mathematically equivalent. It's only a /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That /// scaling is introduced in the inverse transform. /// The transformation is computed by use of the native library /// which currently is set up for your processor and OS version. The underlying /// library is automatically choosen at ILNumerics startup and accessed via the /// static member ILMath.FFT. See the online documentation for more /// details in how to tune/configure and select dedicated native libraries. /// Currently supported libraries are: Intel MKL (included), AMD ACML /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts). /// public static ILRetArray< double> ifftnsym(ILInArray< complex> A) { using (ILScope.Enter(A)) { if (A.IsEmpty) return empty< double>(A.Size); return FFTImplementation.FFTBackwSym(A, A.Size.NumberOfDimensions); } } #endregion #region fftn(A, params dims) /// /// Fast fourier transform (n-D, specific size) /// /// Input array, n-D /// Transformation lengths, specifies the length of the dimensions /// for the transformation array. The length of dims must be > or equal to the number of /// dimensions of A. For elements in dim being smaller than corresponding dimension /// length in A, the dimensions will be truncated, otherwise zeros will be padded. /// Transformation result of size specified by 'dims' parameter, complex hermitian /// /// The n-dimensional transformation is computed for the n-dimensional array A. /// Before the transform, the input is resized according to the 'dims' parameter. /// Dimensions larger than corresponding entries in 'dim' are truncated, dimensions /// smaller than corresponding entries in 'dim' are zero padded. /// The n-dimensional transformation is equivalent to repeatedly (inplace) /// computing one dimensional transformations along all dimensions of A. /// However, using this /// function may be of magnitudes faster than using 1D transformations. This /// depends on the algorithm and API provided by the underlying native library. /// The forward fourier transform and the inverse fourier transform of /// a given data array A are mathematically equivalent. It's only a /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That /// scaling is introduced in the inverse transform. /// The transformation is computed by use of the native library /// which currently is set up for your processor and OS version. The underlying /// library is automatically choosen at ILNumerics startup and accessed via the /// static member ILMath.FFT. See the online documentation for more /// details in how to tune/configure and select dedicated native libraries. /// Currently supported libraries are: Intel MKL (included), AMD ACML /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts). /// /// is thrown if the /// dim parameter is null, its length is less then the number of dimensions of A /// or any element of dims is non-negative public static ILRetArray< complex> fftn(ILInArray< double> A, params int[] dims) { using (ILScope.Enter(A)) { if (A.IsEmpty) return empty< complex>(A.Size); ILRetArray< double> resizedA = resize4Transform(A, dims); return FFTImplementation.FFTForward(resizedA, dims.Length); } } /// /// Fast fourier transform (n-D, specific size) /// /// Tnput array, n-D /// Transformation lengths, specifies the length of the dimensions /// for the transformation array. The length of dims must be > or equal to the number of /// dimensions of A. For elements in dim being smaller than corresponding dimension /// length in A, the dimensions will be truncated, otherwise zeros will be padded. /// Transformation result of size specified by 'dims' parameter /// /// The n-dimensional transformation is computed for the n-dimensional array A. /// Before the transform, the input is resized according to the 'dims' parameter. /// Dimensions larger than corresponding entries in 'dim' are truncated, dimensions /// smaller than corresponding entries in 'dim' are zero padded. /// The n-dimensional transformation is equivalent to repeatedly (inplace) /// computing one dimensional transformations along all dimensions of A. /// However, using this /// function may be of magnitudes faster than using 1D transformations. This /// depends on the algorithm and API provided by the underlying native library. /// The forward fourier transform and the inverse fourier transform of /// a given data array A are mathematically equivalent. It's only a /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That /// scaling is introduced in the inverse transform. /// The transformation is computed by use of the native library /// which currently is set up for your processor and OS version. The underlying /// library is automatically choosen at ILNumerics startup and accessed via the /// static member ILMath.FFT. See the online documentation for more /// details in how to tune/configure and select dedicated native libraries. /// Currently supported libraries are: Intel MKL (included), AMD ACML /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts). /// /// is thrown if the /// dim parameter is null, its length is less then the number of dimensions of A /// or any element of dims is non-negative public static ILRetArray< complex> fftn(ILInArray< complex> A, params int[] dims) { using (ILScope.Enter(A)) { if (A.IsEmpty) return empty< complex>(A.Size); ILRetArray< complex> resizedA = resize4Transform(A, dims); return FFTImplementation.FFTForward(resizedA, dims.Length); } } /// /// Inverse fast fourier transform (n-D, specific size) /// /// Input array, n-D /// Transformation lengths, specifies the length of the dimensions /// for the transformation array. The length of dims must be > or equal to the number of /// dimensions of A. For elements in dim being smaller than corresponding dimension /// length in A, the dimensions will be truncated, otherwise zeros will be padded. /// Transformation result of size specified by 'dims' parameter /// /// The n-dimensional transformation is computed for the n-dimensional array A. /// Before the transform, the input is resized according to the 'dims' parameter. /// Dimensions larger than corresponding entries in 'dim' are truncated, dimensions /// smaller than corresponding entries in 'dim' are zero padded. /// The n-dimensional transformation is equivalent to repeatedly (inplace) /// computing one dimensional transformations along all dimensions of A. /// However, using this /// function may be of magnitudes faster than using 1D transformations. This /// depends on the algorithm and API provided by the underlying native library. /// The forward fourier transform and the inverse fourier transform of /// a given data array A are mathematically equivalent. It's only a /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That /// scaling is introduced in the inverse transform. /// The transformation is computed by use of the native library /// which currently is set up for your processor and OS version. The underlying /// library is automatically choosen at ILNumerics startup and accessed via the /// static member ILMath.FFT. See the online documentation for more /// details in how to tune/configure and select dedicated native libraries. /// Currently supported libraries are: Intel MKL (included), AMD ACML /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts). /// /// is thrown if the /// dim parameter is null, its length is less then the number of dimensions of A /// or any element of dims is non-negative public static ILRetArray< complex> ifftn(ILInArray< complex> A, params int[] dims) { using (ILScope.Enter(A)) { if (A.IsEmpty) return empty< complex>(A.Size); ILRetArray< complex> resizedA = resize4Transform(A, dims); return FFTImplementation.FFTBackward(resizedA, dims.Length); } } /// /// Inverse fast fourier transform (n-D, complex hermitian, specific size) /// /// Complex hermitian input array, n-D /// Transformation lengths, specifies the length of the dimensions /// for the transformation array. The length of dims must be > or equal to the number of /// dimensions of A. For elements in dim being smaller than corresponding dimension /// length in A, the dimensions will be truncated, otherwise zeros will be padded. /// Transformation result, real array of the size specified by the 'dims' parameter /// /// The n-dimensional transformation is computed for the n-dimensional array A. /// Before the transform, the input is resized according to the 'dims' parameter. /// Dimensions larger than corresponding entries in 'dim' are truncated, dimensions /// smaller than corresponding entries in 'dim' are zero padded. /// The n-dimensional transformation is equivalent to repeatedly (inplace) /// computing one dimensional transformations along all dimensions of A. /// However, using this /// function may be of magnitudes faster than using 1D transformations. This /// depends on the algorithm and API provided by the underlying native library. /// Since a transform of complex hermitian input data results in the /// output having the imaginary part equals zero, only the real part is /// returned for convenience reasons. /// No check is made for A being hermitian! If A is not hermitian (by means /// of round-off errors), the result will be wrong! /// The forward fourier transform and the inverse fourier transform of /// a given data array A are mathematically equivalent. It's only a /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That /// scaling is introduced in the inverse transform. /// The transformation is computed by use of the native library /// which currently is set up for your processor and OS version. The underlying /// library is automatically choosen at ILNumerics startup and accessed via the /// static member ILMath.FFT. See the online documentation for more /// details in how to tune/configure and select dedicated native libraries. /// Currently supported libraries are: Intel MKL (included), AMD ACML /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts). /// /// is thrown if the /// dim parameter is null, its length is less then the number of dimensions of A /// or any element of dims is non-negative public static ILRetArray< double> ifftnsym(ILInArray< complex> A, params int[] dims) { using (ILScope.Enter(A)) { if (A.IsEmpty) return empty< double>(A.Size); ILRetArray< complex> resizedA = resize4Transform(A, dims); return FFTImplementation.FFTBackwSym(resizedA, dims.Length); } } #endregion #region HYCALPER AUTO GENERATED CODE #region fft(A) /// /// Fast fourier transform (1D) /// /// Input array /// Transformed output array /// The transformation is computed along the first /// non singleton dimension. /// The output array returned will be complex hermitian. I.e. the real /// part being even and the imaginary part being odd symmetrical. /// The forward fourier transform and the inverse fourier transform of /// a given data array A are mathematically equivalent. It's only a /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That /// scaling is introduced in the inverse transform. /// The transformation is computed by use of the native library /// which currently is set up for your processor and OS version. The underlying /// library is automatically choosen at ILNumerics startup and accessed via the /// static member ILMath.FFT. See the online documentation for more /// details in how to tune/configure and select dedicated native libraries. /// Currently supported libraries are: Intel MKL /// (included), AMD ACML and FFTW3 (prepared, optional modules, not included due to licensing conflicts). /// public static ILRetArray< fcomplex> fft(ILInArray< float> A) { using (ILScope.Enter(A)) { if (A.IsEmpty) return empty< fcomplex>(A.Size); if (A.IsScalar) return new fcomplex(A.GetValue(0), 0); int fnsd = A.Size.WorkingDimension(); return ILMath.FFTImplementation.FFTForward1D(A, fnsd); } } /// /// Fast fourier transform (1D) /// /// Input array /// Transformed output array /// /// The transformation is computed along the first non /// singleton dimension. /// The forward fourier transform and the inverse fourier transform of /// a given data array A are mathematically equivalent. It's only a /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That /// scaling is introduced in the inverse transform. /// The transformation is computed by use of the native library /// which currently is set up for your processor and OS version. The underlying /// library is automatically choosen at ILNumerics startup and accessed via the /// static member ILMath.FFT. See the online documentation for more /// details in how to tune/configure and select dedicated native libraries. /// Currently supported libraries are: Intel MKL /// (included), AMD ACML and FFTW3 (prepared, optional modules, not included due to licensing conflicts). /// public static ILRetArray< fcomplex > fft(ILInArray< fcomplex > A) { using (ILScope.Enter(A)) { if (A.IsEmpty) return empty< fcomplex>(A.Size); if (A.IsScalar) return A.C; int fnsd = A.Size.WorkingDimension(); return ILMath.FFTImplementation.FFTForward1D(A, fnsd); } } /// /// Fast inverse fourier transform (1D) /// /// Input (frequency domain) /// Inverse transformed output array /// /// The transformation is computed along the first non /// singleton dimension. /// The forward fourier transform and the inverse fourier transform of /// a given data array A are mathematically equivalent. It's only a /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That /// scaling is introduced in the inverse transform. /// The transformation is computed by use of the native library /// which currently is set up for your processor and OS version. The underlying /// library is automatically choosen at ILNumerics startup and accessed via the /// static member ILMath.FFT. See the online documentation for more /// details in how to tune/configure and select dedicated native libraries. /// Currently supported libraries are: Intel MKL /// (included), AMD ACML and FFTW3 (prepared, optional modules, not included due to licensing conflicts). /// public static ILRetArray ifft(ILInArray A) { using (ILScope.Enter(A)) { if (A.IsEmpty) return empty< fcomplex>(A.Size); if (A.IsScalar) return A.C; int fnsd = A.Size.WorkingDimension(); return ILMath.FFTImplementation.FFTBackward1D(A, fnsd); } } /// /// Inverse fast fourier transform, complex hermitian input /// /// Complex hermitian input array /// Real output array, same size as A /// /// Since a transform of complex hermitian input data results in /// the output having all imaginary part equal zero, only the real part is /// returned for convenience reasons. /// No check is made for A being hermitian! If A is not hermitian (by means /// of round-off errors), the result will be wrong! /// The transformation is computed along the first non /// singleton dimension. /// The forward fourier transform and the inverse fourier transform of /// a given data array A are mathematically equivalent. It's only a /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That /// scaling is introduced in the inverse transform. /// The transformation is computed by use of the native library /// which currently is set up for your processor and OS version. The underlying /// library is automatically choosen at ILNumerics startup and accessed via the /// static member ILMath.FFT. See the online documentation for more /// details in how to tune/configure and select dedicated native libraries. /// Currently supported libraries are: Intel MKL /// (included), AMD ACML and FFTW3 (prepared, optional modules, not included due to licensing conflicts). /// public static ILRetArray< float > ifftsym(ILInArray< fcomplex > A) { using (ILScope.Enter(A)) { if (A.IsEmpty) return empty< float>(A.Size); if (A.IsScalar) return real(A); int fnsd = A.Size.WorkingDimension(); return ILMath.FFTImplementation.FFTBackwSym1D(A, fnsd); } } #endregion #region fft(A, dim) /// /// Fast fourier transform along specific dimension /// /// Real input array /// Dimension to compute FFT along. This parameter must be non-negative. /// Transformation result /// /// The output array returned will be complex hermitian. I.e. the real /// part being even and the imaginary part being odd symmetrical. /// The forward fourier transform and the inverse fourier transform of /// a given data array A are mathematically equivalent. It's only a /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That /// scaling is introduced in the inverse transform. /// The transformation is computed by use of the native library /// which currently is set up for your processor and OS version. The underlying /// library is automatically choosen at ILNumerics startup and accessed via the /// static member ILMath.FFT. See the online documentation for more /// details in how to tune/configure and select dedicated native libraries. /// Currently supported libraries are: Intel MKL /// (included), AMD ACML and FFTW3 (prepared, optional modules, not included due to licensing conflicts). /// /// is thrown if /// the dim parameter is negative public static ILRetArray< fcomplex > fft(ILInArray< float > A, int dim) { using (ILScope.Enter(A)) { if (dim < 0) throw new ILArgumentException("the 'dim' parameter must point to an existing dimension index of A"); if (A.IsEmpty) return empty< fcomplex>(A.Size); if (A.IsScalar) return new fcomplex(A.GetValue(0), 0); return ILMath.FFTImplementation.FFTForward1D(A, dim); } } /// /// Fast fourier transform along specific dimension /// /// Input array /// Dimension to compute FFT along. This parameter /// must be non-negative. /// Transformation result /// /// The forward fourier transform and the inverse fourier transform of /// a given data array A are mathematically equivalent. It's only a /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That /// scaling is introduced in the inverse transform. /// The transformation is computed by use of the native library /// which currently is set up for your processor and OS version. The underlying /// library is automatically choosen at ILNumerics startup and accessed via the /// static member ILMath.FFT. See the online documentation for more /// details in how to tune/configure and select dedicated native libraries. /// Currently supported libraries are: Intel MKL /// (included), AMD ACML and FFTW3 (prepared, optional modules, not included due to licensing conflicts). /// /// is thrown if /// the dim parameter is negative public static ILRetArray< fcomplex > fft(ILInArray< fcomplex > A, int dim) { using (ILScope.Enter(A)) { if (dim < 0) throw new ILArgumentException("the 'dim' parameter must point to an existing dimension index of A"); if (A.IsEmpty) return empty< fcomplex>(A.Size); if (A.IsScalar) return A.C; return ILMath.FFTImplementation.FFTForward1D(A, dim); } } /// /// Inverse fast fourier transform along specific dimension /// /// Input array /// Dimension to compute FFT along. This parameter /// must be non-negative. /// Transformation result /// /// The forward fourier transform and the inverse fourier transform of /// a given data array A are mathematically equivalent. It's only a /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That /// scaling is introduced in the inverse transform. /// The transformation is computed by use of the native library /// which currently is set up for your processor and OS version. The underlying /// library is automatically choosen at ILNumerics startup and accessed via the /// static member ILMath.FFT. See the online documentation for more /// details in how to tune/configure and select dedicated native libraries. /// Currently supported libraries are: Intel MKL /// (included), AMD ACML and FFTW3 (prepared, optional modules, not included due to licensing conflicts). /// /// is thrown if the dim parameter is negative public static ILRetArray< fcomplex> ifft(ILInArray< fcomplex> A, int dim) { using (ILScope.Enter(A)) { if (dim < 0) throw new ILArgumentException("the 'dim' parameter must point to an existing dimension index of A"); if (A.IsEmpty) return empty< fcomplex>(A.Size); if (A.IsScalar) return A.C; return ILMath.FFTImplementation.FFTBackward1D(A, dim); } } /// /// Inverse fast fourier transform, complex hermitian input /// /// Complex hermitian input array (frequency domain) /// Dimension to compute FFT along. This parameter /// must be non-negative. /// Real output array, same size as A /// /// Since a transform of complex hermitian input data results in the /// output having the imaginary part equals zero, only the real part is /// returned for convenience reasons. /// No check is made for A being hermitian! If A is not hermitian (by means /// of round-off errors), the result will be wrong! /// The forward fourier transform and the inverse fourier transform of /// a given data array A are mathematically equivalent. It's only a /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That /// scaling is introduced in the inverse transform. /// The transformation is computed by use of the native library /// which currently is set up for your processor and OS version. The underlying /// library is automatically choosen at ILNumerics startup and accessed via the /// static member ILMath.FFT. See the online documentation for more /// details in how to tune/configure and select dedicated native libraries. /// Currently supported libraries are: Intel MKL (included), AMD ACML /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts). /// /// is thrown if the dim parameter is negative public static ILRetArray< float > ifftsym(ILInArray< fcomplex > A, int dim) { using (ILScope.Enter(A)) { if (dim < 0) throw new ILArgumentException("the 'dim' parameter must point to an existing dimension index of A"); if (A.IsEmpty) return empty< float>(A.Size); if (A.IsScalar) return real(A); return ILMath.FFTImplementation.FFTBackwSym1D(A, dim); } } #endregion #region fft2(A) /// /// Fast fourier transform (2D) /// /// Input array /// Transformation result /// /// The 2D transformation is computed for the first 2 dimensions, regardless /// of those dimensions being singleton or non-singleton. If A is an n-d array, /// the transformation is repeated for trailing dimensions of A respectively. /// The output array returned will be complex hermitian. /// The two dimensional transformation is equivalent to repeatedly transforming /// the columns and after that transforming the rows of A. However, using this /// function may be of magnitudes faster than using 1D transformations. This /// depends on the algorithm and API provided by the underlying native library. /// The forward fourier transform and the inverse fourier transform of /// a given data array A are mathematically equivalent. It's only a /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That /// scaling is introduced in the inverse transform. /// The transformation is computed by use of the native library /// which currently is set up for your processor and OS version. The underlying /// library is automatically choosen at ILNumerics startup and accessed via the /// static member ILMath.FFT. See the online documentation for more /// details in how to tune/configure and select dedicated native libraries. /// Currently supported libraries are: Intel MKL (included), AMD ACML /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts). /// public static ILRetArray< fcomplex > fft2(ILInArray< float > A) { using (ILScope.Enter(A)) { if (A.IsEmpty) return empty< fcomplex>(A.Size); if (A.IsScalar) return new fcomplex(A.GetValue(0), 0); return FFTImplementation.FFTForward(A, 2); } } /// /// Fast fourier transform (2D) /// /// Input array /// Transformation result /// /// The transformation is computed for the first 2 dimensions, regardless /// of those dimensions being singleton or non-singleton. If A is an n-d array, /// the transformation is repeated for trailing dimensions of A respectively. /// The two dimensional transformation is equivalent to repeatedly transforming /// the columns and after that transforming the rows of A. However, using this /// function may be of magnitudes faster than using 1D transformations. This /// depends on the algorithm and API provided by the underlying native library. /// The forward fourier transform and the inverse fourier transform of /// a given data array A are mathematically equivalent. It's only a /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That /// scaling is introduced in the inverse transform. /// The transformation is computed by use of the native library /// which currently is set up for your processor and OS version. The underlying /// library is automatically choosen at ILNumerics startup and accessed via the /// static member ILMath.FFT. See the online documentation for more /// details in how to tune/configure and select dedicated native libraries. /// Currently supported libraries are: Intel MKL (included), AMD ACML /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts). /// public static ILRetArray< fcomplex> fft2(ILInArray< fcomplex> A) { using (ILScope.Enter(A)) { if (A.IsEmpty) return empty< fcomplex>(A.Size); if (A.IsScalar) return A.C; return FFTImplementation.FFTForward(A, 2); } } /// /// Inverse fast fourier transform (2D) /// /// Input array /// Transformation result /// /// The transformation is computed for the first 2 dimensions, regardless /// of those dimensions being singleton or non-singleton. If A is an n-d array, /// the transformation is repeated for trailing dimensions of A respectively. /// The two dimensional transformation is equivalent to repeatedly transforming /// the columns and after that transforming the rows of A. However, using this /// function may be of magnitudes faster than using 1D transformations. This /// depends on the algorithm and API provided by the underlying native library. /// The forward fourier transform and the inverse fourier transform of /// a given data array A are mathematically equivalent. It's only a /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That /// scaling is introduced in the inverse transform. /// The transformation is computed by use of the native library /// which currently is set up for your processor and OS version. The underlying /// library is automatically choosen at ILNumerics startup and accessed via the /// static member ILMath.FFT. See the online documentation for more /// details in how to tune/configure and select dedicated native libraries. /// Currently supported libraries are: Intel MKL (included), AMD ACML /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts). /// public static ILRetArray< fcomplex> ifft2(ILInArray< fcomplex> A) { using (ILScope.Enter(A)) { if (A.IsEmpty) return empty< fcomplex>(A.Size); if (A.IsScalar) return A.C; return FFTImplementation.FFTBackward(A, 2); } } /// /// Inverse fast fourier transform (2D, hermitian input) /// /// Complex hermitian input array (frequency domain) /// Transformation result /// /// Since a transform of complex hermitian input data results in the /// output having the imaginary part equals zero, only the real part is /// returned for convenience reasons. /// No check is made for A being hermitian! If A is not hermitian (by means /// of round-off errors), the result will be wrong! /// The transformation is computed for the first 2 dimensions, regardless /// of those dimensions being singleton or non-singleton. If A is an n-d array, /// the transformation is repeated for trailing dimensions of A respectively. /// The two dimensional transformation is equivalent to repeatedly transforming /// the columns and after that transforming the rows of A. However, using this /// function may be of magnitudes faster than using 1D transformations. This /// depends on the algorithm and API provided by the underlying native library. /// The forward fourier transform and the inverse fourier transform of /// a given data array A are mathematically equivalent. It's only a /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That /// scaling is introduced in the inverse transform. /// The transformation is computed by use of the native library /// which currently is set up for your processor and OS version. The underlying /// library is automatically choosen at ILNumerics startup and accessed via the /// static member ILMath.FFT. See the online documentation for more /// details in how to tune/configure and select dedicated native libraries. /// Currently supported libraries are: Intel MKL (included), AMD ACML /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts). /// public static ILRetArray< float> ifft2sym(ILInArray< fcomplex> A) { using (ILScope.Enter(A)) { if (A.IsEmpty) return empty< float>(A.Size); if (A.IsScalar) return real(A); return FFTImplementation.FFTBackwSym(A, 2); } } #endregion #region fft2(A,m,n) /// /// Fast fourier transform (2D) /// /// Input array /// Transformation column length /// Transformation row length /// Transformation result, complex hermitian /// /// The transformation is computed for the first 2 dimensions, regardless /// of those dimensions being singleton or non-singleton. If A is an n-d array, /// the transformation is repeated for trailing dimensions of A respectively. /// The data to be transformed (based on the A array) are resized according to /// the length parameter m and n. If m or n is larger then the length of the corresponding /// dimension of A, zeros will be padded, otherwise the dimensions are truncated respectively. /// The two dimensional transformation is equivalent to repeatedly transforming /// the columns and after that transforming the rows of A. However, using this /// function may be of magnitudes faster than using 1D transformations. This /// depends on the algorithm and API provided by the underlying native library. /// The forward fourier transform and the inverse fourier transform of /// a given data array A are mathematically equivalent. It's only a /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That /// scaling is introduced in the inverse transform. /// The transformation is computed by use of the native library /// which currently is set up for your processor and OS version. The underlying /// library is automatically choosen at ILNumerics startup and accessed via the /// static member ILMath.FFT. See the online documentation for more /// details in how to tune/configure and select dedicated native libraries. /// Currently supported libraries are: Intel MKL (included), AMD ACML /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts). /// /// is thrown if one of n or m is negative public static ILRetArray< fcomplex> fft2(ILInArray< float> A, int m, int n) { using (ILScope.Enter(A)) { if (m < 0 || n < 0) throw new ILArgumentException("dimension length specifier 'm' and 'n' must be non-negative!"); if (A.IsEmpty) return empty< fcomplex>(A.Size); int[] Asize = A.Size.ToIntArray(); Asize[0] = m; Asize[1] = n; ILArray< float> resizedA = resize4Transform(A, Asize); return FFTImplementation.FFTForward(resizedA, 2); } } /// /// Fast fourier transform (2D) /// /// input array /// Transformation column length /// Transformation row length /// Transformation result /// /// The transformation is computed for the first 2 dimensions, regardless /// of those dimensions being singleton or non-singleton. If A is an n-d array, /// the transformation is repeated for trailing dimensions of A respectively. /// The data to be transformed (based on the A array) are resized according to /// the length parameter m and n. If m or n is larger then the length of the corresponding /// dimension of A, zeros will be padded, otherwise the dimensions are truncated respectively. /// The two dimensional transformation is equivalent to repeatedly transforming /// the columns and after that transforming the rows of A. However, using this /// function may be of magnitudes faster than using 1D transformations. This /// depends on the algorithm and API provided by the underlying native library. /// The forward fourier transform and the inverse fourier transform of /// a given data array A are mathematically equivalent. It's only a /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That /// scaling is introduced in the inverse transform. /// The transformation is computed by use of the native library /// which currently is set up for your processor and OS version. The underlying /// library is automatically choosen at ILNumerics startup and accessed via the /// static member ILMath.FFT. See the online documentation for more /// details in how to tune/configure and select dedicated native libraries. /// Currently supported libraries are: Intel MKL (included), AMD ACML /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts). /// /// is thrown if one of n or m is negative public static ILRetArray< fcomplex> fft2(ILInArray< fcomplex> A, int m, int n) { using (ILScope.Enter(A)) { if (m < 0 || n < 0) throw new ILArgumentException("dimension length specifier 'm' and 'n' must be non-negative!"); if (A.IsEmpty) return empty< fcomplex>(A.Size); int[] Asize = A.Size.ToIntArray(); Asize[0] = m; Asize[1] = n; ILRetArray< fcomplex> resizedA = resize4Transform(A, Asize); return FFTImplementation.FFTForward(resizedA, 2); } } /// /// Inverse fast fourier transform (2D) /// /// Input array /// Transformation column length /// Transformation row length /// Transformation result /// /// The transformation is computed for the first 2 dimensions, regardless /// of those dimensions being singleton or non-singleton. If A is an n-d array, /// the transformation is repeated for trailing dimensions of A respectively. /// The data to be transformed (based on the array A) are resized according to /// the length parameter m and n. If m or n is larger then the length of the corresponding /// dimension of A, zeros will be padded, otherwise the dimensions are truncated respectively. /// The two dimensional transformation is equivalent to repeatedly transforming /// the columns and after that transforming the rows of A. However, using this /// function may be of magnitudes faster than using 1D transformations. This /// depends on the algorithm and API provided by the underlying native library. /// The forward fourier transform and the inverse fourier transform of /// a given data array A are mathematically equivalent. It's only a /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That /// scaling is introduced in the inverse transform. /// The transformation is computed by use of the native library /// which currently is set up for your processor and OS version. The underlying /// library is automatically choosen at ILNumerics startup and accessed via the /// static member ILMath.FFT. See the online documentation for more /// details in how to tune/configure and select dedicated native libraries. /// Currently supported libraries are: Intel MKL (included), AMD ACML /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts). /// /// is thrown if one of n or m is negative public static ILRetArray< fcomplex> ifft2(ILInArray< fcomplex> A, int m, int n) { using (ILScope.Enter(A)) { if (m < 0 || n < 0) throw new ILArgumentException("dimension length specifier 'm' and 'n' must be non-negative!"); if (A.IsEmpty) return empty< fcomplex>(A.Size); int[] Asize = A.Size.ToIntArray(); Asize[0] = m; Asize[1] = n; ILRetArray< fcomplex> resizedA = resize4Transform(A, Asize); return FFTImplementation.FFTBackward(resizedA, 2); } } /// /// Inverse fast fourier transform (2D) /// /// Complex hermitian input array, symmetric in first 2 dimensions /// Transformation column length /// Transformation row length /// Transformation result /// /// The transformation is computed for the first 2 dimensions, regardless /// of those dimensions being singleton or non-singleton. If A is an n-d array, /// the transformation is repeated for trailing dimensions of A respectively. The /// lengths of those trailing dimensions are not altered. /// Since a transform of complex hermitian input data results in the /// output having the imaginary part equals zero, only the real part is /// returned for convenience reasons. /// No check is made for A being hermitian! If A is not hermitian (by means /// of round-off errors), the result will be wrong! /// The data to be transformed (based on the array A) are resized according to /// the length parameter m and n. If m or n is larger then the length of the corresponding /// dimension of A, zeros will be padded, otherwise the dimensions are truncated respectively. /// The two dimensional transformation is equivalent to repeatedly transforming /// the columns and after that transforming the rows of A. However, using this /// function may be of magnitudes faster than using 1D transformations. This /// depends on the algorithm and API provided by the underlying native library. /// The forward fourier transform and the inverse fourier transform of /// a given data array A are mathematically equivalent. It's only a /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That /// scaling is introduced in the inverse transform. /// The transformation is computed by use of the native library /// which currently is set up for your processor and OS version. The underlying /// library is automatically choosen at ILNumerics startup and accessed via the /// static member ILMath.FFT. See the online documentation for more /// details in how to tune/configure and select dedicated native libraries. /// Currently supported libraries are: Intel MKL (included), AMD ACML /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts). /// /// is thrown if one of n or m is negative public static ILRetArray< float> ifft2sym(ILInArray< fcomplex> A, int m, int n) { using (ILScope.Enter(A)) { if (m < 0 || n < 0) throw new ILArgumentException("dimension length specifier 'm' and 'n' must be non-negative!"); if (A.IsEmpty) return empty< float>(A.Size); int[] Asize = A.Size.ToIntArray(); Asize[0] = m; Asize[1] = n; ILRetArray< fcomplex> resizedA = resize4Transform(A, Asize); return FFTImplementation.FFTBackwSym(resizedA, 2); } } #endregion #region fftn(A) /// /// Fast fourier transform (n-D) /// /// Input array, n-D /// Transformation result, complex hermitian /// /// The n-dimensional transformation is computed for the n-dimensional array A. /// This is equivalent to repeatedly (inplace) /// computing one dimensional transformations along all dimensions of A. /// However, using this /// function may be of magnitudes faster than using 1D transformations. This /// depends on the algorithm and API provided by the underlying native library. /// The forward fourier transform and the inverse fourier transform of /// a given data array A are mathematically equivalent. It's only a /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That /// scaling is introduced in the inverse transform. /// The transformation is computed by use of the native library /// which currently is set up for your processor and OS version. The underlying /// library is automatically choosen at ILNumerics startup and accessed via the /// static member ILMath.FFT. See the online documentation for more /// details in how to tune/configure and select dedicated native libraries. /// Currently supported libraries are: Intel MKL (included), AMD ACML /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts). /// public static ILRetArray< fcomplex> fftn(ILInArray< float> A) { using (ILScope.Enter(A)) { if (A.IsEmpty) return empty< fcomplex>(A.Size); return FFTImplementation.FFTForward(A, A.Size.NumberOfDimensions); } } /// /// Fast fourier transform (n-D) /// /// Input array, n-D /// Transformation result /// /// The n-dimensional transformation is computed for the n-dimensional array A. /// This is equivalent to repeatedly (inplace) /// computing one dimensional transformations along all dimensions of A. /// However, using this /// function may be of magnitudes faster than using 1D transformations. This /// depends on the algorithm and API provided by the underlying native library. /// The forward fourier transform and the inverse fourier transform of /// a given data array A are mathematically equivalent. It's only a /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That /// scaling is introduced in the inverse transform. /// The transformation is computed by use of the native library /// which currently is set up for your processor and OS version. The underlying /// library is automatically choosen at ILNumerics startup and accessed via the /// static member ILMath.FFT. See the online documentation for more /// details in how to tune/configure and select dedicated native libraries. /// Currently supported libraries are: Intel MKL (included), AMD ACML /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts). /// public static ILRetArray< fcomplex> fftn(ILInArray< fcomplex> A) { using (ILScope.Enter(A)) { if (A.IsEmpty) return empty< fcomplex>(A.Size); return FFTImplementation.FFTForward(A, A.Size.NumberOfDimensions); } } /// /// Inverse fast fourier transform (n-D) /// /// Input array, n-D (frequency domain) /// Transformation result /// /// The n-dimensional inverse transformation is computed for the n-dimensional array A. /// This is equivalent to repeatedly (inplace) /// computing one dimensional transformations along all dimensions of A. /// However, using this /// function may be of magnitudes faster than using 1D transformations. This /// depends on the algorithm and API provided by the underlying native library. /// The forward fourier transform and the inverse fourier transform of /// a given data array A are mathematically equivalent. It's only a /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That /// scaling is introduced in the inverse transform. /// The transformation is computed by use of the native library /// which currently is set up for your processor and OS version. The underlying /// library is automatically choosen at ILNumerics startup and accessed via the /// static member ILMath.FFT. See the online documentation for more /// details in how to tune/configure and select dedicated native libraries. /// Currently supported libraries are: Intel MKL (included), AMD ACML /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts). /// public static ILRetArray< fcomplex> ifftn(ILInArray< fcomplex> A) { using (ILScope.Enter(A)) { if (A.IsEmpty) return empty< fcomplex>(A.Size); return FFTImplementation.FFTBackward(A, A.Size.NumberOfDimensions); } } /// /// Inverse fast fourier transform (n-D) /// /// Input array, n-D, complex hermitian (frequency domain) /// Transformation result /// /// The n-dimensional inverse transformation is computed for the n-dimensional array A. /// This is equivalent to repeatedly (inplace) /// computing one dimensional transformations along all dimensions of A. /// However, using this /// function may be of magnitudes faster than using 1D transformations. This /// depends on the algorithm and API provided by the underlying native library. /// Since a transform of complex hermitian input data results in the /// output having the imaginary part equals zero, only the real part is /// returned for convenience reasons. /// No check is made for A being hermitian! If A is not hermitian (by means /// of round-off errors), the result will be wrong! /// The forward fourier transform and the inverse fourier transform of /// a given data array A are mathematically equivalent. It's only a /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That /// scaling is introduced in the inverse transform. /// The transformation is computed by use of the native library /// which currently is set up for your processor and OS version. The underlying /// library is automatically choosen at ILNumerics startup and accessed via the /// static member ILMath.FFT. See the online documentation for more /// details in how to tune/configure and select dedicated native libraries. /// Currently supported libraries are: Intel MKL (included), AMD ACML /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts). /// public static ILRetArray< float> ifftnsym(ILInArray< fcomplex> A) { using (ILScope.Enter(A)) { if (A.IsEmpty) return empty< float>(A.Size); return FFTImplementation.FFTBackwSym(A, A.Size.NumberOfDimensions); } } #endregion #region fftn(A, params dims) /// /// Fast fourier transform (n-D, specific size) /// /// Input array, n-D /// Transformation lengths, specifies the length of the dimensions /// for the transformation array. The length of dims must be > or equal to the number of /// dimensions of A. For elements in dim being smaller than corresponding dimension /// length in A, the dimensions will be truncated, otherwise zeros will be padded. /// Transformation result of size specified by 'dims' parameter, complex hermitian /// /// The n-dimensional transformation is computed for the n-dimensional array A. /// Before the transform, the input is resized according to the 'dims' parameter. /// Dimensions larger than corresponding entries in 'dim' are truncated, dimensions /// smaller than corresponding entries in 'dim' are zero padded. /// The n-dimensional transformation is equivalent to repeatedly (inplace) /// computing one dimensional transformations along all dimensions of A. /// However, using this /// function may be of magnitudes faster than using 1D transformations. This /// depends on the algorithm and API provided by the underlying native library. /// The forward fourier transform and the inverse fourier transform of /// a given data array A are mathematically equivalent. It's only a /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That /// scaling is introduced in the inverse transform. /// The transformation is computed by use of the native library /// which currently is set up for your processor and OS version. The underlying /// library is automatically choosen at ILNumerics startup and accessed via the /// static member ILMath.FFT. See the online documentation for more /// details in how to tune/configure and select dedicated native libraries. /// Currently supported libraries are: Intel MKL (included), AMD ACML /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts). /// /// is thrown if the /// dim parameter is null, its length is less then the number of dimensions of A /// or any element of dims is non-negative public static ILRetArray< fcomplex> fftn(ILInArray< float> A, params int[] dims) { using (ILScope.Enter(A)) { if (A.IsEmpty) return empty< fcomplex>(A.Size); ILRetArray< float> resizedA = resize4Transform(A, dims); return FFTImplementation.FFTForward(resizedA, dims.Length); } } /// /// Fast fourier transform (n-D, specific size) /// /// Tnput array, n-D /// Transformation lengths, specifies the length of the dimensions /// for the transformation array. The length of dims must be > or equal to the number of /// dimensions of A. For elements in dim being smaller than corresponding dimension /// length in A, the dimensions will be truncated, otherwise zeros will be padded. /// Transformation result of size specified by 'dims' parameter /// /// The n-dimensional transformation is computed for the n-dimensional array A. /// Before the transform, the input is resized according to the 'dims' parameter. /// Dimensions larger than corresponding entries in 'dim' are truncated, dimensions /// smaller than corresponding entries in 'dim' are zero padded. /// The n-dimensional transformation is equivalent to repeatedly (inplace) /// computing one dimensional transformations along all dimensions of A. /// However, using this /// function may be of magnitudes faster than using 1D transformations. This /// depends on the algorithm and API provided by the underlying native library. /// The forward fourier transform and the inverse fourier transform of /// a given data array A are mathematically equivalent. It's only a /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That /// scaling is introduced in the inverse transform. /// The transformation is computed by use of the native library /// which currently is set up for your processor and OS version. The underlying /// library is automatically choosen at ILNumerics startup and accessed via the /// static member ILMath.FFT. See the online documentation for more /// details in how to tune/configure and select dedicated native libraries. /// Currently supported libraries are: Intel MKL (included), AMD ACML /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts). /// /// is thrown if the /// dim parameter is null, its length is less then the number of dimensions of A /// or any element of dims is non-negative public static ILRetArray< fcomplex> fftn(ILInArray< fcomplex> A, params int[] dims) { using (ILScope.Enter(A)) { if (A.IsEmpty) return empty< fcomplex>(A.Size); ILRetArray< fcomplex> resizedA = resize4Transform(A, dims); return FFTImplementation.FFTForward(resizedA, dims.Length); } } /// /// Inverse fast fourier transform (n-D, specific size) /// /// Input array, n-D /// Transformation lengths, specifies the length of the dimensions /// for the transformation array. The length of dims must be > or equal to the number of /// dimensions of A. For elements in dim being smaller than corresponding dimension /// length in A, the dimensions will be truncated, otherwise zeros will be padded. /// Transformation result of size specified by 'dims' parameter /// /// The n-dimensional transformation is computed for the n-dimensional array A. /// Before the transform, the input is resized according to the 'dims' parameter. /// Dimensions larger than corresponding entries in 'dim' are truncated, dimensions /// smaller than corresponding entries in 'dim' are zero padded. /// The n-dimensional transformation is equivalent to repeatedly (inplace) /// computing one dimensional transformations along all dimensions of A. /// However, using this /// function may be of magnitudes faster than using 1D transformations. This /// depends on the algorithm and API provided by the underlying native library. /// The forward fourier transform and the inverse fourier transform of /// a given data array A are mathematically equivalent. It's only a /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That /// scaling is introduced in the inverse transform. /// The transformation is computed by use of the native library /// which currently is set up for your processor and OS version. The underlying /// library is automatically choosen at ILNumerics startup and accessed via the /// static member ILMath.FFT. See the online documentation for more /// details in how to tune/configure and select dedicated native libraries. /// Currently supported libraries are: Intel MKL (included), AMD ACML /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts). /// /// is thrown if the /// dim parameter is null, its length is less then the number of dimensions of A /// or any element of dims is non-negative public static ILRetArray< fcomplex> ifftn(ILInArray< fcomplex> A, params int[] dims) { using (ILScope.Enter(A)) { if (A.IsEmpty) return empty< fcomplex>(A.Size); ILRetArray< fcomplex> resizedA = resize4Transform(A, dims); return FFTImplementation.FFTBackward(resizedA, dims.Length); } } /// /// Inverse fast fourier transform (n-D, complex hermitian, specific size) /// /// Complex hermitian input array, n-D /// Transformation lengths, specifies the length of the dimensions /// for the transformation array. The length of dims must be > or equal to the number of /// dimensions of A. For elements in dim being smaller than corresponding dimension /// length in A, the dimensions will be truncated, otherwise zeros will be padded. /// Transformation result, real array of the size specified by the 'dims' parameter /// /// The n-dimensional transformation is computed for the n-dimensional array A. /// Before the transform, the input is resized according to the 'dims' parameter. /// Dimensions larger than corresponding entries in 'dim' are truncated, dimensions /// smaller than corresponding entries in 'dim' are zero padded. /// The n-dimensional transformation is equivalent to repeatedly (inplace) /// computing one dimensional transformations along all dimensions of A. /// However, using this /// function may be of magnitudes faster than using 1D transformations. This /// depends on the algorithm and API provided by the underlying native library. /// Since a transform of complex hermitian input data results in the /// output having the imaginary part equals zero, only the real part is /// returned for convenience reasons. /// No check is made for A being hermitian! If A is not hermitian (by means /// of round-off errors), the result will be wrong! /// The forward fourier transform and the inverse fourier transform of /// a given data array A are mathematically equivalent. It's only a /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That /// scaling is introduced in the inverse transform. /// The transformation is computed by use of the native library /// which currently is set up for your processor and OS version. The underlying /// library is automatically choosen at ILNumerics startup and accessed via the /// static member ILMath.FFT. See the online documentation for more /// details in how to tune/configure and select dedicated native libraries. /// Currently supported libraries are: Intel MKL (included), AMD ACML /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts). /// /// is thrown if the /// dim parameter is null, its length is less then the number of dimensions of A /// or any element of dims is non-negative public static ILRetArray< float> ifftnsym(ILInArray< fcomplex> A, params int[] dims) { using (ILScope.Enter(A)) { if (A.IsEmpty) return empty< float>(A.Size); ILRetArray< fcomplex> resizedA = resize4Transform(A, dims); return FFTImplementation.FFTBackwSym(resizedA, dims.Length); } } #endregion #endregion HYCALPER AUTO GENERATED CODE #region private helper internal static ILRetArray resize4Transform(ILInArray A, params int[] size) { using (ILScope.Enter(A)) { if (size == null || size.Length < A.Size.NumberOfDimensions) throw new ILArgumentException("length of output dimensions must be > or equal to number of dimensions of input array!"); ILSize newDimensions = new ILSize(size); if (A.Size.IsSameShape(newDimensions)) { return A; } else { if (newDimensions.NumberOfElements == 0) return empty(newDimensions); ILArray tmp = array(default(T), newDimensions); int minDimsLen = Math.Min(size.Length, A.Size.NumberOfDimensions); ILArray[] indices = new ILArray[minDimsLen]; for (int i = 0; i < minDimsLen; i++) { if (size[i] < 0) throw new ILArgumentException("all dimension lengths of 'size' must be non-negative!"); if (size[i] == 0) return empty(newDimensions); indices[i] = (ILRetArray)r(0, Math.Min(A.Size[i] - 1, size[i] - 1)); } tmp[indices] = A[indices]; return tmp; } } } #endregion } }