Skip to main content

SpMat

Struct SpMat 

Source
pub struct SpMat<R> { /* private fields */ }

Implementations§

Source§

impl<R> SpMat<R>

Source

pub fn data(&self) -> (&[usize], &[usize], &[R])

Source

pub fn disassemble(self) -> (Vec<usize>, Vec<usize>, Vec<R>)

Source

pub fn zero(shape: (usize, usize)) -> Self

Source

pub fn is_zero(&self) -> bool
where R: Zero,

Source

pub fn id(n: usize) -> Self
where R: Scalar + One,

Source

pub fn is_id(&self) -> bool
where R: Scalar + One + Zero,

Source

pub fn is_triang(&self, t: TriangularType) -> bool
where R: Zero,

Source

pub fn iter(&self) -> impl Iterator<Item = (usize, usize, &R)>

Source

pub fn iter_nz(&self) -> impl Iterator<Item = (usize, usize, &R)>
where R: Zero,

Source

pub fn into_dense(self) -> Mat<R>

Source

pub fn nnz(&self) -> usize

Source

pub fn density(&self) -> f64

Source

pub fn redundancy(&self) -> f64
where R: Zero,

Source

pub fn mean_weight(&self) -> f64
where R: Ring, for<'x> &'x R: RingOps<R>,

Source§

impl<R> SpMat<R>

Source

pub fn from_entries<T>(shape: (usize, usize), entries: T) -> Self
where T: IntoIterator<Item = (usize, usize, R)>,

Source

pub fn from_col_vecs<I>(nrows: usize, vecs: I) -> Self
where I: IntoIterator<Item = SpVec<R>>,

Source

pub fn from_dense_data<I>(shape: (usize, usize), data: I) -> Self
where I: IntoIterator<Item = R>,

Source

pub fn col_vec(&self, j: usize) -> SpVec<R>

Source

pub fn transpose(&self) -> Self

Source

pub fn extract<F>(&self, shape: (usize, usize), f: F) -> SpMat<R>
where F: Fn(usize, usize) -> Option<(usize, usize)>,

Source

pub fn permute(&self, p: PermView<'_>, q: PermView<'_>) -> SpMat<R>

Source

