concision_math/signal/fourier/
mode.rs

1/*
2    Appellation: mode <module>
3    Contrib: FL03 <jo3mccain@icloud.com>
4*/
5
6toggle! {
7    pub enum {
8        C,
9        R
10    }
11}
12
13///
14#[derive(
15    Clone,
16    Copy,
17    Debug,
18    Default,
19    Eq,
20    Hash,
21    Ord,
22    PartialEq,
23    PartialOrd,
24    scsys::VariantConstructors,
25    strum::AsRefStr,
26    strum::Display,
27    strum::EnumCount,
28    strum::EnumIs,
29    strum::EnumIter,
30    strum::EnumString,
31    strum::VariantArray,
32    strum::VariantNames,
33)]
34#[cfg_attr(
35    feature = "serde",
36    derive(serde_derive::Deserialize, serde_derive::Serialize),
37    serde(rename_all = "lowercase", untagged)
38)]
39#[strum(serialize_all = "lowercase")]
40pub enum FftMode {
41    #[default]
42    Complex,
43    Real,
44}
45
46///
47#[derive(
48    Clone,
49    Copy,
50    Debug,
51    Default,
52    Eq,
53    Hash,
54    Ord,
55    PartialEq,
56    PartialOrd,
57    scsys::VariantConstructors,
58    strum::AsRefStr,
59    strum::Display,
60    strum::EnumCount,
61    strum::EnumIs,
62    strum::EnumIter,
63    strum::EnumString,
64    strum::VariantArray,
65    strum::VariantNames,
66)]
67#[cfg_attr(
68    feature = "serde",
69    derive(serde_derive::Deserialize, serde_derive::Serialize),
70    serde(rename_all = "lowercase", untagged)
71)]
72#[strum(serialize_all = "lowercase")]
73pub enum FftDirection {
74    #[default]
75    Forward = 0,
76    Inverse = 1,
77}
78
79impl From<usize> for FftDirection {
80    fn from(direction: usize) -> Self {
81        match direction % 2 {
82            0 => Self::Forward,
83            _ => Self::Inverse,
84        }
85    }
86}
87impl From<FftDirection> for usize {
88    fn from(direction: FftDirection) -> Self {
89        direction as usize
90    }
91}