src/fourier.rs

changeset 0
eb3c7813b67a
equal deleted inserted replaced
-1:000000000000 0:eb3c7813b67a
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 }

mercurial