AtheMathmo / rulinalg

A linear algebra library written in Rust

Home Page:https://crates.io/crates/rulinalg

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot compute induced metric of two `MatrixSlice`s

AtheMathmo opened this issue · comments

The current trait bounds restrict us taking the metric of two slices. It looks like this:

impl<'a, 'b, U, T, M1, M2> MatrixMetric<'a, 'b, T, M1, M2> for U
    where U: MatrixNorm<T, M1>,
    M1: 'a + BaseMatrix<T>,
    M2: 'b + BaseMatrix<T>,
    &'a M1: Sub<&'b M2, Output=M1> {

    fn metric(&self, m1: &'a M1, m2: &'b M2) -> T {
        self.norm(&(m1 - m2))
    }
}

The issue is the last line of the where clause. We require that the output be of type M1 but this is not the case for slices. I think we can remedy this by requiring that the Output is a Matrix<T>.