pub struct CsMatrix<T: Scalar, R: Dim = Dynamic, C: Dim = Dynamic, S: CsStorage<T, R, C> = CsVecStorage<T, R, C>> { /* private fields */ }
Expand description
A compressed sparse column matrix.
Implementations
sourceimpl<T: Scalar, R: Dim, C: Dim> CsMatrix<T, R, C> where
DefaultAllocator: Allocator<usize, C>,
impl<T: Scalar, R: Dim, C: Dim> CsMatrix<T, R, C> where
DefaultAllocator: Allocator<usize, C>,
sourcepub fn new_uninitialized_generic(nrows: R, ncols: C, nvals: usize) -> Self
pub fn new_uninitialized_generic(nrows: R, ncols: C, nvals: usize) -> Self
Creates a new compressed sparse column matrix with the specified dimension and
nvals
possible non-zero values.
sourceimpl<T: Scalar, R: Dim, C: Dim, S: CsStorage<T, R, C>> CsMatrix<T, R, C, S>
impl<T: Scalar, R: Dim, C: Dim, S: CsStorage<T, R, C>> CsMatrix<T, R, C, S>
sourcepub fn is_sorted(&self) -> bool
pub fn is_sorted(&self) -> bool
Should always return true
.
This method is generally used for debugging and should typically not be called in user code.
This checks that the row inner indices of this matrix are sorted. It takes O(n)
time,
where nis
self.len(). All operations of CSC matrices on nalgebra assume, and will return, sorted indices. If at any time this
is_sortedmethod returns
false`, then, something went wrong
and an issue should be open on the nalgebra repository with details on how to reproduce
this.
sourceimpl<T: Scalar, R: Dim, C: Dim, S: CsStorageMut<T, R, C>> CsMatrix<T, R, C, S>
impl<T: Scalar, R: Dim, C: Dim, S: CsStorageMut<T, R, C>> CsMatrix<T, R, C, S>
sourcepub fn values_mut(&mut self) -> impl Iterator<Item = &mut T>
pub fn values_mut(&mut self) -> impl Iterator<Item = &mut T>
Iterator through all the mutable values of this sparse matrix.
sourceimpl<'a, T: Scalar + Zero + ClosedAdd, R: Dim, C: Dim> CsMatrix<T, R, C> where
DefaultAllocator: Allocator<usize, C> + Allocator<T, R>,
impl<'a, T: Scalar + Zero + ClosedAdd, R: Dim, C: Dim> CsMatrix<T, R, C> where
DefaultAllocator: Allocator<usize, C> + Allocator<T, R>,
sourcepub fn from_triplet_generic(
nrows: R,
ncols: C,
irows: &[usize],
icols: &[usize],
vals: &[T]
) -> Self
pub fn from_triplet_generic(
nrows: R,
ncols: C,
irows: &[usize],
icols: &[usize],
vals: &[T]
) -> Self
Creates a column-compressed sparse matrix from a sparse matrix in triplet form.
sourceimpl<T: RealField, D: Dim, S: CsStorage<T, D, D>> CsMatrix<T, D, D, S>
impl<T: RealField, D: Dim, S: CsStorage<T, D, D>> CsMatrix<T, D, D, S>
sourcepub fn solve_lower_triangular<R2: Dim, C2: Dim, S2>(
&self,
b: &Matrix<T, R2, C2, S2>
) -> Option<OMatrix<T, R2, C2>> where
S2: Storage<T, R2, C2>,
DefaultAllocator: Allocator<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<D, R2>,
pub fn solve_lower_triangular<R2: Dim, C2: Dim, S2>(
&self,
b: &Matrix<T, R2, C2, S2>
) -> Option<OMatrix<T, R2, C2>> where
S2: Storage<T, R2, C2>,
DefaultAllocator: Allocator<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<D, R2>,
Solve a lower-triangular system with a dense right-hand-side.
sourcepub fn tr_solve_lower_triangular<R2: Dim, C2: Dim, S2>(
&self,
b: &Matrix<T, R2, C2, S2>
) -> Option<OMatrix<T, R2, C2>> where
S2: Storage<T, R2, C2>,
DefaultAllocator: Allocator<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<D, R2>,
pub fn tr_solve_lower_triangular<R2: Dim, C2: Dim, S2>(
&self,
b: &Matrix<T, R2, C2, S2>
) -> Option<OMatrix<T, R2, C2>> where
S2: Storage<T, R2, C2>,
DefaultAllocator: Allocator<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<D, R2>,
Solve a lower-triangular system with self
transposed and a dense right-hand-side.
sourcepub fn solve_lower_triangular_mut<R2: Dim, C2: Dim, S2>(
&self,
b: &mut Matrix<T, R2, C2, S2>
) -> bool where
S2: StorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<D, R2>,
pub fn solve_lower_triangular_mut<R2: Dim, C2: Dim, S2>(
&self,
b: &mut Matrix<T, R2, C2, S2>
) -> bool where
S2: StorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<D, R2>,
Solve in-place a lower-triangular system with a dense right-hand-side.
sourcepub fn tr_solve_lower_triangular_mut<R2: Dim, C2: Dim, S2>(
&self,
b: &mut Matrix<T, R2, C2, S2>
) -> bool where
S2: StorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<D, R2>,
pub fn tr_solve_lower_triangular_mut<R2: Dim, C2: Dim, S2>(
&self,
b: &mut Matrix<T, R2, C2, S2>
) -> bool where
S2: StorageMut<T, R2, C2>,
ShapeConstraint: SameNumberOfRows<D, R2>,
Solve a lower-triangular system with self
transposed and a dense right-hand-side.
sourcepub fn solve_lower_triangular_cs<D2: Dim, S2>(
&self,
b: &CsVector<T, D2, S2>
) -> Option<CsVector<T, D2>> where
S2: CsStorage<T, D2>,
DefaultAllocator: Allocator<bool, D> + Allocator<T, D2> + Allocator<usize, D2>,
ShapeConstraint: SameNumberOfRows<D, D2>,
pub fn solve_lower_triangular_cs<D2: Dim, S2>(
&self,
b: &CsVector<T, D2, S2>
) -> Option<CsVector<T, D2>> where
S2: CsStorage<T, D2>,
DefaultAllocator: Allocator<bool, D> + Allocator<T, D2> + Allocator<usize, D2>,
ShapeConstraint: SameNumberOfRows<D, D2>,
Solve a lower-triangular system with a sparse right-hand-side.
Trait Implementations
sourceimpl<'a, 'b, T, R1, R2, C1, C2, S1, S2> Add<&'b CsMatrix<T, R2, C2, S2>> for &'a CsMatrix<T, R1, C1, S1> where
T: Scalar + ClosedAdd + ClosedMul + Zero + One,
R1: Dim,
C1: Dim,
R2: Dim,
C2: Dim,
S1: CsStorage<T, R1, C1>,
S2: CsStorage<T, R2, C2>,
ShapeConstraint: DimEq<R1, R2> + DimEq<C1, C2>,
DefaultAllocator: Allocator<usize, C2> + Allocator<usize, R1> + Allocator<T, R1>,
impl<'a, 'b, T, R1, R2, C1, C2, S1, S2> Add<&'b CsMatrix<T, R2, C2, S2>> for &'a CsMatrix<T, R1, C1, S1> where
T: Scalar + ClosedAdd + ClosedMul + Zero + One,
R1: Dim,
C1: Dim,
R2: Dim,
C2: Dim,
S1: CsStorage<T, R1, C1>,
S2: CsStorage<T, R2, C2>,
ShapeConstraint: DimEq<R1, R2> + DimEq<C1, C2>,
DefaultAllocator: Allocator<usize, C2> + Allocator<usize, R1> + Allocator<T, R1>,
sourceimpl<T: Clone + Scalar, R: Clone + Dim, C: Clone + Dim, S: Clone + CsStorage<T, R, C>> Clone for CsMatrix<T, R, C, S>
impl<T: Clone + Scalar, R: Clone + Dim, C: Clone + Dim, S: Clone + CsStorage<T, R, C>> Clone for CsMatrix<T, R, C, S>
sourceimpl<T: Debug + Scalar, R: Debug + Dim, C: Debug + Dim, S: Debug + CsStorage<T, R, C>> Debug for CsMatrix<T, R, C, S>
impl<T: Debug + Scalar, R: Debug + Dim, C: Debug + Dim, S: Debug + CsStorage<T, R, C>> Debug for CsMatrix<T, R, C, S>
sourceimpl<'a, T: Scalar + Zero, R: Dim, C: Dim, S> From<CsMatrix<T, R, C, S>> for OMatrix<T, R, C> where
S: CsStorage<T, R, C>,
DefaultAllocator: Allocator<T, R, C>,
impl<'a, T: Scalar + Zero, R: Dim, C: Dim, S> From<CsMatrix<T, R, C, S>> for OMatrix<T, R, C> where
S: CsStorage<T, R, C>,
DefaultAllocator: Allocator<T, R, C>,
sourceimpl<'a, T: Scalar + Zero, R: Dim, C: Dim, S> From<Matrix<T, R, C, S>> for CsMatrix<T, R, C> where
S: Storage<T, R, C>,
DefaultAllocator: Allocator<T, R, C> + Allocator<usize, C>,
impl<'a, T: Scalar + Zero, R: Dim, C: Dim, S> From<Matrix<T, R, C, S>> for CsMatrix<T, R, C> where
S: Storage<T, R, C>,
DefaultAllocator: Allocator<T, R, C> + Allocator<usize, C>,
sourceimpl<'a, 'b, T, R1, R2, C1, C2, S1, S2> Mul<&'b CsMatrix<T, R2, C2, S2>> for &'a CsMatrix<T, R1, C1, S1> where
T: Scalar + ClosedAdd + ClosedMul + Zero,
R1: Dim,
C1: Dim,
R2: Dim,
C2: Dim,
S1: CsStorage<T, R1, C1>,
S2: CsStorage<T, R2, C2>,
ShapeConstraint: AreMultipliable<R1, C1, R2, C2>,
DefaultAllocator: Allocator<usize, C2> + Allocator<usize, R1> + Allocator<T, R1>,
impl<'a, 'b, T, R1, R2, C1, C2, S1, S2> Mul<&'b CsMatrix<T, R2, C2, S2>> for &'a CsMatrix<T, R1, C1, S1> where
T: Scalar + ClosedAdd + ClosedMul + Zero,
R1: Dim,
C1: Dim,
R2: Dim,
C2: Dim,
S1: CsStorage<T, R1, C1>,
S2: CsStorage<T, R2, C2>,
ShapeConstraint: AreMultipliable<R1, C1, R2, C2>,
DefaultAllocator: Allocator<usize, C2> + Allocator<usize, R1> + Allocator<T, R1>,
sourceimpl<'a, 'b, T, R, C, S> Mul<T> for CsMatrix<T, R, C, S> where
T: Scalar + ClosedAdd + ClosedMul + Zero,
R: Dim,
C: Dim,
S: CsStorageMut<T, R, C>,
impl<'a, 'b, T, R, C, S> Mul<T> for CsMatrix<T, R, C, S> where
T: Scalar + ClosedAdd + ClosedMul + Zero,
R: Dim,
C: Dim,
S: CsStorageMut<T, R, C>,
sourceimpl<T: PartialEq + Scalar, R: PartialEq + Dim, C: PartialEq + Dim, S: PartialEq + CsStorage<T, R, C>> PartialEq<CsMatrix<T, R, C, S>> for CsMatrix<T, R, C, S>
impl<T: PartialEq + Scalar, R: PartialEq + Dim, C: PartialEq + Dim, S: PartialEq + CsStorage<T, R, C>> PartialEq<CsMatrix<T, R, C, S>> for CsMatrix<T, R, C, S>
impl<T: Scalar, R: Dim, C: Dim, S: CsStorage<T, R, C>> StructuralPartialEq for CsMatrix<T, R, C, S>
Auto Trait Implementations
impl<T, R, C, S> RefUnwindSafe for CsMatrix<T, R, C, S> where
C: RefUnwindSafe,
R: RefUnwindSafe,
S: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, R, C, S> Send for CsMatrix<T, R, C, S> where
S: Send,
T: Send,
impl<T, R, C, S> Sync for CsMatrix<T, R, C, S> where
S: Sync,
T: Sync,
impl<T, R, C, S> Unpin for CsMatrix<T, R, C, S> where
C: Unpin,
R: Unpin,
S: Unpin,
T: Unpin,
impl<T, R, C, S> UnwindSafe for CsMatrix<T, R, C, S> where
C: UnwindSafe,
R: UnwindSafe,
S: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> ArchivePointee for T
impl<T> ArchivePointee for T
type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
sourcefn pointer_metadata(
&<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
fn pointer_metadata(
&<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<F, W, T, D> Deserialize<With<T, W>, D> for F where
W: DeserializeWith<F, T, D>,
D: Fallible + ?Sized,
F: ?Sized,
impl<F, W, T, D> Deserialize<With<T, W>, D> for F where
W: DeserializeWith<F, T, D>,
D: Fallible + ?Sized,
F: ?Sized,
sourceimpl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
sourcefn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct self
from the equivalent element of its
superset. Read more
sourcefn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if self
is actually part of its subset T
(and can be converted to it).
sourcefn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as self.to_subset
but without any property checks. Always succeeds.
sourcefn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts self
to the equivalent element of its superset.
sourceimpl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
sourcefn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct self
from the equivalent element of its
superset. Read more
sourcefn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if self
is actually part of its subset T
(and can be converted to it).
sourceunsafe fn to_subset_unchecked(&self) -> SS
unsafe fn to_subset_unchecked(&self) -> SS
Use with care! Same as self.to_subset
but without any property checks. Always succeeds.
sourcefn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts self
to the equivalent element of its superset.