pub struct Matrix<Set: Clone> { /* private fields */ }Implementations§
Source§impl<F: MetaType> Matrix<F>
impl<F: MetaType> Matrix<F>
pub fn gram_schmidt_row_orthogonalization_algorithm( self, ) -> (Matrix<F>, Matrix<F>)
pub fn gram_schmidt_col_orthogonalization_algorithm( self, ) -> (Matrix<F>, Matrix<F>)
pub fn gram_schmidt_row_orthogonalization(self) -> Matrix<F>
pub fn gram_schmidt_col_orthogonalization(self) -> Matrix<F>
Source§impl<F: MetaType> Matrix<F>
impl<F: MetaType> Matrix<F>
pub fn lq_decomposition_algorithm(self) -> (Matrix<F>, Matrix<F>)
pub fn qr_decomposition_algorithm(self) -> (Matrix<F>, Matrix<F>)
pub fn gram_schmidt_row_orthonormalization(self) -> Matrix<F>
pub fn gram_schmidt_col_orthonormalization(self) -> Matrix<F>
Source§impl<R: MetaType> Matrix<R>
impl<R: MetaType> Matrix<R>
pub fn row_reduced_hermite_algorithm(&self) -> (Self, Self, R, Vec<usize>)
pub fn row_reduced_hermite_normal_form(&self) -> Self
pub fn col_reduced_hermite_algorithm(&self) -> (Self, Self, R, Vec<usize>)
pub fn col_reduced_hermite_normal_form(&self) -> Self
pub fn inv(&self) -> Result<Matrix<R>, MatOppErr>
pub fn row_span(self) -> FinitelyFreeSubmodule<R>
pub fn col_span(self) -> FinitelyFreeSubmodule<R>
pub fn row_kernel(self) -> FinitelyFreeSubmodule<R>
pub fn col_kernel(self) -> FinitelyFreeSubmodule<R>
pub fn row_preimage( &self, space: &FinitelyFreeSubmodule<R>, ) -> FinitelyFreeSubmodule<R>
pub fn col_preimage( &self, space: &FinitelyFreeSubmodule<R>, ) -> FinitelyFreeSubmodule<R>
pub fn row_affine_span(self) -> FinitelyFreeSubmoduleAffineSubset<R>
pub fn col_affine_span(self) -> FinitelyFreeSubmoduleAffineSubset<R>
pub fn row_solve(self, y: &Vec<R>) -> Option<Vec<R>>
pub fn col_solve(self, y: &Vec<R>) -> Option<Vec<R>>
pub fn row_solution_set( self, y: &Vec<R>, ) -> FinitelyFreeSubmoduleAffineSubset<R>
pub fn col_solution_set( self, y: &Vec<R>, ) -> FinitelyFreeSubmoduleAffineSubset<R>
Source§impl<Set: Clone> Matrix<Set>
impl<Set: Clone> Matrix<Set>
pub fn full(rows: usize, cols: usize, elem: &Set) -> Self
Sourcepub fn construct(
rows: usize,
cols: usize,
make_entry: impl Fn(usize, usize) -> Set,
) -> Self
pub fn construct( rows: usize, cols: usize, make_entry: impl Fn(usize, usize) -> Set, ) -> Self
Construct a matrix from a closure.
use algebraeon_nzq::Integer;
use algebraeon_rings::matrix::Matrix;
let a = Matrix::<Integer>::construct(2, 3, |r, c| if (r + c) % 2 == 0 { Integer::ZERO } else { Integer::ONE });
let b = Matrix::<Integer>::from_rows(
vec![
vec![Integer::ZERO, Integer::ONE, Integer::ZERO],
vec![Integer::ONE, Integer::ZERO, Integer::ONE]
]
);
assert_eq!(a, b);Sourcepub fn from_rows(rows_elems: Vec<Vec<impl Into<Set> + Clone>>) -> Self
pub fn from_rows(rows_elems: Vec<Vec<impl Into<Set> + Clone>>) -> Self
Construct a matrix from a list of rows.
Sourcepub fn from_cols(cols_elems: Vec<Vec<impl Into<Set> + Clone>>) -> Self
pub fn from_cols(cols_elems: Vec<Vec<impl Into<Set> + Clone>>) -> Self
Construct a matrix from a list of columns.
Sourcepub fn at(&self, r: usize, c: usize) -> Result<&Set, MatOppErr>
pub fn at(&self, r: usize, c: usize) -> Result<&Set, MatOppErr>
Get a reference to the entry at row r and column c.
Sourcepub fn at_mut(&mut self, r: usize, c: usize) -> Result<&mut Set, MatOppErr>
pub fn at_mut(&mut self, r: usize, c: usize) -> Result<&mut Set, MatOppErr>
Get a mutable reference to the entry at row r and column c.
pub fn rows(&self) -> usize
pub fn cols(&self) -> usize
Sourcepub fn submatrix(&self, rows: Vec<usize>, cols: Vec<usize>) -> Self
pub fn submatrix(&self, rows: Vec<usize>, cols: Vec<usize>) -> Self
Return the submatrix given by the intersection of the rows defined by rows and the columns defined by cols.
pub fn get_row_submatrix(&self, row: usize) -> Self
pub fn get_col_submatrix(&self, col: usize) -> Self
pub fn get_row_refs(&self, row: usize) -> Vec<&Set>
pub fn get_col_refs(&self, col: usize) -> Vec<&Set>
pub fn get_row(&self, row: usize) -> Vec<Set>
pub fn get_col(&self, col: usize) -> Vec<Set>
Sourcepub fn apply_map<NewSet: Clone>(
&self,
f: impl Fn(&Set) -> NewSet,
) -> Matrix<NewSet>
pub fn apply_map<NewSet: Clone>( &self, f: impl Fn(&Set) -> NewSet, ) -> Matrix<NewSet>
Apply a function f to the entries of this matrix, producing a new matrix.
pub fn transpose(self) -> Self
pub fn transpose_ref(&self) -> Self
pub fn transpose_mut(&mut self)
pub fn flip_rows(self) -> Self
pub fn flip_rows_ref(&self) -> Self
pub fn flip_rows_mut(&mut self)
pub fn flip_cols(self) -> Self
pub fn flip_cols_ref(&self) -> Self
pub fn flip_cols_mut(&mut self)
Sourcepub fn join_rows<MatT: Borrow<Matrix<Set>>>(
cols: usize,
mats: Vec<MatT>,
) -> Matrix<Set>
pub fn join_rows<MatT: Borrow<Matrix<Set>>>( cols: usize, mats: Vec<MatT>, ) -> Matrix<Set>
Concatenate the rows of the matrices in mats into a single matrix.
cols must match the number of columns of every matrix in mats. The purpose of this input is to produce an empty matrix of the correct dimension when mats is empty.
§Panics
This function panics if cols does not match the number of columns of every matrix in mats.
Sourcepub fn join_cols<MatT: Borrow<Matrix<Set>>>(
rows: usize,
mats: Vec<MatT>,
) -> Matrix<Set>
pub fn join_cols<MatT: Borrow<Matrix<Set>>>( rows: usize, mats: Vec<MatT>, ) -> Matrix<Set>
Concatenate the columns of the matrices in mats into a single matrix.
rows must match the number of rows of every matrix in mats. The purpose of this input is to produce an empty matrix of the correct dimension when mats is empty.
§Panics
This function panics if rows does not match the number of rows of every matrix in mats.
Sourcepub fn entries_list(&self) -> Vec<&Set>
pub fn entries_list(&self) -> Vec<&Set>
Return a vector containing the entries of this matrix.
Most useful when this matrix is a row vector or a column vector.
Source§impl<R: MetaType> Matrix<R>where
R::Signature: RingSignature,
impl<R: MetaType> Matrix<R>where
R::Signature: RingSignature,
pub fn zero(rows: usize, cols: usize) -> Self
pub fn ident(n: usize) -> Self
pub fn diag(diag: &[R]) -> Self
pub fn dot(a: &Self, b: &Self) -> R
pub fn add_mut(&mut self, b: &Self) -> Result<(), MatOppErr>
pub fn add(a: &Self, b: &Self) -> Result<Self, MatOppErr>
pub fn neg_mut(&mut self)
pub fn neg(&self) -> Self
pub fn mul(a: &Self, b: &Self) -> Result<Self, MatOppErr>
pub fn apply_row(&self, row: &[R]) -> Vec<R>
pub fn apply_col(&self, col: &[R]) -> Vec<R>
pub fn mul_scalar(&self, scalar: &R) -> Matrix<R>
pub fn mul_scalar_ref(&self, scalar: &R) -> Matrix<R>
pub fn det_naive(&self) -> Result<R, MatOppErr>
pub fn trace(&self) -> Result<R, MatOppErr>
Source§impl<F: MetaType> Matrix<F>where
F::Signature: FieldSignature,
impl<F: MetaType> Matrix<F>where
F::Signature: FieldSignature,
pub fn presentation_matrix(&self) -> Result<Matrix<Polynomial<F>>, MatOppErr>
pub fn minimal_polynomial(&self) -> Result<Polynomial<F>, MatOppErr>
pub fn characteristic_polynomial(&self) -> Result<Polynomial<F>, MatOppErr>
Source§impl<R: MetaType> Matrix<R>where
R::Signature: GreatestCommonDivisorSignature,
impl<R: MetaType> Matrix<R>where
R::Signature: GreatestCommonDivisorSignature,
pub fn factor_primitive(self) -> Option<(R, Matrix<R>)>
pub fn primitive_part(self) -> Option<Matrix<R>>
Source§impl<Field: MetaType> Matrix<Field>where
Field::Signature: FieldSignature,
PrincipalIntegerMap<Field::Signature, Field::Signature>: FieldOfFractionsInclusion<IntegerCanonicalStructure, Field::Signature>,
impl<Field: MetaType> Matrix<Field>where
Field::Signature: FieldSignature,
PrincipalIntegerMap<Field::Signature, Field::Signature>: FieldOfFractionsInclusion<IntegerCanonicalStructure, Field::Signature>,
pub fn factor_primitive_fof(&self) -> (Field, Matrix<Integer>)
Source§impl<R: MetaType> Matrix<R>where
R::Signature: BezoutDomainSignature,
impl<R: MetaType> Matrix<R>where
R::Signature: BezoutDomainSignature,
pub fn smith_algorithm(&self) -> (Self, Self, Self, usize)
Trait Implementations§
impl<R: MetaType> Eq for Matrix<R>
Auto Trait Implementations§
impl<Set> Freeze for Matrix<Set>
impl<Set> RefUnwindSafe for Matrix<Set>where
Set: RefUnwindSafe,
impl<Set> Send for Matrix<Set>where
Set: Send,
impl<Set> Sync for Matrix<Set>where
Set: Sync,
impl<Set> Unpin for Matrix<Set>where
Set: Unpin,
impl<Set> UnwindSafe for Matrix<Set>where
Set: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more