From ee1eafc8612bf15e8eea811db367a956441530e5 Mon Sep 17 00:00:00 2001 From: Koen Deschacht Date: Fri, 30 Aug 2019 08:10:13 +0200 Subject: [PATCH] Allow getting .min() and .max() of matrices of unsigned integers --- src/base/ops.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/base/ops.rs b/src/base/ops.rs index f389eae5..6f06607f 100644 --- a/src/base/ops.rs +++ b/src/base/ops.rs @@ -918,10 +918,11 @@ impl> Matrix { /// # use nalgebra::Vector3; /// assert_eq!(Vector3::new(-1.0, 2.0, 3.0).max(), 3.0); /// assert_eq!(Vector3::new(-1.0, -2.0, -3.0).max(), -1.0); + /// assert_eq!(Vector3::::new(5, 2, 3).max(), 5); /// ``` #[inline] pub fn max(&self) -> N - where N: PartialOrd + Signed { + where N: PartialOrd + Zero { self.xcmp(|e| e, Ordering::Greater) } @@ -959,10 +960,11 @@ impl> Matrix { /// # use nalgebra::Vector3; /// assert_eq!(Vector3::new(-1.0, 2.0, 3.0).min(), -1.0); /// assert_eq!(Vector3::new(1.0, 2.0, 3.0).min(), 1.0); + /// assert_eq!(Vector3::::new(5, 2, 3).min(), 2); /// ``` #[inline] pub fn min(&self) -> N - where N: PartialOrd + Signed { + where N: PartialOrd + Zero { self.xcmp(|e| e, Ordering::Less) } } \ No newline at end of file