all -> iter().all

This commit is contained in:
Sébastien Crozet 2013-06-23 16:19:13 +00:00
parent 8dc9067121
commit 0a90e6e6d8
3 changed files with 6 additions and 6 deletions

View File

@ -22,7 +22,7 @@ pub fn zero_mat_with_dim<N: Zero + Copy>(dim: uint) -> DMat<N>
#[inline(always)]
pub fn is_zero_mat<N: Zero>(mat: &DMat<N>) -> bool
{ mat.mij.all(|e| e.is_zero()) }
{ mat.mij.iter().all(|e| e.is_zero()) }
#[inline(always)]
pub fn one_mat_with_dim<N: Copy + One + Zero>(dim: uint) -> DMat<N>

View File

@ -23,7 +23,7 @@ pub fn zero_vec_with_dim<N: Zero + Copy>(dim: uint) -> DVec<N>
#[inline(always)]
pub fn is_zero_vec<N: Zero>(vec: &DVec<N>) -> bool
{ vec.at.all(|e| e.is_zero()) }
{ vec.at.iter().all(|e| e.is_zero()) }
// FIXME: is Clone needed?
impl<N: Copy + DivisionRing + Algebraic + Clone + ApproxEq<N>> DVec<N>
@ -64,7 +64,7 @@ impl<N: Copy + DivisionRing + Algebraic + Clone + ApproxEq<N>> DVec<N>
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())

View File

@ -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())));
}
);
)