concrete_fftw/
types.rs

1//! Rusty types for manipulating FFTW
2
3use bitflags::bitflags;
4use num_complex::Complex;
5
6/// Expose the kinds of real-to-real transformations
7pub use ffi::fftw_r2r_kind as R2RKind;
8#[cfg(feature = "quad")]
9pub use quad::*;
10
11#[allow(non_camel_case_types)]
12pub type c32 = Complex<f32>;
13#[allow(non_camel_case_types)]
14pub type c64 = Complex<f64>;
15
16/// Direction of Complex-to-Complex transformation
17#[repr(i32)]
18#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
19pub enum Sign {
20    Forward = -1,
21    Backward = 1,
22}
23
24impl ::std::ops::Neg for Sign {
25    type Output = Sign;
26    fn neg(self) -> Self::Output {
27        match self {
28            Sign::Forward => Sign::Backward,
29            Sign::Backward => Sign::Forward,
30        }
31    }
32}
33
34bitflags! {
35    /// Flags for creating plans and wisdom
36    ///
37    /// This will be the most important part for fast FFT.
38    ///
39    /// You should see the [Words of Wisdom] in the original document
40    ///
41    /// [Words of Wisdom]: http://www.fftw.org/fftw3_doc/Words-of-Wisdom_002dSaving-Plans.html
42    #[derive(Default)]
43    pub struct Flag: u32 {
44        const MEASURE = 0;
45        const DESTROYINPUT = 1 ;
46        const UNALIGNED = 1 << 1;
47        const CONSERVEMEMORY = 1 << 2;
48        const EXHAUSIVE = 1 << 3;
49        const PRESERVEINPUT = 1 << 4;
50        const PATIENT = 1 << 5;
51        const ESTIMATE = 1 << 6;
52        const WISDOWMONLY = 1 << 21;
53    }
54}