src/nalgebra_support.rs

branch
dev
changeset 162
bea0c3841ced
parent 160
e7920e205785
child 164
fd9dba51afd3
equal deleted inserted replaced
160:e7920e205785 162:bea0c3841ced
7 force-feeding its own versions of the same basic mathematical methods on `f32` and `f64` as 7 force-feeding its own versions of the same basic mathematical methods on `f32` and `f64` as
8 [`num_traits`] does. 8 [`num_traits`] does.
9 */ 9 */
10 10
11 use crate::euclidean::*; 11 use crate::euclidean::*;
12 use crate::instance::{Decomposition, Instance, Ownable, Space}; 12 use crate::instance::{Decomposition, Instance, MyCow, Ownable, Space};
13 use crate::linops::*; 13 use crate::linops::*;
14 use crate::norms::*; 14 use crate::norms::*;
15 use crate::types::Float; 15 use crate::types::Float;
16 use nalgebra::base::allocator::Allocator; 16 use nalgebra::base::allocator::Allocator;
17 use nalgebra::base::constraint::{DimEq, SameNumberOfColumns, SameNumberOfRows, ShapeConstraint}; 17 use nalgebra::base::constraint::{DimEq, SameNumberOfColumns, SameNumberOfRows, ShapeConstraint};
41 41
42 /// Returns an owned instance of a reference. 42 /// Returns an owned instance of a reference.
43 fn clone_owned(&self) -> Self::OwnedVariant { 43 fn clone_owned(&self) -> Self::OwnedVariant {
44 Matrix::clone_owned(self) 44 Matrix::clone_owned(self)
45 } 45 }
46
47 fn cow_owned<'b>(self) -> MyCow<'b, Self::OwnedVariant>
48 where
49 Self: 'b,
50 {
51 todo!()
52 //MyCow::owned(self.into_owned())
53 }
46 } 54 }
47 55
48 trait StridesOk<E, N, M = U1, S = <DefaultAllocator as Allocator<N, M>>::Buffer<E>>: 56 trait StridesOk<E, N, M = U1, S = <DefaultAllocator as Allocator<N, M>>::Buffer<E>>:
49 DimEq<Dyn, S::RStride> 57 DimEq<Dyn, S::RStride>
50 + DimEq<Dyn, S::CStride> 58 + DimEq<Dyn, S::CStride>
101 K: Dim, 109 K: Dim,
102 E: Scalar + Zero + One, 110 E: Scalar + Zero + One,
103 DefaultAllocator: Allocator<M, K>, 111 DefaultAllocator: Allocator<M, K>,
104 ShapeConstraint: StridesOk<E, M, K, S> + StridesOk<E, M, K>, 112 ShapeConstraint: StridesOk<E, M, K, S> + StridesOk<E, M, K>,
105 { 113 {
106 type OwnedInstance = OMatrix<E, M, K>;
107
108 type Decomposition<'b> 114 type Decomposition<'b>
109 = OMatrix<E, M, K> 115 = OMatrix<E, M, K>
110 where 116 where
111 Matrix<E, M, K, S>: 'b; 117 Matrix<E, M, K, S>: 'b;
112 type Reference<'b> 118 type Reference<'b>

mercurial