Trait scirust::matrix::update::traits::InPlaceUpdates
[−]
[src]
pub trait InPlaceUpdates<T: MagmaBase + Num>: Shape<T> + MatrixBuffer<T> { fn add_scalar(&mut self, rhs: T) -> &mut Self; fn mul_scalar(&mut self, rhs: T) -> &mut Self; fn div_scalar(&mut self, rhs: T) -> SRResult<&mut Self>; fn scale_row_lt(&mut self, r: usize, scale_factor: T) -> &mut Self; fn scale_col_lt(&mut self, c: usize, scale_factor: T) -> &mut Self; fn scale_row_ut(&mut self, r: usize, scale_factor: T) -> &mut Self; fn scale_col_ut(&mut self, c: usize, scale_factor: T) -> &mut Self; fn scale_rows(&mut self, scale_factors: &Matrix<T>) -> &mut Self; fn scale_cols(&mut self, scale_factors: &Matrix<T>) -> &mut Self; fn sub_vec_from_cols(&mut self, vec: &Matrix<T>) -> SRResult<()>; fn sub_vec_from_rows(&mut self, vec: &Matrix<T>) -> SRResult<()>; fn add_vec_to_cols(&mut self, vec: &Matrix<T>) -> SRResult<()>; fn add_vec_to_rows(&mut self, vec: &Matrix<T>) -> SRResult<()>; fn mul_vec_to_cols(&mut self, vec: &Matrix<T>) -> SRResult<()>; fn mul_vec_to_rows(&mut self, vec: &Matrix<T>) -> SRResult<()>; fn ut_to_lt(&mut self) -> &mut Self; fn set_diagonal(&mut self, value: T) -> &mut Self { ... } fn set_row(&mut self, r: usize, value: T) -> &mut Self { ... } fn set_col(&mut self, c: usize, value: T) -> &mut Self { ... } fn set_block(&mut self, start_row: isize, start_col: isize, num_rows: usize, num_cols: usize, value: T) -> &mut Self { ... } }
Matrix In Place Updates API
This trait defines various updates to the contents of a matrix in-place. Such updates include:
- Setting all the entries on a diagonal
- Setting all the entries on a row
- Setting all the entries on a column
- etc.
These are not standard linear algebra operations, but since they are needed once in a while, hence the helper functions are provided to achieve them quickly. Further, optimizing the low level code can help a lot in improving performance of higher level functions.
Required Methods
fn add_scalar(&mut self, rhs: T) -> &mut Self
Add the matrix by a scalar
fn mul_scalar(&mut self, rhs: T) -> &mut Self
Multiply the matrix by a scalar
fn div_scalar(&mut self, rhs: T) -> SRResult<&mut Self>
Divide the matrix by a scalar
fn scale_row_lt(&mut self, r: usize, scale_factor: T) -> &mut Self
Scales a specific row in lower triangular part
fn scale_col_lt(&mut self, c: usize, scale_factor: T) -> &mut Self
Scales a specific column in lower triangular part
fn scale_row_ut(&mut self, r: usize, scale_factor: T) -> &mut Self
Scales a specific row in upper triangular part
fn scale_col_ut(&mut self, c: usize, scale_factor: T) -> &mut Self
Scales a specific column in upper triangular part
fn scale_rows(&mut self, scale_factors: &Matrix<T>) -> &mut Self
Scale all rows as per the scale factors
fn scale_cols(&mut self, scale_factors: &Matrix<T>) -> &mut Self
Scale all columns as per the scale factors
fn sub_vec_from_cols(&mut self, vec: &Matrix<T>) -> SRResult<()>
Subtract a vector from each column
fn sub_vec_from_rows(&mut self, vec: &Matrix<T>) -> SRResult<()>
Subtract a vector from each row
fn add_vec_to_cols(&mut self, vec: &Matrix<T>) -> SRResult<()>
Subtract a vector from each column
fn add_vec_to_rows(&mut self, vec: &Matrix<T>) -> SRResult<()>
Subtract a vector from each row
fn mul_vec_to_cols(&mut self, vec: &Matrix<T>) -> SRResult<()>
Subtract a vector from each column
fn mul_vec_to_rows(&mut self, vec: &Matrix<T>) -> SRResult<()>
Subtract a vector from each row
fn ut_to_lt(&mut self) -> &mut Self
Copies data from upper triangular part to lower triangular part
Provided Methods
fn set_diagonal(&mut self, value: T) -> &mut Self
fn set_row(&mut self, r: usize, value: T) -> &mut Self
Sets all the entries on a row to a particular value
fn set_col(&mut self, c: usize, value: T) -> &mut Self
Sets all the entries on a column to a particular value
fn set_block(&mut self, start_row: isize, start_col: isize, num_rows: usize, num_cols: usize, value: T) -> &mut Self
Sets all the entries on a block to a particular value
Implementors
impl<T: MagmaBase + Num> InPlaceUpdates<T> for Matrix<T>