Fix bug - PartialEq for Matrix no longer panics when shapes do not match

This commit is contained in:
S.Brandeis 2020-01-19 03:06:00 +01:00 committed by Sébastien Crozet
parent 39a433c0e7
commit 2b8410e08b
1 changed files with 5 additions and 6 deletions

View File

@ -1350,12 +1350,11 @@ where
S: Storage<N, R, C>,
{
#[inline]
fn eq(&self, right: &Matrix<N, R, C, S>) -> bool {
assert!(
self.shape() == right.shape(),
"Matrix equality test dimension mismatch."
);
self.iter().zip(right.iter()).all(|(l, r)| l == r)
fn eq(&self, right: &Matrix<N, R2, C2, S2>) -> bool {
if self.shape() == right.shape() {
return self.iter().zip(right.iter()).all(|(l, r)| l == r)
}
false
}
}