oxiphysics_core/machine_learning/matrix_traits.rs
1//! # Matrix - Trait Implementations
2//!
3//! This module contains trait implementations for `Matrix`.
4//!
5//! ## Implemented Traits
6//!
7//! - `Index`
8//! - `IndexMut`
9//!
10//! 🤖 Generated with [SplitRS](https://github.com/cool-japan/splitrs)
11
12#[allow(unused_imports)]
13use super::functions::*;
14use super::types::Matrix;
15
16impl std::ops::Index<(usize, usize)> for Matrix {
17 type Output = f64;
18 fn index(&self, (r, c): (usize, usize)) -> &f64 {
19 &self.data[r * self.cols + c]
20 }
21}
22
23impl std::ops::IndexMut<(usize, usize)> for Matrix {
24 fn index_mut(&mut self, (r, c): (usize, usize)) -> &mut f64 {
25 &mut self.data[r * self.cols + c]
26 }
27}