| 1 /*! |
1 /*! |
| 2 Norms, projections, etc. |
2 Norms, projections, etc. |
| 3 */ |
3 */ |
| 4 |
4 |
| 5 use crate::euclidean::*; |
5 use crate::euclidean::*; |
| |
6 use crate::linops::AXPY; |
| 6 use crate::mapping::{Instance, Mapping, Space}; |
7 use crate::mapping::{Instance, Mapping, Space}; |
| 7 use crate::types::*; |
8 use crate::types::*; |
| 8 use serde::{Deserialize, Serialize}; |
9 use serde::{Deserialize, Serialize}; |
| 9 use std::marker::PhantomData; |
10 use std::marker::PhantomData; |
| 10 |
11 |
| 229 fn is_zero(&self) -> bool { |
230 fn is_zero(&self) -> bool { |
| 230 self.norm_() == F::ZERO |
231 self.norm_() == F::ZERO |
| 231 } |
232 } |
| 232 } |
233 } |
| 233 |
234 |
| 234 pub trait HasDual<F: Num = f64>: Normed<F> { |
235 pub trait HasDual<F: Num = f64>: Normed<F> + AXPY<Field = F> { |
| 235 type DualSpace: Normed<F>; |
236 type DualSpace: Normed<F> + AXPY<Field = F>; |
| |
237 |
| |
238 fn dual_origin(&self) -> <Self::DualSpace as AXPY>::Owned; |
| 236 } |
239 } |
| 237 |
240 |
| 238 /// Automatically implemented trait for reflexive spaces |
241 /// Automatically implemented trait for reflexive spaces |
| 239 pub trait Reflexive<F: Num = f64>: HasDual<F> |
242 pub trait Reflexive<F: Num = f64>: HasDual<F> |
| 240 where |
243 where |