src/linops.rs

branch
dev
changeset 124
6aa955ad8122
parent 110
a1278320be26
child 129
d2994e34a5f5
equal deleted inserted replaced
122:495448cca603 124:6aa955ad8122
75 75
76 /// Bounded linear operators 76 /// Bounded linear operators
77 pub trait BoundedLinear<X, XExp, CodExp, F = f64>: Linear<X> 77 pub trait BoundedLinear<X, XExp, CodExp, F = f64>: Linear<X>
78 where 78 where
79 F: Num, 79 F: Num,
80 X: Space + Norm<F, XExp>, 80 X: Space + Norm<XExp, F>,
81 XExp: NormExponent, 81 XExp: NormExponent,
82 CodExp: NormExponent, 82 CodExp: NormExponent,
83 { 83 {
84 /// A bound on the operator norm $\|A\|$ for the linear operator $A$=`self`. 84 /// A bound on the operator norm $\|A\|$ for the linear operator $A$=`self`.
85 /// This is not expected to be the norm, just any bound on it that can be 85 /// This is not expected to be the norm, just any bound on it that can be
180 } 180 }
181 } 181 }
182 182
183 impl<F, X, E> BoundedLinear<X, E, E, F> for IdOp<X> 183 impl<F, X, E> BoundedLinear<X, E, E, F> for IdOp<X>
184 where 184 where
185 X: Space + Clone + Norm<F, E>, 185 X: Space + Clone + Norm<E, F>,
186 F: Num, 186 F: Num,
187 E: NormExponent, 187 E: NormExponent,
188 { 188 {
189 fn opnorm_bound(&self, _xexp: E, _codexp: E) -> DynResult<F> { 189 fn opnorm_bound(&self, _xexp: E, _codexp: E) -> DynResult<F> {
190 Ok(F::ONE) 190 Ok(F::ONE)
262 } 262 }
263 } 263 }
264 264
265 impl<'a, F, X, XD, Y, E1, E2> BoundedLinear<X, E1, E2, F> for ZeroOp<'a, X, XD, Y, F> 265 impl<'a, F, X, XD, Y, E1, E2> BoundedLinear<X, E1, E2, F> for ZeroOp<'a, X, XD, Y, F>
266 where 266 where
267 X: Space + Norm<F, E1>, 267 X: Space + Norm<E1, F>,
268 Y: AXPY<F> + Clone + Norm<F, E2>, 268 Y: AXPY<F> + Clone + Norm<E2, F>,
269 F: Num, 269 F: Num,
270 E1: NormExponent, 270 E1: NormExponent,
271 E2: NormExponent, 271 E2: NormExponent,
272 { 272 {
273 fn opnorm_bound(&self, _xexp: E1, _codexp: E2) -> DynResult<F> { 273 fn opnorm_bound(&self, _xexp: E1, _codexp: E2) -> DynResult<F> {
344 } 344 }
345 345
346 impl<F, S, T, X, Z, Xexp, Yexp, Zexp> BoundedLinear<X, Xexp, Yexp, F> for Composition<S, T, Zexp> 346 impl<F, S, T, X, Z, Xexp, Yexp, Zexp> BoundedLinear<X, Xexp, Yexp, F> for Composition<S, T, Zexp>
347 where 347 where
348 F: Num, 348 F: Num,
349 X: Space + Norm<F, Xexp>, 349 X: Space + Norm<Xexp, F>,
350 Z: Space + Norm<F, Zexp>, 350 Z: Space + Norm<Zexp, F>,
351 Xexp: NormExponent, 351 Xexp: NormExponent,
352 Yexp: NormExponent, 352 Yexp: NormExponent,
353 Zexp: NormExponent, 353 Zexp: NormExponent,
354 T: BoundedLinear<X, Xexp, Zexp, F, Codomain = Z>, 354 T: BoundedLinear<X, Xexp, Zexp, F, Codomain = Z>,
355 S: BoundedLinear<Z, Zexp, Yexp, F>, 355 S: BoundedLinear<Z, Zexp, Yexp, F>,
678 ($expj:ty) => { 678 ($expj:ty) => {
679 impl<F, A, B, S, T, ExpA, ExpB, ExpR> 679 impl<F, A, B, S, T, ExpA, ExpB, ExpR>
680 BoundedLinear<Pair<A, B>, PairNorm<ExpA, ExpB, $expj>, ExpR, F> for RowOp<S, T> 680 BoundedLinear<Pair<A, B>, PairNorm<ExpA, ExpB, $expj>, ExpR, F> for RowOp<S, T>
681 where 681 where
682 F: Float, 682 F: Float,
683 A: Space + Norm<F, ExpA>, 683 A: Space + Norm<ExpA, F>,
684 B: Space + Norm<F, ExpB>, 684 B: Space + Norm<ExpB, F>,
685 S: BoundedLinear<A, ExpA, ExpR, F>, 685 S: BoundedLinear<A, ExpA, ExpR, F>,
686 T: BoundedLinear<B, ExpB, ExpR, F>, 686 T: BoundedLinear<B, ExpB, ExpR, F>,
687 S::Codomain: Add<T::Codomain>, 687 S::Codomain: Add<T::Codomain>,
688 <S::Codomain as Add<T::Codomain>>::Output: Space, 688 <S::Codomain as Add<T::Codomain>>::Output: Space,
689 ExpA: NormExponent, 689 ExpA: NormExponent,
705 705
706 impl<F, A, S, T, ExpA, ExpS, ExpT> BoundedLinear<A, ExpA, PairNorm<ExpS, ExpT, $expj>, F> 706 impl<F, A, S, T, ExpA, ExpS, ExpT> BoundedLinear<A, ExpA, PairNorm<ExpS, ExpT, $expj>, F>
707 for ColOp<S, T> 707 for ColOp<S, T>
708 where 708 where
709 F: Float, 709 F: Float,
710 A: Space + Norm<F, ExpA>, 710 A: Space + Norm<ExpA, F>,
711 S: BoundedLinear<A, ExpA, ExpS, F>, 711 S: BoundedLinear<A, ExpA, ExpS, F>,
712 T: BoundedLinear<A, ExpA, ExpT, F>, 712 T: BoundedLinear<A, ExpA, ExpT, F>,
713 ExpA: NormExponent, 713 ExpA: NormExponent,
714 ExpS: NormExponent, 714 ExpS: NormExponent,
715 ExpT: NormExponent, 715 ExpT: NormExponent,

mercurial