Type Definition sprs::CsVecI

source ·
pub type CsVecI<N, I = usize> = CsVecBase<Vec<I>, Vec<N>, N, I>;

Implementations§

source§

impl<N, I: SpIndex> CsVecI<N, I>

source

pub fn empty(dim: usize) -> Self

Create an empty CsVec, which can be used for incremental construction

source

pub fn append(&mut self, ind: usize, val: N)

Append an element to the sparse vector. Used for incremental building of the CsVec. The append should preserve the structure of the vector, ie the newly added index should be strictly greater than the last element of indices.

Panics
  • Panics if ind is lower or equal to the last element of self.indices()
  • Panics if ind is greater than self.dim()
source

pub fn reserve(&mut self, size: usize)

Reserve size additional non-zero values.

source

pub fn reserve_exact(&mut self, exact_size: usize)

Reserve exactly exact_size non-zero values.

source

pub fn clear(&mut self)

Clear the underlying storage

Trait Implementations§

source§

impl<N, I> AbstractMagma<Additive> for CsVecI<N, I>where N: Num + Clone, for<'r> &'r N: Add<Output = N>, I: SpIndex,

source§

fn operate(&self, right: &Self) -> Self

Performs an operation.
source§

fn op(&self, _: O, lhs: &Self) -> Self

Performs specific operation.
source§

impl<N, I> Identity<Additive> for CsVecI<N, I>where N: Num + Clone, for<'r> &'r N: Add<Output = N>, I: SpIndex,

source§

fn identity() -> Self

The identity element.
source§

fn id(_: O) -> Selfwhere Self: Sized,

Specific identity.
source§

impl<N, I> Neg for CsVecI<N, I>where N: Clone + Neg<Output = N>, I: SpIndex,

§

type Output = CsVecBase<Vec<I, Global>, Vec<N, Global>, N, I>

The resulting type after applying the - operator.
source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
source§

impl<N, I> TwoSidedInverse<Additive> for CsVecI<N, I>where N: Clone + Neg<Output = N> + Num, I: SpIndex,

source§

fn two_sided_inverse(&self) -> Self

Returns the two_sided_inverse of self, relative to the operator O. Read more
source§

fn two_sided_inverse_mut(&mut self)

In-place inversion of self, relative to the operator O. Read more
source§

impl<N, I> Zero for CsVecI<N, I>where N: Zero + Clone, for<'r> &'r N: Add<Output = N>, I: SpIndex,

source§

fn zero() -> Self

Returns the additive identity element of Self, 0. Read more
source§

fn is_zero(&self) -> bool

Returns true if self is equal to the additive identity.
source§

fn set_zero(&mut self)

Sets self to the additive identity element of Self, 0.
source§

impl<N, I> AbstractGroup<Additive> for CsVecI<N, I>where N: Num + Copy + Neg<Output = N>, for<'r> &'r N: Add<Output = N>, I: SpIndex,

source§

impl<N, I> AbstractGroupAbelian<Additive> for CsVecI<N, I>where N: Num + Copy + Neg<Output = N>, for<'r> &'r N: Add<Output = N>, I: SpIndex,

source§

impl<N, I> AbstractLoop<Additive> for CsVecI<N, I>where N: Num + Copy + Neg<Output = N>, for<'r> &'r N: Add<Output = N>, I: SpIndex,

source§

impl<N, I> AbstractMonoid<Additive> for CsVecI<N, I>where N: Num + Copy, for<'r> &'r N: Add<Output = N>, I: SpIndex,

source§

impl<N, I> AbstractQuasigroup<Additive> for CsVecI<N, I>where N: Num + Clone + Neg<Output = N>, for<'r> &'r N: Add<Output = N>, I: SpIndex,

source§

impl<N, I> AbstractSemigroup<Additive> for CsVecI<N, I>where N: Num + Clone, for<'r> &'r N: Add<Output = N>, I: SpIndex,