Hi, I have a case where I need to implement a 3D FFT. This crate doesn't seem to have an existing utility function for it. I figured I could potentially create my own by combining multiple 1D FFTs, but it seems to have resulted in garbage output. Could an example be added to the repository of how to do a multidimensional transform correctly with this crate? (Even better would be if there were wrapper functions provided by the crate.)
My current attempt looks like this:
// Applies a real-to-complex 3-dimensional FFT to `real`
fn real_to_complex_3d(
&self, real: &[f32; BLOCK_VOLUME], output: &mut [Complex<f32>; CCNT],
) {
let scratch_len = self
.ft
.0
.get_inplace_scratch_len()
.max(self.ft.1.get_inplace_scratch_len())
.max(self.ft.2.get_inplace_scratch_len());
let mut scratch = vec![Complex::default(); scratch_len];
let mut complex =
real.iter().map(|val| Complex::from(*val)).collect::<Vec<_>>();
self.ft.0.process_with_scratch(&mut complex, &mut scratch);
self.ft.1.process_with_scratch(&mut complex, &mut scratch);
self.ft.2.process_with_scratch(&mut complex, &mut scratch);
output.iter_mut().zip(complex.iter()).for_each(|(out, inn)| {
*out = *inn;
});
}
Hi, I have a case where I need to implement a 3D FFT. This crate doesn't seem to have an existing utility function for it. I figured I could potentially create my own by combining multiple 1D FFTs, but it seems to have resulted in garbage output. Could an example be added to the repository of how to do a multidimensional transform correctly with this crate? (Even better would be if there were wrapper functions provided by the crate.)
My current attempt looks like this: