Trait Trace

Source
pub trait Trace: SquareMatrix {
    type Output;

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

Required Associated Types§

Required Methods§

Source

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

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);

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<F, const N: usize> Trace for [[F; N]; N]
where Self: SquareMatrix, F: Add<F, Output = F> + Clone + Zero,

Source§

type Output = F

Source§

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

Implementors§