[FEA] Add option for an un-normalized fft
SquireRoot opened this issue · comments
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
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.
By the way, this was done because Numpy does it the same way: https://numpy.org/doc/stable/reference/generated/numpy.fft.fft.html
Closing since this doesn't seem to be an issue.