pub fn mat_max_abs_diff(
    a: &Matrix,
    b: &Matrix
) -> Result<(usize, usize, f64), StrError>
Expand description

Finds the maximum absolute difference between the components of two matrices

Returns (i,j,max_abs_diff)

max_abs_diff := max_ij ( |aᵢⱼ - bᵢⱼ| )

Warning

This function may be slow for large matrices.

Example

use russell_lab::{mat_max_abs_diff, Matrix, StrError};
use russell_chk::assert_approx_eq;

fn main() -> Result<(), StrError> {
    let a = Matrix::from(&[
        [ 10.0,  20.0],
        [-10.0, -20.0],
    ]);
    let b = Matrix::from(&[
        [ 10.0,  20.0],
        [-10.0, -20.01],
    ]);
    let (i, j, max_abs_diff) = mat_max_abs_diff(&a, &b)?;
    assert_eq!(i, 1);
    assert_eq!(j, 1);
    assert_approx_eq!(max_abs_diff, 0.01, 1e-14);
    Ok(())
}