Struct sprs::vec::CsVecBase

source ·
pub struct CsVecBase<IStorage, DStorage, N, I: SpIndex = usize>where
    IStorage: Deref<Target = [I]>,
    DStorage: Deref<Target = [N]>,{ /* private fields */ }
Expand description

A sparse vector, storing the indices of its non-zero data.

A CsVec represents a sparse vector by storing a sorted indices() array containing the locations of the non-zero values and a data() array containing the corresponding values. The format is compatible with CsMat, ie a CsVec can represent the row of a CSR matrix without any copying.

Similar to CsMat and TriMat, the CsVecBase type is parameterized over the indexing storage backend IStorage and the data storage backend DStorage. Type aliases are provided for common cases: CsVec represents a sparse vector owning its data, with Vecs as storage backends; CsVecView represents a sparse vector borrowing its data, using slices as storage backends; and CsVecViewMut represents a sparse vector that mutably borrows its data (but immutably borrows its indices).

Additionaly, the type aliases CsVecI, CsVecViewI, and CsVecViewMutI can be used to choose an index type different from the default usize.

Implementations§

source§

impl<N, I: SpIndex, DStorage, IStorage> CsVecBase<IStorage, DStorage, N, I>where DStorage: Deref<Target = [N]>, IStorage: Deref<Target = [I]>,

source

pub fn new(n: usize, indices: IStorage, data: DStorage) -> Self

Create a sparse vector

Panics
  • if indices and data lengths differ
  • if the vector contains out of bounds indices
  • if indices are out of order
Examples
// Creating a sparse owned vector
let owned = CsVec::new(10, vec![0, 4], vec![-4, 2]);
// Creating a sparse borrowing vector with `I = u16`
let borrow = CsVecViewI::new(10, &[0_u16, 4], &[-4, 2]);
// Creating a general sparse vector with different storage types
let mixed = CsVecBase::new(10, &[0_u64, 4] as &[_], vec![-4, 2]);
source

pub fn try_new( n: usize, indices: IStorage, data: DStorage ) -> Result<Self, (IStorage, DStorage, StructureError)>

Try create a sparse vector from the given buffers

Will return the buffers along with the error if conversion is illegal

source

pub unsafe fn new_uncheked(n: usize, indices: IStorage, data: DStorage) -> Self

Create a CsVec without checking the structure

Safety

This is unsafe because algorithms are free to assume that properties guaranteed by check_structure are enforced. For instance, non out-of-bounds indices can be relied upon to perform unchecked slice access.

source§

impl<N, I: SpIndex, DStorage, IStorage> CsVecBase<IStorage, DStorage, N, I>where DStorage: DerefMut<Target = [N]>, IStorage: DerefMut<Target = [I]>,

source

pub fn new_from_unsorted( n: usize, indices: IStorage, data: DStorage ) -> Result<Self, (IStorage, DStorage, StructureError)>where N: Clone,

Creates a sparse vector

Will sort indices and data if necessary

source§

impl<N, I: SpIndex> CsVecBase<Vec<I, Global>, Vec<N, Global>, 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

source§

impl<N, I, IStorage, DStorage> CsVecBase<IStorage, DStorage, N, I>where I: SpIndex, IStorage: Deref<Target = [I]>, DStorage: Deref<Target = [N]>,

source

pub fn view(&self) -> CsVecViewI<'_, N, I>

Get a view of this vector.

source

pub fn to_dense(&self) -> Array<N, Ix1>where N: Clone + Zero,

Convert the sparse vector to a dense one

source

pub fn iter(&self) -> VectorIterator<'_, N, I>

Iterate over the non zero values.

Example
use sprs::CsVec;
let v = CsVec::new(5, vec![0, 2, 4], vec![1., 2., 3.]);
let mut iter = v.iter();
assert_eq!(iter.next(), Some((0, &1.)));
assert_eq!(iter.next(), Some((2, &2.)));
assert_eq!(iter.next(), Some((4, &3.)));
assert_eq!(iter.next(), None);
source

pub fn indices(&self) -> &[I]

The underlying indices.

source

pub fn data(&self) -> &[N]

The underlying non zero values.

source

pub fn into_raw_storage(self) -> (IStorage, DStorage)

Destruct the vector object and recycle its storage containers.

source

pub fn dim(&self) -> usize

The dimension of this vector.

source

pub fn nnz(&self) -> usize

The non zero count of this vector.

source

pub fn check_structure(&self) -> Result<(), StructureError>

Check the sparse structure, namely that:

  • indices are sorted
  • all indices are less than dims()
