pub fn check_singular_diagonal<T: DiagSingularity + Copy + Debug>(
t: &TypedTensor<T>,
) -> Result<()>Expand description
Checks that every diagonal element of a (possibly batched) upper-triangular factor is non-singular and finite.
Iterates over all batch slices and inspects the diagonal entries
data[i + i * rows] for i in 0..min(rows, cols). Returns
a numerical crate::Error::Extension carrying a typed
DiagonalError::SingularOrNonFinite source for the first offending entry,
or ValidationError::RankMismatch wrapped in Error::Validation when
t has rank less than two.
§Examples
use tenferro_tensor::validate::check_singular_diagonal;
use tenferro_tensor::TypedTensor;
let t = TypedTensor::from_vec_col_major(vec![2, 2], vec![1.0f32, 0.0, 0.0, 2.0]).unwrap();
assert!(check_singular_diagonal(&t).is_ok());§Errors
Returns crate::Error::Validation with RankMismatch for a non-matrix
tensor, a numerical crate::Error::Extension with a typed
DiagonalError::SingularOrNonFinite source for a singular or non-finite
diagonal, or an unsupported crate::Error::Extension with a typed
DiagonalError::UnsupportedDType source for integer and boolean inputs.