Consider two empty matrices as equal.

This commit is contained in:
sebcrozet 2018-10-13 11:32:49 +02:00 committed by Sébastien Crozet
parent 54747817b2
commit a68937990b

View File

@ -894,10 +894,14 @@ where
{ {
#[inline] #[inline]
fn partial_cmp(&self, other: &Self) -> Option<Ordering> { fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
if self.shape() != other.shape() || self.nrows() == 0 || self.ncols() == 0 { if self.shape() != other.shape() {
return None; return None;
} }
if self.nrows() == 0 || self.ncols() == 0 {
return Some(Ordering::Equal);
}
let mut first_ord = unsafe { let mut first_ord = unsafe {
self.data self.data
.get_unchecked_linear(0) .get_unchecked_linear(0)