| 57 } |
57 } |
| 58 |
58 |
| 59 #[derive(Copy, Clone, Debug)] |
59 #[derive(Copy, Clone, Debug)] |
| 60 pub struct MatrixDecomposition; |
60 pub struct MatrixDecomposition; |
| 61 |
61 |
| 62 impl<E, M, K, S> Decomposition<Matrix<E, M, K, S>> for MatrixDecomposition |
62 impl<E, M, K, S, RS, CS> Decomposition<Matrix<E, M, K, S>> for MatrixDecomposition |
| 63 where |
63 where |
| 64 S: Storage<E, M, K>, |
64 S: Storage<E, M, K, RStride = RS, CStride = CS>, |
| 65 M: Dim, |
65 M: Dim, |
| 66 K: Dim, |
66 K: Dim, |
| |
67 RS: Dim, |
| |
68 CS: Dim, |
| 67 E: Scalar + Zero + One, |
69 E: Scalar + Zero + One, |
| 68 DefaultAllocator: Allocator<M, K>, |
70 DefaultAllocator: Allocator<M, K>, |
| 69 { |
71 { |
| 70 type OwnedInstance = OMatrix<E, M, K>; |
72 type OwnedInstance = OMatrix<E, M, K>; |
| 71 |
73 |
| 72 type Decomposition<'b> |
74 type Decomposition<'b> |
| 73 = OMatrix<E, M, K> |
75 = OMatrix<E, M, K> |
| 74 where |
76 where |
| 75 Matrix<E, M, K, S>: 'b; |
77 Matrix<E, M, K, S>: 'b; |
| 76 type Reference<'b> |
78 type Reference<'b> |
| 77 = &'b MatrixView<'b, E, M, K, Dyn, Dyn> |
79 = &'b MatrixView<'b, E, M, K, RS, CS> |
| 78 where |
80 where |
| 79 Matrix<E, M, K, S>: 'b; |
81 Matrix<E, M, K, S>: 'b; |
| 80 |
82 |
| 81 #[inline] |
83 #[inline] |
| 82 fn lift<'b>(r: Self::Reference<'b>) -> Self::Decomposition<'b> { |
84 fn lift<'b>(r: Self::Reference<'b>) -> Self::Decomposition<'b> |
| |
85 where |
| |
86 S: 'b, |
| |
87 { |
| 83 r.into_owned() |
88 r.into_owned() |
| 84 } |
89 } |
| 85 } |
90 } |
| 86 |
91 |
| 87 impl<SM, SV, M, K, E> Instance<Matrix<E, M, K, SM>> for Matrix<E, M, K, SV> |
92 impl<S, SV, M, K, E, RS, CS> Instance<Matrix<E, M, K, S>, MatrixDecomposition> |
| 88 where |
93 for Matrix<E, M, K, SV> |
| 89 SM: Storage<E, M, K>, |
94 where |
| |
95 S: Storage<E, M, K, RStride = RS, CStride = CS>, |
| 90 SV: Storage<E, M, K>, |
96 SV: Storage<E, M, K>, |
| 91 M: Dim, |
97 M: Dim, |
| 92 K: Dim, |
98 K: Dim, |
| 93 E: Scalar + Zero + One, |
99 E: Scalar + Zero + One, |
| 94 DefaultAllocator: Allocator<M, K>, |
100 DefaultAllocator: Allocator<M, K>, |