[][src]Enum ndsparse::csl::CslError

pub enum CslError {
    DataIndcsLengthGreaterThanDimsLength,
    DiffDataIndcsLength,
    DuplicatedIndices,
    IndcsGreaterThanEqualDimLength,
    InnermostDimsZero,
    InvalidIterDim,
    InvalidOffsetsLength,
    InvalidOffsetsOrder,
    LastOffsetDifferentNnz,
    NnzGreaterThanMaximumNnz,
    OffsLengthOverflow,
}

Any error related to Csl operations

Variants

DataIndcsLengthGreaterThanDimsLength

Data or indices length is greater than the product of all dimensions length

use ndsparse::csl::{CslError, CslVec};
let csl = CslVec::new([3], vec![8, 9, 9, 9, 9], vec![0, 5, 5, 5, 5], vec![0, 2]);
assert_eq!(csl, Err(ndsparse::Error::Csl(CslError::DataIndcsLengthGreaterThanDimsLength)));
DiffDataIndcsLength

The data length is different than the indices length

use ndsparse::csl::{ CslError, CslVec};
let csl = CslVec::new([10], vec![8, 9], vec![0], vec![0, 2]);
assert_eq!(csl, Err(ndsparse::Error::Csl(CslError::DiffDataIndcsLength)));
DuplicatedIndices

Duplicated indices in a line

use ndsparse::csl::{CslArray, CslError};
let csl = CslArray::new([10], [8, 9], [0, 0], [0, 2]);
assert_eq!(csl, Err(ndsparse::Error::Csl(CslError::DuplicatedIndices)));
IndcsGreaterThanEqualDimLength

A index is greater or equal to the innermost dimension length

use ndsparse::csl::{CslArray, CslError};
let csl = CslArray::new([10], [8, 9], [0, 10], [0, 2]);
assert_eq!(csl, Err(ndsparse::Error::Csl(CslError::IndcsGreaterThanEqualDimLength)));
InnermostDimsZero

Some innermost dimension length is equal to zero

use ndsparse::csl::{CslError, CslVec};
let csl: ndsparse::Result<CslVec<[usize; 5], i32>>;
csl = CslVec::new([1, 2, 3, 0, 5], vec![], vec![], vec![]);
assert_eq!(csl, Err(ndsparse::Error::Csl(CslError::InnermostDimsZero)));
InvalidIterDim

Line iterator must deal with non-empty dimensions

use ndsparse::csl::{CslVec, CslError};
let csl = CslVec::<[usize; 0], i32>::default();
assert_eq!(csl.outermost_line_iter(), Err(ndsparse::Error::Csl(CslError::InvalidIterDim)));
InvalidOffsetsLength

Offsets length is different than the dimensions product (without the innermost dimension) plus one. This rule doesn't not apply to an empty dimension.

use ndsparse::csl::{CslError, CslVec};
let csl = CslVec::new([10], vec![8, 9], vec![0, 5], vec![0, 2, 4]);
assert_eq!(csl, Err(ndsparse::Error::Csl(CslError::InvalidOffsetsLength)));
InvalidOffsetsOrder

Offsets aren't in ascending order

use ndsparse::csl::{CslArray, CslError};
let csl = CslArray::new([10], [8, 9], [0, 5], [2, 0]);
assert_eq!(csl, Err(ndsparse::Error::Csl(CslError::InvalidOffsetsOrder)));
LastOffsetDifferentNnz

Last offset is not equal to the nnz

use ndsparse::csl::{CslArray, CslError};
let csl = CslArray::new([10], [8, 9], [0, 5], [0, 4]);
assert_eq!(csl, Err(ndsparse::Error::Csl(CslError::LastOffsetDifferentNnz)));
NnzGreaterThanMaximumNnz

nnz is greater than the maximum permitted number of nnz

use ndsparse::csl::CslVec;
use rand::{thread_rng, Rng};
let mut rng = thread_rng();
let dims = [1, 2, 3]; // Max of 6 elements (1 * 2 * 3)
let csl: ndsparse::Result<CslVec<[usize; 3], i32>>;
csl = CslVec::new_controlled_random_rand(dims, 7, &mut rng, |r, _| r.gen());
assert_eq!(csl, Err(ndsparse::Error::Csl(ndsparse::csl::CslError::NnzGreaterThanMaximumNnz)));
OffsLengthOverflow

It isn't possible to have more lines than usize::MAX - 2

use ndsparse::csl::{CslArray, CslError};
let csl = CslArray::new([18446744073709551295, 255, 3026418949592973312], [0], [0], [0, 1]);
assert_eq!(csl, Err(ndsparse::Error::Csl(CslError::OffsLengthOverflow)));

Trait Implementations

impl Debug for CslError[src]

impl Display for CslError[src]

impl Error for CslError[src]

impl From<CslError> for Error[src]

impl PartialEq<CslError> for CslError[src]

impl StructuralPartialEq for CslError[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,