--- a/src/nalgebra_support.rs Tue Sep 02 15:11:35 2025 -0500 +++ b/src/nalgebra_support.rs Tue Sep 02 15:18:30 2025 -0500 @@ -94,57 +94,11 @@ #[derive(Copy, Clone, Debug)] pub struct MatrixDecomposition; -/// nalgebra [`Storage`] that's convertible to dynamic strides (practically all, but we need this -/// to work around the type system). -trait ViewableStorage<E, M, K = U1>: Storage<E, M, K> -where - M: Dim, - K: Dim, - E: Scalar, - ShapeConstraint: StridesOk<E, M, K, Self>, - DefaultAllocator: Allocator<M, K>, -{ -} - -impl<M, K, E, S> ViewableStorage<E, M, K> for S +impl<E, M, K, S> Decomposition<Matrix<E, M, K, S>> for MatrixDecomposition where S: Storage<E, M, K>, M: Dim, K: Dim, - E: Scalar, - ShapeConstraint: StridesOk<E, M, K, Self>, - DefaultAllocator: Allocator<M, K>, -{ -} - -/// nalgebra [`StorageMut`] that's convertible to dynamic strides (practically all, but we need this -/// to work around the type system). -trait ViewableStorageMut<E, M, K = U1>: StorageMut<E, M, K> -where - M: Dim, - K: Dim, - E: Scalar, - ShapeConstraint: StridesOk<E, M, K, Self>, - DefaultAllocator: Allocator<M, K>, -{ -} - -impl<M, K, E, S> ViewableStorageMut<E, M, K> for S -where - S: StorageMut<E, M, K>, - M: Dim, - K: Dim, - E: Scalar, - ShapeConstraint: StridesOk<E, M, K, Self>, - DefaultAllocator: Allocator<M, K>, -{ -} - -impl<E, M, K, S> Decomposition<Matrix<E, M, K, S>> for MatrixDecomposition -where - S: ViewableStorage<E, M, K>, - M: Dim, - K: Dim, E: Scalar + Zero + One, DefaultAllocator: Allocator<M, K>, ShapeConstraint: StridesOk<E, M, K, S> + StridesOk<E, M, K>, @@ -171,8 +125,8 @@ impl<S1, S2, M, K, E> Instance<Matrix<E, M, K, S1>, MatrixDecomposition> for Matrix<E, M, K, S2> where - S1: ViewableStorage<E, M, K>, - S2: ViewableStorage<E, M, K>, + S1: Storage<E, M, K>, + S2: Storage<E, M, K>, M: Dim, K: Dim, E: Scalar + Zero + One, @@ -206,8 +160,8 @@ impl<'a, S1, S2, M, K, E> Instance<Matrix<E, M, K, S1>, MatrixDecomposition> for &'a Matrix<E, M, K, S2> where - S1: ViewableStorage<E, M, K>, - S2: ViewableStorage<E, M, K>, + S1: Storage<E, M, K>, + S2: Storage<E, M, K>, M: Dim, K: Dim, E: Scalar + Zero + One, @@ -240,8 +194,8 @@ impl<SM, SV, N, M, K, E> Mapping<Matrix<E, M, K, SV>> for Matrix<E, N, M, SM> where - SM: ViewableStorage<E, N, M>, - SV: ViewableStorage<E, M, K> + Clone, + SM: Storage<E, N, M>, + SV: Storage<E, M, K> + Clone, N: Dim, M: Dim, K: Dim, @@ -259,8 +213,8 @@ impl<'a, SM, SV, N, M, K, E> Linear<Matrix<E, M, K, SV>> for Matrix<E, N, M, SM> where - SM: ViewableStorage<E, N, M>, - SV: ViewableStorage<E, M, K> + Clone, + SM: Storage<E, N, M>, + SV: Storage<E, M, K> + Clone, N: Dim, M: Dim, K: Dim, @@ -273,9 +227,9 @@ impl<SM, SV1, SV2, N, M, K, E> GEMV<E, Matrix<E, M, K, SV1>, Matrix<E, N, K, SV2>> for Matrix<E, N, M, SM> where - SM: ViewableStorage<E, N, M>, - SV1: ViewableStorage<E, M, K> + Clone, - SV2: ViewableStorageMut<E, N, K>, + SM: Storage<E, N, M>, + SV1: Storage<E, M, K> + Clone, + SV2: StorageMut<E, N, K>, N: Dim, M: Dim, K: Dim, @@ -302,7 +256,7 @@ impl<S, M, N, E> VectorSpace for Matrix<E, M, N, S> where - S: ViewableStorage<E, M, N>, + S: Storage<E, M, N>, M: Dim, N: Dim, E: Scalar + Zero + One + Float, @@ -321,8 +275,8 @@ impl<SM, SV1, M, N, E> AXPY<Matrix<E, M, N, SV1>> for Matrix<E, M, N, SM> where - SM: ViewableStorageMut<E, M, N>, - SV1: ViewableStorage<E, M, N>, + SM: StorageMut<E, M, N>, + SV1: Storage<E, M, N>, M: Dim, N: Dim, E: Scalar + Zero + One + Float, @@ -368,7 +322,7 @@ impl<SM, M, E> Projection<E, Linfinity> for Vector<E, M, SM> where - SM: ViewableStorageMut<E, M> + Clone, + SM: StorageMut<E, M> + Clone, M: Dim, E: Scalar + Zero + One + Float + RealField, DefaultAllocator: Allocator<M>, @@ -384,7 +338,7 @@ impl<SM, M, E> ProjectionMut<E, Linfinity> for Vector<E, M, SM> where - SM: ViewableStorageMut<E, M> + Clone, + SM: StorageMut<E, M> + Clone, M: Dim, E: Scalar + Zero + One + Float + RealField, DefaultAllocator: Allocator<M>, @@ -400,9 +354,9 @@ impl<'own, SV1, SV2, SM, N, M, K, E> Adjointable<Matrix<E, M, K, SV1>, Matrix<E, N, K, SV2>> for Matrix<E, N, M, SM> where - SM: ViewableStorage<E, N, M>, - SV1: ViewableStorage<E, M, K> + Clone, - SV2: ViewableStorage<E, N, K> + Clone, + SM: Storage<E, N, M>, + SV1: Storage<E, M, K> + Clone, + SV2: Storage<E, N, K> + Clone, N: Dim, M: Dim, K: Dim, @@ -453,7 +407,7 @@ impl<E, M, S> Euclidean<E> for Vector<E, M, S> where M: Dim, - S: ViewableStorage<E, M>, + S: Storage<E, M>, E: Float + Scalar + Zero + One + RealField, DefaultAllocator: Allocator<M>, ShapeConstraint: StridesOk<E, M, U1, S>, @@ -479,7 +433,7 @@ impl<E, M, S> StaticEuclidean<E> for Vector<E, M, S> where M: DimName, - S: ViewableStorage<E, M>, + S: Storage<E, M>, E: Float + Scalar + Zero + One + RealField, DefaultAllocator: Allocator<M>, ShapeConstraint: StridesOk<E, M, U1, S>, @@ -494,7 +448,7 @@ impl<E, M, S> Normed<E> for Vector<E, M, S> where M: Dim, - S: ViewableStorage<E, M>, + S: Storage<E, M>, E: Float + Scalar + Zero + One + RealField, DefaultAllocator: Allocator<M>, ShapeConstraint: StridesOk<E, M, U1, S>, @@ -515,7 +469,7 @@ impl<E, M, S> HasDual<E> for Vector<E, M, S> where M: Dim, - S: ViewableStorage<E, M>, + S: Storage<E, M>, E: Float + Scalar + Zero + One + RealField, DefaultAllocator: Allocator<M>, ShapeConstraint: StridesOk<E, M, U1, S>, @@ -530,7 +484,7 @@ impl<E, M, S> Norm<L1, E> for Vector<E, M, S> where M: Dim, - S: ViewableStorage<E, M>, + S: Storage<E, M>, E: Float + Scalar + Zero + One + RealField, DefaultAllocator: Allocator<M>, ShapeConstraint: StridesOk<E, M, U1, S>, @@ -544,7 +498,7 @@ impl<E, M, S> Dist<L1, E> for Vector<E, M, S> where M: Dim, - S: ViewableStorage<E, M> + Clone, + S: Storage<E, M> + Clone, E: Float + Scalar + Zero + One + RealField, DefaultAllocator: Allocator<M>, ShapeConstraint: StridesOk<E, M, U1, S>, @@ -558,7 +512,7 @@ impl<E, M, S> Norm<L2, E> for Vector<E, M, S> where M: Dim, - S: ViewableStorage<E, M>, + S: Storage<E, M>, E: Float + Scalar + Zero + One + RealField, DefaultAllocator: Allocator<M>, ShapeConstraint: StridesOk<E, M, U1, S>, @@ -572,7 +526,7 @@ impl<E, M, S> Dist<L2, E> for Vector<E, M, S> where M: Dim, - S: ViewableStorage<E, M> + Clone, + S: Storage<E, M> + Clone, E: Float + Scalar + Zero + One + RealField, DefaultAllocator: Allocator<M>, ShapeConstraint: StridesOk<E, M, U1, S>, @@ -586,7 +540,7 @@ impl<E, M, S> Norm<Linfinity, E> for Vector<E, M, S> where M: Dim, - S: ViewableStorage<E, M>, + S: Storage<E, M>, E: Float + Scalar + Zero + One + RealField, DefaultAllocator: Allocator<M>, ShapeConstraint: StridesOk<E, M, U1, S>, @@ -600,7 +554,7 @@ impl<E, M, S> Dist<Linfinity, E> for Vector<E, M, S> where M: Dim, - S: ViewableStorage<E, M> + Clone, + S: Storage<E, M> + Clone, E: Float + Scalar + Zero + One + RealField, DefaultAllocator: Allocator<M>, ShapeConstraint: StridesOk<E, M, U1, S>,