Skip to content
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

[FEA] Add option for an un-normalized fft #526

Closed
SquireRoot opened this issue Dec 6, 2023 · 3 comments
Closed

[FEA] Add option for an un-normalized fft #526

SquireRoot opened this issue Dec 6, 2023 · 3 comments

Comments

@SquireRoot
Copy link

Is your feature request related to a problem? Please describe.
Not a problem, just a feature. When building pipelines for signal processing algorithms, usually there is already a normalization step in the algorithm. This normalization step may ensure the data has the correct units, apply some amplitude scaling, apply some phase offset (for complex data), or sometimes all three. By allowing the user to include the fft normalization in the pipeline's broader normalization step, all the normalization factors can be combined together and applied in one operation outside of the fft.

Describe the solution you'd like
I believe the solution is very easy and just involves adding an UNNORMALIZED entry to the FFTNorm enum in transforms/fft.h. This should bypass the normalization logic in matxFFTPlan_t::Forward and matxFFTPlan_t::Inverse when UNNORMALIZED is given as the norm

Describe alternatives you've considered

Additional context

@cliffburdick
Copy link
Collaborator

Hi @SquireRoot, we currently have backward and forward defined as:

enum class FFTNorm {
  BACKWARD, /// fft is unscaled, ifft is 1/N
  FORWARD, /// fft is scaled 1/N, ifft is not scaled
  ORTHO /// fft is scaled 1/sqrt(N), ifft is scaled 1/sqrt(N)
};

So technically you can do an unscaled version by passing BACKWARD to fft, and FORWARD to ifft. The names are poor for this choice, but that should work.

@cliffburdick
Copy link
Collaborator

By the way, this was done because Numpy does it the same way: https://numpy.org/doc/stable/reference/generated/numpy.fft.fft.html

@cliffburdick
Copy link
Collaborator

Closing since this doesn't seem to be an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants