From 0a90e6e6d8f8569789d5c68c2054bdb67a52fe46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Crozet?= Date: Sun, 23 Jun 2013 16:19:13 +0000 Subject: [PATCH] all -> iter().all --- src/ndim/dmat.rs | 2 +- src/ndim/dvec.rs | 4 ++-- src/tests/vec.rs | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/ndim/dmat.rs b/src/ndim/dmat.rs index c15f0e5c..fcbb669e 100644 --- a/src/ndim/dmat.rs +++ b/src/ndim/dmat.rs @@ -22,7 +22,7 @@ pub fn zero_mat_with_dim(dim: uint) -> DMat #[inline(always)] pub fn is_zero_mat(mat: &DMat) -> bool -{ mat.mij.all(|e| e.is_zero()) } +{ mat.mij.iter().all(|e| e.is_zero()) } #[inline(always)] pub fn one_mat_with_dim(dim: uint) -> DMat diff --git a/src/ndim/dvec.rs b/src/ndim/dvec.rs index 9145cb85..ea1168b4 100644 --- a/src/ndim/dvec.rs +++ b/src/ndim/dvec.rs @@ -23,7 +23,7 @@ pub fn zero_vec_with_dim(dim: uint) -> DVec #[inline(always)] pub fn is_zero_vec(vec: &DVec) -> bool -{ vec.at.all(|e| e.is_zero()) } +{ vec.at.iter().all(|e| e.is_zero()) } // FIXME: is Clone needed? impl> DVec @@ -64,7 +64,7 @@ impl> DVec elt = elt - self.scalar_mul(&basis_element.dot(self)); - for res.each |v| + for res.iter().advance |v| { elt = elt - v.scalar_mul(&elt.dot(v)) }; if !elt.sqnorm().approx_eq(&Zero::zero()) diff --git a/src/tests/vec.rs b/src/tests/vec.rs index f6300733..f4393b31 100644 --- a/src/tests/vec.rs +++ b/src/tests/vec.rs @@ -79,7 +79,7 @@ macro_rules! test_basis_impl( |(e1, e2)| { e1 == e2 || e1.dot(e2).approx_eq(&Zero::zero()) } ); // check vectors form an orthonormal basis - assert!(basis.all(|e| e.norm().approx_eq(&One::one()))); + assert!(basis.iter().all(|e| e.norm().approx_eq(&One::one()))); } ); ) @@ -93,14 +93,14 @@ macro_rules! test_subspace_basis_impl( let subbasis = v1.orthogonal_subspace_basis(); // check vectors are orthogonal to v1 - assert!(subbasis.all(|e| v1.dot(e).approx_eq(&Zero::zero()))); + assert!(subbasis.iter().all(|e| v1.dot(e).approx_eq(&Zero::zero()))); // check vectors form an ortogonal basis assert!( do subbasis.iter().zip(subbasis.iter()).all |(e1, e2)| { e1 == e2 || e1.dot(e2).approx_eq(&Zero::zero()) } ); // check vectors form an orthonormal basis - assert!(subbasis.all(|e| e.norm().approx_eq(&One::one()))); + assert!(subbasis.iter().all(|e| e.norm().approx_eq(&One::one()))); } ); )