/// Finds the last non-zero row in a matrix.
Finds the last non-zero row in a matrix.
Finds the last non - zero row in a matrix .
pub fn ilalr<A, S>(x: &ArrayBase<S, Ix2>) -> Option<usize>
where
    A: Scalar,
    S: Data<Elem = A>,
{
    if x.nrows() == 0 || x.ncols() == 0 {
        return None;
    }
    let last_row = x.nrows() - 1;
    if x[(last_row, x.ncols() - 1)] != A::zero() {
        return Some(last_row);
    }
    for row in (0..x.nrows()).rev() {
        if x.row(row).iter().any(|&elem| elem != A::zero()) {
            return Some(row);
        }
    }
    None
}
pub fn ilalr < A , S > ( x : & ArrayBase < S , Ix2 > ) -> Option < usize > where A : Scalar , S : Data < Elem = A > , { if x . nrows ( ) == 0 || x . ncols ( ) == 0 { return None ; } let last_row = x . nrows ( ) - 1 ; if x [ ( last_row , x . ncols ( ) - 1 ) ] != A :: zero ( ) { return Some ( last_row ) ; } for row in ( 0 .. x . nrows ( ) ) . rev ( ) { if x . row ( row ) . iter ( ) . any ( | & elem | elem != A :: zero ( ) ) { return Some ( row ) ; } } None }
Finds the last non-zero row in a matrix.
Finds the last non - zero row in a matrix .
x
&ArrayBase<S, Ix2>