src/norms.rs

branch
dev
changeset 79
d63e40672dd6
parent 60
848ecc05becf
equal deleted inserted replaced
78:cebedc4a8331 79:d63e40672dd6
5 use serde::Serialize; 5 use serde::Serialize;
6 use std::marker::PhantomData; 6 use std::marker::PhantomData;
7 use crate::types::*; 7 use crate::types::*;
8 use crate::euclidean::*; 8 use crate::euclidean::*;
9 use crate::mapping::{Mapping, Space, Instance}; 9 use crate::mapping::{Mapping, Space, Instance};
10 use crate::linops::AXPY;
10 11
11 // 12 //
12 // Abstract norms 13 // Abstract norms
13 // 14 //
14 15
200 fn apply<I : Instance<Domain>>(&self, x : I) -> F { 201 fn apply<I : Instance<Domain>>(&self, x : I) -> F {
201 x.eval(|r| r.norm(self.exponent)) 202 x.eval(|r| r.norm(self.exponent))
202 } 203 }
203 } 204 }
204 205
205 pub trait Normed<F : Num = f64> : Space + Norm<F, Self::NormExp> { 206 pub trait Normed<F : Num = f64> : AXPY + Norm<F, Self::NormExp> {
206 type NormExp : NormExponent; 207 type NormExp : NormExponent;
207 208
208 fn norm_exponent(&self) -> Self::NormExp; 209 fn norm_exponent(&self) -> Self::NormExp;
209 210
210 #[inline] 211 #[inline]

mercurial