pub fn check_structure(&self) -> Result<(), SprsError> {
        if ! self.indices.windows(2).all(|x| x[0] < x[1]) {
            return Err(SprsError::NonSortedIndices);
        }

        if self.dim == 0 && self.indices.len() == 0 && self.data.len() == 0 {
            return Ok(());
        }

        let max_ind = self.indices.iter().max().unwrap_or(&I::zero()).index();
        if max_ind >= self.dim {
            panic!("Out of bounds index");
        }

        Ok(())
    }
/// Check the sparse structure, namely that:
/// - indices is sorted
/// - indices are lower than dims()
Check the sparse structure, namely that:
indices is sorted
indices are lower than dims()
Check the sparse structure namely that : indices is sorted indices are lower than dims ()
pub fn check_structure(&self) -> Result<(), SprsError> {
        if ! self.indices.windows(2).all(|x| x[0] < x[1]) {
            return Err(SprsError::NonSortedIndices);
        }
        if self.dim == 0 && self.indices.len() == 0 && self.data.len() == 0 {
            return Ok(());
        }
        let max_ind = self.indices.iter().max().unwrap_or(&I::zero()).index();
        if max_ind >= self.dim {
            panic!("Out of bounds index");
        }
        Ok(())
    }
pub fn check_structure ( & self ) -> Result < ( ) , SprsError > { if ! self . indices . windows ( 2 ) . all ( | x | x [ 0 ] < x [ 1 ] ) { return Err ( SprsError :: NonSortedIndices ) ; } if self . dim == 0 && self . indices . len ( ) == 0 && self . data . len ( ) == 0 { return Ok ( ( ) ) ; } let max_ind = self . indices . iter ( ) . max ( ) . unwrap_or ( & I :: zero ( ) ) . index ( ) ; if max_ind >= self . dim { panic ! ( " " ) ; } Ok ( ( ) ) }
Check the sparse structure, namely that:
 indices is sorted
 indices are lower than dims()
Check the sparse structure namely that : indices is sorted indices are lower than dims ()
&self
&self