| 8 use super::{DifferentiableImpl, LipschitzDifferentiableImpl, 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, Normed, L2}; |
| 14 use crate::types::Float; |
14 use crate::types::Float; |
| 15 use std::marker::PhantomData; |
15 use std::marker::PhantomData; |
| 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$ |
| 18 /// to a [`Euclidean`] space. |
18 /// to a [`Euclidean`] space. |
| 57 // can be consumed, so maybe GEMV is no use. |
57 // can be consumed, so maybe GEMV is no use. |
| 58 (self.opA.apply(x) - self.b).norm2_squared() / F::TWO |
58 (self.opA.apply(x) - self.b).norm2_squared() / F::TWO |
| 59 } |
59 } |
| 60 } |
60 } |
| 61 |
61 |
| 62 impl<'a, F: Float, X: Space, A: Linear<X>> ConvexMapping<X, F> for Quadratic<'a, F, X, A> where |
62 impl<'a, F: Float, X: Normed<F>, A: Linear<X>> ConvexMapping<X, F> for Quadratic<'a, F, X, A> where |
| 63 A::Codomain: Euclidean<F> |
63 A::Codomain: Euclidean<F> |
| 64 { |
64 { |
| 65 } |
65 } |
| 66 |
66 |
| 67 impl<'a, F, X, A> DifferentiableImpl<X> for Quadratic<'a, F, X, A> |
67 impl<'a, F, X, A> DifferentiableImpl<X> for Quadratic<'a, F, X, A> |