Method
zip_each_mut
(
&mut self,
rhs: &Matrix<ROWS, COLS, U>,
mut f: impl FnMut(usize, usize, &mut T, &U),
)
Source from the content-addressed store, hash-verified
| 463 | |
| 464 | #[inline] |
| 465 | pub fn zip_each_mut<U>( |
| 466 | &mut self, |
| 467 | rhs: &Matrix<ROWS, COLS, U>, |
| 468 | mut f: impl FnMut(usize, usize, &mut T, &U), |
| 469 | ) -> &mut Self { |
| 470 | for row in 0..ROWS { |
| 471 | for col in 0..COLS { |
| 472 | // SAFETY: row/col come from matrix bounds for both same-shape matrices. |
| 473 | f( |
| 474 | row, |
| 475 | col, |
| 476 | unsafe { self.get_unchecked_mut(row, col) }, |
| 477 | unsafe { rhs.get_unchecked(row, col) }, |
| 478 | ); |
| 479 | } |
| 480 | } |
| 481 | self |
| 482 | } |
| 483 | |
| 484 | #[inline] |
| 485 | pub fn for_neighbors_4( |