Struct oxygengine_physics_2d::prelude::nalgebra::CsMatrix
source · 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>>,
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>>,
sourcepub fn new_uninitialized_generic(
nrows: R,
ncols: C,
nvals: usize
) -> CsMatrix<T, R, C, CsVecStorage<T, R, C>>
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>,
impl<T, R, C, S> CsMatrix<T, R, C, S>where T: Scalar, R: Dim, C: Dim, S: CsStorage<T, R, C>,
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.
sourcepub fn transpose(&self) -> CsMatrix<T, C, R, CsVecStorage<T, C, R>>where
DefaultAllocator: Allocator<usize, R, Const<1>>,
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>,
impl<T, R, C, S> CsMatrix<T, R, C, S>where T: Scalar, R: Dim, C: Dim, S: CsStorageMut<T, R, C>,
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.
source§impl<'a, T> CsMatrix<T, Dynamic, Dynamic, CsVecStorage<T, Dynamic, Dynamic>>where
T: Scalar + Zero + ClosedAdd<T>,
impl<'a, T> CsMatrix<T, Dynamic, Dynamic, CsVecStorage<T, Dynamic, Dynamic>>where T: Scalar + Zero + ClosedAdd<T>,
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>>,
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>>,
sourcepub fn from_triplet_generic(
nrows: R,
ncols: C,
irows: &[usize],
icols: &[usize],
vals: &[T]
) -> CsMatrix<T, R, C, CsVecStorage<T, R, C>>
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>,
impl<T, D, S> CsMatrix<T, D, D, S>where T: RealField, D: Dim, S: CsStorage<T, D, D>,
sourcepub 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>,
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.
sourcepub 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>,
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.
sourcepub 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>,
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.
sourcepub 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>,
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.
sourcepub 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>,
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>>,
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>>,
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>,
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§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>,
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§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>,
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§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>>,
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§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>>,
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>>,
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>,
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>,
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>,
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>,
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> 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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
§fn into_any(self: Box<T, Global>) -> Box<dyn Any, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any, Global>
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>
fn into_any_rc(self: Rc<T, Global>) -> Rc<dyn Any, Global>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§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).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.