source

pub fn to_owned(&self) -> CsVecI<N, I>where N: Clone,

Allocate a new vector equal to this one.

source

pub fn to_other_types<I2>(&self) -> CsVecI<N, I2>where N: Clone, I2: SpIndex,

Clone the vector with another integer type for its indices

Panics

If the indices cannot be represented by the requested integer type.

source

pub fn row_view<Iptr: SpIndex>( &self ) -> CsMatBase<N, I, Array2<Iptr>, &'_ [I], &'_ [N], Iptr>

View this vector as a matrix with only one row.

source

pub fn col_view<Iptr: SpIndex>( &self ) -> CsMatBase<N, I, Array2<Iptr>, &'_ [I], &'_ [N], Iptr>

View this vector as a matrix with only one column.

source

pub fn get<'a>(&'a self, index: usize) -> Option<&'a N>where I: 'a,

Access element at given index, with logarithmic complexity

source

pub fn nnz_index(&self, index: usize) -> Option<NnzIndex>

Find the non-zero index of the requested dimension index, returning None if no non-zero is present at the requested location.

Looking for the NnzIndex is done with logarithmic complexity, but once it is available, the NnzIndex enables retrieving the data with O(1) complexity.

source

pub fn dot<'b, T>(&'b self, rhs: T) -> Nwhere N: 'b + MulAcc + Zero, I: 'b, <T as IntoSparseVecIter<'b, N>>::IterType: Iterator<Item = (usize, &'b N)>, T: Copy + IntoSparseVecIter<'b, N>,

Sparse vector dot product. The right-hand-side can be any type that can be interpreted as a sparse vector (hence sparse vectors, std vectors and slices, and ndarray’s dense vectors work).

However, even if dense vectors work, it is more performant to use the dot_dense.

Panics

If the dimension of the vectors do not match.

Example
use sprs::CsVec;
let v1 = CsVec::new(8, vec![1, 2, 4, 6], vec![1.; 4]);
let v2 = CsVec::new(8, vec![1, 3, 5, 7], vec![2.; 4]);
assert_eq!(2., v1.dot(&v2));
assert_eq!(4., v1.dot(&v1));
assert_eq!(16., v2.dot(&v2));
source

pub fn dot_acc<'b, T, M, Acc>(&'b self, rhs: T) -> Accwhere Acc: 'b + MulAcc<N, M> + Zero, M: 'b, <T as IntoSparseVecIter<'b, M>>::IterType: Iterator<Item = (usize, &'b M)>, T: Copy + IntoSparseVecIter<'b, M>,

Sparse vector dot product into accumulator.

The right-hand-side can be any type that can be interpreted as a sparse vector (hence sparse vectors, std vectors and slices, and ndarray’s dense vectors work). The output type can be any type supporting MulAcc.

source

pub fn dot_dense<V>(&self, rhs: V) -> Nwhere V: DenseVector<Scalar = N>, N: Sum, for<'r> &'r N: Mul<&'r N, Output = N>,

Sparse-dense vector dot product. The right-hand-side can be any type that can be interpreted as a dense vector (hence std vectors and slices, and ndarray’s dense vectors work).

Since the dot method can work with the same performance on dot vectors, the main interest of this method is to enforce at compile time that the rhs is dense.

Panics

If the dimension of the vectors do not match.

source

pub fn squared_l2_norm(&self) -> Nwhere N: Sum, for<'r> &'r N: Mul<&'r N, Output = N>,

Compute the squared L2-norm.

source

pub fn l2_norm(&self) -> Nwhere N: Float + Sum, for<'r> &'r N: Mul<&'r N, Output = N>,

Compute the L2-norm.

source

pub fn l1_norm(&self) -> Nwhere N: Signed + Sum,

Compute the L1-norm.

source

pub fn norm(&self, p: N) -> Nwhere N: Float + Sum,

Compute the vector norm for the given order p.

The norm for vector v is defined as:

  • If p = ∞: maxᵢ |vᵢ|
  • If p = -∞: minᵢ |vᵢ|
  • If p = 0: ∑ᵢ[vᵢ≠0]
  • Otherwise: ᵖ√(∑ᵢ|vᵢ|ᵖ)
source

pub fn scatter<V>(&self, out: &mut V)where N: Clone, V: DenseVectorMut<Scalar = N> + ?Sized,

Fill a dense vector with our values

source

pub fn to_set(&self) -> HashSet<(usize, N)>where N: Hash + Eq + Clone,

