pub struct Matrix {
pub rows: usize,
pub cols: usize,
/* private fields */
}Expand description
A dense symbolic matrix stored in row-major order.
Fields§
§rows: usize§cols: usizeImplementations§
Source§impl Matrix
impl Matrix
Sourcepub fn new(rows: Vec<Vec<ExprId>>) -> Result<Self, MatrixError>
pub fn new(rows: Vec<Vec<ExprId>>) -> Result<Self, MatrixError>
Create a matrix from row-major nested vectors.
Sourcepub fn zeros(rows: usize, cols: usize, pool: &ExprPool) -> Self
pub fn zeros(rows: usize, cols: usize, pool: &ExprPool) -> Self
Create a zero matrix (all entries are pool.integer(0)).
Sourcepub fn add(
&self,
other: &Matrix,
pool: &ExprPool,
) -> Result<Matrix, MatrixError>
pub fn add( &self, other: &Matrix, pool: &ExprPool, ) -> Result<Matrix, MatrixError>
Element-wise addition.
Sourcepub fn sub(
&self,
other: &Matrix,
pool: &ExprPool,
) -> Result<Matrix, MatrixError>
pub fn sub( &self, other: &Matrix, pool: &ExprPool, ) -> Result<Matrix, MatrixError>
Element-wise subtraction.
Sourcepub fn mul(
&self,
other: &Matrix,
pool: &ExprPool,
) -> Result<Matrix, MatrixError>
pub fn mul( &self, other: &Matrix, pool: &ExprPool, ) -> Result<Matrix, MatrixError>
Matrix multiplication (self is m×k, other is k×n → result is m×n).
Sourcepub fn simplify_entries(&self, pool: &ExprPool) -> Matrix
pub fn simplify_entries(&self, pool: &ExprPool) -> Matrix
Simplify all entries.
Sourcepub fn det(&self, pool: &ExprPool) -> Result<ExprId, MatrixError>
pub fn det(&self, pool: &ExprPool) -> Result<ExprId, MatrixError>
Determinant using Bareiss algorithm (exact over integers, symbolic otherwise).
Sourcepub fn characteristic_polynomial_lambda_minus_m(
&self,
pool: &ExprPool,
) -> Result<(ExprId, ExprId), EigenError>
pub fn characteristic_polynomial_lambda_minus_m( &self, pool: &ExprPool, ) -> Result<(ExprId, ExprId), EigenError>
V2-17 — det(λI − M) as a pooled expression plus the fresh λ symbol used.
Sourcepub fn eigenvalues(
&self,
pool: &ExprPool,
) -> Result<Vec<(ExprId, usize)>, EigenError>
pub fn eigenvalues( &self, pool: &ExprPool, ) -> Result<Vec<(ExprId, usize)>, EigenError>
V2-17 — Algebraic eigenvalues (value, multiplicity) for matrices whose characteristic
polynomial factors over ℚ into linear and quadratic terms.
Sourcepub fn eigenvectors(
&self,
pool: &ExprPool,
) -> Result<Vec<(ExprId, usize, Vec<Matrix>)>, EigenError>
pub fn eigenvectors( &self, pool: &ExprPool, ) -> Result<Vec<(ExprId, usize, Vec<Matrix>)>, EigenError>
V2-17 — Eigenvalue tuples (λ, multiplicity, column eigenvectors).
Sourcepub fn diagonalize(
&self,
pool: &ExprPool,
) -> Result<(Matrix, Matrix), EigenError>
pub fn diagonalize( &self, pool: &ExprPool, ) -> Result<(Matrix, Matrix), EigenError>
V2-17 — (P, D) with M·P == P·D when diagonalizable in the ℚ-splitting-field sense.
Trait Implementations§
impl Eq for Matrix
impl StructuralPartialEq for Matrix
Auto Trait Implementations§
impl Freeze for Matrix
impl RefUnwindSafe for Matrix
impl Send for Matrix
impl Sync for Matrix
impl Unpin for Matrix
impl UnsafeUnpin for Matrix
impl UnwindSafe for Matrix
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
Mutably borrows from an owned value. Read more
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Casts the value.
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Casts the value.
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
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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>
Converts
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>
Converts
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 moreSource§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
Source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
Source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
Casts the value.
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
Source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
Source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<T> StrictAs for T
impl<T> StrictAs for T
Source§fn strict_as<Dst>(self) -> Dstwhere
T: StrictCast<Dst>,
fn strict_as<Dst>(self) -> Dstwhere
T: StrictCast<Dst>,
Casts the value.
Source§impl<Src, Dst> StrictCastFrom<Src> for Dstwhere
Src: StrictCast<Dst>,
impl<Src, Dst> StrictCastFrom<Src> for Dstwhere
Src: StrictCast<Dst>,
Source§fn strict_cast_from(src: Src) -> Dst
fn strict_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<T> UnwrappedAs for T
impl<T> UnwrappedAs for T
Source§fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
Casts the value.
Source§impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
Source§fn unwrapped_cast_from(src: Src) -> Dst
fn unwrapped_cast_from(src: Src) -> Dst
Casts the value.
Source§impl<T> WrappingAs for T
impl<T> WrappingAs for T
Source§fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
Casts the value.
Source§impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
Source§fn wrapping_cast_from(src: Src) -> Dst
fn wrapping_cast_from(src: Src) -> Dst
Casts the value.