Tue, 06 Dec 2022 15:02:49 +0200
Oops, some μ were x in the README.
0 | 1 | /*! |
2 | Fourier transform traits | |
3 | */ | |
4 | ||
5 | use alg_tools::types::{Num, Float}; | |
6 | use alg_tools::mapping::{RealMapping, Mapping}; | |
7 | use alg_tools::bisection_tree::Weighted; | |
8 | use alg_tools::loc::Loc; | |
9 | ||
10 | /// Trait for Fourier transforms. When F is a non-complex number, the transform | |
11 | /// also has to be non-complex, i.e., the function itself symmetric. | |
12 | pub trait Fourier<F : Num> : Mapping<Self::Domain, Codomain=F> { | |
13 | type Domain; | |
14 | type Transformed : Mapping<Self::Domain, Codomain=F>; | |
15 | ||
16 | fn fourier(&self) -> Self::Transformed; | |
17 | } | |
18 | ||
19 | impl<F : Float, T, const N : usize> Fourier<F> | |
20 | for Weighted<T, F> | |
21 | where T : Fourier<F, Domain = Loc<F, N>> + RealMapping<F, N> { | |
22 | type Domain = T::Domain; | |
23 | type Transformed = Weighted<T::Transformed, F>; | |
24 | ||
25 | #[inline] | |
26 | fn fourier(&self) -> Self::Transformed { | |
27 | Weighted { | |
28 | base_fn : self.base_fn.fourier(), | |
29 | weight : self.weight | |
30 | } | |
31 | } | |
32 | } |