pub struct FftSetup { /* private fields */ }Expand description
Owned FFTSetup handle.
Implementations§
Source§impl FftSetup
impl FftSetup
Sourcepub fn new(log2n: usize, radix: i32) -> Option<Self>
pub fn new(log2n: usize, radix: i32) -> Option<Self>
Examples found in repository?
examples/01_vdsp_fft.rs (line 17)
5fn main() {
6 let added = add_f32(&[1.0, 2.0, 3.0], &[4.0, 5.0, 6.0]).expect("vector add failed");
7 assert_eq!(added, vec![5.0, 7.0, 9.0]);
8
9 let dot = dot_f32(&[1.0, 2.0, 3.0], &[4.0, 5.0, 6.0]).expect("dot product failed");
10 assert!((dot - 32.0).abs() < 1.0e-6);
11
12 let hamm = hamming_window(8, 0);
13 let blk = blackman_window(8, 0);
14 assert_eq!(hamm.len(), 8);
15 assert_eq!(blk.len(), 8);
16
17 let setup = FftSetup::new(2, fft_radix::RADIX2).expect("failed to create FFT setup");
18 let mut real = vec![1.0_f32, 0.0, 0.0, 0.0];
19 let mut imag = vec![0.0_f32; 4];
20 setup
21 .fft_zip(&mut real, &mut imag, 2, fft_direction::FORWARD)
22 .expect("fft failed");
23
24 for value in &real {
25 assert!(
26 (*value - 1.0).abs() < 1.0e-5,
27 "unexpected FFT real output: {real:?}"
28 );
29 }
30 for value in &imag {
31 assert!(value.abs() < 1.0e-5, "unexpected FFT imag output: {imag:?}");
32 }
33
34 println!("vdsp smoke passed: added={added:?} dot={dot} fft_real={real:?}");
35}Sourcepub fn fft_zip(
&self,
real: &mut [f32],
imag: &mut [f32],
log2n: usize,
direction: i32,
) -> Result<()>
pub fn fft_zip( &self, real: &mut [f32], imag: &mut [f32], log2n: usize, direction: i32, ) -> Result<()>
Examples found in repository?
examples/01_vdsp_fft.rs (line 21)
5fn main() {
6 let added = add_f32(&[1.0, 2.0, 3.0], &[4.0, 5.0, 6.0]).expect("vector add failed");
7 assert_eq!(added, vec![5.0, 7.0, 9.0]);
8
9 let dot = dot_f32(&[1.0, 2.0, 3.0], &[4.0, 5.0, 6.0]).expect("dot product failed");
10 assert!((dot - 32.0).abs() < 1.0e-6);
11
12 let hamm = hamming_window(8, 0);
13 let blk = blackman_window(8, 0);
14 assert_eq!(hamm.len(), 8);
15 assert_eq!(blk.len(), 8);
16
17 let setup = FftSetup::new(2, fft_radix::RADIX2).expect("failed to create FFT setup");
18 let mut real = vec![1.0_f32, 0.0, 0.0, 0.0];
19 let mut imag = vec![0.0_f32; 4];
20 setup
21 .fft_zip(&mut real, &mut imag, 2, fft_direction::FORWARD)
22 .expect("fft failed");
23
24 for value in &real {
25 assert!(
26 (*value - 1.0).abs() < 1.0e-5,
27 "unexpected FFT real output: {real:?}"
28 );
29 }
30 for value in &imag {
31 assert!(value.abs() < 1.0e-5, "unexpected FFT imag output: {imag:?}");
32 }
33
34 println!("vdsp smoke passed: added={added:?} dot={dot} fft_real={real:?}");
35}Trait Implementations§
Auto Trait Implementations§
impl Freeze for FftSetup
impl RefUnwindSafe for FftSetup
impl Unpin for FftSetup
impl UnsafeUnpin for FftSetup
impl UnwindSafe for FftSetup
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more