diff -r 000000000000 -r eb3c7813b67a src/fourier.rs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/fourier.rs Thu Dec 01 23:07:35 2022 +0200 @@ -0,0 +1,32 @@ +/*! +Fourier transform traits +*/ + +use alg_tools::types::{Num, Float}; +use alg_tools::mapping::{RealMapping, Mapping}; +use alg_tools::bisection_tree::Weighted; +use alg_tools::loc::Loc; + +/// Trait for Fourier transforms. When F is a non-complex number, the transform +/// also has to be non-complex, i.e., the function itself symmetric. +pub trait Fourier : Mapping { + type Domain; + type Transformed : Mapping; + + fn fourier(&self) -> Self::Transformed; +} + +impl Fourier +for Weighted +where T : Fourier> + RealMapping { + type Domain = T::Domain; + type Transformed = Weighted; + + #[inline] + fn fourier(&self) -> Self::Transformed { + Weighted { + base_fn : self.base_fn.fourier(), + weight : self.weight + } + } +}