-
Notifications
You must be signed in to change notification settings - Fork 28
Improve FFT interpolation (1/2) #116
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…ncy spectrum with negligible additional computation.
…transform is now applied after (before) the first transform is completed. This reduces the size of the problem, so the computation is less expensive.
| return jnp.fft.irfft(c, n, axis=0, norm="forward") | ||
|
|
||
| if n < c.shape[0]: | ||
| c = c[:n] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't this truncation mean that we're still interpolating the band limited signal, not the full one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
c.shape[0] has size f.shape[0]//2 + 1. so our band limited signal can preserve double the width of the fourier spectrum than before
| x = jnp.linspace(0, 2 * jnp.pi, n, endpoint=False) | ||
| x = jnp.exp(1j * (c.shape[0] // 2) * x).reshape(n, *((1,) * (c.ndim - 1))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you explain this part? Isn't this just multiplying the output by exp(i*n*x)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we transform sum_n^N c_n e^(i n x) for n>=0 to e^iNx//2 sum_k c_n e^(ikx) where k now includes the relevant negative values (that result from pulling the highest frequency outside the sum)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the first of two pull requests to improve the FFT interpolation.
4 goals are achieved by this PR.