| 3 to a [`Euclidean`] space, and a function g on that space. |
3 to a [`Euclidean`] space, and a function g on that space. |
| 4 */ |
4 */ |
| 5 |
5 |
| 6 #![allow(non_snake_case)] |
6 #![allow(non_snake_case)] |
| 7 |
7 |
| 8 use super::{DifferentiableImpl, DifferentiableMapping, /*LipschitzDifferentiableImpl,*/ Mapping,}; |
8 use super::{DifferentiableImpl, DifferentiableMapping, LipschitzDifferentiableImpl, Mapping}; |
| 9 use crate::convex::ConvexMapping; |
9 use crate::convex::ConvexMapping; |
| 10 use crate::instance::{Instance, Space}; |
10 use crate::instance::{Instance, Space}; |
| 11 use crate::linops::{/*BoundedLinear,*/ Linear, Preadjointable}; |
11 use crate::linops::{BoundedLinear, Linear, Preadjointable}; |
| 12 //use crate::norms::{Norm, NormExponent, L2}; |
12 use crate::norms::{Normed, L2}; |
| 13 use crate::types::Float; |
13 use crate::types::Float; |
| 14 use std::ops::Sub; |
14 use std::ops::Sub; |
| 15 //use serde::{Deserialize, Serialize}; |
15 //use serde::{Deserialize, Serialize}; |
| 16 |
16 |
| 17 /// Functions of the form $\frac{1}{2}\|Ax-b\|_2^2$ for an operator $A$ |
17 /// Functions of the form $\frac{1}{2}\|Ax-b\|_2^2$ for an operator $A$ |
| 70 } |
70 } |
| 71 |
71 |
| 72 impl<F, X, A, G> ConvexMapping<X, F> for DataTerm<F, X, A, G> |
72 impl<F, X, A, G> ConvexMapping<X, F> for DataTerm<F, X, A, G> |
| 73 where |
73 where |
| 74 F: Float, |
74 F: Float, |
| 75 X: Space, |
75 X: Normed<F>, |
| 76 A: Linear<X>, |
76 A: Linear<X>, |
| 77 G: ConvexMapping<A::Codomain, F>, |
77 G: ConvexMapping<A::Codomain, F>, |
| 78 A::Codomain: for<'a> Sub<&'a A::Codomain, Output = A::Codomain>, |
78 A::Codomain: Normed<F> + for<'a> Sub<&'a A::Codomain, Output = A::Codomain>, |
| 79 { |
79 { |
| 80 } |
80 } |
| 81 |
81 |
| 82 impl<F, X, Y, A, G> DifferentiableImpl<X> for DataTerm<F, X, A, G> |
82 impl<F, X, Y, A, G> DifferentiableImpl<X> for DataTerm<F, X, A, G> |
| 83 where |
83 where |
| 101 .preadjoint() |
101 .preadjoint() |
| 102 .apply(self.g.diff_ref().apply(self.opA.apply(x) - &self.b)) |
102 .apply(self.g.diff_ref().apply(self.opA.apply(x) - &self.b)) |
| 103 } |
103 } |
| 104 } |
104 } |
| 105 |
105 |
| 106 /* |
106 impl<'a, F, X, Y, A, G> LipschitzDifferentiableImpl<X, X::NormExp> for DataTerm<F, X, A, G> |
| 107 impl<'a, F, X, ExpX, Y, ExpY, A, G> LipschitzDifferentiableImpl<X, ExpX> for DataTerm<F, X, A, G> |
|
| 108 where |
107 where |
| 109 F: Float, |
108 F: Float, |
| 110 X: Space + Clone + Norm<F, ExpX>, |
109 X: Normed<F> + Clone, |
| 111 Y: Space + Norm<F, ExpY>, |
110 Y: Normed<F>, |
| 112 ExpX: NormExponent, |
111 A: Clone + BoundedLinear<X, X::NormExp, L2, F, Codomain = Y>, |
| 113 ExpY: NormExponent, |
112 G: Mapping<Y, Codomain = F> + LipschitzDifferentiableImpl<Y, Y::NormExp>, |
| 114 A: Clone + BoundedLinear<X, ExpX, L2, F, Codomain = Y>, |
|
| 115 G: Mapping<Y, Codomain = F> + LipschitzDifferentiableImpl<Y, ExpY>, |
|
| 116 Self: DifferentiableImpl<X>, |
113 Self: DifferentiableImpl<X>, |
| 117 { |
114 { |
| 118 type FloatType = F; |
115 type FloatType = F; |
| 119 |
116 |
| 120 fn diff_lipschitz_factor(&self, seminorm: ExpX) -> Option<F> { |
117 fn diff_lipschitz_factor(&self, seminorm: X::NormExp) -> Option<F> { |
| 121 Some(self.opA.opnorm_bound(seminorm, L2).powi(2)) |
118 Some(self.opA.opnorm_bound(seminorm, L2).powi(2)) |
| 122 } |
119 } |
| 123 } |
120 } |
| 124 */ |
|