StaticEuclideanOriginGenerator dev

Sun, 07 Sep 2025 09:51:26 -0500

author
Tuomo Valkonen <tuomov@iki.fi>
date
Sun, 07 Sep 2025 09:51:26 -0500
branch
dev
changeset 185
e6829fbe2737
parent 184
b7b60b3b3eff
child 186
afe04e6b4a5b

StaticEuclideanOriginGenerator

src/linops.rs file | annotate | diff | comparison | revisions
--- a/src/linops.rs	Sun Sep 07 09:44:43 2025 -0500
+++ b/src/linops.rs	Sun Sep 07 09:51:26 2025 -0500
@@ -4,6 +4,7 @@
 
 use crate::direct_product::Pair;
 use crate::error::DynResult;
+use crate::euclidean::StaticEuclidean;
 use crate::instance::Instance;
 pub use crate::mapping::{ClosedSpace, Composition, DifferentiableImpl, Mapping, Space};
 use crate::norms::{HasDual, Linfinity, Norm, NormExponent, PairNorm, L1, L2};
@@ -171,7 +172,7 @@
 /// This exists due to restrictions of Rust's type system: if `A :: Adjointable`, and we make
 /// further restrictions on the adjoint operator, through, e.g.
 /// ```
-/// for<'a> A::Adjoint<'a> : GEMV<F, X, Y>,
+/// for<'a> A::Adjoint<'a> : GEMV<F, Z, Y>,
 /// ```
 /// Then `'static` lifetime is forced on `X`. Having `A::SimpleAdjoint` not depend on `'a`
 /// avoids this, but makes it impossible for the adjoint to be just a light wrapper around the
@@ -362,6 +363,26 @@
     fn as_ref(&self) -> Self::Ref<'_>;
 }
 
+#[derive(Copy, Clone, Debug)]
+pub struct StaticEuclideanOriginGenerator;
+
+impl<Y: StaticEuclidean> OriginGenerator<Y> for StaticEuclideanOriginGenerator {
+    type Ref<'b>
+        = Self
+    where
+        Self: 'b;
+
+    #[inline]
+    fn origin(&self) -> Y::PrincipalV {
+        return Y::origin();
+    }
+
+    #[inline]
+    fn as_ref(&self) -> Self::Ref<'_> {
+        *self
+    }
+}
+
 impl<Y: VectorSpace> OriginGenerator<Y> for Y {
     type Ref<'b>
         = &'b Y

mercurial