Transform this vector into a set of (index, value) tuples

source

pub fn map<F>(&self, f: F) -> CsVecI<N, I>where F: FnMut(&N) -> N, N: Clone,

Apply a function to each non-zero element, yielding a new matrix with the same sparsity structure.

source§

impl<'a, N, I, IStorage, DStorage> CsVecBase<IStorage, DStorage, N, I>where N: 'a, I: 'a + SpIndex, IStorage: 'a + Deref<Target = [I]>, DStorage: DerefMut<Target = [N]>,

source

pub fn view_mut(&mut self) -> CsVecViewMutI<'_, N, I>

source

pub fn get_mut(&mut self, index: usize) -> Option<&mut N>

Access element at given index, with logarithmic complexity

source

pub fn map_inplace<F>(&mut self, f: F)where F: FnMut(&N) -> N,

Apply a function to each non-zero element, mutating it

source

pub fn iter_mut(&mut self) -> VectorIteratorMut<'_, N, I>

Mutable iteration over the non-zero values of a sparse vector

Only the values can be changed, the sparse structure is kept.

source

pub fn unit_normalize(&mut self)where N: Float + Sum, for<'r> &'r N: Mul<&'r N, Output = N>,

Divides the vector by its own L2-norm.

Zero vector is left unchanged.

source§

impl<'a, N: 'a, I: 'a + SpIndex> CsVecBase<&'a [I], &'a [N], N, I>

source

pub fn get_rbr(&self, index: usize) -> Option<&'a N>

Access element at given index, with logarithmic complexity

Re-borrowing version of at().

Trait Implementations§

source§

impl<N, I, IS1, DS1, IS2, DS2> AbsDiffEq<CsVecBase<IS2, DS2, N, I>> for CsVecBase<IS1, DS1, N, I>where I: SpIndex, CsVecBase<IS1, DS1, N, I>: PartialEq<CsVecBase<IS2, DS2, N, I>>, IS1: Deref<Target = [I]>, IS2: Deref<Target = [I]>, DS1: Deref<Target = [N]>, DS2: Deref<Target = [N]>, N: AbsDiffEq + Zero, N::Epsilon: Clone,

§

type Epsilon = <N as AbsDiffEq<N>>::Epsilon

Used for specifying relative comparisons.
source§

fn default_epsilon() -> N::Epsilon

The default tolerance to use when testing values that are close together. Read more
source§

fn abs_diff_eq( &self, other: &CsVecBase<IS2, DS2, N, I>, epsilon: N::Epsilon ) -> bool

A test for equality that uses the absolute difference to compute the approximate equality of two numbers.
source§

fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool

The inverse of AbsDiffEq::abs_diff_eq.
source§

impl<'a, Lhs, Rhs, Res, I, IS1, DS1, IS2, DS2> Add<&'a CsVecBase<IS2, DS2, Rhs, I>> for CsVecBase<IS1, DS1, Lhs, I>where Lhs: Zero, Rhs: Zero, for<'r> &'r Lhs: Add<&'r Rhs, Output = Res>, I: SpIndex, IS1: Deref<Target = [I]>, DS1: Deref<Target = [Lhs]>, IS2: Deref<Target = [I]>, DS2: Deref<Target = [Rhs]>,

§

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

The resulting type after applying the + operator.
source§

fn add(self, rhs: &CsVecBase<IS2, DS2, Rhs, I>) -> Self::Output

Performs the + operation. Read more
source§

impl<'a, 'b, Lhs, Rhs, Res, I, IS1, DS1, IS2, DS2> Add<&'b CsVecBase<IS2, DS2, Rhs, I>> for &'a CsVecBase<IS1, DS1, Lhs, I>where Lhs: Zero, Rhs: Zero, for<'r> &'r Lhs: Add<&'r Rhs, Output = Res>, I: SpIndex, IS1: Deref<Target = [I]>, DS1: Deref<Target = [Lhs]>, IS2: Deref<Target = [I]>, DS2: Deref<Target = [Rhs]>,

§

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

The resulting type after applying the + operator.
source§

fn add(self, rhs: &CsVecBase<IS2, DS2, Rhs, I>) -> Self::Output

Performs the + operation. Read more
source§

impl<'a, Lhs, Rhs, Res, I, IS1, DS1, IS2, DS2> Add<CsVecBase<IS2, DS2, Rhs, I>> for &'a CsVecBase<IS1, DS1, Lhs, I>where Lhs: Zero, Rhs: Zero, for<'r> &'r Lhs: Add<&'r Rhs, Output = Res>, I: SpIndex, IS1: Deref<Target = [I]>, DS1: Deref<Target = [Lhs]>, IS2: Deref<Target = [I]>, DS2: Deref<Target = [Rhs]>,