pub fn permute_rows(&self, p: PermView<'_>) -> SpMat<R>

Source

pub fn permute_cols(&self, q: PermView<'_>) -> SpMat<R>

Source

pub fn submat(&self, rows: Range<usize>, cols: Range<usize>) -> SpMat<R>

Source

pub fn submat_rows(&self, rows: Range<usize>) -> SpMat<R>

Source

pub fn submat_cols(&self, cols: Range<usize>) -> SpMat<R>

Source

pub fn divide4(&self, point: (usize, usize)) -> [SpMat<R>; 4]

Source

pub fn combine_blocks(blocks: [&SpMat<R>; 4]) -> SpMat<R>

Source

pub fn concat(&self, b: &Self) -> Self

Source

pub fn stack(&self, b: &Self) -> Self

Source

pub fn extend_cols(&mut self, b: Self)

Source

pub fn from_row_perm(p: PermView<'_>) -> Self
where R: One,

Source

pub fn from_col_perm(p: PermView<'_>) -> Self
where R: One,

Trait Implementations§

Source§

impl<'a, 'b, R> Add for SpMat<R>

Source§

type Output = SpMat<R>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: SpMat<R>) -> Self::Output

Performs the + operation. Read more
Source§

impl<'a, 'b, R> Add<&'b SpMat<R>> for &'a SpMat<R>

Source§

type Output = SpMat<R>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &'b SpMat<R>) -> Self::Output

Performs the + operation. Read more
Source§

impl<'a, 'b, R> Add<&'b SpMat<R>> for SpMat<R>

Source§

type Output = SpMat<R>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &'b SpMat<R>) -> Self::Output

Performs the + operation. Read more
Source§

impl<'a, 'b, R> Add<SpMat<R>> for &'a SpMat<R>

Source§

type Output = SpMat<R>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: SpMat<R>) -> Self::Output

Performs the + operation. Read more
Source§

impl<'a, 'b, R> AddAssign for SpMat<R>

Source§

fn add_assign(&mut self, rhs: SpMat<R>)

Performs the += operation. Read more
Source§

impl<'a, 'b, R> AddAssign<&'b SpMat<R>> for SpMat<R>

Source§

fn add_assign(&mut self, rhs: &'b SpMat<R>)

Performs the += operation. Read more
Source§

impl<R: Clone> Clone for SpMat<R>

Source§

fn clone(&self) -> SpMat<R>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<R> Debug for SpMat<R>
where R: Display + Debug,

Source§

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

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

impl<R> Default for SpMat<R>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<R> Display for SpMat<R>
where R: Display + Debug,

Source§

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

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

impl<R: Eq> Eq for SpMat<R>

Source§

impl<R> From<CscMatrix<R>> for SpMat<R>

Source§

fn from(inner: CscMatrix<R>) -> Self

Converts to this type from the input type.
Source§

impl<R> From<Mat<R>> for SpMat<R>
where R: Scalar + Zero,

Source§

fn from(value: Mat<R>) -> Self

Converts to this type from the input type.
Source§

impl<R> From<SpMat<R>> for Mat<R>

Source§

fn from(value: SpMat<R>) -> Self

Converts to this type from the input type.
Source§

impl<R> From<SpVec<R>> for SpMat<R>

Source§

fn from(vec: SpVec<R>) -> Self

Converts to this type from the input type.
Source§

impl<R> MatTrait for SpMat<R>

Source§

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

Source§

fn nrows(&self) -> usize

Source§

fn ncols(&self) -> usize

Source§

fn is_square(&self) -> bool

Source§

impl<'a, 'b, R> Mul for SpMat<R>

Source§

type Output = SpMat<R>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: SpMat<R>) -> Self::Output

Performs the * operation. Read more
Source§

impl<'a, 'b, R> Mul<&'b SpMat<R>> for &'a SpMat<R>

Source§

type Output = SpMat<R>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &'b SpMat<R>) -> Self::Output

Performs the * operation. Read more
Source§

impl<'a, 'b, R> Mul<&'b SpMat<R>> for SpMat<R>

Source§

type Output = SpMat<R>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &'b SpMat<R>) -> Self::Output

Performs the * operation. Read more
Source§

impl<'a, 'b, R> Mul<&'b SpVec<R>> for &'a SpMat<R>
where R: Ring, for<'x> &'x R: RingOps<R>,

Source§

type Output = SpVec<R>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &'b SpVec<R>) -> Self::Output

Performs the * operation. Read more
Source§

impl<'a, 'b, R> Mul<&'b SpVec<R>> for SpMat<R>
where R: Ring, for<'x> &'x R: RingOps<R>,

Source§

type Output = SpVec<R>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &'b SpVec<R>) -> Self::Output

Performs the * operation. Read more
Source§

impl<'a, 'b, R> Mul<SpMat<R>> for &'a SpMat<R>

Source§

type Output = SpMat<R>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: SpMat<R>) -> Self::Output

Performs the * operation. Read more
Source§

impl<'a, 'b, R> Mul<SpVec<R>> for &'a SpMat<R>
where R: Ring, for<'x> &'x R: RingOps<R>,

Source§

type Output = SpVec<R>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: SpVec<R>) -> Self::Output

Performs the * operation. Read more
Source§

impl<'a, 'b, R> Mul<SpVec<R>> for SpMat<R>
where R: Ring, for<'x> &'x R: RingOps<R>,

Source§

type Output = SpVec<R>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: SpVec<R>) -> Self::Output

Performs the * operation. Read more
Source§

impl<'a, 'b, R> MulAssign for SpMat<R>

Source§

fn mul_assign(&mut self, rhs: SpMat<R>)

Performs the *= operation. Read more
Source§

impl<'a, 'b, R> MulAssign<&'b SpMat<R>> for SpMat<R>

Source§

