pub struct CsMatrix<T, R = Dynamic, C = Dynamic, S = CsVecStorage<T, R, C>>where
    T: Scalar,
    R: Dim,
    C: Dim,
    S: CsStorage<T, R, C>,{ /* private fields */ }
Expand description

A compressed sparse column matrix.

Implementations§

source§

impl<T, R, C> CsMatrix<T, R, C, CsVecStorage<T, R, C>>where T: Scalar, R: Dim, C: Dim, DefaultAllocator: Allocator<usize, C, Const<1>>,

source

pub fn new_uninitialized_generic( nrows: R, ncols: C, nvals: usize ) -> CsMatrix<T, R, C, CsVecStorage<T, R, C>>

Creates a new compressed sparse column matrix with the specified dimension and nvals possible non-zero values.

source§

impl<T, R, C, S> CsMatrix<T, R, C, S>where T: Scalar, R: Dim, C: Dim, S: CsStorage<T, R, C>,

source

pub fn len(&self) -> usize

The size of the data buffer.

source

pub fn nrows(&self) -> usize

The number of rows of this matrix.

source

pub fn ncols(&self) -> usize

The number of rows of this matrix.

source

pub fn shape(&self) -> (usize, usize)

The shape of this matrix.

source

pub fn is_square(&self) -> bool

Whether this matrix is square or not.