§

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

The resulting type after applying the + operator.
source§

fn add(self, rhs: CsVecBase<IS2, DS2, Rhs, I>) -> Self::Output

Performs the + operation. Read more
source§

impl<Lhs, Rhs, Res, I, IS1, DS1, IS2, DS2> Add<CsVecBase<IS2, DS2, Rhs, I>> for CsVecBase<IS1, DS1, Lhs, I>where Lhs: Zero, Rhs: Zero, for<'r> &'r Lhs: Add<&'r Rhs, Output = Res>, I: SpIndex, IS1: Deref<Target = [I]>, DS1: Deref<Target = [Lhs]>, IS2: Deref<Target = [I]>, DS2: Deref<Target = [Rhs]>,

§

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

The resulting type after applying the + operator.
source§

fn add(self, rhs: CsVecBase<IS2, DS2, Rhs, I>) -> Self::Output

Performs the + operation. Read more
source§

impl<IStorage, DStorage, N: Clone, I: Clone + SpIndex> Clone for CsVecBase<IStorage, DStorage, N, I>where IStorage: Deref<Target = [I]> + Clone, DStorage: Deref<Target = [N]> + Clone,

source§

fn clone(&self) -> CsVecBase<IStorage, DStorage, N, I>

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<IStorage, DStorage, N: Debug, I: Debug + SpIndex> Debug for CsVecBase<IStorage, DStorage, N, I>where IStorage: Deref<Target = [I]> + Debug, DStorage: Deref<Target = [N]> + Debug,

source§

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

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

impl<'de, IStorage, DStorage, N, I: SpIndex> Deserialize<'de> for CsVecBase<IStorage, DStorage, N, I>where IStorage: Deref<Target = [I]> + Deserialize<'de>, DStorage: Deref<Target = [N]> + Deserialize<'de>,

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl<N, I, IStorage, DStorage> DivAssign<N> for CsVecBase<IStorage, DStorage, N, I>where N: Clone + DivAssign<N>, I: SpIndex, IStorage: Deref<Target = [I]>, DStorage: DerefMut<Target = [N]>,

source§

fn div_assign(&mut self, rhs: N)

Performs the /= operation. Read more
source§

impl<IStorage, DStorage, N: Hash, I: Hash + SpIndex> Hash for CsVecBase<IStorage, DStorage, N, I>where IStorage: Deref<Target = [I]> + Hash, DStorage: Deref<Target = [N]> + Hash,

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<N, IS, DS> Index<NnzIndex> for CsVecBase<IS, DS, N>where IS: Deref<Target = [usize]>, DS: Deref<Target = [N]>,

§

type Output = N

The returned type after indexing.
source§

fn index(&self, index: NnzIndex) -> &N

Performs the indexing (container[index]) operation. Read more
source§

impl<N, IS, DS> Index<usize> for CsVecBase<IS, DS, N>where IS: Deref<Target = [usize]>, DS: Deref<Target = [N]>,

§

type Output = N

The returned type after indexing.
source§

fn index(&self, index: usize) -> &N

Performs the indexing (container[index]) operation. Read more
source§

impl<N, IS, DS> IndexMut<NnzIndex> for CsVecBase<IS, DS, N>where IS: Deref<Target = [usize]>, DS: DerefMut<Target = [N]>,

source§

fn index_mut(&mut self, index: NnzIndex) -> &mut N

Performs the mutable indexing (container[index]) operation. Read more
source§

impl<N, IS, DS> IndexMut<usize> for CsVecBase<IS, DS, N>where IS: Deref<Target = [usize]>, DS: DerefMut<Target = [N]>,

source§

fn index_mut(&mut self, index: usize) -> &mut N

Performs the mutable indexing (container[index]) operation. Read more
source§

impl<'a, N: 'a, I, IS, DS> IntoSparseVecIter<'a, N> for &'a CsVecBase<IS, DS, N, I>where I: SpIndex + 'a, IS: Deref<Target = [I]>, DS: Deref<Target = [N]>,

§

type IterType = VectorIterator<'a, N, I>

source§

fn dim(&self) -> usize

The dimension of the vector
source§

fn into_sparse_vec_iter(self) -> VectorIterator<'a, N, I>

Transform self into an iterator that yields (usize, &N) tuples where the usize is the index of the value in the sparse vector. The indices should be sorted.
source§

