pub struct TriangularMat<T: Scalar> { /* private fields */ }Expand description
Triangular matrix using packed storage.
This is a wrapper around PackedMat that provides triangular matrix
semantics with efficient packed storage.
Implementations§
Source§impl<T: Scalar> TriangularMat<T>
impl<T: Scalar> TriangularMat<T>
Sourcepub fn zeros(n: usize, uplo: TriangularKind, diag: DiagonalKind) -> Selfwhere
T: Zeroable,
pub fn zeros(n: usize, uplo: TriangularKind, diag: DiagonalKind) -> Selfwhere
T: Zeroable,
Creates a new triangular matrix filled with zeros.
Sourcepub fn unit_zeros(n: usize, uplo: TriangularKind) -> Selfwhere
T: Zeroable,
pub fn unit_zeros(n: usize, uplo: TriangularKind) -> Selfwhere
T: Zeroable,
Creates a unit triangular matrix (identity-like).
The diagonal is implicitly one and not stored.
Sourcepub fn from_packed(packed: PackedMat<T>, diag: DiagonalKind) -> Self
pub fn from_packed(packed: PackedMat<T>, diag: DiagonalKind) -> Self
Creates from a packed matrix.
Sourcepub fn from_dense(
mat: &MatRef<'_, T>,
uplo: TriangularKind,
diag: DiagonalKind,
) -> Selfwhere
T: Zeroable,
pub fn from_dense(
mat: &MatRef<'_, T>,
uplo: TriangularKind,
diag: DiagonalKind,
) -> Selfwhere
T: Zeroable,
Creates from a dense matrix view.
Sourcepub fn uplo(&self) -> TriangularKind
pub fn uplo(&self) -> TriangularKind
Returns the triangular kind.
Sourcepub fn diag(&self) -> DiagonalKind
pub fn diag(&self) -> DiagonalKind
Returns the diagonal kind.
Sourcepub fn in_triangle(&self, row: usize, col: usize) -> bool
pub fn in_triangle(&self, row: usize, col: usize) -> bool
Returns true if element is in the stored triangle.
Sourcepub fn get(&self, row: usize, col: usize) -> Option<&T>
pub fn get(&self, row: usize, col: usize) -> Option<&T>
Returns a reference to element.
For unit triangular matrices, returns None for diagonal elements.
Sourcepub fn get_mut(&mut self, row: usize, col: usize) -> Option<&mut T>
pub fn get_mut(&mut self, row: usize, col: usize) -> Option<&mut T>
Returns a mutable reference to element.
Sourcepub fn as_mut_ptr(&mut self) -> *mut T
pub fn as_mut_ptr(&mut self) -> *mut T
Returns a mutable pointer to the packed data.
Sourcepub fn as_slice_mut(&mut self) -> &mut [T]
pub fn as_slice_mut(&mut self) -> &mut [T]
Returns the packed data as a mutable slice.
Sourcepub fn as_packed_mut(&mut self) -> &mut PackedMat<T>
pub fn as_packed_mut(&mut self) -> &mut PackedMat<T>
Returns a mutable reference to the underlying packed matrix.
Sourcepub fn diagonal(&self) -> Vec<T>
pub fn diagonal(&self) -> Vec<T>
Returns the diagonal elements.
For unit triangular matrices, returns a vector of ones.
Sourcepub fn set_diagonal(&mut self, diag: &[T])
pub fn set_diagonal(&mut self, diag: &[T])
Trait Implementations§
Source§impl<T: Clone + Scalar> Clone for TriangularMat<T>
impl<T: Clone + Scalar> Clone for TriangularMat<T>
Source§fn clone(&self) -> TriangularMat<T>
fn clone(&self) -> TriangularMat<T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more