-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect output for realTransform
(size >4)
#25
Comments
If it helps debug, it does work for input size = 4: import FFT from 'https://cdn.jsdelivr.net/npm/fft.js@4.0.4/+esm'
const input = new Float32Array(4);
input.fill(1);
const f = new FFT(input.length);
const out = f.createComplexArray();
const a = performance.now();
f.realTransform(out, input);
const b = performance.now();
console.log(b-a, out)
// [4, 0, 0, 0, 0, 0, 0, 0]
// correct |
realTransform
(size >4)
Further investigation shows this only occurs for import FFT from 'https://cdn.jsdelivr.net/npm/fft.js@4.0.0/+esm'
const input = new Float32Array([1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0]);
const f = new FFT(input.length/2);
const out = f.createComplexArray();
const a = performance.now();
f.transform(out, input);
const b = performance.now();
console.log(b-a, Array.from(out))
// [8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] |
Also, if you replace this block of code: Lines 339 to 439 in 4a18cf8
with this block of code: Lines 151 to 222 in 4a18cf8
The output is as expected, so it seems to be an error in the optimization. |
I think you have to call |
Oh wow, that was it... thanks so much @daniele-roncaglioni! |
Hi there 馃憢 While experimenting with your library, I encountered an issue where the output would be different (to numpy's implementation) by a single number. I would greatly appreciate any advice on the matter, thanks!
Reproduction:
JSFiddle link (including a comparison with another library, which matches the numpy implementation).
https://jsfiddle.net/9ex3bkzt/
The text was updated successfully, but these errors were encountered: