1use crate::*;
2
3impl< E, const ROWS : usize, const COLS : usize, Descriptor : mat::Descriptor > Mat< ROWS, COLS, E, Descriptor >
4where
5 E : MatEl,
6 Self : RawSlice,
8{
9
10 #[ inline( always ) ]
12 pub fn raw_slice( &self ) -> &[ < Self as Collection >::Scalar ]
13 {
14 < Self as RawSlice >::raw_slice( self )
15 }
16
17}
18
19impl< E, const ROWS : usize, const COLS : usize, Descriptor : mat::Descriptor > Mat< ROWS, COLS, E, Descriptor >
20where
21 E : MatEl,
22 Self : RawSliceMut,
24{
25 #[ inline( always ) ]
30 pub fn as_raw_slice_mut( &mut self ) -> &mut [ < Self as Collection >::Scalar ]
31 {
32 < Self as RawSliceMut >::raw_slice_mut( self )
33 }
34
35 #[ inline( always ) ]
40 pub fn set_raw_slice( &mut self, scalars : &[ < Self as Collection >::Scalar ] )
41 {
42 < Self as RawSliceMut >::raw_set_slice( self, scalars )
43 }
44
45 #[ inline( always ) ]
50 pub fn set_raw< const N : usize >( self, scalars : [ < Self as Collection >::Scalar ; N ] ) -> Self
51 {
52 < Self as RawSliceMut >::raw_set( self, scalars )
53 }
54
55 #[ inline( always ) ]
61 pub fn set_data< const N : usize >( self, scalars : [ < Self as Collection >::Scalar ; N ] ) -> Self
62 {
63 < Self as RawSliceMut >::set( self, scalars )
64 }
65
66 #[ inline( always ) ]
72 pub fn set_row_major( self, scalars : &[ < Self as Collection >::Scalar ] ) -> Self
73 {
74 < Self as RawSliceMut >::with_row_major( self, scalars )
75 }
76
77 #[ inline( always ) ]
83 pub fn set_column_major( self, scalars : &[ < Self as Collection >::Scalar ] ) -> Self
84 {
85 < Self as RawSliceMut >::with_column_major( self, scalars )
86 }
87}
88
89impl< E, const ROWS : usize, const COLS : usize, Descriptor : mat::Descriptor > Mat< ROWS, COLS, E, Descriptor >
116where
117 E : MatEl,
118 E : nd::NdFloat,
119 Self : IndexingRef,
120{
121 #[ inline( always ) ]
130 pub fn lane_iter( &self, varying_dim : usize, lane : usize )
131 -> impl Iterator< Item = &< Self as Collection >::Scalar >
132 {
133 < Self as IndexingRef >::lane_iter( self, varying_dim, lane )
134 }
135
136 #[ inline( always ) ]
145 pub fn lane_indexed_iter( &self, varying_dim : usize, lane : usize )
146 -> impl Iterator< Item = ( < Self as Indexable >::Index, &< Self as Collection >::Scalar ) >
147 {
148 < Self as IndexingRef >::lane_indexed_iter( self, varying_dim, lane )
149 }
150
151 #[ inline( always ) ]
156 pub fn iter_unstable( &self )
157 -> impl Iterator< Item = &< Self as Collection >::Scalar >
158 {
159 < Self as IndexingRef >::iter_unstable( self )
160 }
161
162 #[ inline( always ) ]
167 pub fn iter_indexed_unstable( &self )
168 -> impl Iterator< Item = ( < Self as Indexable >::Index, &< Self as Collection >::Scalar ) >
169 {
170 < Self as IndexingRef >::iter_indexed_unstable( self )
171 }
172
173 #[ inline( always ) ]
178 pub fn iter_lsfirst( &self )
179 -> impl Iterator< Item = &< Self as Collection >::Scalar >
180 {
181 < Self as IndexingRef >::iter_lsfirst( self )
182 }
183
184 #[ inline( always ) ]
189 pub fn iter_indexed_lsfirst( &self )
190 -> impl Iterator< Item = ( < Self as Indexable >::Index, &< Self as Collection >::Scalar ) >
191 {
192 < Self as IndexingRef >::iter_indexed_lsfirst( self )
193 }
194
195 #[ inline( always ) ]
200 pub fn iter_msfirst( &self )
201 -> impl Iterator< Item = &< Self as Collection >::Scalar >
202 {
203 < Self as IndexingRef >::iter_msfirst( self )
204 }
205
206 #[ inline( always ) ]
211 pub fn iter_indexed_msfirst( &self )
212 -> impl Iterator< Item = ( < Self as Indexable >::Index, &< Self as Collection >::Scalar ) >
213 {
214 < Self as IndexingRef >::iter_indexed_msfirst( self )
215 }
216}
217
218impl< E, const ROWS : usize, const COLS : usize, Descriptor : mat::Descriptor > Mat< ROWS, COLS, E, Descriptor >
219where
220 E : MatEl,
221 E : nd::NdFloat,
222 Self : IndexingMut,
223{
224 #[ inline( always ) ]
233 pub fn lane_iter_mut( &mut self, varying_dim : usize, lane : usize ) -> impl Iterator< Item = &mut < Self as Collection>::Scalar >
234 {
235 < Self as IndexingMut>::lane_iter_mut( self, varying_dim, lane )
236 }
237
238 #[ inline( always ) ]
247 pub fn lane_iter_indexed_mut( &mut self, varying_dim : usize, lane : usize ) -> impl Iterator< Item = ( < Self as Indexable>::Index, &mut < Self as Collection>::Scalar ) >
248 {
249 < Self as IndexingMut>::lane_iter_indexed_mut( self, varying_dim, lane )
250 }
251
252 #[ inline( always ) ]
257 pub fn iter_unstable_mut( &mut self ) -> impl Iterator< Item = &mut < Self as Collection>::Scalar >
258 {
259 < Self as IndexingMut>::iter_unstable_mut( self )
260 }
261
262 #[ inline( always ) ]
267 pub fn iter_indexed_unstable_mut( &mut self ) -> impl Iterator< Item = ( < Self as Indexable>::Index, &mut < Self as Collection>::Scalar ) >
268 {
269 < Self as IndexingMut>::iter_indexed_unstable_mut( self )
270 }
271
272 #[ inline( always ) ]
277 pub fn iter_lsfirst_mut( &mut self ) -> impl Iterator< Item = &mut < Self as Collection>::Scalar >
278 {
279 < Self as IndexingMut >::iter_lsfirst_mut( self )
280 }
281
282 #[ inline( always ) ]
287 pub fn iter_indexed_lsfirst_mut( &mut self ) -> impl Iterator< Item = ( < Self as Indexable>::Index, &mut < Self as Collection>::Scalar ) >
288 {
289 < Self as IndexingMut >::iter_indexed_lsfirst_mut( self )
290 }
291
292 #[ inline( always ) ]
297 pub fn iter_msfirst_mut( &mut self ) -> impl Iterator< Item = &mut < Self as Collection>::Scalar >
298 {
299 < Self as IndexingMut >::iter_msfirst_mut( self )
300 }
301
302 #[ inline( always ) ]
307 pub fn iter_indexed_msfirst_mut( &mut self ) -> impl Iterator< Item = ( < Self as Indexable>::Index, &mut < Self as Collection>::Scalar ) >
308 {
309 < Self as IndexingMut >::iter_indexed_msfirst_mut( self )
310 }
311}
312
313impl< E, const ROWS : usize, const COLS : usize, Descriptor : mat::Descriptor > Mat< ROWS, COLS, E, Descriptor >
314where
315 E : MatEl,
316 E : nd::NdFloat,
317 Self : ScalarRef,
318{
319 #[ inline( always ) ]
327 pub fn scalar_ref( &self, index : < Self as Indexable >::Index ) -> &< Self as Collection >::Scalar
328 {
329 < Self as ScalarRef >::scalar_ref( self, index )
330 }
331}
332
333impl< E, const ROWS : usize, const COLS : usize, Descriptor : mat::Descriptor > Mat< ROWS, COLS, E, Descriptor >
334where
335 E : MatEl,
336 E : nd::NdFloat,
337 Self : ScalarMut,
338{
339 #[ inline( always ) ]
347 pub fn scalar_mut( &mut self, index : < Self as Indexable >::Index ) -> &mut < Self as Collection >::Scalar
348 {
349 < Self as ScalarMut >::scalar_mut( self, index )
350 }
351}
352
353impl< E, const ROWS : usize, const COLS : usize, Descriptor : mat::Descriptor > Mat< ROWS, COLS, E, Descriptor >
354where
355 E : MatEl,
356 Self : ConstLayout,
357{
358 #[ inline( always ) ]
360 pub fn scalar_offset( index : < Self as Indexable >::Index ) -> usize
361 {
362 < Self as ConstLayout >::scalar_offset( index )
363 }
364}