pub trait Matrix:
ArithmeticallyOperable<Self>
+ Invertible
+ Parseable
+ Serializable {
type T: ArithmeticallyOperable<Self::T>;
Show 14 methods
// Required methods
fn columns(&self) -> usize;
fn rows(&self) -> usize;
fn is_square(&self) -> bool;
fn is_symmetric(&self) -> bool;
fn get(&self, row: usize, column: usize) -> Result<&Self::T>;
fn get_mut(&mut self, row: usize, column: usize) -> Result<&mut Self::T>;
fn set(&mut self, row: usize, column: usize, value: Self::T) -> Result<()>;
fn swap_rows(&mut self, row1: usize, row2: usize) -> Result<()>;
fn transpose(&self) -> Self;
fn gaussian_triangulation(&self) -> Result<Self>;
fn lu_decomposition(&self) -> Result<(Self, Self)>;
fn cholesky_decomposition(&self) -> Result<Self>;
fn determinant_using_gauss(&self) -> Option<Self::T>;
fn determinant_using_lu(&self) -> Option<Self::T>;
}
Required Associated Types§
type T: ArithmeticallyOperable<Self::T>
Required Methods§
Sourcefn is_square(&self) -> bool
fn is_square(&self) -> bool
Will return true
if the matrix is squared, i.e., if rows == columns
Sourcefn is_symmetric(&self) -> bool
fn is_symmetric(&self) -> bool
Will return true
if the matrix is symmetric, i.e., if A == A^T
Sourcefn get(&self, row: usize, column: usize) -> Result<&Self::T>
fn get(&self, row: usize, column: usize) -> Result<&Self::T>
Get a reference of an element of the matrix, or error if you provide wrong indexes
Sourcefn get_mut(&mut self, row: usize, column: usize) -> Result<&mut Self::T>
fn get_mut(&mut self, row: usize, column: usize) -> Result<&mut Self::T>
Get a mutable reference of an element of the matrix, or error if you provide wrong indexes
Sourcefn set(&mut self, row: usize, column: usize, value: Self::T) -> Result<()>
fn set(&mut self, row: usize, column: usize, value: Self::T) -> Result<()>
Set an element of the matrix, or error if you provide wrong indexes
Sourcefn swap_rows(&mut self, row1: usize, row2: usize) -> Result<()>
fn swap_rows(&mut self, row1: usize, row2: usize) -> Result<()>
Swap two rows of the matrix, or error if you provide wrong indexes
Sourcefn transpose(&self) -> Self
fn transpose(&self) -> Self
Return a new matrix being the transposed of the current one. It does not eliminate the current one
Sourcefn gaussian_triangulation(&self) -> Result<Self>
fn gaussian_triangulation(&self) -> Result<Self>
Return a new matrix being the reduced gaussian inferior triangular of the current one. It does not eliminate the current one
Sourcefn lu_decomposition(&self) -> Result<(Self, Self)>
fn lu_decomposition(&self) -> Result<(Self, Self)>
Returns a tuple containing the matrices L
and U
of the LU decomposition, in order. It does not eliminate the current one
Sourcefn cholesky_decomposition(&self) -> Result<Self>
fn cholesky_decomposition(&self) -> Result<Self>
Returns a matrix resulting from the Cholesky decomposition. It does not eliminate the current one
Sourcefn determinant_using_gauss(&self) -> Option<Self::T>
fn determinant_using_gauss(&self) -> Option<Self::T>
Return the determinant or a None
if the matrix is not squared
fn determinant_using_lu(&self) -> Option<Self::T>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.