Trait cgmath::SquareMatrix
source · pub trait SquareMatrixwhere
Self: Matrix<Column = Self::ColumnRow, Row = Self::ColumnRow, Transpose = Self>,{
type ColumnRow: Array<Element = Self::Element>;
Show 18 methods
// Required methods
fn from_value(value: Self::Element) -> Self;
fn from_diagonal(diagonal: Self::Column) -> Self;
fn identity() -> Self;
fn add_m(&self, m: &Self) -> Self;
fn sub_m(&self, m: &Self) -> Self;
fn add_self_m(&mut self, m: &Self);
fn sub_self_m(&mut self, m: &Self);
fn transpose_self(&mut self);
fn determinant(&self) -> Self::Element;
fn diagonal(&self) -> Self::Column;
fn invert(&self) -> Option<Self>;
fn is_diagonal(&self) -> bool;
fn is_symmetric(&self) -> bool;
// Provided methods
fn mul_self_m(&mut self, m: &Self) { ... }
fn trace(&self) -> Self::Element { ... }
fn invert_self(&mut self) { ... }
fn is_invertible(&self) -> bool { ... }
fn is_identity(&self) -> bool { ... }
}
Expand description
A column-major major matrix where the rows and column vectors are of the same dimensions.
Required Associated Types§
Required Methods§
sourcefn from_value(value: Self::Element) -> Self
fn from_value(value: Self::Element) -> Self
Create a new diagonal matrix using the supplied value.
sourcefn from_diagonal(diagonal: Self::Column) -> Self
fn from_diagonal(diagonal: Self::Column) -> Self
Create a matrix from a non-uniform scale
sourcefn identity() -> Self
fn identity() -> Self
The identity matrix. Multiplying this matrix with another has no effect.
sourcefn add_m(&self, m: &Self) -> Self
fn add_m(&self, m: &Self) -> Self
Add this matrix with another matrix, returning the new metrix.
sourcefn sub_m(&self, m: &Self) -> Self
fn sub_m(&self, m: &Self) -> Self
Subtract another matrix from this matrix, returning the new matrix.
sourcefn add_self_m(&mut self, m: &Self)
fn add_self_m(&mut self, m: &Self)
Add this matrix with another matrix, in-place.
sourcefn sub_self_m(&mut self, m: &Self)
fn sub_self_m(&mut self, m: &Self)
Subtract another matrix from this matrix, in-place.
sourcefn transpose_self(&mut self)
fn transpose_self(&mut self)
Transpose this matrix in-place.
sourcefn determinant(&self) -> Self::Element
fn determinant(&self) -> Self::Element
Take the determinant of this matrix.
sourcefn invert(&self) -> Option<Self>
fn invert(&self) -> Option<Self>
Invert this matrix, returning a new matrix. m.mul_m(m.invert())
is
the identity matrix. Returns None
if this matrix is not invertible
(has a determinant of zero).
sourcefn is_diagonal(&self) -> bool
fn is_diagonal(&self) -> bool
Test if this is a diagonal matrix. That is, every element outside of the diagonal is 0.
sourcefn is_symmetric(&self) -> bool
fn is_symmetric(&self) -> bool
Test if this matrix is symmetric. That is, it is equal to its transpose.
Provided Methods§
sourcefn mul_self_m(&mut self, m: &Self)
fn mul_self_m(&mut self, m: &Self)
Multiply this matrix by another matrix, in-place.
sourcefn trace(&self) -> Self::Element
fn trace(&self) -> Self::Element
Return the trace of this matrix. That is, the sum of the diagonal.
sourcefn invert_self(&mut self)
fn invert_self(&mut self)
Invert this matrix in-place.
sourcefn is_invertible(&self) -> bool
fn is_invertible(&self) -> bool
Test if this matrix is invertible.
sourcefn is_identity(&self) -> bool
fn is_identity(&self) -> bool
Test if this matrix is the identity matrix. That is, it is diagonal and every element in the diagonal is one.