pub fn validate(&self) -> Result<(), SparseMatrixError> {
        let RawCoo { dim, ref val, ref row, ref col } = *self;
        ensure!(row.iter().max().map(|x| x.index() < dim.0).unwrap_or(true), "row out of range");
        ensure!(col.iter().max().map(|x| x.index() < dim.1).unwrap_or(true), "col out of range");
        ensure!(val.len() == row.len(), "len mismatch: val vs row");
        ensure!(val.len() == col.len(), "len mismatch: val vs col");
        Ok(())
    }
// Check properties that would typically be considered invariants of the format.
// It is a logic error to call other methods on this type when these properties
// are not satisfied.
Check properties that would typically be considered invariants of the format.
It is a logic error to call other methods on this type when these properties
are not satisfied.
Check properties that would typically be considered invariants of the format . It is a logic error to call other methods on this type when these properties are not satisfied .
pub fn validate(&self) -> Result<(), SparseMatrixError> {
        let RawCoo { dim, ref val, ref row, ref col } = *self;
        ensure!(row.iter().max().map(|x| x.index() < dim.0).unwrap_or(true), "row out of range");
        ensure!(col.iter().max().map(|x| x.index() < dim.1).unwrap_or(true), "col out of range");
        ensure!(val.len() == row.len(), "len mismatch: val vs row");
        ensure!(val.len() == col.len(), "len mismatch: val vs col");
        Ok(())
    }
pub fn validate ( & self ) -> Result < ( ) , SparseMatrixError > { let RawCoo { dim , ref val , ref row , ref col } = * self ; ensure ! ( row iter ( ) max ( ) map ( x x index ( ) dim 0 ) unwrap_or ( true ) " " ) ; ensure ! ( col iter ( ) max ( ) map ( x x index ( ) dim 1 ) unwrap_or ( true ) " " ) ; ensure ! ( val len ( ) row len ( ) " " ) ; ensure ! ( val len ( ) col len ( ) " " ) ; Ok ( ( ) ) }
Check properties that would typically be considered invariants of the format.
Check properties that would typically be considered invariants of the format .
&self
&self