pub trait Trace: SquareMatrix {
    type Output;

    fn trace(&self) -> Self::Output;
}

Required Associated Types§

Required Methods§

Returns the trace of a given matrix

tr(A)

Examples
let a = [
    [1.0, 2.0, 3.0],
    [4.0, 5.0, 6.0],
    [7.0, 8.0, 9.0]
];
let t = a[0][0] + a[1][1] + a[2][2];
assert_eq!(a.trace(), t);

Implementations on Foreign Types§

Implementors§