Use provided storage or create an array of size fft.size and fill it with
real values from the complexInput.
NOTE: Imaginary values from complexInput are ignored. This is a convenience
method.
NOTE: Always provide storage for better performance and to avoid extra time
in Garbage Collection.
fft.completeSpectrum(spectrum)
Fill the right half of spectrum complex array (See:
fft.createComplexArray()) with the complex conjugates of the left half:
for (every every `i` between 1 and (N / 2 - 1)) spectrum[N - i] = spectrum*[i]
NOTE: This method may be used with fft.realTransform() if full output is
desired.
FFT Methods
fft.realTransform(output, input)
Take array of real numbers input and perform FFT transformation on it, filling
the left half of the output with the real part of the Fourier Transform's complex output (See:
fft.completeSpectrum()).
NOTE: Always use this method if the input for FFT transformation is real (has
no imaginary parts). It is about 40% faster to do such transformation this way.
NOTE: input - real array of size fft.size, output - complex array (See:
fft.createComplexArray()).
fft.transform(output, input)
Perform transformation on complex input array and store results in
the complex output array.
NOTE: input and output are complex arrays (See:
fft.createComplexArray()).
fft.inverseTransform(output, input)
Perform inverse Fourier transform on complex input array and store results in
the complex output array.
NOTE: input and output are complex arrays (See:
fft.createComplexArray()).
LICENSE
This software is licensed under the MIT License.
Copyright Fedor Indutny, 2017.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the
following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE.
fourier-transform x 34,859 ops/sec ±0.77% (93 runs sampled)
Fastest is fft.js
===== realTransform size=4096 =====
fft.js x 21,841 ops/sec ±0.70% (94 runs sampled)
fourier-transform x 16,135 ops/sec ±0.39% (93 runs sampled)
Fastest is fft.js
===== realTransform size=8192 =====
fft.js x 9,665 ops/sec ±0.65% (95 runs sampled)
fourier-transform x 6,456 ops/sec ±0.83% (93 runs sampled)
Fastest is fft.js
===== realTransform size=16384 =====
fft.js x 4,399 ops/sec ±0.82% (93 runs sampled)
fourier-transform x 2,745 ops/sec ±0.68% (94 runs sampled)