| 3 to a [`Euclidean`] space. |
3 to a [`Euclidean`] space. |
| 4 */ |
4 */ |
| 5 |
5 |
| 6 #![allow(non_snake_case)] |
6 #![allow(non_snake_case)] |
| 7 |
7 |
| 8 use super::{DifferentiableImpl, Differential, Lipschitz, Mapping}; |
8 use super::{DifferentiableImpl, LipschitzDifferentiableImpl, Mapping}; |
| 9 use crate::convex::ConvexMapping; |
9 use crate::convex::ConvexMapping; |
| 10 use crate::euclidean::Euclidean; |
10 use crate::euclidean::Euclidean; |
| 11 use crate::instance::{Instance, Space}; |
11 use crate::instance::{Instance, Space}; |
| 12 use crate::linops::{BoundedLinear, Linear, Preadjointable}; |
12 use crate::linops::{BoundedLinear, Linear, Preadjointable}; |
| 13 use crate::norms::{Norm, NormExponent, L2}; |
13 use crate::norms::{Norm, NormExponent, L2}; |
| 81 // can be consumed, so maybe GEMV is no use. |
81 // can be consumed, so maybe GEMV is no use. |
| 82 self.opA.preadjoint().apply(self.opA.apply(x) - self.b) |
82 self.opA.preadjoint().apply(self.opA.apply(x) - self.b) |
| 83 } |
83 } |
| 84 } |
84 } |
| 85 |
85 |
| 86 impl<'a, 'b, F, X, ExpX, A> Lipschitz<ExpX> for Differential<'b, X, Quadratic<'a, F, X, A>> |
86 impl<'a, F, X, ExpX, A> LipschitzDifferentiableImpl<X, ExpX> for Quadratic<'a, F, X, A> |
| 87 where |
87 where |
| 88 F: Float, |
88 F: Float, |
| 89 X: Space + Clone + Norm<F, ExpX>, |
89 X: Space + Clone + Norm<F, ExpX>, |
| 90 ExpX: NormExponent, |
90 ExpX: NormExponent, |
| 91 A: Clone + BoundedLinear<X, ExpX, L2, F>, |
91 A: Clone + BoundedLinear<X, ExpX, L2, F>, |
| |
92 Self: DifferentiableImpl<X>, |
| 92 { |
93 { |
| 93 type FloatType = F; |
94 type FloatType = F; |
| 94 |
95 |
| 95 fn lipschitz_factor(&self, seminorm: ExpX) -> Option<F> { |
96 fn diff_lipschitz_factor(&self, seminorm: ExpX) -> Option<F> { |
| 96 Some((*self.g).opA.opnorm_bound(seminorm, L2).powi(2)) |
97 Some(self.opA.opnorm_bound(seminorm, L2).powi(2)) |
| 97 } |
98 } |
| 98 } |
99 } |