fn is_dense(&self) -> bool

Indicator to check whether the vector is actually dense
source§

fn index(self, idx: usize) -> &'a Nwhere Self: Sized,

Random access to an element in the vector. Read more
source§

impl<'a, 'b, N, I, Iptr, IS1, DS1, IpS2, IS2, DS2> Mul<&'b CsMatBase<N, I, IpS2, IS2, DS2, Iptr>> for &'a CsVecBase<IS1, DS1, N, I>where N: 'a + Clone + MulAcc + Zero + Default + Send + Sync, I: 'a + SpIndex, Iptr: 'a + SpIndex, IS1: 'a + Deref<Target = [I]>, DS1: 'a + Deref<Target = [N]>, IpS2: 'b + Deref<Target = [Iptr]>, IS2: 'b + Deref<Target = [I]>, DS2: 'b + Deref<Target = [N]>,

§

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

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &CsMatBase<N, I, IpS2, IS2, DS2, Iptr>) -> Self::Output

Performs the * operation. Read more
source§

impl<'a, 'b, N, I, Iptr, IpS1, IS1, DS1, IS2, DS2> Mul<&'b CsVecBase<IS2, DS2, N, I>> for &'a CsMatBase<N, I, IpS1, IS1, DS1, Iptr>where N: Clone + MulAcc + Zero + PartialEq + Default + Send + Sync, I: SpIndex, Iptr: SpIndex, IpS1: Deref<Target = [Iptr]>, IS1: Deref<Target = [I]>, DS1: Deref<Target = [N]>, IS2: Deref<Target = [I]>, DS2: Deref<Target = [N]>,

§

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

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &CsVecBase<IS2, DS2, N, I>) -> Self::Output

Performs the * operation. Read more
source§

impl<N, I, IStorage, DStorage> MulAssign<N> for CsVecBase<IStorage, DStorage, N, I>where N: Clone + MulAssign<N>, I: SpIndex, IStorage: Deref<Target = [I]>, DStorage: DerefMut<Target = [N]>,

source§

fn mul_assign(&mut self, rhs: N)

Performs the *= operation. Read more
source§

impl<IStorage, DStorage, N: PartialEq, I: PartialEq + SpIndex> PartialEq<CsVecBase<IStorage, DStorage, N, I>> for CsVecBase<IStorage, DStorage, N, I>where IStorage: Deref<Target = [I]> + PartialEq, DStorage: Deref<Target = [N]> + PartialEq,

source§

fn eq(&self, other: &CsVecBase<IStorage, DStorage, N, I>) -> 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<N, I, IS1, DS1, IS2, DS2> RelativeEq<CsVecBase<IS2, DS2, N, I>> for CsVecBase<IS1, DS1, N, I>where I: SpIndex, CsVecBase<IS1, DS1, N, I>: PartialEq<CsVecBase<IS2, DS2, N, I>>, IS1: Deref<Target = [I]>, IS2: Deref<Target = [I]>, DS1: Deref<Target = [N]>, DS2: Deref<Target = [N]>, N: RelativeEq + Zero, N::Epsilon: Clone,

source§

fn default_max_relative() -> N::Epsilon

The default relative tolerance for testing values that are far-apart. Read more
source§

fn relative_eq( &self, other: &CsVecBase<IS2, DS2, N, I>, epsilon: N::Epsilon, max_relative: Self::Epsilon ) -> bool

A test for equality that uses a relative comparison if the values are far apart.
source§

fn relative_ne( &self, other: &Rhs, epsilon: Self::Epsilon, max_relative: Self::Epsilon ) -> bool

The inverse of RelativeEq::relative_eq.
source§

impl<IStorage, DStorage, N, I: SpIndex> Serialize for CsVecBase<IStorage, DStorage, N, I>where IStorage: Deref<Target = [I]> + Serialize, DStorage: Deref<Target = [N]> + Serialize,

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl<'a, 'b, Lhs, Rhs, Res, I, IS1, DS1, IS2, DS2> Sub<&'b CsVecBase<IS2, DS2, Rhs, I>> for &'a CsVecBase<IS1, DS1, Lhs, I>where Lhs: Zero, Rhs: Zero, for<'r> &'r Lhs: Sub<&'r Rhs, Output = Res>, I: SpIndex, IS1: Deref<Target = [I]>, DS1: Deref<Target = [Lhs]>, IS2: Deref<Target = [I]>, DS2: Deref<Target = [Rhs]>,

§

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

The resulting type after applying the - operator.
source§

