Sat, 14 Dec 2024 09:31:27 -0500
Convex analysis basics
58 | 1 | /*! |
2 | Some convex analysis basics | |
3 | */ | |
4 | ||
5 | use crate::mapping::{Apply, Mapping}; | |
6 | ||
7 | /// Trait for convex mappings. Has no features, just serves as a constraint | |
8 | /// | |
9 | /// TODO: should constrain `Mapping::Codomain` to implement a partial order, | |
10 | /// but this makes everything complicated with little benefit. | |
11 | pub trait ConvexMapping<Domain> : Mapping<Domain> {} | |
12 | ||
13 | /// Trait for mappings with a Fenchel conjugate | |
14 | /// | |
15 | /// The conjugate type has to implement [`ConvexMapping`], but a `Conjugable` mapping need | |
16 | /// not be convex. | |
17 | pub trait Conjugable<Domain> : Mapping<Domain> { | |
18 | type DualDomain; | |
19 | type Conjugate<'a> : ConvexMapping<Self::DualDomain> where Self : 'a; | |
20 | ||
21 | fn conjugate(&self) -> Self::Conjugate<'_>; | |
22 | } | |
23 | ||
24 | /// Trait for mappings with a Fenchel preconjugate | |
25 | /// | |
26 | /// In contrast to [`Conjugable`], the preconjugate need not implement [`ConvexMapping`], | |
27 | /// but a `Preconjugable` mapping has be convex. | |
28 | pub trait Preconjugable<Domain> : ConvexMapping<Domain> { | |
29 | type PredualDomain; | |
30 | type Preconjugate<'a> : Mapping<Self::PredualDomain> where Self : 'a; | |
31 | ||
32 | fn preconjugate(&self) -> Self::Preconjugate<'_>; | |
33 | } | |
34 | ||
35 | /// Trait for mappings with a proximap map | |
36 | /// | |
37 | /// The conjugate type has to implement [`ConvexMapping`], but a `Conjugable` mapping need | |
38 | /// not be convex. | |
39 | pub trait HasProx<Domain> : Mapping<Domain> { | |
40 | type Prox<'a> : Mapping<Domain, Codomain=Domain> where Self : 'a; | |
41 | ||
42 | /// Returns a proximal mapping with weight τ | |
43 | fn prox_mapping(&self, τ : Self::Codomain) -> Self::Prox<'_>; | |
44 | ||
45 | /// Calculate the proximal mapping with weight τ | |
46 | fn prox(&self, z : Domain, τ : Self::Codomain) -> Domain { | |
47 | self.prox_mapping(τ).apply(z) | |
48 | } | |
49 | } | |
50 |