Sun, 11 Dec 2022 23:25:53 +0200
Support arbitrary regularisation terms; implement non-positivity-constrained regularisation.
* Fixes the conditional gradient methods that were incorrectly solving
positivity constrained subproblems although the infinite-dimensional
versions do not include such constraints.
* Introduces the `ExperimentV2` struct that has `regularisation` in place
of `α`. The `Experiment` struct is now deprecated.
* The L^2-squared experiments were switch to be unconstrained, as the
Franke-Wolfe implementations do not support constraints. (This would
be easy to add for the “fully corrective” variant, but is not
immediate for the “relaxed” variant.)
| 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 | } |