src/nalgebra_support.rs

branch
dev
changeset 173
102421d462d1
parent 172
73608862ef54
child 174
53ab61a41d70
equal deleted inserted replaced
172:73608862ef54 173:102421d462d1
144 E: Scalar + Zero + One + Copy, 144 E: Scalar + Zero + One + Copy,
145 DefaultAllocator: Allocator<M, K>, 145 DefaultAllocator: Allocator<M, K>,
146 ShapeConstraint: StridesOk<E, M, K, S1> + StridesOk<E, M, K, S2>, 146 ShapeConstraint: StridesOk<E, M, K, S1> + StridesOk<E, M, K, S2>,
147 { 147 {
148 #[inline] 148 #[inline]
149 fn either<'b, R>(
150 self,
151 f: impl FnOnce(MyCow<'b, OMatrix<E, M, K>>) -> R,
152 _g: impl FnOnce(MatrixView<'b, E, M, K, Dyn, Dyn>) -> R,
153 ) -> R
154 where
155 Self: 'b,
156 {
157 // TODO: should not turn non-owned matrices into owned
158 f(MyCow::Owned(self.into_owned()))
159 }
160
161 #[inline]
162 fn eval_ref<'b, R>( 149 fn eval_ref<'b, R>(
163 &'b self, 150 &'b self,
164 f: impl FnOnce(<MatrixDecomposition as Decomposition<Matrix<E, M, K, S1>>>::Reference<'b>) -> R, 151 f: impl FnOnce(<MatrixDecomposition as Decomposition<Matrix<E, M, K, S1>>>::Reference<'b>) -> R,
165 ) -> R 152 ) -> R
166 where 153 where
201 K: Dim, 188 K: Dim,
202 E: Scalar + Zero + One + Copy, 189 E: Scalar + Zero + One + Copy,
203 DefaultAllocator: Allocator<M, K>, 190 DefaultAllocator: Allocator<M, K>,
204 ShapeConstraint: StridesOk<E, M, K, S1> + StridesOk<E, M, K, S2>, 191 ShapeConstraint: StridesOk<E, M, K, S1> + StridesOk<E, M, K, S2>,
205 { 192 {
206 #[inline]
207 fn either<'b, R>(
208 self,
209 _f: impl FnOnce(MyCow<'b, OMatrix<E, M, K>>) -> R,
210 g: impl FnOnce(MatrixView<'b, E, M, K, Dyn, Dyn>) -> R,
211 ) -> R
212 where
213 Self: 'b,
214 {
215 g(self.as_view())
216 }
217
218 fn eval_ref<'b, R>( 193 fn eval_ref<'b, R>(
219 &'b self, 194 &'b self,
220 f: impl FnOnce(<MatrixDecomposition as Decomposition<Matrix<E, M, K, S1>>>::Reference<'b>) -> R, 195 f: impl FnOnce(<MatrixDecomposition as Decomposition<Matrix<E, M, K, S1>>>::Reference<'b>) -> R,
221 ) -> R 196 ) -> R
222 where 197 where
256 K: Dim, 231 K: Dim,
257 E: Scalar + Zero + One + Copy, 232 E: Scalar + Zero + One + Copy,
258 DefaultAllocator: Allocator<M, K>, 233 DefaultAllocator: Allocator<M, K>,
259 ShapeConstraint: StridesOk<E, M, K, S1> + StridesOk<E, M, K>, 234 ShapeConstraint: StridesOk<E, M, K, S1> + StridesOk<E, M, K>,
260 { 235 {
261 #[inline]
262 fn either<'b, R>(
263 self,
264 f: impl FnOnce(MyCow<'b, OMatrix<E, M, K>>) -> R,
265 _g: impl FnOnce(MatrixView<'b, E, M, K, Dyn, Dyn>) -> R,
266 ) -> R
267 where
268 Self: 'b,
269 {
270 f(self)
271 }
272
273 #[inline] 236 #[inline]
274 fn eval_ref<'b, R>( 237 fn eval_ref<'b, R>(
275 &'b self, 238 &'b self,
276 f: impl FnOnce(<MatrixDecomposition as Decomposition<Matrix<E, M, K, S1>>>::Reference<'b>) -> R, 239 f: impl FnOnce(<MatrixDecomposition as Decomposition<Matrix<E, M, K, S1>>>::Reference<'b>) -> R,
277 ) -> R 240 ) -> R

mercurial