opensrdk_linear_algebra/matrix/di/operators/
index.rs

1use crate::{DiagonalMatrix, Number};
2use std::ops::{Index, IndexMut};
3
4impl<T> Index<usize> for DiagonalMatrix<T>
5where
6    T: Number,
7{
8    type Output = T;
9    fn index(&self, index: usize) -> &Self::Output {
10        &self.d[index]
11    }
12}
13
14impl<T> IndexMut<usize> for DiagonalMatrix<T>
15where
16    T: Number,
17{
18    fn index_mut(&mut self, index: usize) -> &mut Self::Output {
19        &mut self.d[index]
20    }
21}