Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Problems.GaussianProcessTuning/ILNumerics.2.14.4735.573/Functions/builtin/fft.cs @ 11316

Last change on this file since 11316 was 9102, checked in by gkronber, 12 years ago

#1967: ILNumerics source for experimentation

File size: 116.6 KB
Line 
1///
2///    This file is part of ILNumerics Community Edition.
3///
4///    ILNumerics Community Edition - high performance computing for applications.
5///    Copyright (C) 2006 - 2012 Haymo Kutschbach, http://ilnumerics.net
6///
7///    ILNumerics Community Edition is free software: you can redistribute it and/or modify
8///    it under the terms of the GNU General Public License version 3 as published by
9///    the Free Software Foundation.
10///
11///    ILNumerics Community Edition is distributed in the hope that it will be useful,
12///    but WITHOUT ANY WARRANTY; without even the implied warranty of
13///    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14///    GNU General Public License for more details.
15///
16///    You should have received a copy of the GNU General Public License
17///    along with ILNumerics Community Edition. See the file License.txt in the root
18///    of your distribution package. If not, see <http://www.gnu.org/licenses/>.
19///
20///    In addition this software uses the following components and/or licenses:
21///
22///    =================================================================================
23///    The Open Toolkit Library License
24///   
25///    Copyright (c) 2006 - 2009 the Open Toolkit library.
26///   
27///    Permission is hereby granted, free of charge, to any person obtaining a copy
28///    of this software and associated documentation files (the "Software"), to deal
29///    in the Software without restriction, including without limitation the rights to
30///    use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
31///    the Software, and to permit persons to whom the Software is furnished to do
32///    so, subject to the following conditions:
33///
34///    The above copyright notice and this permission notice shall be included in all
35///    copies or substantial portions of the Software.
36///
37///    =================================================================================
38///   
39
40using System;
41using ILNumerics.Exceptions;
42using ILNumerics.Misc;
43
44namespace ILNumerics  {
45    public partial class ILMath {
46
47
48
49
50        #region fft(A)
51        /// <summary>
52        /// Fast fourier transform (1D)
53        /// </summary>
54        /// <param name="A">Input array</param>
55        /// <returns>Transformed output array</returns>
56        /// <remarks><para>The transformation is computed along the first
57        /// non singleton dimension.</para>
58        /// <para>The output array returned will be complex hermitian. I.e. the real
59        /// part being even and the imaginary part being odd symmetrical.</para>
60        /// <para>The forward fourier transform and the inverse fourier transform of
61        /// a given data array A are mathematically equivalent. It's only a
62        /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That
63        /// scaling is introduced in the inverse transform.</para>
64        /// <para>The transformation is computed by use of the native library
65        /// which currently is set up for your processor and OS version. The underlying
66        /// library is automatically choosen at ILNumerics startup and accessed via the
67        /// static member ILMath.FFT. See the online documentation for more
68        /// details in how to tune/configure and select dedicated native libraries.
69        /// Currently supported libraries are: Intel MKL
70        /// (included), AMD ACML and FFTW3 (prepared, optional modules, not included due to licensing conflicts).</para>
71        /// </remarks>
72        public static ILRetArray< complex> fft(ILInArray< double> A) {
73            using (ILScope.Enter(A)) {
74                if (A.IsEmpty) return empty< complex>(A.Size);
75                if (A.IsScalar) return new  complex(A.GetValue(0), 0);
76                int fnsd = A.Size.WorkingDimension();
77                return ILMath.FFTImplementation.FFTForward1D(A, fnsd);
78            }
79        }
80        /// <summary>
81        /// Fast fourier transform (1D)
82        /// </summary>
83        /// <param name="A">Input array</param>
84        /// <returns>Transformed output array</returns>
85        /// <remarks>
86        /// <para>The transformation is computed along the first non
87        /// singleton dimension.</para>
88        /// <para>The forward fourier transform and the inverse fourier transform of
89        /// a given data array A are mathematically equivalent. It's only a
90        /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That
91        /// scaling is introduced in the inverse transform.</para>
92        /// <para>The transformation is computed by use of the native library
93        /// which currently is set up for your processor and OS version. The underlying
94        /// library is automatically choosen at ILNumerics startup and accessed via the
95        /// static member ILMath.FFT. See the online documentation for more
96        /// details in how to tune/configure and select dedicated native libraries.
97        /// Currently supported libraries are: Intel MKL
98        /// (included), AMD ACML and FFTW3 (prepared, optional modules, not included due to licensing conflicts).</para>
99        /// </remarks>
100        public static ILRetArray< complex > fft(ILInArray< complex > A) {
101            using (ILScope.Enter(A)) {
102                if (A.IsEmpty) return empty< complex>(A.Size);
103                if (A.IsScalar) return A.C;
104                int fnsd = A.Size.WorkingDimension();
105                return ILMath.FFTImplementation.FFTForward1D(A, fnsd);
106            }
107        }
108        /// <summary>
109        /// Fast inverse fourier transform (1D)
110        /// </summary>
111        /// <param name="A">Input (frequency domain)</param>
112        /// <returns>Inverse transformed output array</returns>
113        /// <remarks>
114        /// <para>The transformation is computed along the first non
115        /// singleton dimension.</para>
116        /// <para>The forward fourier transform and the inverse fourier transform of
117        /// a given data array A are mathematically equivalent. It's only a
118        /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That
119        /// scaling is introduced in the inverse transform.</para>
120        /// <para>The transformation is computed by use of the native library
121        /// which currently is set up for your processor and OS version. The underlying
122        /// library is automatically choosen at ILNumerics startup and accessed via the
123        /// static member ILMath.FFT. See the online documentation for more
124        /// details in how to tune/configure and select dedicated native libraries.
125        /// Currently supported libraries are: Intel MKL
126        /// (included), AMD ACML and FFTW3 (prepared, optional modules, not included due to licensing conflicts).</para>
127        /// </remarks>
128        public static ILRetArray<complex> ifft(ILInArray<complex> A) {
129            using (ILScope.Enter(A)) {
130                if (A.IsEmpty) return empty< complex>(A.Size);
131                if (A.IsScalar) return A.C;
132                int fnsd = A.Size.WorkingDimension();
133                return ILMath.FFTImplementation.FFTBackward1D(A, fnsd);
134            }
135        }
136        /// <summary>
137        /// Inverse fast fourier transform, complex hermitian input
138        /// </summary>
139        /// <param name="A">Complex hermitian input array</param>
140        /// <returns>Real output array, same size as A</returns>
141        /// <remarks>
142        /// <para>Since a transform of complex hermitian input data results in
143        /// the output having all imaginary part equal zero, only the real part is
144        /// returned for convenience reasons.</para>
145        /// <para>No check is made for A being hermitian! If A is not hermitian (by means
146        /// of round-off errors), the result will be wrong!</para>
147        /// <para>The transformation is computed along the first non
148        /// singleton dimension.</para>
149        /// <para>The forward fourier transform and the inverse fourier transform of
150        /// a given data array A are mathematically equivalent. It's only a
151        /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That
152        /// scaling is introduced in the inverse transform.</para>
153        /// <para>The transformation is computed by use of the native library
154        /// which currently is set up for your processor and OS version. The underlying
155        /// library is automatically choosen at ILNumerics startup and accessed via the
156        /// static member ILMath.FFT. See the online documentation for more
157        /// details in how to tune/configure and select dedicated native libraries.
158        /// Currently supported libraries are: Intel MKL
159        /// (included), AMD ACML and FFTW3 (prepared, optional modules, not included due to licensing conflicts).</para>
160        /// </remarks>
161        public static ILRetArray< double > ifftsym(ILInArray< complex > A) {
162            using (ILScope.Enter(A)) {
163                if (A.IsEmpty) return empty< double>(A.Size);
164                if (A.IsScalar) return real(A);
165                int fnsd = A.Size.WorkingDimension();
166                return ILMath.FFTImplementation.FFTBackwSym1D(A, fnsd);
167            }
168        }
169        #endregion
170
171        #region fft(A, dim)
172        /// <summary>
173        /// Fast fourier transform along specific dimension
174        /// </summary>
175        /// <param name="A">Real input array</param>
176        /// <param name="dim">Dimension to compute FFT along. This parameter must be non-negative. </param>
177        /// <returns>Transformation result</returns>
178        /// <remarks>
179        /// <para>The output array returned will be complex hermitian. I.e. the real
180        /// part being even and the imaginary part being odd symmetrical.</para>
181        /// <para>The forward fourier transform and the inverse fourier transform of
182        /// a given data array A are mathematically equivalent. It's only a
183        /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That
184        /// scaling is introduced in the inverse transform.</para>
185        /// <para>The transformation is computed by use of the native library
186        /// which currently is set up for your processor and OS version. The underlying
187        /// library is automatically choosen at ILNumerics startup and accessed via the
188        /// static member ILMath.FFT. See the online documentation for more
189        /// details in how to tune/configure and select dedicated native libraries.
190        /// Currently supported libraries are: Intel MKL
191        /// (included), AMD ACML and FFTW3 (prepared, optional modules, not included due to licensing conflicts).</para>
192        /// </remarks>
193        /// <exception cref="ILNumerics.Exceptions.ILArgumentException">is thrown if
194        /// the dim parameter is negative</exception>
195        public static ILRetArray< complex > fft(ILInArray< double > A, int dim) {
196            using (ILScope.Enter(A)) {
197                if (dim < 0) throw new ILArgumentException("the 'dim' parameter must point to an existing dimension index of A");
198                if (A.IsEmpty) return empty< complex>(A.Size);
199                if (A.IsScalar) return new  complex(A.GetValue(0), 0);
200                return ILMath.FFTImplementation.FFTForward1D(A, dim);
201            }
202        }
203        /// <summary>
204        /// Fast fourier transform along specific dimension
205        /// </summary>
206        /// <param name="A">Input array</param>
207        /// <param name="dim">Dimension to compute FFT along. This parameter
208        /// must be non-negative. </param>
209        /// <returns>Transformation result</returns>
210        /// <remarks>
211        /// <para>The forward fourier transform and the inverse fourier transform of
212        /// a given data array A are mathematically equivalent. It's only a
213        /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That
214        /// scaling is introduced in the inverse transform.</para>
215        /// <para>The transformation is computed by use of the native library
216        /// which currently is set up for your processor and OS version. The underlying
217        /// library is automatically choosen at ILNumerics startup and accessed via the
218        /// static member ILMath.FFT. See the online documentation for more
219        /// details in how to tune/configure and select dedicated native libraries.
220        /// Currently supported libraries are: Intel MKL
221        /// (included), AMD ACML and FFTW3 (prepared, optional modules, not included due to licensing conflicts).</para>
222        /// </remarks>
223        /// <exception cref="ILNumerics.Exceptions.ILArgumentException">is thrown if
224        /// the dim parameter is negative</exception>
225        public static ILRetArray< complex > fft(ILInArray< complex > A, int dim) {
226            using (ILScope.Enter(A)) {
227                if (dim < 0) throw new ILArgumentException("the 'dim' parameter must point to an existing dimension index of A");
228                if (A.IsEmpty) return empty< complex>(A.Size);
229                if (A.IsScalar) return A.C;
230                return ILMath.FFTImplementation.FFTForward1D(A, dim);
231            }
232        }
233        /// <summary>
234        /// Inverse fast fourier transform along specific dimension
235        /// </summary>
236        /// <param name="A">Input array</param>
237        /// <param name="dim">Dimension to compute FFT along. This parameter
238        /// must be non-negative. </param>
239        /// <returns>Transformation result</returns>
240        /// <remarks>
241        /// <para>The forward fourier transform and the inverse fourier transform of
242        /// a given data array A are mathematically equivalent. It's only a
243        /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That
244        /// scaling is introduced in the inverse transform.</para>
245        /// <para>The transformation is computed by use of the native library
246        /// which currently is set up for your processor and OS version. The underlying
247        /// library is automatically choosen at ILNumerics startup and accessed via the
248        /// static member ILMath.FFT. See the online documentation for more
249        /// details in how to tune/configure and select dedicated native libraries.
250        /// Currently supported libraries are: Intel MKL
251        /// (included), AMD ACML and FFTW3 (prepared, optional modules, not included due to licensing conflicts).</para>
252        /// </remarks>
253        /// <exception cref="ILNumerics.Exceptions.ILArgumentException">is thrown if the dim parameter is negative</exception>
254        public static ILRetArray< complex> ifft(ILInArray< complex> A, int dim) {
255            using (ILScope.Enter(A)) {
256                if (dim < 0) throw new ILArgumentException("the 'dim' parameter must point to an existing dimension index of A");
257                if (A.IsEmpty) return empty< complex>(A.Size);
258                if (A.IsScalar) return A.C;
259                return ILMath.FFTImplementation.FFTBackward1D(A, dim);
260            }
261        }
262        /// <summary>
263        /// Inverse fast fourier transform, complex hermitian input
264        /// </summary>
265        /// <param name="A">Complex hermitian input array (frequency domain)</param>
266        /// <param name="dim">Dimension to compute FFT along. This parameter
267        /// must be non-negative. </param>
268        /// <returns>Real output array, same size as A</returns>
269        /// <remarks>
270        /// <para>Since a transform of complex hermitian input data results in the
271        /// output having the imaginary part equals zero, only the real part is
272        /// returned for convenience reasons.</para>
273        /// <para>No check is made for A being hermitian! If A is not hermitian (by means
274        /// of round-off errors), the result will be wrong!</para>
275        /// <para>The forward fourier transform and the inverse fourier transform of
276        /// a given data array A are mathematically equivalent. It's only a
277        /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That
278        /// scaling is introduced in the inverse transform.</para>
279        /// <para>The transformation is computed by use of the native library
280        /// which currently is set up for your processor and OS version. The underlying
281        /// library is automatically choosen at ILNumerics startup and accessed via the
282        /// static member ILMath.FFT. See the online documentation for more
283        /// details in how to tune/configure and select dedicated native libraries.
284        /// Currently supported libraries are: Intel MKL (included), AMD ACML
285        /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts).</para>
286        /// </remarks>
287        /// <exception cref="ILNumerics.Exceptions.ILArgumentException">is thrown if the dim parameter is negative</exception>
288        public static ILRetArray< double > ifftsym(ILInArray< complex > A, int dim) {
289            using (ILScope.Enter(A)) {
290                if (dim < 0) throw new ILArgumentException("the 'dim' parameter must point to an existing dimension index of A");
291                if (A.IsEmpty) return empty< double>(A.Size);
292                if (A.IsScalar) return real(A);
293                return ILMath.FFTImplementation.FFTBackwSym1D(A, dim);
294            }
295        }
296        #endregion
297
298        #region fft2(A)
299        /// <summary>
300        /// Fast fourier transform (2D)
301        /// </summary>
302        /// <param name="A">Input array</param>
303        /// <returns>Transformation result</returns>
304        /// <remarks>
305        /// <para>The 2D transformation is computed for the first 2 dimensions, regardless
306        /// of those dimensions being singleton or non-singleton. If A is an n-d array,
307        /// the transformation is repeated for trailing dimensions of A respectively. </para>
308        /// <para>The output array returned will be complex hermitian.</para>
309        /// <para>The two dimensional transformation is equivalent to repeatedly transforming
310        /// the columns and after that transforming the rows of A. However, using this
311        /// function may be of magnitudes faster than using 1D transformations. This
312        /// depends on the algorithm and API provided by the underlying native library.</para>
313        /// <para>The forward fourier transform and the inverse fourier transform of
314        /// a given data array A are mathematically equivalent. It's only a
315        /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That
316        /// scaling is introduced in the inverse transform.</para>
317        /// <para>The transformation is computed by use of the native library
318        /// which currently is set up for your processor and OS version. The underlying
319        /// library is automatically choosen at ILNumerics startup and accessed via the
320        /// static member ILMath.FFT. See the online documentation for more
321        /// details in how to tune/configure and select dedicated native libraries.
322        /// Currently supported libraries are: Intel MKL (included), AMD ACML
323        /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts).</para>
324        /// </remarks>
325        public static ILRetArray< complex > fft2(ILInArray< double > A) {
326            using (ILScope.Enter(A)) {
327                if (A.IsEmpty) return empty< complex>(A.Size);
328                if (A.IsScalar) return new  complex(A.GetValue(0), 0);
329                return FFTImplementation.FFTForward(A, 2);
330            }
331        }
332        /// <summary>
333        /// Fast fourier transform (2D)
334        /// </summary>
335        /// <param name="A">Input array</param>
336        /// <returns>Transformation result</returns>
337        /// <remarks>
338        /// <para>The transformation is computed for the first 2 dimensions, regardless
339        /// of those dimensions being singleton or non-singleton. If A is an n-d array,
340        /// the transformation is repeated for trailing dimensions of A respectively. </para>
341        /// <para>The two dimensional transformation is equivalent to repeatedly transforming
342        /// the columns and after that transforming the rows of A. However, using this
343        /// function may be of magnitudes faster than using 1D transformations. This
344        /// depends on the algorithm and API provided by the underlying native library.</para>
345        /// <para>The forward fourier transform and the inverse fourier transform of
346        /// a given data array A are mathematically equivalent. It's only a
347        /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That
348        /// scaling is introduced in the inverse transform.</para>
349        /// <para>The transformation is computed by use of the native library
350        /// which currently is set up for your processor and OS version. The underlying
351        /// library is automatically choosen at ILNumerics startup and accessed via the
352        /// static member ILMath.FFT. See the online documentation for more
353        /// details in how to tune/configure and select dedicated native libraries.
354        /// Currently supported libraries are: Intel MKL (included), AMD ACML
355        /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts).</para>
356        /// </remarks>
357        public static ILRetArray< complex> fft2(ILInArray< complex> A) {
358            using (ILScope.Enter(A)) {
359                if (A.IsEmpty) return empty< complex>(A.Size);
360                if (A.IsScalar) return A.C;
361                return FFTImplementation.FFTForward(A, 2);
362            }
363        }
364        /// <summary>
365        /// Inverse fast fourier transform (2D)
366        /// </summary>
367        /// <param name="A">Input array</param>
368        /// <returns>Transformation result</returns>
369        /// <remarks>
370        /// <para>The transformation is computed for the first 2 dimensions, regardless
371        /// of those dimensions being singleton or non-singleton. If A is an n-d array,
372        /// the transformation is repeated for trailing dimensions of A respectively. </para>
373        /// <para>The two dimensional transformation is equivalent to repeatedly transforming
374        /// the columns and after that transforming the rows of A. However, using this
375        /// function may be of magnitudes faster than using 1D transformations. This
376        /// depends on the algorithm and API provided by the underlying native library.</para>
377        /// <para>The forward fourier transform and the inverse fourier transform of
378        /// a given data array A are mathematically equivalent. It's only a
379        /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That
380        /// scaling is introduced in the inverse transform.</para>
381        /// <para>The transformation is computed by use of the native library
382        /// which currently is set up for your processor and OS version. The underlying
383        /// library is automatically choosen at ILNumerics startup and accessed via the
384        /// static member ILMath.FFT. See the online documentation for more
385        /// details in how to tune/configure and select dedicated native libraries.
386        /// Currently supported libraries are: Intel MKL (included), AMD ACML
387        /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts).</para>
388        /// </remarks>
389        public static ILRetArray< complex> ifft2(ILInArray< complex> A) {
390            using (ILScope.Enter(A)) {
391                if (A.IsEmpty) return empty< complex>(A.Size);
392                if (A.IsScalar) return A.C;
393                return FFTImplementation.FFTBackward(A, 2);
394            }
395        }
396        /// <summary>
397        /// Inverse fast fourier transform (2D, hermitian input)
398        /// </summary>
399        /// <param name="A">Complex hermitian input array (frequency domain)</param>
400        /// <returns>Transformation result</returns>
401        /// <remarks>
402        /// <para>Since a transform of complex hermitian input data results in the
403        /// output having the imaginary part equals zero, only the real part is
404        /// returned for convenience reasons.</para>
405        /// <para>No check is made for A being hermitian! If A is not hermitian (by means
406        /// of round-off errors), the result will be wrong!</para>
407        /// <para>The transformation is computed for the first 2 dimensions, regardless
408        /// of those dimensions being singleton or non-singleton. If A is an n-d array,
409        /// the transformation is repeated for trailing dimensions of A respectively. </para>
410        /// <para>The two dimensional transformation is equivalent to repeatedly transforming
411        /// the columns and after that transforming the rows of A. However, using this
412        /// function may be of magnitudes faster than using 1D transformations. This
413        /// depends on the algorithm and API provided by the underlying native library.</para>
414        /// <para>The forward fourier transform and the inverse fourier transform of
415        /// a given data array A are mathematically equivalent. It's only a
416        /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That
417        /// scaling is introduced in the inverse transform.</para>
418        /// <para>The transformation is computed by use of the native library
419        /// which currently is set up for your processor and OS version. The underlying
420        /// library is automatically choosen at ILNumerics startup and accessed via the
421        /// static member ILMath.FFT. See the online documentation for more
422        /// details in how to tune/configure and select dedicated native libraries.
423        /// Currently supported libraries are: Intel MKL (included), AMD ACML
424        /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts).</para>
425        /// </remarks>
426        public static ILRetArray< double> ifft2sym(ILInArray< complex> A) {
427            using (ILScope.Enter(A)) {
428                if (A.IsEmpty) return empty< double>(A.Size);
429                if (A.IsScalar) return real(A);
430                return FFTImplementation.FFTBackwSym(A, 2);
431            }
432        }
433        #endregion
434
435        #region fft2(A,m,n)
436        /// <summary>
437        /// Fast fourier transform (2D)
438        /// </summary>
439        /// <param name="A">Input array</param>
440        /// <param name="m">Transformation column length</param>
441        /// <param name="n">Transformation row length</param>
442        /// <returns>Transformation result, complex hermitian</returns>
443        /// <remarks>
444        /// <para>The transformation is computed for the first 2 dimensions, regardless
445        /// of those dimensions being singleton or non-singleton. If A is an n-d array,
446        /// the transformation is repeated for trailing dimensions of A respectively. </para>
447        /// <para>The data to be transformed (based on the A array) are resized according to
448        /// the length parameter m and n. If m or n is larger then the length of the corresponding
449        /// dimension of A, zeros will be padded, otherwise the dimensions are truncated respectively. </para>
450        /// <para>The two dimensional transformation is equivalent to repeatedly transforming
451        /// the columns and after that transforming the rows of A. However, using this
452        /// function may be of magnitudes faster than using 1D transformations. This
453        /// depends on the algorithm and API provided by the underlying native library.</para>
454        /// <para>The forward fourier transform and the inverse fourier transform of
455        /// a given data array A are mathematically equivalent. It's only a
456        /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That
457        /// scaling is introduced in the inverse transform.</para>
458        /// <para>The transformation is computed by use of the native library
459        /// which currently is set up for your processor and OS version. The underlying
460        /// library is automatically choosen at ILNumerics startup and accessed via the
461        /// static member ILMath.FFT. See the online documentation for more
462        /// details in how to tune/configure and select dedicated native libraries.
463        /// Currently supported libraries are: Intel MKL (included), AMD ACML
464        /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts).</para>
465        /// </remarks>
466        /// <exception cref="ILNumerics.Exceptions.ILArgumentException">is thrown if one of n or m is negative</exception>
467        public static ILRetArray< complex> fft2(ILInArray< double> A, int m, int n) {
468            using (ILScope.Enter(A)) {
469                if (m < 0 || n < 0) throw new ILArgumentException("dimension length specifier 'm' and 'n' must be non-negative!");
470                if (A.IsEmpty) return empty< complex>(A.Size);
471                int[] Asize = A.Size.ToIntArray();
472                Asize[0] = m; Asize[1] = n;
473                ILArray< double> resizedA = resize4Transform(A, Asize);
474                return FFTImplementation.FFTForward(resizedA, 2);
475            }
476        }
477        /// <summary>
478        /// Fast fourier transform (2D)
479        /// </summary>
480        /// <param name="A">input array</param>
481        /// <param name="m">Transformation column length</param>
482        /// <param name="n">Transformation row length</param>
483        /// <returns>Transformation result</returns>
484        /// <remarks>
485        /// <para>The transformation is computed for the first 2 dimensions, regardless
486        /// of those dimensions being singleton or non-singleton. If A is an n-d array,
487        /// the transformation is repeated for trailing dimensions of A respectively. </para>
488        /// <para>The data to be transformed (based on the A array) are resized according to
489        /// the length parameter m and n. If m or n is larger then the length of the corresponding
490        /// dimension of A, zeros will be padded, otherwise the dimensions are truncated respectively. </para>
491        /// <para>The two dimensional transformation is equivalent to repeatedly transforming
492        /// the columns and after that transforming the rows of A. However, using this
493        /// function may be of magnitudes faster than using 1D transformations. This
494        /// depends on the algorithm and API provided by the underlying native library.</para>
495        /// <para>The forward fourier transform and the inverse fourier transform of
496        /// a given data array A are mathematically equivalent. It's only a
497        /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That
498        /// scaling is introduced in the inverse transform.</para>
499        /// <para>The transformation is computed by use of the native library
500        /// which currently is set up for your processor and OS version. The underlying
501        /// library is automatically choosen at ILNumerics startup and accessed via the
502        /// static member ILMath.FFT. See the online documentation for more
503        /// details in how to tune/configure and select dedicated native libraries.
504        /// Currently supported libraries are: Intel MKL (included), AMD ACML
505        /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts).</para>
506        /// </remarks>
507        /// <exception cref="ILNumerics.Exceptions.ILArgumentException">is thrown if one of n or m is negative</exception>
508        public static ILRetArray< complex> fft2(ILInArray< complex> A, int m, int n) {
509            using (ILScope.Enter(A)) {
510                if (m < 0 || n < 0) throw new ILArgumentException("dimension length specifier 'm' and 'n' must be non-negative!");
511                if (A.IsEmpty) return empty< complex>(A.Size);
512                int[] Asize = A.Size.ToIntArray();
513                Asize[0] = m; Asize[1] = n;
514                ILRetArray< complex> resizedA = resize4Transform(A, Asize);
515                return FFTImplementation.FFTForward(resizedA, 2);
516            }
517        }
518        /// <summary>
519        /// Inverse fast fourier transform (2D)
520        /// </summary>
521        /// <param name="A">Input array</param>
522        /// <param name="m">Transformation column length</param>
523        /// <param name="n">Transformation row length</param>
524        /// <returns>Transformation result</returns>
525        /// <remarks>
526        /// <para>The transformation is computed for the first 2 dimensions, regardless
527        /// of those dimensions being singleton or non-singleton. If A is an n-d array,
528        /// the transformation is repeated for trailing dimensions of A respectively. </para>
529        /// <para>The data to be transformed (based on the array A) are resized according to
530        /// the length parameter m and n. If m or n is larger then the length of the corresponding
531        /// dimension of A, zeros will be padded, otherwise the dimensions are truncated respectively. </para>
532        /// <para>The two dimensional transformation is equivalent to repeatedly transforming
533        /// the columns and after that transforming the rows of A. However, using this
534        /// function may be of magnitudes faster than using 1D transformations. This
535        /// depends on the algorithm and API provided by the underlying native library.</para>
536        /// <para>The forward fourier transform and the inverse fourier transform of
537        /// a given data array A are mathematically equivalent. It's only a
538        /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That
539        /// scaling is introduced in the inverse transform.</para>
540        /// <para>The transformation is computed by use of the native library
541        /// which currently is set up for your processor and OS version. The underlying
542        /// library is automatically choosen at ILNumerics startup and accessed via the
543        /// static member ILMath.FFT. See the online documentation for more
544        /// details in how to tune/configure and select dedicated native libraries.
545        /// Currently supported libraries are: Intel MKL (included), AMD ACML
546        /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts).</para>
547        /// </remarks>
548        /// <exception cref="ILNumerics.Exceptions.ILArgumentException">is thrown if one of n or m is negative</exception>
549        public static ILRetArray< complex> ifft2(ILInArray< complex> A, int m, int n) {
550            using (ILScope.Enter(A)) {
551                if (m < 0 || n < 0) throw new ILArgumentException("dimension length specifier 'm' and 'n' must be non-negative!");
552                if (A.IsEmpty) return empty< complex>(A.Size);
553                int[] Asize = A.Size.ToIntArray();
554                Asize[0] = m; Asize[1] = n;
555                ILRetArray< complex> resizedA = resize4Transform(A, Asize);
556                return FFTImplementation.FFTBackward(resizedA, 2);
557            }
558        }
559        /// <summary>
560        /// Inverse fast fourier transform (2D)
561        /// </summary>
562        /// <param name="A">Complex hermitian input array, symmetric in first 2 dimensions</param>
563        /// <param name="m">Transformation column length</param>
564        /// <param name="n">Transformation row length</param>
565        /// <returns>Transformation result</returns>
566        /// <remarks>
567        /// <para>The transformation is computed for the first 2 dimensions, regardless
568        /// of those dimensions being singleton or non-singleton. If A is an n-d array,
569        /// the transformation is repeated for trailing dimensions of A respectively. The
570        /// lengths of those trailing dimensions are not altered.</para>
571        /// <para>Since a transform of complex hermitian input data results in the
572        /// output having the imaginary part equals zero, only the real part is
573        /// returned for convenience reasons.</para>
574        /// <para>No check is made for A being hermitian! If A is not hermitian (by means
575        /// of round-off errors), the result will be wrong!</para>
576        /// <para>The data to be transformed (based on the array A) are resized according to
577        /// the length parameter m and n. If m or n is larger then the length of the corresponding
578        /// dimension of A, zeros will be padded, otherwise the dimensions are truncated respectively. </para>
579        /// <para>The two dimensional transformation is equivalent to repeatedly transforming
580        /// the columns and after that transforming the rows of A. However, using this
581        /// function may be of magnitudes faster than using 1D transformations. This
582        /// depends on the algorithm and API provided by the underlying native library.</para>
583        /// <para>The forward fourier transform and the inverse fourier transform of
584        /// a given data array A are mathematically equivalent. It's only a
585        /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That
586        /// scaling is introduced in the inverse transform.</para>
587        /// <para>The transformation is computed by use of the native library
588        /// which currently is set up for your processor and OS version. The underlying
589        /// library is automatically choosen at ILNumerics startup and accessed via the
590        /// static member ILMath.FFT. See the online documentation for more
591        /// details in how to tune/configure and select dedicated native libraries.
592        /// Currently supported libraries are: Intel MKL (included), AMD ACML
593        /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts).</para>
594        /// </remarks>
595        /// <exception cref="ILNumerics.Exceptions.ILArgumentException">is thrown if one of n or m is negative</exception>
596        public static ILRetArray< double> ifft2sym(ILInArray< complex> A, int m, int n) {
597            using (ILScope.Enter(A)) {
598                if (m < 0 || n < 0) throw new ILArgumentException("dimension length specifier 'm' and 'n' must be non-negative!");
599                if (A.IsEmpty) return empty< double>(A.Size);
600                int[] Asize = A.Size.ToIntArray();
601                Asize[0] = m; Asize[1] = n;
602                ILRetArray< complex> resizedA = resize4Transform(A, Asize);
603                return FFTImplementation.FFTBackwSym(resizedA, 2);
604            }
605        }
606        #endregion
607
608        #region fftn(A)
609        /// <summary>
610        /// Fast fourier transform (n-D)
611        /// </summary>
612        /// <param name="A">Input array, n-D</param>
613        /// <returns>Transformation result, complex hermitian</returns>
614        /// <remarks>
615        /// <para>The n-dimensional transformation is computed for the n-dimensional array A.
616        /// This is equivalent to repeatedly (inplace)
617        /// computing one dimensional transformations along all dimensions of A.
618        /// However, using this
619        /// function may be of magnitudes faster than using 1D transformations. This
620        /// depends on the algorithm and API provided by the underlying native library.</para>
621        /// <para>The forward fourier transform and the inverse fourier transform of
622        /// a given data array A are mathematically equivalent. It's only a
623        /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That
624        /// scaling is introduced in the inverse transform.</para>
625        /// <para>The transformation is computed by use of the native library
626        /// which currently is set up for your processor and OS version. The underlying
627        /// library is automatically choosen at ILNumerics startup and accessed via the
628        /// static member ILMath.FFT. See the online documentation for more
629        /// details in how to tune/configure and select dedicated native libraries.
630        /// Currently supported libraries are: Intel MKL (included), AMD ACML
631        /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts).</para>
632        /// </remarks>
633        public static ILRetArray< complex> fftn(ILInArray< double> A) {
634            using (ILScope.Enter(A)) {
635                if (A.IsEmpty) return empty< complex>(A.Size);
636                return FFTImplementation.FFTForward(A, A.Size.NumberOfDimensions);
637            }
638        }
639        /// <summary>
640        /// Fast fourier transform (n-D)
641        /// </summary>
642        /// <param name="A">Input array, n-D</param>
643        /// <returns>Transformation result</returns>
644        /// <remarks>
645        /// <para>The n-dimensional transformation is computed for the n-dimensional array A.
646        /// This is equivalent to repeatedly (inplace)
647        /// computing one dimensional transformations along all dimensions of A.
648        /// However, using this
649        /// function may be of magnitudes faster than using 1D transformations. This
650        /// depends on the algorithm and API provided by the underlying native library.</para>
651        /// <para>The forward fourier transform and the inverse fourier transform of
652        /// a given data array A are mathematically equivalent. It's only a
653        /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That
654        /// scaling is introduced in the inverse transform.</para>
655        /// <para>The transformation is computed by use of the native library
656        /// which currently is set up for your processor and OS version. The underlying
657        /// library is automatically choosen at ILNumerics startup and accessed via the
658        /// static member ILMath.FFT. See the online documentation for more
659        /// details in how to tune/configure and select dedicated native libraries.
660        /// Currently supported libraries are: Intel MKL (included), AMD ACML
661        /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts).</para>
662        /// </remarks>
663        public static ILRetArray< complex> fftn(ILInArray< complex> A) {
664            using (ILScope.Enter(A)) {
665                if (A.IsEmpty) return empty< complex>(A.Size);
666                return FFTImplementation.FFTForward(A, A.Size.NumberOfDimensions);
667            }
668        }
669        /// <summary>
670        /// Inverse fast fourier transform (n-D)
671        /// </summary>
672        /// <param name="A">Input array, n-D (frequency domain)</param>
673        /// <returns>Transformation result</returns>
674        /// <remarks>
675        /// <para>The n-dimensional inverse transformation is computed for the n-dimensional array A.
676        /// This is equivalent to repeatedly (inplace)
677        /// computing one dimensional transformations along all dimensions of A.
678        /// However, using this
679        /// function may be of magnitudes faster than using 1D transformations. This
680        /// depends on the algorithm and API provided by the underlying native library.</para>
681        /// <para>The forward fourier transform and the inverse fourier transform of
682        /// a given data array A are mathematically equivalent. It's only a
683        /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That
684        /// scaling is introduced in the inverse transform.</para>
685        /// <para>The transformation is computed by use of the native library
686        /// which currently is set up for your processor and OS version. The underlying
687        /// library is automatically choosen at ILNumerics startup and accessed via the
688        /// static member ILMath.FFT. See the online documentation for more
689        /// details in how to tune/configure and select dedicated native libraries.
690        /// Currently supported libraries are: Intel MKL (included), AMD ACML
691        /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts).</para>
692        /// </remarks>
693        public static ILRetArray< complex> ifftn(ILInArray< complex> A) {
694            using (ILScope.Enter(A)) {
695                if (A.IsEmpty) return empty< complex>(A.Size);
696                return FFTImplementation.FFTBackward(A, A.Size.NumberOfDimensions);
697            }
698        }
699        /// <summary>
700        /// Inverse fast fourier transform (n-D)
701        /// </summary>
702        /// <param name="A">Input array, n-D, complex hermitian (frequency domain)</param>
703        /// <returns>Transformation result</returns>
704        /// <remarks>
705        /// <para>The n-dimensional inverse transformation is computed for the n-dimensional array A.
706        /// This is equivalent to repeatedly (inplace)
707        /// computing one dimensional transformations along all dimensions of A.
708        /// However, using this
709        /// function may be of magnitudes faster than using 1D transformations. This
710        /// depends on the algorithm and API provided by the underlying native library.</para>
711        /// <para>Since a transform of complex hermitian input data results in the
712        /// output having the imaginary part equals zero, only the real part is
713        /// returned for convenience reasons.</para>
714        /// <para>No check is made for A being hermitian! If A is not hermitian (by means
715        /// of round-off errors), the result will be wrong!</para>
716        /// <para>The forward fourier transform and the inverse fourier transform of
717        /// a given data array A are mathematically equivalent. It's only a
718        /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That
719        /// scaling is introduced in the inverse transform.</para>
720        /// <para>The transformation is computed by use of the native library
721        /// which currently is set up for your processor and OS version. The underlying
722        /// library is automatically choosen at ILNumerics startup and accessed via the
723        /// static member ILMath.FFT. See the online documentation for more
724        /// details in how to tune/configure and select dedicated native libraries.
725        /// Currently supported libraries are: Intel MKL (included), AMD ACML
726        /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts).</para>
727        /// </remarks>
728        public static ILRetArray< double> ifftnsym(ILInArray< complex> A) {
729            using (ILScope.Enter(A)) {
730                if (A.IsEmpty) return empty< double>(A.Size);
731                return FFTImplementation.FFTBackwSym(A, A.Size.NumberOfDimensions);
732            }
733        }
734        #endregion
735
736        #region fftn(A, params dims)
737        /// <summary>
738        /// Fast fourier transform (n-D, specific size)
739        /// </summary>
740        /// <param name="A">Input array, n-D</param>
741        /// <param name="dims">Transformation lengths, specifies the length of the dimensions
742        /// for the transformation array. The length of dims must be &gt; or equal to the number of
743        /// dimensions of A. For elements in dim being smaller than corresponding dimension
744        /// length in A, the dimensions will be truncated, otherwise zeros will be padded.</param>
745        /// <returns>Transformation result of size specified by 'dims' parameter, complex hermitian</returns>
746        /// <remarks>
747        /// <para>The n-dimensional transformation is computed for the n-dimensional array A.
748        /// Before the transform, the input is resized according to the 'dims' parameter.
749        /// Dimensions larger than corresponding entries in 'dim' are truncated, dimensions
750        /// smaller than corresponding entries in 'dim' are zero padded.</para>
751        /// <para>The n-dimensional transformation is equivalent to repeatedly (inplace)
752        /// computing one dimensional transformations along all dimensions of A.
753        /// However, using this
754        /// function may be of magnitudes faster than using 1D transformations. This
755        /// depends on the algorithm and API provided by the underlying native library.</para>
756        /// <para>The forward fourier transform and the inverse fourier transform of
757        /// a given data array A are mathematically equivalent. It's only a
758        /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That
759        /// scaling is introduced in the inverse transform.</para>
760        /// <para>The transformation is computed by use of the native library
761        /// which currently is set up for your processor and OS version. The underlying
762        /// library is automatically choosen at ILNumerics startup and accessed via the
763        /// static member ILMath.FFT. See the online documentation for more
764        /// details in how to tune/configure and select dedicated native libraries.
765        /// Currently supported libraries are: Intel MKL (included), AMD ACML
766        /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts).</para>
767        /// </remarks>
768        /// <exception cref="ILNumerics.Exceptions.ILArgumentException">is thrown if the
769        /// dim parameter is null, its length is less then the number of dimensions of A
770        /// or any element of dims is non-negative</exception>
771        public static ILRetArray< complex> fftn(ILInArray< double> A, params int[] dims) {
772            using (ILScope.Enter(A)) {
773                if (A.IsEmpty) return empty< complex>(A.Size);
774                ILRetArray< double> resizedA = resize4Transform(A, dims);
775                return FFTImplementation.FFTForward(resizedA, dims.Length);
776            }
777        }
778        /// <summary>
779        /// Fast fourier transform (n-D, specific size)
780        /// </summary>
781        /// <param name="A">Tnput array, n-D</param>
782        /// <param name="dims">Transformation lengths, specifies the length of the dimensions
783        /// for the transformation array. The length of dims must be &gt; or equal to  the number of
784        /// dimensions of A. For elements in dim being smaller than corresponding dimension
785        /// length in A, the dimensions will be truncated, otherwise zeros will be padded.</param>
786        /// <returns>Transformation result of size specified by 'dims' parameter</returns>
787        /// <remarks>
788        /// <para>The n-dimensional transformation is computed for the n-dimensional array A.
789        /// Before the transform, the input is resized according to the 'dims' parameter.
790        /// Dimensions larger than corresponding entries in 'dim' are truncated, dimensions
791        /// smaller than corresponding entries in 'dim' are zero padded.</para>
792        /// <para>The n-dimensional transformation is equivalent to repeatedly (inplace)
793        /// computing one dimensional transformations along all dimensions of A.
794        /// However, using this
795        /// function may be of magnitudes faster than using 1D transformations. This
796        /// depends on the algorithm and API provided by the underlying native library.</para>
797        /// <para>The forward fourier transform and the inverse fourier transform of
798        /// a given data array A are mathematically equivalent. It's only a
799        /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That
800        /// scaling is introduced in the inverse transform.</para>
801        /// <para>The transformation is computed by use of the native library
802        /// which currently is set up for your processor and OS version. The underlying
803        /// library is automatically choosen at ILNumerics startup and accessed via the
804        /// static member ILMath.FFT. See the online documentation for more
805        /// details in how to tune/configure and select dedicated native libraries.
806        /// Currently supported libraries are: Intel MKL (included), AMD ACML
807        /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts).</para>
808        /// </remarks>
809        /// <exception cref="ILNumerics.Exceptions.ILArgumentException">is thrown if the
810        /// dim parameter is null, its length is less then the number of dimensions of A
811        /// or any element of dims is non-negative</exception>
812        public static ILRetArray< complex> fftn(ILInArray< complex> A, params int[] dims) {
813            using (ILScope.Enter(A)) {
814                if (A.IsEmpty) return empty< complex>(A.Size);
815                ILRetArray< complex> resizedA = resize4Transform(A, dims);
816                return FFTImplementation.FFTForward(resizedA, dims.Length);
817            }
818        }
819        /// <summary>
820        /// Inverse fast fourier transform (n-D, specific size)
821        /// </summary>
822        /// <param name="A">Input array, n-D</param>
823        /// <param name="dims">Transformation lengths, specifies the length of the dimensions
824        /// for the transformation array. The length of dims must be &gt; or equal to  the number of
825        /// dimensions of A. For elements in dim being smaller than corresponding dimension
826        /// length in A, the dimensions will be truncated, otherwise zeros will be padded.</param>
827        /// <returns>Transformation result of size specified by 'dims' parameter</returns>
828        /// <remarks>
829        /// <para>The n-dimensional transformation is computed for the n-dimensional array A.
830        /// Before the transform, the input is resized according to the 'dims' parameter.
831        /// Dimensions larger than corresponding entries in 'dim' are truncated, dimensions
832        /// smaller than corresponding entries in 'dim' are zero padded.</para>
833        /// <para>The n-dimensional transformation is equivalent to repeatedly (inplace)
834        /// computing one dimensional transformations along all dimensions of A.
835        /// However, using this
836        /// function may be of magnitudes faster than using 1D transformations. This
837        /// depends on the algorithm and API provided by the underlying native library.</para>
838        /// <para>The forward fourier transform and the inverse fourier transform of
839        /// a given data array A are mathematically equivalent. It's only a
840        /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That
841        /// scaling is introduced in the inverse transform.</para>
842        /// <para>The transformation is computed by use of the native library
843        /// which currently is set up for your processor and OS version. The underlying
844        /// library is automatically choosen at ILNumerics startup and accessed via the
845        /// static member ILMath.FFT. See the online documentation for more
846        /// details in how to tune/configure and select dedicated native libraries.
847        /// Currently supported libraries are: Intel MKL (included), AMD ACML
848        /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts).</para>
849        /// </remarks>
850        /// <exception cref="ILNumerics.Exceptions.ILArgumentException">is thrown if the
851        /// dim parameter is null, its length is less then the number of dimensions of A
852        /// or any element of dims is non-negative</exception>
853        public static ILRetArray< complex> ifftn(ILInArray< complex> A, params int[] dims) {
854            using (ILScope.Enter(A)) {
855                if (A.IsEmpty) return empty< complex>(A.Size);
856                ILRetArray< complex> resizedA = resize4Transform(A, dims);
857                return FFTImplementation.FFTBackward(resizedA, dims.Length);
858            }
859        }
860        /// <summary>
861        /// Inverse fast fourier transform (n-D, complex hermitian, specific size)
862        /// </summary>
863        /// <param name="A">Complex hermitian input array, n-D</param>
864        /// <param name="dims">Transformation lengths, specifies the length of the dimensions
865        /// for the transformation array. The length of dims must be &gt; or equal to  the number of
866        /// dimensions of A. For elements in dim being smaller than corresponding dimension
867        /// length in A, the dimensions will be truncated, otherwise zeros will be padded.</param>
868        /// <returns>Transformation result, real array of the size specified by the 'dims' parameter</returns>
869        /// <remarks>
870        /// <para>The n-dimensional transformation is computed for the n-dimensional array A.
871        /// Before the transform, the input is resized according to the 'dims' parameter.
872        /// Dimensions larger than corresponding entries in 'dim' are truncated, dimensions
873        /// smaller than corresponding entries in 'dim' are zero padded.</para>
874        /// <para>The n-dimensional transformation is equivalent to repeatedly (inplace)
875        /// computing one dimensional transformations along all dimensions of A.
876        /// However, using this
877        /// function may be of magnitudes faster than using 1D transformations. This
878        /// depends on the algorithm and API provided by the underlying native library.</para>
879        /// <para>Since a transform of complex hermitian input data results in the
880        /// output having the imaginary part equals zero, only the real part is
881        /// returned for convenience reasons.</para>
882        /// <para>No check is made for A being hermitian! If A is not hermitian (by means
883        /// of round-off errors), the result will be wrong!</para>
884        /// <para>The forward fourier transform and the inverse fourier transform of
885        /// a given data array A are mathematically equivalent. It's only a
886        /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That
887        /// scaling is introduced in the inverse transform.</para>
888        /// <para>The transformation is computed by use of the native library
889        /// which currently is set up for your processor and OS version. The underlying
890        /// library is automatically choosen at ILNumerics startup and accessed via the
891        /// static member ILMath.FFT. See the online documentation for more
892        /// details in how to tune/configure and select dedicated native libraries.
893        /// Currently supported libraries are: Intel MKL (included), AMD ACML
894        /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts).</para>
895        /// </remarks>
896        /// <exception cref="ILNumerics.Exceptions.ILArgumentException">is thrown if the
897        /// dim parameter is null, its length is less then the number of dimensions of A
898        /// or any element of dims is non-negative</exception>
899        public static ILRetArray< double> ifftnsym(ILInArray< complex> A, params int[] dims) {
900            using (ILScope.Enter(A)) {
901                if (A.IsEmpty) return empty< double>(A.Size);
902                ILRetArray< complex> resizedA = resize4Transform(A, dims);
903                return FFTImplementation.FFTBackwSym(resizedA, dims.Length);
904            }
905        }
906        #endregion
907
908
909#region HYCALPER AUTO GENERATED CODE
910
911
912
913        #region fft(A)
914        /// <summary>
915        /// Fast fourier transform (1D)
916        /// </summary>
917        /// <param name="A">Input array</param>
918        /// <returns>Transformed output array</returns>
919        /// <remarks><para>The transformation is computed along the first
920        /// non singleton dimension.</para>
921        /// <para>The output array returned will be complex hermitian. I.e. the real
922        /// part being even and the imaginary part being odd symmetrical.</para>
923        /// <para>The forward fourier transform and the inverse fourier transform of
924        /// a given data array A are mathematically equivalent. It's only a
925        /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That
926        /// scaling is introduced in the inverse transform.</para>
927        /// <para>The transformation is computed by use of the native library
928        /// which currently is set up for your processor and OS version. The underlying
929        /// library is automatically choosen at ILNumerics startup and accessed via the
930        /// static member ILMath.FFT. See the online documentation for more
931        /// details in how to tune/configure and select dedicated native libraries.
932        /// Currently supported libraries are: Intel MKL
933        /// (included), AMD ACML and FFTW3 (prepared, optional modules, not included due to licensing conflicts).</para>
934        /// </remarks>
935        public static ILRetArray< fcomplex> fft(ILInArray< float> A) {
936            using (ILScope.Enter(A)) {
937                if (A.IsEmpty) return empty< fcomplex>(A.Size);
938                if (A.IsScalar) return new  fcomplex(A.GetValue(0), 0);
939                int fnsd = A.Size.WorkingDimension();
940                return ILMath.FFTImplementation.FFTForward1D(A, fnsd);
941            }
942        }
943        /// <summary>
944        /// Fast fourier transform (1D)
945        /// </summary>
946        /// <param name="A">Input array</param>
947        /// <returns>Transformed output array</returns>
948        /// <remarks>
949        /// <para>The transformation is computed along the first non
950        /// singleton dimension.</para>
951        /// <para>The forward fourier transform and the inverse fourier transform of
952        /// a given data array A are mathematically equivalent. It's only a
953        /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That
954        /// scaling is introduced in the inverse transform.</para>
955        /// <para>The transformation is computed by use of the native library
956        /// which currently is set up for your processor and OS version. The underlying
957        /// library is automatically choosen at ILNumerics startup and accessed via the
958        /// static member ILMath.FFT. See the online documentation for more
959        /// details in how to tune/configure and select dedicated native libraries.
960        /// Currently supported libraries are: Intel MKL
961        /// (included), AMD ACML and FFTW3 (prepared, optional modules, not included due to licensing conflicts).</para>
962        /// </remarks>
963        public static ILRetArray< fcomplex > fft(ILInArray< fcomplex > A) {
964            using (ILScope.Enter(A)) {
965                if (A.IsEmpty) return empty< fcomplex>(A.Size);
966                if (A.IsScalar) return A.C;
967                int fnsd = A.Size.WorkingDimension();
968                return ILMath.FFTImplementation.FFTForward1D(A, fnsd);
969            }
970        }
971        /// <summary>
972        /// Fast inverse fourier transform (1D)
973        /// </summary>
974        /// <param name="A">Input (frequency domain)</param>
975        /// <returns>Inverse transformed output array</returns>
976        /// <remarks>
977        /// <para>The transformation is computed along the first non
978        /// singleton dimension.</para>
979        /// <para>The forward fourier transform and the inverse fourier transform of
980        /// a given data array A are mathematically equivalent. It's only a
981        /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That
982        /// scaling is introduced in the inverse transform.</para>
983        /// <para>The transformation is computed by use of the native library
984        /// which currently is set up for your processor and OS version. The underlying
985        /// library is automatically choosen at ILNumerics startup and accessed via the
986        /// static member ILMath.FFT. See the online documentation for more
987        /// details in how to tune/configure and select dedicated native libraries.
988        /// Currently supported libraries are: Intel MKL
989        /// (included), AMD ACML and FFTW3 (prepared, optional modules, not included due to licensing conflicts).</para>
990        /// </remarks>
991        public static ILRetArray<fcomplex> ifft(ILInArray<fcomplex> A) {
992            using (ILScope.Enter(A)) {
993                if (A.IsEmpty) return empty< fcomplex>(A.Size);
994                if (A.IsScalar) return A.C;
995                int fnsd = A.Size.WorkingDimension();
996                return ILMath.FFTImplementation.FFTBackward1D(A, fnsd);
997            }
998        }
999        /// <summary>
1000        /// Inverse fast fourier transform, complex hermitian input
1001        /// </summary>
1002        /// <param name="A">Complex hermitian input array</param>
1003        /// <returns>Real output array, same size as A</returns>
1004        /// <remarks>
1005        /// <para>Since a transform of complex hermitian input data results in
1006        /// the output having all imaginary part equal zero, only the real part is
1007        /// returned for convenience reasons.</para>
1008        /// <para>No check is made for A being hermitian! If A is not hermitian (by means
1009        /// of round-off errors), the result will be wrong!</para>
1010        /// <para>The transformation is computed along the first non
1011        /// singleton dimension.</para>
1012        /// <para>The forward fourier transform and the inverse fourier transform of
1013        /// a given data array A are mathematically equivalent. It's only a
1014        /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That
1015        /// scaling is introduced in the inverse transform.</para>
1016        /// <para>The transformation is computed by use of the native library
1017        /// which currently is set up for your processor and OS version. The underlying
1018        /// library is automatically choosen at ILNumerics startup and accessed via the
1019        /// static member ILMath.FFT. See the online documentation for more
1020        /// details in how to tune/configure and select dedicated native libraries.
1021        /// Currently supported libraries are: Intel MKL
1022        /// (included), AMD ACML and FFTW3 (prepared, optional modules, not included due to licensing conflicts).</para>
1023        /// </remarks>
1024        public static ILRetArray< float > ifftsym(ILInArray< fcomplex > A) {
1025            using (ILScope.Enter(A)) {
1026                if (A.IsEmpty) return empty< float>(A.Size);
1027                if (A.IsScalar) return real(A);
1028                int fnsd = A.Size.WorkingDimension();
1029                return ILMath.FFTImplementation.FFTBackwSym1D(A, fnsd);
1030            }
1031        }
1032        #endregion
1033
1034        #region fft(A, dim)
1035        /// <summary>
1036        /// Fast fourier transform along specific dimension
1037        /// </summary>
1038        /// <param name="A">Real input array</param>
1039        /// <param name="dim">Dimension to compute FFT along. This parameter must be non-negative. </param>
1040        /// <returns>Transformation result</returns>
1041        /// <remarks>
1042        /// <para>The output array returned will be complex hermitian. I.e. the real
1043        /// part being even and the imaginary part being odd symmetrical.</para>
1044        /// <para>The forward fourier transform and the inverse fourier transform of
1045        /// a given data array A are mathematically equivalent. It's only a
1046        /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That
1047        /// scaling is introduced in the inverse transform.</para>
1048        /// <para>The transformation is computed by use of the native library
1049        /// which currently is set up for your processor and OS version. The underlying
1050        /// library is automatically choosen at ILNumerics startup and accessed via the
1051        /// static member ILMath.FFT. See the online documentation for more
1052        /// details in how to tune/configure and select dedicated native libraries.
1053        /// Currently supported libraries are: Intel MKL
1054        /// (included), AMD ACML and FFTW3 (prepared, optional modules, not included due to licensing conflicts).</para>
1055        /// </remarks>
1056        /// <exception cref="ILNumerics.Exceptions.ILArgumentException">is thrown if
1057        /// the dim parameter is negative</exception>
1058        public static ILRetArray< fcomplex > fft(ILInArray< float > A, int dim) {
1059            using (ILScope.Enter(A)) {
1060                if (dim < 0) throw new ILArgumentException("the 'dim' parameter must point to an existing dimension index of A");
1061                if (A.IsEmpty) return empty< fcomplex>(A.Size);
1062                if (A.IsScalar) return new  fcomplex(A.GetValue(0), 0);
1063                return ILMath.FFTImplementation.FFTForward1D(A, dim);
1064            }
1065        }
1066        /// <summary>
1067        /// Fast fourier transform along specific dimension
1068        /// </summary>
1069        /// <param name="A">Input array</param>
1070        /// <param name="dim">Dimension to compute FFT along. This parameter
1071        /// must be non-negative. </param>
1072        /// <returns>Transformation result</returns>
1073        /// <remarks>
1074        /// <para>The forward fourier transform and the inverse fourier transform of
1075        /// a given data array A are mathematically equivalent. It's only a
1076        /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That
1077        /// scaling is introduced in the inverse transform.</para>
1078        /// <para>The transformation is computed by use of the native library
1079        /// which currently is set up for your processor and OS version. The underlying
1080        /// library is automatically choosen at ILNumerics startup and accessed via the
1081        /// static member ILMath.FFT. See the online documentation for more
1082        /// details in how to tune/configure and select dedicated native libraries.
1083        /// Currently supported libraries are: Intel MKL
1084        /// (included), AMD ACML and FFTW3 (prepared, optional modules, not included due to licensing conflicts).</para>
1085        /// </remarks>
1086        /// <exception cref="ILNumerics.Exceptions.ILArgumentException">is thrown if
1087        /// the dim parameter is negative</exception>
1088        public static ILRetArray< fcomplex > fft(ILInArray< fcomplex > A, int dim) {
1089            using (ILScope.Enter(A)) {
1090                if (dim < 0) throw new ILArgumentException("the 'dim' parameter must point to an existing dimension index of A");
1091                if (A.IsEmpty) return empty< fcomplex>(A.Size);
1092                if (A.IsScalar) return A.C;
1093                return ILMath.FFTImplementation.FFTForward1D(A, dim);
1094            }
1095        }
1096        /// <summary>
1097        /// Inverse fast fourier transform along specific dimension
1098        /// </summary>
1099        /// <param name="A">Input array</param>
1100        /// <param name="dim">Dimension to compute FFT along. This parameter
1101        /// must be non-negative. </param>
1102        /// <returns>Transformation result</returns>
1103        /// <remarks>
1104        /// <para>The forward fourier transform and the inverse fourier transform of
1105        /// a given data array A are mathematically equivalent. It's only a
1106        /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That
1107        /// scaling is introduced in the inverse transform.</para>
1108        /// <para>The transformation is computed by use of the native library
1109        /// which currently is set up for your processor and OS version. The underlying
1110        /// library is automatically choosen at ILNumerics startup and accessed via the
1111        /// static member ILMath.FFT. See the online documentation for more
1112        /// details in how to tune/configure and select dedicated native libraries.
1113        /// Currently supported libraries are: Intel MKL
1114        /// (included), AMD ACML and FFTW3 (prepared, optional modules, not included due to licensing conflicts).</para>
1115        /// </remarks>
1116        /// <exception cref="ILNumerics.Exceptions.ILArgumentException">is thrown if the dim parameter is negative</exception>
1117        public static ILRetArray< fcomplex> ifft(ILInArray< fcomplex> A, int dim) {
1118            using (ILScope.Enter(A)) {
1119                if (dim < 0) throw new ILArgumentException("the 'dim' parameter must point to an existing dimension index of A");
1120                if (A.IsEmpty) return empty< fcomplex>(A.Size);
1121                if (A.IsScalar) return A.C;
1122                return ILMath.FFTImplementation.FFTBackward1D(A, dim);
1123            }
1124        }
1125        /// <summary>
1126        /// Inverse fast fourier transform, complex hermitian input
1127        /// </summary>
1128        /// <param name="A">Complex hermitian input array (frequency domain)</param>
1129        /// <param name="dim">Dimension to compute FFT along. This parameter
1130        /// must be non-negative. </param>
1131        /// <returns>Real output array, same size as A</returns>
1132        /// <remarks>
1133        /// <para>Since a transform of complex hermitian input data results in the
1134        /// output having the imaginary part equals zero, only the real part is
1135        /// returned for convenience reasons.</para>
1136        /// <para>No check is made for A being hermitian! If A is not hermitian (by means
1137        /// of round-off errors), the result will be wrong!</para>
1138        /// <para>The forward fourier transform and the inverse fourier transform of
1139        /// a given data array A are mathematically equivalent. It's only a
1140        /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That
1141        /// scaling is introduced in the inverse transform.</para>
1142        /// <para>The transformation is computed by use of the native library
1143        /// which currently is set up for your processor and OS version. The underlying
1144        /// library is automatically choosen at ILNumerics startup and accessed via the
1145        /// static member ILMath.FFT. See the online documentation for more
1146        /// details in how to tune/configure and select dedicated native libraries.
1147        /// Currently supported libraries are: Intel MKL (included), AMD ACML
1148        /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts).</para>
1149        /// </remarks>
1150        /// <exception cref="ILNumerics.Exceptions.ILArgumentException">is thrown if the dim parameter is negative</exception>
1151        public static ILRetArray< float > ifftsym(ILInArray< fcomplex > A, int dim) {
1152            using (ILScope.Enter(A)) {
1153                if (dim < 0) throw new ILArgumentException("the 'dim' parameter must point to an existing dimension index of A");
1154                if (A.IsEmpty) return empty< float>(A.Size);
1155                if (A.IsScalar) return real(A);
1156                return ILMath.FFTImplementation.FFTBackwSym1D(A, dim);
1157            }
1158        }
1159        #endregion
1160
1161        #region fft2(A)
1162        /// <summary>
1163        /// Fast fourier transform (2D)
1164        /// </summary>
1165        /// <param name="A">Input array</param>
1166        /// <returns>Transformation result</returns>
1167        /// <remarks>
1168        /// <para>The 2D transformation is computed for the first 2 dimensions, regardless
1169        /// of those dimensions being singleton or non-singleton. If A is an n-d array,
1170        /// the transformation is repeated for trailing dimensions of A respectively. </para>
1171        /// <para>The output array returned will be complex hermitian.</para>
1172        /// <para>The two dimensional transformation is equivalent to repeatedly transforming
1173        /// the columns and after that transforming the rows of A. However, using this
1174        /// function may be of magnitudes faster than using 1D transformations. This
1175        /// depends on the algorithm and API provided by the underlying native library.</para>
1176        /// <para>The forward fourier transform and the inverse fourier transform of
1177        /// a given data array A are mathematically equivalent. It's only a
1178        /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That
1179        /// scaling is introduced in the inverse transform.</para>
1180        /// <para>The transformation is computed by use of the native library
1181        /// which currently is set up for your processor and OS version. The underlying
1182        /// library is automatically choosen at ILNumerics startup and accessed via the
1183        /// static member ILMath.FFT. See the online documentation for more
1184        /// details in how to tune/configure and select dedicated native libraries.
1185        /// Currently supported libraries are: Intel MKL (included), AMD ACML
1186        /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts).</para>
1187        /// </remarks>
1188        public static ILRetArray< fcomplex > fft2(ILInArray< float > A) {
1189            using (ILScope.Enter(A)) {
1190                if (A.IsEmpty) return empty< fcomplex>(A.Size);
1191                if (A.IsScalar) return new  fcomplex(A.GetValue(0), 0);
1192                return FFTImplementation.FFTForward(A, 2);
1193            }
1194        }
1195        /// <summary>
1196        /// Fast fourier transform (2D)
1197        /// </summary>
1198        /// <param name="A">Input array</param>
1199        /// <returns>Transformation result</returns>
1200        /// <remarks>
1201        /// <para>The transformation is computed for the first 2 dimensions, regardless
1202        /// of those dimensions being singleton or non-singleton. If A is an n-d array,
1203        /// the transformation is repeated for trailing dimensions of A respectively. </para>
1204        /// <para>The two dimensional transformation is equivalent to repeatedly transforming
1205        /// the columns and after that transforming the rows of A. However, using this
1206        /// function may be of magnitudes faster than using 1D transformations. This
1207        /// depends on the algorithm and API provided by the underlying native library.</para>
1208        /// <para>The forward fourier transform and the inverse fourier transform of
1209        /// a given data array A are mathematically equivalent. It's only a
1210        /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That
1211        /// scaling is introduced in the inverse transform.</para>
1212        /// <para>The transformation is computed by use of the native library
1213        /// which currently is set up for your processor and OS version. The underlying
1214        /// library is automatically choosen at ILNumerics startup and accessed via the
1215        /// static member ILMath.FFT. See the online documentation for more
1216        /// details in how to tune/configure and select dedicated native libraries.
1217        /// Currently supported libraries are: Intel MKL (included), AMD ACML
1218        /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts).</para>
1219        /// </remarks>
1220        public static ILRetArray< fcomplex> fft2(ILInArray< fcomplex> A) {
1221            using (ILScope.Enter(A)) {
1222                if (A.IsEmpty) return empty< fcomplex>(A.Size);
1223                if (A.IsScalar) return A.C;
1224                return FFTImplementation.FFTForward(A, 2);
1225            }
1226        }
1227        /// <summary>
1228        /// Inverse fast fourier transform (2D)
1229        /// </summary>
1230        /// <param name="A">Input array</param>
1231        /// <returns>Transformation result</returns>
1232        /// <remarks>
1233        /// <para>The transformation is computed for the first 2 dimensions, regardless
1234        /// of those dimensions being singleton or non-singleton. If A is an n-d array,
1235        /// the transformation is repeated for trailing dimensions of A respectively. </para>
1236        /// <para>The two dimensional transformation is equivalent to repeatedly transforming
1237        /// the columns and after that transforming the rows of A. However, using this
1238        /// function may be of magnitudes faster than using 1D transformations. This
1239        /// depends on the algorithm and API provided by the underlying native library.</para>
1240        /// <para>The forward fourier transform and the inverse fourier transform of
1241        /// a given data array A are mathematically equivalent. It's only a
1242        /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That
1243        /// scaling is introduced in the inverse transform.</para>
1244        /// <para>The transformation is computed by use of the native library
1245        /// which currently is set up for your processor and OS version. The underlying
1246        /// library is automatically choosen at ILNumerics startup and accessed via the
1247        /// static member ILMath.FFT. See the online documentation for more
1248        /// details in how to tune/configure and select dedicated native libraries.
1249        /// Currently supported libraries are: Intel MKL (included), AMD ACML
1250        /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts).</para>
1251        /// </remarks>
1252        public static ILRetArray< fcomplex> ifft2(ILInArray< fcomplex> A) {
1253            using (ILScope.Enter(A)) {
1254                if (A.IsEmpty) return empty< fcomplex>(A.Size);
1255                if (A.IsScalar) return A.C;
1256                return FFTImplementation.FFTBackward(A, 2);
1257            }
1258        }
1259        /// <summary>
1260        /// Inverse fast fourier transform (2D, hermitian input)
1261        /// </summary>
1262        /// <param name="A">Complex hermitian input array (frequency domain)</param>
1263        /// <returns>Transformation result</returns>
1264        /// <remarks>
1265        /// <para>Since a transform of complex hermitian input data results in the
1266        /// output having the imaginary part equals zero, only the real part is
1267        /// returned for convenience reasons.</para>
1268        /// <para>No check is made for A being hermitian! If A is not hermitian (by means
1269        /// of round-off errors), the result will be wrong!</para>
1270        /// <para>The transformation is computed for the first 2 dimensions, regardless
1271        /// of those dimensions being singleton or non-singleton. If A is an n-d array,
1272        /// the transformation is repeated for trailing dimensions of A respectively. </para>
1273        /// <para>The two dimensional transformation is equivalent to repeatedly transforming
1274        /// the columns and after that transforming the rows of A. However, using this
1275        /// function may be of magnitudes faster than using 1D transformations. This
1276        /// depends on the algorithm and API provided by the underlying native library.</para>
1277        /// <para>The forward fourier transform and the inverse fourier transform of
1278        /// a given data array A are mathematically equivalent. It's only a
1279        /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That
1280        /// scaling is introduced in the inverse transform.</para>
1281        /// <para>The transformation is computed by use of the native library
1282        /// which currently is set up for your processor and OS version. The underlying
1283        /// library is automatically choosen at ILNumerics startup and accessed via the
1284        /// static member ILMath.FFT. See the online documentation for more
1285        /// details in how to tune/configure and select dedicated native libraries.
1286        /// Currently supported libraries are: Intel MKL (included), AMD ACML
1287        /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts).</para>
1288        /// </remarks>
1289        public static ILRetArray< float> ifft2sym(ILInArray< fcomplex> A) {
1290            using (ILScope.Enter(A)) {
1291                if (A.IsEmpty) return empty< float>(A.Size);
1292                if (A.IsScalar) return real(A);
1293                return FFTImplementation.FFTBackwSym(A, 2);
1294            }
1295        }
1296        #endregion
1297
1298        #region fft2(A,m,n)
1299        /// <summary>
1300        /// Fast fourier transform (2D)
1301        /// </summary>
1302        /// <param name="A">Input array</param>
1303        /// <param name="m">Transformation column length</param>
1304        /// <param name="n">Transformation row length</param>
1305        /// <returns>Transformation result, complex hermitian</returns>
1306        /// <remarks>
1307        /// <para>The transformation is computed for the first 2 dimensions, regardless
1308        /// of those dimensions being singleton or non-singleton. If A is an n-d array,
1309        /// the transformation is repeated for trailing dimensions of A respectively. </para>
1310        /// <para>The data to be transformed (based on the A array) are resized according to
1311        /// the length parameter m and n. If m or n is larger then the length of the corresponding
1312        /// dimension of A, zeros will be padded, otherwise the dimensions are truncated respectively. </para>
1313        /// <para>The two dimensional transformation is equivalent to repeatedly transforming
1314        /// the columns and after that transforming the rows of A. However, using this
1315        /// function may be of magnitudes faster than using 1D transformations. This
1316        /// depends on the algorithm and API provided by the underlying native library.</para>
1317        /// <para>The forward fourier transform and the inverse fourier transform of
1318        /// a given data array A are mathematically equivalent. It's only a
1319        /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That
1320        /// scaling is introduced in the inverse transform.</para>
1321        /// <para>The transformation is computed by use of the native library
1322        /// which currently is set up for your processor and OS version. The underlying
1323        /// library is automatically choosen at ILNumerics startup and accessed via the
1324        /// static member ILMath.FFT. See the online documentation for more
1325        /// details in how to tune/configure and select dedicated native libraries.
1326        /// Currently supported libraries are: Intel MKL (included), AMD ACML
1327        /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts).</para>
1328        /// </remarks>
1329        /// <exception cref="ILNumerics.Exceptions.ILArgumentException">is thrown if one of n or m is negative</exception>
1330        public static ILRetArray< fcomplex> fft2(ILInArray< float> A, int m, int n) {
1331            using (ILScope.Enter(A)) {
1332                if (m < 0 || n < 0) throw new ILArgumentException("dimension length specifier 'm' and 'n' must be non-negative!");
1333                if (A.IsEmpty) return empty< fcomplex>(A.Size);
1334                int[] Asize = A.Size.ToIntArray();
1335                Asize[0] = m; Asize[1] = n;
1336                ILArray< float> resizedA = resize4Transform(A, Asize);
1337                return FFTImplementation.FFTForward(resizedA, 2);
1338            }
1339        }
1340        /// <summary>
1341        /// Fast fourier transform (2D)
1342        /// </summary>
1343        /// <param name="A">input array</param>
1344        /// <param name="m">Transformation column length</param>
1345        /// <param name="n">Transformation row length</param>
1346        /// <returns>Transformation result</returns>
1347        /// <remarks>
1348        /// <para>The transformation is computed for the first 2 dimensions, regardless
1349        /// of those dimensions being singleton or non-singleton. If A is an n-d array,
1350        /// the transformation is repeated for trailing dimensions of A respectively. </para>
1351        /// <para>The data to be transformed (based on the A array) are resized according to
1352        /// the length parameter m and n. If m or n is larger then the length of the corresponding
1353        /// dimension of A, zeros will be padded, otherwise the dimensions are truncated respectively. </para>
1354        /// <para>The two dimensional transformation is equivalent to repeatedly transforming
1355        /// the columns and after that transforming the rows of A. However, using this
1356        /// function may be of magnitudes faster than using 1D transformations. This
1357        /// depends on the algorithm and API provided by the underlying native library.</para>
1358        /// <para>The forward fourier transform and the inverse fourier transform of
1359        /// a given data array A are mathematically equivalent. It's only a
1360        /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That
1361        /// scaling is introduced in the inverse transform.</para>
1362        /// <para>The transformation is computed by use of the native library
1363        /// which currently is set up for your processor and OS version. The underlying
1364        /// library is automatically choosen at ILNumerics startup and accessed via the
1365        /// static member ILMath.FFT. See the online documentation for more
1366        /// details in how to tune/configure and select dedicated native libraries.
1367        /// Currently supported libraries are: Intel MKL (included), AMD ACML
1368        /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts).</para>
1369        /// </remarks>
1370        /// <exception cref="ILNumerics.Exceptions.ILArgumentException">is thrown if one of n or m is negative</exception>
1371        public static ILRetArray< fcomplex> fft2(ILInArray< fcomplex> A, int m, int n) {
1372            using (ILScope.Enter(A)) {
1373                if (m < 0 || n < 0) throw new ILArgumentException("dimension length specifier 'm' and 'n' must be non-negative!");
1374                if (A.IsEmpty) return empty< fcomplex>(A.Size);
1375                int[] Asize = A.Size.ToIntArray();
1376                Asize[0] = m; Asize[1] = n;
1377                ILRetArray< fcomplex> resizedA = resize4Transform(A, Asize);
1378                return FFTImplementation.FFTForward(resizedA, 2);
1379            }
1380        }
1381        /// <summary>
1382        /// Inverse fast fourier transform (2D)
1383        /// </summary>
1384        /// <param name="A">Input array</param>
1385        /// <param name="m">Transformation column length</param>
1386        /// <param name="n">Transformation row length</param>
1387        /// <returns>Transformation result</returns>
1388        /// <remarks>
1389        /// <para>The transformation is computed for the first 2 dimensions, regardless
1390        /// of those dimensions being singleton or non-singleton. If A is an n-d array,
1391        /// the transformation is repeated for trailing dimensions of A respectively. </para>
1392        /// <para>The data to be transformed (based on the array A) are resized according to
1393        /// the length parameter m and n. If m or n is larger then the length of the corresponding
1394        /// dimension of A, zeros will be padded, otherwise the dimensions are truncated respectively. </para>
1395        /// <para>The two dimensional transformation is equivalent to repeatedly transforming
1396        /// the columns and after that transforming the rows of A. However, using this
1397        /// function may be of magnitudes faster than using 1D transformations. This
1398        /// depends on the algorithm and API provided by the underlying native library.</para>
1399        /// <para>The forward fourier transform and the inverse fourier transform of
1400        /// a given data array A are mathematically equivalent. It's only a
1401        /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That
1402        /// scaling is introduced in the inverse transform.</para>
1403        /// <para>The transformation is computed by use of the native library
1404        /// which currently is set up for your processor and OS version. The underlying
1405        /// library is automatically choosen at ILNumerics startup and accessed via the
1406        /// static member ILMath.FFT. See the online documentation for more
1407        /// details in how to tune/configure and select dedicated native libraries.
1408        /// Currently supported libraries are: Intel MKL (included), AMD ACML
1409        /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts).</para>
1410        /// </remarks>
1411        /// <exception cref="ILNumerics.Exceptions.ILArgumentException">is thrown if one of n or m is negative</exception>
1412        public static ILRetArray< fcomplex> ifft2(ILInArray< fcomplex> A, int m, int n) {
1413            using (ILScope.Enter(A)) {
1414                if (m < 0 || n < 0) throw new ILArgumentException("dimension length specifier 'm' and 'n' must be non-negative!");
1415                if (A.IsEmpty) return empty< fcomplex>(A.Size);
1416                int[] Asize = A.Size.ToIntArray();
1417                Asize[0] = m; Asize[1] = n;
1418                ILRetArray< fcomplex> resizedA = resize4Transform(A, Asize);
1419                return FFTImplementation.FFTBackward(resizedA, 2);
1420            }
1421        }
1422        /// <summary>
1423        /// Inverse fast fourier transform (2D)
1424        /// </summary>
1425        /// <param name="A">Complex hermitian input array, symmetric in first 2 dimensions</param>
1426        /// <param name="m">Transformation column length</param>
1427        /// <param name="n">Transformation row length</param>
1428        /// <returns>Transformation result</returns>
1429        /// <remarks>
1430        /// <para>The transformation is computed for the first 2 dimensions, regardless
1431        /// of those dimensions being singleton or non-singleton. If A is an n-d array,
1432        /// the transformation is repeated for trailing dimensions of A respectively. The
1433        /// lengths of those trailing dimensions are not altered.</para>
1434        /// <para>Since a transform of complex hermitian input data results in the
1435        /// output having the imaginary part equals zero, only the real part is
1436        /// returned for convenience reasons.</para>
1437        /// <para>No check is made for A being hermitian! If A is not hermitian (by means
1438        /// of round-off errors), the result will be wrong!</para>
1439        /// <para>The data to be transformed (based on the array A) are resized according to
1440        /// the length parameter m and n. If m or n is larger then the length of the corresponding
1441        /// dimension of A, zeros will be padded, otherwise the dimensions are truncated respectively. </para>
1442        /// <para>The two dimensional transformation is equivalent to repeatedly transforming
1443        /// the columns and after that transforming the rows of A. However, using this
1444        /// function may be of magnitudes faster than using 1D transformations. This
1445        /// depends on the algorithm and API provided by the underlying native library.</para>
1446        /// <para>The forward fourier transform and the inverse fourier transform of
1447        /// a given data array A are mathematically equivalent. It's only a
1448        /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That
1449        /// scaling is introduced in the inverse transform.</para>
1450        /// <para>The transformation is computed by use of the native library
1451        /// which currently is set up for your processor and OS version. The underlying
1452        /// library is automatically choosen at ILNumerics startup and accessed via the
1453        /// static member ILMath.FFT. See the online documentation for more
1454        /// details in how to tune/configure and select dedicated native libraries.
1455        /// Currently supported libraries are: Intel MKL (included), AMD ACML
1456        /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts).</para>
1457        /// </remarks>
1458        /// <exception cref="ILNumerics.Exceptions.ILArgumentException">is thrown if one of n or m is negative</exception>
1459        public static ILRetArray< float> ifft2sym(ILInArray< fcomplex> A, int m, int n) {
1460            using (ILScope.Enter(A)) {
1461                if (m < 0 || n < 0) throw new ILArgumentException("dimension length specifier 'm' and 'n' must be non-negative!");
1462                if (A.IsEmpty) return empty< float>(A.Size);
1463                int[] Asize = A.Size.ToIntArray();
1464                Asize[0] = m; Asize[1] = n;
1465                ILRetArray< fcomplex> resizedA = resize4Transform(A, Asize);
1466                return FFTImplementation.FFTBackwSym(resizedA, 2);
1467            }
1468        }
1469        #endregion
1470
1471        #region fftn(A)
1472        /// <summary>
1473        /// Fast fourier transform (n-D)
1474        /// </summary>
1475        /// <param name="A">Input array, n-D</param>
1476        /// <returns>Transformation result, complex hermitian</returns>
1477        /// <remarks>
1478        /// <para>The n-dimensional transformation is computed for the n-dimensional array A.
1479        /// This is equivalent to repeatedly (inplace)
1480        /// computing one dimensional transformations along all dimensions of A.
1481        /// However, using this
1482        /// function may be of magnitudes faster than using 1D transformations. This
1483        /// depends on the algorithm and API provided by the underlying native library.</para>
1484        /// <para>The forward fourier transform and the inverse fourier transform of
1485        /// a given data array A are mathematically equivalent. It's only a
1486        /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That
1487        /// scaling is introduced in the inverse transform.</para>
1488        /// <para>The transformation is computed by use of the native library
1489        /// which currently is set up for your processor and OS version. The underlying
1490        /// library is automatically choosen at ILNumerics startup and accessed via the
1491        /// static member ILMath.FFT. See the online documentation for more
1492        /// details in how to tune/configure and select dedicated native libraries.
1493        /// Currently supported libraries are: Intel MKL (included), AMD ACML
1494        /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts).</para>
1495        /// </remarks>
1496        public static ILRetArray< fcomplex> fftn(ILInArray< float> A) {
1497            using (ILScope.Enter(A)) {
1498                if (A.IsEmpty) return empty< fcomplex>(A.Size);
1499                return FFTImplementation.FFTForward(A, A.Size.NumberOfDimensions);
1500            }
1501        }
1502        /// <summary>
1503        /// Fast fourier transform (n-D)
1504        /// </summary>
1505        /// <param name="A">Input array, n-D</param>
1506        /// <returns>Transformation result</returns>
1507        /// <remarks>
1508        /// <para>The n-dimensional transformation is computed for the n-dimensional array A.
1509        /// This is equivalent to repeatedly (inplace)
1510        /// computing one dimensional transformations along all dimensions of A.
1511        /// However, using this
1512        /// function may be of magnitudes faster than using 1D transformations. This
1513        /// depends on the algorithm and API provided by the underlying native library.</para>
1514        /// <para>The forward fourier transform and the inverse fourier transform of
1515        /// a given data array A are mathematically equivalent. It's only a
1516        /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That
1517        /// scaling is introduced in the inverse transform.</para>
1518        /// <para>The transformation is computed by use of the native library
1519        /// which currently is set up for your processor and OS version. The underlying
1520        /// library is automatically choosen at ILNumerics startup and accessed via the
1521        /// static member ILMath.FFT. See the online documentation for more
1522        /// details in how to tune/configure and select dedicated native libraries.
1523        /// Currently supported libraries are: Intel MKL (included), AMD ACML
1524        /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts).</para>
1525        /// </remarks>
1526        public static ILRetArray< fcomplex> fftn(ILInArray< fcomplex> A) {
1527            using (ILScope.Enter(A)) {
1528                if (A.IsEmpty) return empty< fcomplex>(A.Size);
1529                return FFTImplementation.FFTForward(A, A.Size.NumberOfDimensions);
1530            }
1531        }
1532        /// <summary>
1533        /// Inverse fast fourier transform (n-D)
1534        /// </summary>
1535        /// <param name="A">Input array, n-D (frequency domain)</param>
1536        /// <returns>Transformation result</returns>
1537        /// <remarks>
1538        /// <para>The n-dimensional inverse transformation is computed for the n-dimensional array A.
1539        /// This is equivalent to repeatedly (inplace)
1540        /// computing one dimensional transformations along all dimensions of A.
1541        /// However, using this
1542        /// function may be of magnitudes faster than using 1D transformations. This
1543        /// depends on the algorithm and API provided by the underlying native library.</para>
1544        /// <para>The forward fourier transform and the inverse fourier transform of
1545        /// a given data array A are mathematically equivalent. It's only a
1546        /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That
1547        /// scaling is introduced in the inverse transform.</para>
1548        /// <para>The transformation is computed by use of the native library
1549        /// which currently is set up for your processor and OS version. The underlying
1550        /// library is automatically choosen at ILNumerics startup and accessed via the
1551        /// static member ILMath.FFT. See the online documentation for more
1552        /// details in how to tune/configure and select dedicated native libraries.
1553        /// Currently supported libraries are: Intel MKL (included), AMD ACML
1554        /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts).</para>
1555        /// </remarks>
1556        public static ILRetArray< fcomplex> ifftn(ILInArray< fcomplex> A) {
1557            using (ILScope.Enter(A)) {
1558                if (A.IsEmpty) return empty< fcomplex>(A.Size);
1559                return FFTImplementation.FFTBackward(A, A.Size.NumberOfDimensions);
1560            }
1561        }
1562        /// <summary>
1563        /// Inverse fast fourier transform (n-D)
1564        /// </summary>
1565        /// <param name="A">Input array, n-D, complex hermitian (frequency domain)</param>
1566        /// <returns>Transformation result</returns>
1567        /// <remarks>
1568        /// <para>The n-dimensional inverse transformation is computed for the n-dimensional array A.
1569        /// This is equivalent to repeatedly (inplace)
1570        /// computing one dimensional transformations along all dimensions of A.
1571        /// However, using this
1572        /// function may be of magnitudes faster than using 1D transformations. This
1573        /// depends on the algorithm and API provided by the underlying native library.</para>
1574        /// <para>Since a transform of complex hermitian input data results in the
1575        /// output having the imaginary part equals zero, only the real part is
1576        /// returned for convenience reasons.</para>
1577        /// <para>No check is made for A being hermitian! If A is not hermitian (by means
1578        /// of round-off errors), the result will be wrong!</para>
1579        /// <para>The forward fourier transform and the inverse fourier transform of
1580        /// a given data array A are mathematically equivalent. It's only a
1581        /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That
1582        /// scaling is introduced in the inverse transform.</para>
1583        /// <para>The transformation is computed by use of the native library
1584        /// which currently is set up for your processor and OS version. The underlying
1585        /// library is automatically choosen at ILNumerics startup and accessed via the
1586        /// static member ILMath.FFT. See the online documentation for more
1587        /// details in how to tune/configure and select dedicated native libraries.
1588        /// Currently supported libraries are: Intel MKL (included), AMD ACML
1589        /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts).</para>
1590        /// </remarks>
1591        public static ILRetArray< float> ifftnsym(ILInArray< fcomplex> A) {
1592            using (ILScope.Enter(A)) {
1593                if (A.IsEmpty) return empty< float>(A.Size);
1594                return FFTImplementation.FFTBackwSym(A, A.Size.NumberOfDimensions);
1595            }
1596        }
1597        #endregion
1598
1599        #region fftn(A, params dims)
1600        /// <summary>
1601        /// Fast fourier transform (n-D, specific size)
1602        /// </summary>
1603        /// <param name="A">Input array, n-D</param>
1604        /// <param name="dims">Transformation lengths, specifies the length of the dimensions
1605        /// for the transformation array. The length of dims must be &gt; or equal to the number of
1606        /// dimensions of A. For elements in dim being smaller than corresponding dimension
1607        /// length in A, the dimensions will be truncated, otherwise zeros will be padded.</param>
1608        /// <returns>Transformation result of size specified by 'dims' parameter, complex hermitian</returns>
1609        /// <remarks>
1610        /// <para>The n-dimensional transformation is computed for the n-dimensional array A.
1611        /// Before the transform, the input is resized according to the 'dims' parameter.
1612        /// Dimensions larger than corresponding entries in 'dim' are truncated, dimensions
1613        /// smaller than corresponding entries in 'dim' are zero padded.</para>
1614        /// <para>The n-dimensional transformation is equivalent to repeatedly (inplace)
1615        /// computing one dimensional transformations along all dimensions of A.
1616        /// However, using this
1617        /// function may be of magnitudes faster than using 1D transformations. This
1618        /// depends on the algorithm and API provided by the underlying native library.</para>
1619        /// <para>The forward fourier transform and the inverse fourier transform of
1620        /// a given data array A are mathematically equivalent. It's only a
1621        /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That
1622        /// scaling is introduced in the inverse transform.</para>
1623        /// <para>The transformation is computed by use of the native library
1624        /// which currently is set up for your processor and OS version. The underlying
1625        /// library is automatically choosen at ILNumerics startup and accessed via the
1626        /// static member ILMath.FFT. See the online documentation for more
1627        /// details in how to tune/configure and select dedicated native libraries.
1628        /// Currently supported libraries are: Intel MKL (included), AMD ACML
1629        /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts).</para>
1630        /// </remarks>
1631        /// <exception cref="ILNumerics.Exceptions.ILArgumentException">is thrown if the
1632        /// dim parameter is null, its length is less then the number of dimensions of A
1633        /// or any element of dims is non-negative</exception>
1634        public static ILRetArray< fcomplex> fftn(ILInArray< float> A, params int[] dims) {
1635            using (ILScope.Enter(A)) {
1636                if (A.IsEmpty) return empty< fcomplex>(A.Size);
1637                ILRetArray< float> resizedA = resize4Transform(A, dims);
1638                return FFTImplementation.FFTForward(resizedA, dims.Length);
1639            }
1640        }
1641        /// <summary>
1642        /// Fast fourier transform (n-D, specific size)
1643        /// </summary>
1644        /// <param name="A">Tnput array, n-D</param>
1645        /// <param name="dims">Transformation lengths, specifies the length of the dimensions
1646        /// for the transformation array. The length of dims must be &gt; or equal to  the number of
1647        /// dimensions of A. For elements in dim being smaller than corresponding dimension
1648        /// length in A, the dimensions will be truncated, otherwise zeros will be padded.</param>
1649        /// <returns>Transformation result of size specified by 'dims' parameter</returns>
1650        /// <remarks>
1651        /// <para>The n-dimensional transformation is computed for the n-dimensional array A.
1652        /// Before the transform, the input is resized according to the 'dims' parameter.
1653        /// Dimensions larger than corresponding entries in 'dim' are truncated, dimensions
1654        /// smaller than corresponding entries in 'dim' are zero padded.</para>
1655        /// <para>The n-dimensional transformation is equivalent to repeatedly (inplace)
1656        /// computing one dimensional transformations along all dimensions of A.
1657        /// However, using this
1658        /// function may be of magnitudes faster than using 1D transformations. This
1659        /// depends on the algorithm and API provided by the underlying native library.</para>
1660        /// <para>The forward fourier transform and the inverse fourier transform of
1661        /// a given data array A are mathematically equivalent. It's only a
1662        /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That
1663        /// scaling is introduced in the inverse transform.</para>
1664        /// <para>The transformation is computed by use of the native library
1665        /// which currently is set up for your processor and OS version. The underlying
1666        /// library is automatically choosen at ILNumerics startup and accessed via the
1667        /// static member ILMath.FFT. See the online documentation for more
1668        /// details in how to tune/configure and select dedicated native libraries.
1669        /// Currently supported libraries are: Intel MKL (included), AMD ACML
1670        /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts).</para>
1671        /// </remarks>
1672        /// <exception cref="ILNumerics.Exceptions.ILArgumentException">is thrown if the
1673        /// dim parameter is null, its length is less then the number of dimensions of A
1674        /// or any element of dims is non-negative</exception>
1675        public static ILRetArray< fcomplex> fftn(ILInArray< fcomplex> A, params int[] dims) {
1676            using (ILScope.Enter(A)) {
1677                if (A.IsEmpty) return empty< fcomplex>(A.Size);
1678                ILRetArray< fcomplex> resizedA = resize4Transform(A, dims);
1679                return FFTImplementation.FFTForward(resizedA, dims.Length);
1680            }
1681        }
1682        /// <summary>
1683        /// Inverse fast fourier transform (n-D, specific size)
1684        /// </summary>
1685        /// <param name="A">Input array, n-D</param>
1686        /// <param name="dims">Transformation lengths, specifies the length of the dimensions
1687        /// for the transformation array. The length of dims must be &gt; or equal to  the number of
1688        /// dimensions of A. For elements in dim being smaller than corresponding dimension
1689        /// length in A, the dimensions will be truncated, otherwise zeros will be padded.</param>
1690        /// <returns>Transformation result of size specified by 'dims' parameter</returns>
1691        /// <remarks>
1692        /// <para>The n-dimensional transformation is computed for the n-dimensional array A.
1693        /// Before the transform, the input is resized according to the 'dims' parameter.
1694        /// Dimensions larger than corresponding entries in 'dim' are truncated, dimensions
1695        /// smaller than corresponding entries in 'dim' are zero padded.</para>
1696        /// <para>The n-dimensional transformation is equivalent to repeatedly (inplace)
1697        /// computing one dimensional transformations along all dimensions of A.
1698        /// However, using this
1699        /// function may be of magnitudes faster than using 1D transformations. This
1700        /// depends on the algorithm and API provided by the underlying native library.</para>
1701        /// <para>The forward fourier transform and the inverse fourier transform of
1702        /// a given data array A are mathematically equivalent. It's only a
1703        /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That
1704        /// scaling is introduced in the inverse transform.</para>
1705        /// <para>The transformation is computed by use of the native library
1706        /// which currently is set up for your processor and OS version. The underlying
1707        /// library is automatically choosen at ILNumerics startup and accessed via the
1708        /// static member ILMath.FFT. See the online documentation for more
1709        /// details in how to tune/configure and select dedicated native libraries.
1710        /// Currently supported libraries are: Intel MKL (included), AMD ACML
1711        /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts).</para>
1712        /// </remarks>
1713        /// <exception cref="ILNumerics.Exceptions.ILArgumentException">is thrown if the
1714        /// dim parameter is null, its length is less then the number of dimensions of A
1715        /// or any element of dims is non-negative</exception>
1716        public static ILRetArray< fcomplex> ifftn(ILInArray< fcomplex> A, params int[] dims) {
1717            using (ILScope.Enter(A)) {
1718                if (A.IsEmpty) return empty< fcomplex>(A.Size);
1719                ILRetArray< fcomplex> resizedA = resize4Transform(A, dims);
1720                return FFTImplementation.FFTBackward(resizedA, dims.Length);
1721            }
1722        }
1723        /// <summary>
1724        /// Inverse fast fourier transform (n-D, complex hermitian, specific size)
1725        /// </summary>
1726        /// <param name="A">Complex hermitian input array, n-D</param>
1727        /// <param name="dims">Transformation lengths, specifies the length of the dimensions
1728        /// for the transformation array. The length of dims must be &gt; or equal to  the number of
1729        /// dimensions of A. For elements in dim being smaller than corresponding dimension
1730        /// length in A, the dimensions will be truncated, otherwise zeros will be padded.</param>
1731        /// <returns>Transformation result, real array of the size specified by the 'dims' parameter</returns>
1732        /// <remarks>
1733        /// <para>The n-dimensional transformation is computed for the n-dimensional array A.
1734        /// Before the transform, the input is resized according to the 'dims' parameter.
1735        /// Dimensions larger than corresponding entries in 'dim' are truncated, dimensions
1736        /// smaller than corresponding entries in 'dim' are zero padded.</para>
1737        /// <para>The n-dimensional transformation is equivalent to repeatedly (inplace)
1738        /// computing one dimensional transformations along all dimensions of A.
1739        /// However, using this
1740        /// function may be of magnitudes faster than using 1D transformations. This
1741        /// depends on the algorithm and API provided by the underlying native library.</para>
1742        /// <para>Since a transform of complex hermitian input data results in the
1743        /// output having the imaginary part equals zero, only the real part is
1744        /// returned for convenience reasons.</para>
1745        /// <para>No check is made for A being hermitian! If A is not hermitian (by means
1746        /// of round-off errors), the result will be wrong!</para>
1747        /// <para>The forward fourier transform and the inverse fourier transform of
1748        /// a given data array A are mathematically equivalent. It's only a
1749        /// scaling factor which is needed to make sure, A equals ifft(fft(A)). That
1750        /// scaling is introduced in the inverse transform.</para>
1751        /// <para>The transformation is computed by use of the native library
1752        /// which currently is set up for your processor and OS version. The underlying
1753        /// library is automatically choosen at ILNumerics startup and accessed via the
1754        /// static member ILMath.FFT. See the online documentation for more
1755        /// details in how to tune/configure and select dedicated native libraries.
1756        /// Currently supported libraries are: Intel MKL (included), AMD ACML
1757        /// and FFTW3 (prepared, optional modules, not included due to licensing conflicts).</para>
1758        /// </remarks>
1759        /// <exception cref="ILNumerics.Exceptions.ILArgumentException">is thrown if the
1760        /// dim parameter is null, its length is less then the number of dimensions of A
1761        /// or any element of dims is non-negative</exception>
1762        public static ILRetArray< float> ifftnsym(ILInArray< fcomplex> A, params int[] dims) {
1763            using (ILScope.Enter(A)) {
1764                if (A.IsEmpty) return empty< float>(A.Size);
1765                ILRetArray< fcomplex> resizedA = resize4Transform(A, dims);
1766                return FFTImplementation.FFTBackwSym(resizedA, dims.Length);
1767            }
1768        }
1769        #endregion
1770
1771
1772#endregion HYCALPER AUTO GENERATED CODE
1773
1774        #region private helper
1775        internal static ILRetArray<T> resize4Transform<T>(ILInArray<T> A, params int[] size) {
1776            using (ILScope.Enter(A)) {
1777                if (size == null || size.Length < A.Size.NumberOfDimensions)
1778                    throw new ILArgumentException("length of output dimensions must be &gt; or equal to number of dimensions of input array!");
1779                ILSize newDimensions = new ILSize(size);
1780                if (A.Size.IsSameShape(newDimensions)) {
1781                    return A;
1782                } else {
1783                    if (newDimensions.NumberOfElements == 0) return empty<T>(newDimensions);
1784                    ILArray<T> tmp = array<T>(default(T), newDimensions);
1785                    int minDimsLen = Math.Min(size.Length, A.Size.NumberOfDimensions);
1786                    ILArray<ILRegularRange>[] indices = new ILArray<ILRegularRange>[minDimsLen];
1787                    for (int i = 0; i < minDimsLen; i++) {
1788                        if (size[i] < 0)
1789                            throw new ILArgumentException("all dimension lengths of 'size' must be non-negative!");
1790                        if (size[i] == 0) return empty<T>(newDimensions);
1791                        indices[i] = (ILRetArray<ILRegularRange>)r(0, Math.Min(A.Size[i] - 1, size[i] - 1));
1792                    }
1793                    tmp[indices] = A[indices];
1794                    return tmp;
1795                }
1796            }
1797        }
1798
1799        #endregion
1800
1801    }
1802}
Note: See TracBrowser for help on using the repository browser.