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 set(&mut self, row: usize, col: usize, value: T)
pub fn set(&mut self, row: usize, col: usize, value: T)
Sets an element.
§Panics
Panics if (row, col) is outside the stored triangle, or if
setting the diagonal on a unit triangular matrix.
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§
Auto Trait Implementations§
impl<T> Freeze for TriangularMat<T>
impl<T> RefUnwindSafe for TriangularMat<T>where
T: RefUnwindSafe,
impl<T> Send for TriangularMat<T>
impl<T> Sync for TriangularMat<T>
impl<T> Unpin for TriangularMat<T>
impl<T> UnsafeUnpin for TriangularMat<T>
impl<T> UnwindSafe for TriangularMat<T>where
T: RefUnwindSafe,
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<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.