diff -r c5f70e767511 -r f802ddbabcfc src/mapping.rs --- a/src/mapping.rs Tue Dec 31 08:48:50 2024 -0500 +++ b/src/mapping.rs Mon Dec 23 23:27:45 2024 -0500 @@ -9,11 +9,20 @@ pub use crate::instance::{Instance, Decomposition, BasicDecomposition, Space}; use crate::norms::{Norm, NormExponent}; +pub trait ArithmeticOptIn {} + +pub struct ArithmeticTrue; +pub struct ArithmeticFalse; + +impl ArithmeticOptIn for ArithmeticTrue {} +impl ArithmeticOptIn for ArithmeticFalse {} + /// A mapping from `Domain` to `Codomain`. /// /// This is automatically implemented when the relevant [`Apply`] are implemented. pub trait Mapping { type Codomain : Space; + type ArithmeticOptIn : ArithmeticOptIn; /// Compute the value of `self` at `x`. fn apply>(&self, x : I) -> Self::Codomain; @@ -154,6 +163,7 @@ M::Codomain : std::iter::Sum + Clone { type Codomain = M::Codomain; + type ArithmeticOptIn = ArithmeticTrue; fn apply>(&self, x : I) -> Self::Codomain { let xr = x.ref_instance(); @@ -193,6 +203,7 @@ G : Clone + DifferentiableMapping { type Codomain = G::DerivativeDomain; + type ArithmeticOptIn = ArithmeticTrue; #[inline] fn apply>(&self, x : I) -> Self::Codomain { @@ -212,6 +223,7 @@ G: Mapping> { type Codomain = F; + type ArithmeticOptIn = ArithmeticTrue; #[inline] fn apply>(&self, x : I) -> Self::Codomain { @@ -244,6 +256,7 @@ G : Mapping> + Clone, { type Codomain = F; + type ArithmeticOptIn = ArithmeticTrue; #[inline] fn apply>(&self, x : I) -> Self::Codomain { @@ -290,6 +303,7 @@ S : Mapping { type Codomain = S::Codomain; + type ArithmeticOptIn = ArithmeticTrue; #[inline] fn apply>(&self, x : I) -> Self::Codomain {