src/linops.rs

branch
dev
changeset 80
f802ddbabcfc
parent 67
d7c0f431cbd6
--- a/src/linops.rs	Tue Dec 31 08:48:50 2024 -0500
+++ b/src/linops.rs	Mon Dec 23 23:27:45 2024 -0500
@@ -6,7 +6,7 @@
 use std::marker::PhantomData;
 use serde::Serialize;
 use crate::types::*;
-pub use crate::mapping::{Mapping, Space, Composition};
+pub use crate::mapping::{Mapping, Space, Composition, ArithmeticTrue};
 use crate::direct_product::Pair;
 use crate::instance::Instance;
 use crate::norms::{NormExponent, PairNorm, L1, L2, Linfinity, Norm};
@@ -137,6 +137,7 @@
 
 impl<X : Clone + Space> Mapping<X> for IdOp<X> {
     type Codomain = X;
+    type ArithmeticOptIn = ArithmeticTrue;
 
     fn apply<I : Instance<X>>(&self, x : I) -> X {
         x.own()
@@ -204,6 +205,7 @@
 
 impl<'a, F : Num, X : Space, XD, Y : AXPY<F> + Clone> Mapping<X> for ZeroOp<'a, X, XD, Y, F> {
     type Codomain = Y;
+    type ArithmeticOptIn = ArithmeticTrue;
 
     fn apply<I : Instance<X>>(&self, _x : I) -> Y {
         self.zero.clone()
@@ -335,6 +337,7 @@
 
 {
     type Codomain = <S::Codomain as Add<T::Codomain>>::Output;
+    type ArithmeticOptIn = ArithmeticTrue;
 
     fn apply<I : Instance<Pair<A, B>>>(&self, x : I) -> Self::Codomain {
         let Pair(a, b) = x.decompose();
@@ -392,6 +395,7 @@
     T : Mapping<A>,
 {
     type Codomain = Pair<S::Codomain, T::Codomain>;
+    type ArithmeticOptIn = ArithmeticTrue;
 
     fn apply<I : Instance<A>>(&self, a : I) -> Self::Codomain {
         Pair(self.0.apply(a.ref_instance()), self.1.apply(a))
@@ -527,6 +531,7 @@
     T : Mapping<B>,
 {
     type Codomain = Pair<S::Codomain, T::Codomain>;
+    type ArithmeticOptIn = ArithmeticTrue;
 
     fn apply<I : Instance<Pair<A, B>>>(&self, x : I) -> Self::Codomain {
         let Pair(a, b) = x.decompose();

mercurial