fn mul_assign(&mut self, rhs: &'b SpMat<R>)

Performs the *= operation. Read more
Source§

impl<R> Neg for &SpMat<R>
where R: Scalar + Neg<Output = R>,

Source§

type Output = SpMat<R>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
Source§

impl<R> Neg for SpMat<R>
where R: Scalar + Neg<Output = R>,

Source§

type Output = SpMat<R>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
Source§

impl<R: PartialEq> PartialEq for SpMat<R>

Source§

fn eq(&self, other: &SpMat<R>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<R> StructuralPartialEq for SpMat<R>

Source§

impl<'a, 'b, R> Sub for SpMat<R>

Source§

type Output = SpMat<R>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: SpMat<R>) -> Self::Output

Performs the - operation. Read more
Source§

impl<'a, 'b, R> Sub<&'b SpMat<R>> for &'a SpMat<R>

Source§

type Output = SpMat<R>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &'b SpMat<R>) -> Self::Output

Performs the - operation. Read more
Source§

impl<'a, 'b, R> Sub<&'b SpMat<R>> for SpMat<R>

Source§

type Output = SpMat<R>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &'b SpMat<R>) -> Self::Output

Performs the - operation. Read more
Source§

impl<'a, 'b, R> Sub<SpMat<R>> for &'a SpMat<R>

Source§

type Output = SpMat<R>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: SpMat<R>) -> Self::Output

Performs the - operation. Read more
Source§

impl<'a, 'b, R> SubAssign for SpMat<R>

Source§

fn sub_assign(&mut self, rhs: SpMat<R>)

Performs the -= operation. Read more
Source§

impl<'a, 'b, R> SubAssign<&'b SpMat<R>> for SpMat<R>

Source§

fn sub_assign(&mut self, rhs: &'b SpMat<R>)

Performs the -= operation. Read more

Auto Trait Implementations§

§

impl<R> Freeze for SpMat<R>

§

impl<R> RefUnwindSafe for SpMat<R>
where R: RefUnwindSafe,

§

impl<R> Send for SpMat<R>
where R: Send,

§

impl<R> Sync for SpMat<R>
where R: Sync,

§

impl<R> Unpin for SpMat<R>
where R: Unpin,

§

impl<R> UnsafeUnpin for SpMat<R>

§

impl<R> UnwindSafe for SpMat<R>
where R: UnwindSafe,

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneAnd for T
where T: Clone,

Source§

fn clone_and<F>(&self, f: F) -> Self
where F: FnOnce(&mut Self),

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T, Right> ClosedAdd<Right> for T
where T: Add<Right, Output = T> + AddAssign<Right>,

Source§

impl<T, Right> ClosedAdd<Right> for T
where T: Add<Right, Output = T> + AddAssign<Right>,

Source§

impl<T, Right> ClosedAddAssign<Right> for T
where T: ClosedAdd<Right> + AddAssign<Right>,

Source§

impl<T, Right> ClosedMul<Right> for T
where T: Mul<Right, Output = T> + MulAssign<Right>,

Source§

impl<T, Right> ClosedMul<Right> for T
where T: Mul<Right, Output = T> + MulAssign<Right>,

Source§

impl<T, Right> ClosedMulAssign<Right> for T
where T: ClosedMul<Right> + MulAssign<Right>,

Source§

impl<T> ClosedNeg for T
where T: Neg<Output = T>,

Source§

impl<T> ClosedNeg for T
where T: Neg<Output = T>,

Source§

impl<T, Right> ClosedSub<Right> for T
where T: Sub<Right, Output = T> + SubAssign<Right>,

Source§

impl<T, Right> ClosedSub<Right> for T
where T: Sub<Right, Output = T> + SubAssign<Right>,

Source§

impl<T, Right> ClosedSubAssign<Right> for T
where T: ClosedSub<Right> + SubAssign<Right>,

Source§

impl<T> ElemBase for T
where T: Default + PartialEq + Eq + Clone + Send + Sync + Display + Debug + 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<N, A, B> MulAcc<A, B> for N
where &'x A: for<'x> Mul<&'x B, Output = N>, N: AddAssign,

Source§

fn mul_acc(&mut self, a: &A, b: &B)

Multiply and accumulate in this variable, formally *self += a * b.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

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

Source§

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

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

fn is_in_subset(&self) -> bool

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

fn to_subset_unchecked(&self) -> SS

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

fn from_subset(element: &SS) -> SP

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

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

Source§

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

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

fn is_in_subset(&self) -> bool

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

unsafe fn to_subset_unchecked(&self) -> SS

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

fn from_subset(element: &SS) -> SP

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

impl<T> ToOwned for T
where T: Clone,

Source§

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

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 T
where U: TryFrom<T>,

Source§

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.