source

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 nisself.len(). All operations of CSC matrices on nalgebra assume, and will return, sorted indices. If at any time this is_sortedmethod returnsfalse`, then, something went wrong and an issue should be open on the nalgebra repository with details on how to reproduce this.

source

pub fn transpose(&self) -> CsMatrix<T, C, R, CsVecStorage<T, C, R>>where DefaultAllocator: Allocator<usize, R, Const<1>>,

Computes the transpose of this sparse matrix.

source§

impl<T, R, C, S> CsMatrix<T, R, C, S>where T: Scalar, R: Dim, C: Dim, S: CsStorageMut<T, R, C>,

source

pub fn values_mut(&mut self) -> impl Iterator<Item = &mut T>

Iterator through all the mutable values of this sparse matrix.

source§

impl<'a, T> CsMatrix<T, Dynamic, Dynamic, CsVecStorage<T, Dynamic, Dynamic>>where T: Scalar + Zero + ClosedAdd<T>,

source

pub fn from_triplet( nrows: usize, ncols: usize, irows: &[usize], icols: &[usize], vals: &[T] ) -> CsMatrix<T, Dynamic, Dynamic, CsVecStorage<T, Dynamic, Dynamic>>

Creates a column-compressed sparse matrix from a sparse matrix in triplet form.

source§

impl<'a, T, R, C> CsMatrix<T, R, C, CsVecStorage<T, R, C>>where T: Scalar + Zero + ClosedAdd<T>, R: Dim, C: Dim, DefaultAllocator: Allocator<usize, C, Const<1>> + Allocator<T, R, Const<1>>,

source

pub fn from_triplet_generic( nrows: R, ncols: C, irows: &[usize], icols: &[usize], vals: &[T] ) -> CsMatrix<T, R, C, CsVecStorage<T, R, C>>

Creates a column-compressed sparse matrix from a sparse matrix in triplet form.

source§

impl<T, D, S> CsMatrix<T, D, D, S>where T: RealField, D: Dim, S: CsStorage<T, D, D>,

source

pub fn solve_lower_triangular<R2, C2, S2>( &self, b: &Matrix<T, R2, C2, S2> ) -> Option<Matrix<T, R2, C2, <DefaultAllocator as Allocator<T, R2, C2>>::Buffer>>where R2: Dim, C2: Dim, 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.

source

pub fn tr_solve_lower_triangular<R2, C2, S2>( &self, b: &Matrix<T, R2, C2, S2> ) -> Option<Matrix<T, R2, C2, <DefaultAllocator as Allocator<T, R2, C2>>::Buffer>>where R2: Dim, C2: Dim, 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.

source

pub fn solve_lower_triangular_mut<R2, C2, S2>( &self, b: &mut Matrix<T, R2, C2, S2> ) -> boolwhere R2: Dim, C2: Dim, S2: StorageMut<T, R2, C2>, ShapeConstraint: SameNumberOfRows<D, R2>,

Solve in-place a lower-triangular system with a dense right-hand-side.

source

pub fn tr_solve_lower_triangular_mut<R2, C2, S2>( &self, b: &mut Matrix<T, R2, C2, S2> ) -> boolwhere R2: Dim, C2: Dim, S2: StorageMut<T, R2, C2>, ShapeConstraint: SameNumberOfRows<D, R2>,

Solve a lower-triangular system with self transposed and a dense right-hand-side.

source

pub fn solve_lower_triangular_cs<D2, S2>( &self, b: &CsMatrix<T, D2, Const<1>, S2> ) -> Option<CsMatrix<T, D2, Const<1>, CsVecStorage<T, D2, Const<1>>>>where D2: Dim, S2: CsStorage<T, D2, Const<1>>, DefaultAllocator: Allocator<bool, D, Const<1>> + Allocator<T, D2, Const<1>> + Allocator<usize, D2, Const<1>>, ShapeConstraint: SameNumberOfRows<D, D2>,

Solve a lower-triangular system with a sparse right-hand-side.

Trait Implementations§

source§

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<T> + ClosedMul<T> + 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, Const<1>> + Allocator<usize, R1, Const<1>> + Allocator<T, R1, Const<1>>,

§

type Output = CsMatrix<T, R1, C2, CsVecStorage<T, R1, C2>>

The resulting type after applying the + operator.
source§

fn add( self, rhs: &'b CsMatrix<T, R2, C2, S2> ) -> <&'a CsMatrix<T, R1, C1, S1> as Add<&'b CsMatrix<T, R2, C2, S2>>>::Output

Performs the + operation. Read more
source§

impl<T, R, C, S> Clone for CsMatrix<T, R, C, S>where T: Clone + Scalar, R: Clone + Dim, C: Clone + Dim, S: Clone + CsStorage<T, R, C>,

source§

fn clone(&self) -> CsMatrix<T, R, C, S>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T, R, C, S> Debug for CsMatrix<T, R, C, S>where T: Debug + Scalar, R: Debug + Dim, C: Debug + Dim, S: Debug + CsStorage<T, R, C>,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl<'a, T, R, C, S> From<CsMatrix<T, R, C, S>> for Matrix<T, R, C, <DefaultAllocator as Allocator<T, R, C>>::Buffer>where T: Scalar + Zero, R: Dim, C: Dim, S: CsStorage<T, R, C>, DefaultAllocator: Allocator<T, R, C>,

source§

fn from( m: CsMatrix<T, R, C, S> ) -> Matrix<T, R, C, <DefaultAllocator as Allocator<T, R, C>>::Buffer>

Converts to this type from the input type.
source§

impl<'a, T, R, C, S> From<Matrix<T, R, C, S>> for CsMatrix<T, R, C, CsVecStorage<T, R, C>>where T: Scalar + Zero, R: Dim, C: Dim, S: Storage<T, R, C>, DefaultAllocator: Allocator<T, R, C> + Allocator<usize, C, Const<1>>,

source§

fn from(m: Matrix<T, R, C, S>) -> CsMatrix<T, R, C, CsVecStorage<T, R, C>>

Converts to this type from the input type.
source§

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<T> + ClosedMul<T> + 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, Const<1>> + Allocator<usize, R1, Const<1>> + Allocator<T, R1, Const<1>>,

§

type Output = CsMatrix<T, R1, C2, CsVecStorage<T, R1, C2>>

The resulting type after applying the * operator.
source§

fn mul( self, rhs: &'b CsMatrix<T, R2, C2, S2> ) -> <&'a CsMatrix<T, R1, C1, S1> as Mul<&'b CsMatrix<T, R2, C2, S2>>>::Output

Performs the * operation. Read more
source§

impl<'a, 'b, T, R, C, S> Mul<T> for CsMatrix<T, R, C, S>where T: Scalar + ClosedAdd<T> + ClosedMul<T> + Zero, R: Dim, C: Dim, S: CsStorageMut<T, R, C>,

§

type Output = CsMatrix<T, R, C, S>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: T) -> <CsMatrix<T, R, C, S> as Mul<T>>::Output

Performs the * operation. Read more
source§

impl<T, R, C, S> PartialEq<CsMatrix<T, R, C, S>> for CsMatrix<T, R, C, S>where T: PartialEq<T> + Scalar, R: PartialEq<R> + Dim, C: PartialEq<C> + Dim, S: PartialEq<S> + CsStorage<T, R, C>,

source§

fn eq(&self, other: &CsMatrix<T, R, C, S>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T, R, C, S> StructuralPartialEq for CsMatrix<T, R, C, S>where T: Scalar, R: Dim, C: Dim, S: CsStorage<T, R, C>,

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§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Downcast for Twhere T: Any,

§

fn into_any(self: Box<T, Global>) -> Box<dyn Any, Global>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T, Global>) -> Rc<dyn Any, Global>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for Twhere T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T, Global>) -> Arc<dyn Any + Send + Sync, Global>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
§

impl<T> Finalize for T

§

unsafe fn finalize_raw(data: *mut ())

Safety Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
§

impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> UserData for Twhere T: Clone + Any + Send + Sync,

source§

fn clone_boxed(&self) -> Box<dyn UserData, Global>

Clone this trait-object.
source§

fn to_any(&self) -> Box<dyn Any + Send + Sync, Global>

Clone as its super-trait trait objects.
source§

fn as_any(&self) -> &(dyn Any + Send + Sync + 'static)

Downcast to Any.
§

impl<T> Component for Twhere T: Send + Sync + 'static,

source§

impl<T> Scalar for Twhere T: 'static + Clone + PartialEq<T> + Debug,