fn sub(self, rhs: &CsVecBase<IS2, DS2, Rhs, I>) -> Self::Output

Performs the - operation. Read more
source§

impl<N, I, IS1, DS1, IS2, DS2> UlpsEq<CsVecBase<IS2, DS2, N, I>> for CsVecBase<IS1, DS1, N, I>where I: SpIndex, CsVecBase<IS1, DS1, N, I>: PartialEq<CsVecBase<IS2, DS2, N, I>>, IS1: Deref<Target = [I]>, IS2: Deref<Target = [I]>, DS1: Deref<Target = [N]>, DS2: Deref<Target = [N]>, N: UlpsEq + Zero, N::Epsilon: Clone,

source§

fn default_max_ulps() -> u32

The default ULPs to tolerate when testing values that are far-apart. Read more
source§

fn ulps_eq( &self, other: &CsVecBase<IS2, DS2, N, I>, epsilon: N::Epsilon, max_ulps: u32 ) -> bool

A test for equality that uses units in the last place (ULP) if the values are far apart.
source§

fn ulps_ne(&self, other: &Rhs, epsilon: Self::Epsilon, max_ulps: u32) -> bool

The inverse of UlpsEq::ulps_eq.
source§

impl<N, I: SpIndex, IS: Deref<Target = [I]>, DS: Deref<Target = [N]>> VecDim<N> for CsVecBase<IS, DS, N, I>

source§

fn dim(&self) -> usize

The dimension of the vector
source§

impl<IStorage, DStorage, N: Copy, I: Copy + SpIndex> Copy for CsVecBase<IStorage, DStorage, N, I>where IStorage: Deref<Target = [I]> + Copy, DStorage: Deref<Target = [N]> + Copy,

source§

impl<IStorage, DStorage, N: Eq, I: Eq + SpIndex> Eq for CsVecBase<IStorage, DStorage, N, I>where IStorage: Deref<Target = [I]> + Eq, DStorage: Deref<Target = [N]> + Eq,

source§

impl<IStorage, DStorage, N, I: SpIndex> StructuralEq for CsVecBase<IStorage, DStorage, N, I>where IStorage: Deref<Target = [I]>, DStorage: Deref<Target = [N]>,

source§

impl<IStorage, DStorage, N, I: SpIndex> StructuralPartialEq for CsVecBase<IStorage, DStorage, N, I>where IStorage: Deref<Target = [I]>, DStorage: Deref<Target = [N]>,

Auto Trait Implementations§

§

impl<IStorage, DStorage, N, I> RefUnwindSafe for CsVecBase<IStorage, DStorage, N, I>where DStorage: RefUnwindSafe, IStorage: RefUnwindSafe,

§

impl<IStorage, DStorage, N, I> Send for CsVecBase<IStorage, DStorage, N, I>where DStorage: Send, IStorage: Send,

§

impl<IStorage, DStorage, N, I> Sync for CsVecBase<IStorage, DStorage, N, I>where DStorage: Sync, IStorage: Sync,

§

impl<IStorage, DStorage, N, I> Unpin for CsVecBase<IStorage, DStorage, N, I>where DStorage: Unpin, IStorage: Unpin,

§

impl<IStorage, DStorage, N, I> UnwindSafe for CsVecBase<IStorage, DStorage, N, I>where DStorage: UnwindSafe, IStorage: 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
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.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

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

Initializes a with the given initializer. Read more
§

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

Dereferences the given pointer. Read more
§

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

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

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

impl<SS, SP> SupersetOf<SS> for SPwhere 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 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> AdditiveGroup for Twhere T: AbstractGroup<Additive> + AdditiveLoop + AdditiveMonoid,

source§

impl<T> AdditiveGroupAbelian for Twhere T: AbstractGroupAbelian<Additive> + AdditiveGroup,

source§

impl<T> AdditiveLoop for Twhere T: AbstractLoop<Additive> + AdditiveQuasigroup + ClosedNeg + Zero,

source§

impl<T> AdditiveMagma for Twhere T: AbstractMagma<Additive>,

source§

impl<T> AdditiveMonoid for Twhere T: AbstractMonoid<Additive> + AdditiveSemigroup + Zero,

source§

impl<T> AdditiveSemigroup for Twhere T: AbstractSemigroup<Additive> + AdditiveMagma + ClosedAdd<T>,

source§

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

source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,

source§

impl<T, Base> RefNum<Base> for Twhere T: NumOps<Base, Base> + for<'r> NumOps<&'r Base, Base>,