diff --git a/benches/dmat.rs b/benches/dmat.rs index 0fc3cbe0..96b07324 100644 --- a/benches/dmat.rs +++ b/benches/dmat.rs @@ -11,7 +11,7 @@ macro_rules! bench_mul_dmat( let a: DMat = DMat::new_random($nrows, $ncols); let mut b: DMat = DMat::new_random($nrows, $ncols); - for _ in range(0us, 1000) { + for _ in (0us .. 1000) { // XXX: the clone here is highly undesirable! b = a.clone() * b; } @@ -53,7 +53,7 @@ macro_rules! bench_mul_dmat_dvec( let m : DMat = DMat::new_random($nrows, $ncols); let mut v : DVec = DVec::new_random($ncols); - for _ in range(0us, 1000) { + for _ in (0us .. 1000) { // XXX: the clone here is highly undesirable! v = m.clone() * v } diff --git a/src/lib.rs b/src/lib.rs index cb819222..0a2f50ed 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -81,6 +81,7 @@ Feel free to add your project to this list if you happen to use **nalgebra**! #![deny(non_upper_case_globals)] #![deny(unused_qualifications)] #![deny(unused_results)] +// #![allow(unstable)] #![warn(missing_docs)] #![feature(old_orphan_check)] #![feature(unboxed_closures)] diff --git a/src/linalg/decompositions.rs b/src/linalg/decompositions.rs index 9c14e61d..b4379ee0 100644 --- a/src/linalg/decompositions.rs +++ b/src/linalg/decompositions.rs @@ -22,8 +22,8 @@ pub fn householder_matrix(dim: usize, start: usize, vec: V) -> M assert!(dim >= stop); - for j in range(start, stop) { - for i in range(start, stop) { + for j in (start .. stop) { + for i in (start .. stop) { unsafe { let vv = vec.unsafe_at(i - start) * vec.unsafe_at(j - start); let qkij = qk.unsafe_at((i, j)); @@ -50,7 +50,7 @@ pub fn qr(m: &M) -> (M, M) let iterations = min(rows - 1, cols); - for ite in range(0us, iterations) { + for ite in (0us .. iterations) { let mut v = r.col_slice(ite, ite, rows); let alpha = if unsafe { v.unsafe_at(ite) } >= ::zero() { @@ -85,18 +85,18 @@ pub fn eigen_qr(m: &M, eps: &N, niter: usize) -> (M, V) // let mut shifter: M = Eye::new_identity(rows); let mut iter = 0us; - for _ in range(0, niter) { + for _ in (0 .. niter) { let mut stop = true; - for j in range(0, ::dim::()) { - for i in range(0, j) { + for j in (0 .. ::dim::()) { + for i in (0 .. j) { if unsafe { eigenvalues.unsafe_at((i, j)) }.abs() >= *eps { stop = false; break; } } - for i in range(j + 1, ::dim::()) { + for i in (j + 1 .. ::dim::()) { if unsafe { eigenvalues.unsafe_at((i, j)) }.abs() >= *eps { stop = false; break; diff --git a/src/structs/dmat.rs b/src/structs/dmat.rs index cc6d3195..44d7dd2d 100644 --- a/src/structs/dmat.rs +++ b/src/structs/dmat.rs @@ -131,7 +131,7 @@ impl DMat { DMat { nrows: nrows, ncols: ncols, - mij: range(0, nrows * ncols).map(|i| { let m = i / nrows; f(i - m * nrows, m) }).collect() + mij: (0 .. nrows * ncols).map(|i| { let m = i / nrows; f(i - m * nrows, m) }).collect() } } @@ -157,14 +157,14 @@ impl DMat { /// Gets a reference to this matrix data. /// The returned vector contains the matrix data in column-major order. #[inline] - pub fn as_vec<'r>(&'r self) -> &'r [N] { - self.mij.as_slice() + pub fn as_vec(&self) -> &[N] { + &self.mij[] } /// Gets a mutable reference to this matrix data. /// The returned vector contains the matrix data in column-major order. #[inline] - pub fn as_mut_vec<'r>(&'r mut self) -> &'r mut [N] { + pub fn as_mut_vec(&mut self) -> &mut [N] { self.mij.as_mut_slice() } } @@ -181,7 +181,7 @@ impl Eye for DMat { fn new_identity(dim: usize) -> DMat { let mut res = DMat::new_zeros(dim, dim); - for i in range(0us, dim) { + for i in (0us .. dim) { let _1: N = ::one(); res[(i, i)] = _1; } @@ -238,7 +238,7 @@ impl Indexable<(usize, usize), N> for DMat { unsafe fn unsafe_at(&self, rowcol: (usize, usize)) -> N { let (row, col) = rowcol; - *self.mij.as_slice().get_unchecked(self.offset(row, col)) + *self.mij[].get_unchecked(self.offset(row, col)) } #[inline] @@ -270,7 +270,7 @@ impl Index<(usize, usize)> for DMat { assert!(j < self.ncols); unsafe { - self.mij.as_slice().get_unchecked(self.offset(i, j)) + self.mij[].get_unchecked(self.offset(i, j)) } } } @@ -298,12 +298,12 @@ impl + Add + Zero> Mul> for let mut res = unsafe { DMat::new_uninitialized(self.nrows, right.ncols) }; - for i in range(0us, self.nrows) { - for j in range(0us, right.ncols) { + for i in (0us .. self.nrows) { + for j in (0us .. right.ncols) { let mut acc: N = ::zero(); unsafe { - for k in range(0us, self.ncols) { + for k in (0us .. self.ncols) { acc = acc + self.unsafe_at((i, k)) * right.unsafe_at((k, j)); } @@ -325,10 +325,10 @@ impl + Mul + Zero> Mul> for let mut res : DVec = unsafe { DVec::new_uninitialized(self.nrows) }; - for i in range(0us, self.nrows) { + for i in (0us .. self.nrows) { let mut acc: N = ::zero(); - for j in range(0us, self.ncols) { + for j in (0us .. self.ncols) { unsafe { acc = acc + self.unsafe_at((i, j)) * right.unsafe_at(j); } @@ -350,10 +350,10 @@ impl + Mul + Zero> Mul> for let mut res : DVec = unsafe { DVec::new_uninitialized(right.ncols) }; - for i in range(0us, right.ncols) { + for i in (0us .. right.ncols) { let mut acc: N = ::zero(); - for j in range(0us, right.nrows) { + for j in (0us .. right.nrows) { unsafe { acc = acc + self.unsafe_at(j) * right.unsafe_at((j, i)); } @@ -385,7 +385,7 @@ impl Inv for DMat { let mut res: DMat = Eye::new_identity(dim); // inversion using Gauss-Jordan elimination - for k in range(0us, dim) { + for k in (0us .. dim) { // search a non-zero value on the k-th column // FIXME: would it be worth it to spend some more time searching for the // max instead? @@ -406,7 +406,7 @@ impl Inv for DMat { // swap pivot line if n0 != k { - for j in range(0us, dim) { + for j in (0us .. dim) { let off_n0_j = self.offset(n0, j); let off_k_j = self.offset(k, j); @@ -418,26 +418,26 @@ impl Inv for DMat { unsafe { let pivot = self.unsafe_at((k, k)); - for j in range(k, dim) { + for j in (k .. dim) { let selfval = self.unsafe_at((k, j)) / pivot; self.unsafe_set((k, j), selfval); } - for j in range(0us, dim) { + for j in (0us .. dim) { let resval = res.unsafe_at((k, j)) / pivot; res.unsafe_set((k, j), resval); } - for l in range(0us, dim) { + for l in (0us .. dim) { if l != k { let normalizer = self.unsafe_at((l, k)); - for j in range(k, dim) { + for j in (k .. dim) { let selfval = self.unsafe_at((l, j)) - self.unsafe_at((k, j)) * normalizer; self.unsafe_set((l, j), selfval); } - for j in range(0us, dim) { + for j in (0us .. dim) { let resval = res.unsafe_at((l, j)) - res.unsafe_at((k, j)) * normalizer; res.unsafe_set((l, j), resval); } @@ -465,8 +465,8 @@ impl Transpose for DMat { else { let mut res = unsafe { DMat::new_uninitialized(self.ncols, self.nrows) }; - for i in range(0us, self.nrows) { - for j in range(0us, self.ncols) { + for i in (0us .. self.nrows) { + for j in (0us .. self.ncols) { unsafe { res.unsafe_set((j, i), self.unsafe_at((i, j))) } @@ -480,8 +480,8 @@ impl Transpose for DMat { #[inline] fn transpose(&mut self) { if self.nrows == self.ncols { - for i in range(1us, self.nrows) { - for j in range(0us, self.ncols - 1) { + for i in (1us .. self.nrows) { + for j in (0us .. self.ncols - 1) { let off_i_j = self.offset(i, j); let off_j_i = self.offset(j, i); @@ -503,8 +503,8 @@ impl + Clone> Mean> for DMat { let mut res: DVec = DVec::new_zeros(self.ncols); let normalizer: N = Cast::from(1.0f64 / Cast::from(self.nrows)); - for i in range(0us, self.nrows) { - for j in range(0us, self.ncols) { + for i in (0us .. self.nrows) { + for j in (0us .. self.ncols) { unsafe { let acc = res.unsafe_at(j) + self.unsafe_at((i, j)) * normalizer; res.unsafe_set(j, acc); @@ -525,8 +525,8 @@ impl + Clone> Cov> for DMat { let mean = self.mean(); // FIXME: use the rows iterator when available - for i in range(0us, self.nrows) { - for j in range(0us, self.ncols) { + for i in (0us .. self.nrows) { + for j in (0us .. self.ncols) { unsafe { centered.unsafe_set((i, j), self.unsafe_at((i, j)) - mean.unsafe_at(j)); } @@ -549,8 +549,7 @@ impl ColSlice> for DMat { // we can init from slice thanks to the matrix being column major let start= self.offset(row_start, col_id); let stop = self.offset(row_end, col_id); - let slice = DVec::from_slice( - row_end - row_start, self.mij.slice(start, stop)); + let slice = DVec::from_slice(row_end - row_start, &self.mij[start .. stop]); slice } } @@ -564,7 +563,7 @@ impl RowSlice> for DMat { DVec::new_uninitialized(self.nrows) }; let mut slice_idx = 0us; - for col_id in range(col_start, col_end) { + for col_id in (col_start .. col_end) { unsafe { slice.unsafe_set(slice_idx, self.unsafe_at((row_id, col_id))); } @@ -590,7 +589,7 @@ impl Diag> for DMat { assert!(diag.len() == smallest_dim); - for i in range(0, smallest_dim) { + for i in (0 .. smallest_dim) { unsafe { self.unsafe_set((i, i), diag.unsafe_at(i)) } } } @@ -601,7 +600,7 @@ impl Diag> for DMat { let mut diag: DVec = DVec::new_zeros(smallest_dim); - for i in range(0, smallest_dim) { + for i in (0 .. smallest_dim) { unsafe { diag.unsafe_set(i, self.unsafe_at((i, i))) } } @@ -635,8 +634,8 @@ impl> ApproxEq for DMat { impl Show for DMat { fn fmt(&self, form:&mut Formatter) -> Result { - for i in range(0us, self.nrows()) { - for j in range(0us, self.ncols()) { + for i in (0us .. self.nrows()) { + for j in (0us .. self.ncols()) { let _ = write!(form, "{} ", self[(i, j)]); } let _ = write!(form, "\n"); diff --git a/src/structs/dvec.rs b/src/structs/dvec.rs index 452234c5..36b78317 100644 --- a/src/structs/dvec.rs +++ b/src/structs/dvec.rs @@ -47,7 +47,7 @@ impl DVec { assert!(dim <= vec.len()); DVec { - at: vec.slice_to(dim).to_vec() + at: vec[.. dim].to_vec() } } } @@ -56,7 +56,7 @@ impl DVec { /// Builds a vector filled with the result of a function. #[inline(always)] pub fn from_fn N>(dim: usize, mut f: F) -> DVec { - DVec { at: range(0, dim).map(|i| f(i)).collect() } + DVec { at: (0 .. dim).map(|i| f(i)).collect() } } #[inline] diff --git a/src/structs/dvec_macros.rs b/src/structs/dvec_macros.rs index 7e25bb83..c64a8c4c 100644 --- a/src/structs/dvec_macros.rs +++ b/src/structs/dvec_macros.rs @@ -130,7 +130,7 @@ macro_rules! dvec_impl( fn axpy(&mut self, a: &N, x: &$dvec) { assert!(self.len() == x.len()); - for i in range(0, x.len()) { + for i in (0 .. x.len()) { unsafe { let self_i = self.unsafe_at(i); self.unsafe_set(i, self_i + *a * x.unsafe_at(i)) @@ -146,7 +146,7 @@ macro_rules! dvec_impl( pub fn canonical_basis_with_dim(dim: usize) -> Vec<$dvec> { let mut res : Vec<$dvec> = Vec::new(); - for i in range(0us, dim) { + for i in (0us .. dim) { let mut basis_element : $dvec = $dvec::new_zeros(dim); basis_element.set(i, ::one()); @@ -165,7 +165,7 @@ macro_rules! dvec_impl( let dim = self.len(); let mut res : Vec<$dvec> = Vec::new(); - for i in range(0us, dim) { + for i in (0us .. dim) { let mut basis_element : $dvec = $dvec::new_zeros(self.len()); basis_element.set(i, ::one()); @@ -276,7 +276,7 @@ macro_rules! dvec_impl( fn dot(&self, other: &$dvec) -> N { assert!(self.len() == other.len()); let mut res: N = ::zero(); - for i in range(0us, self.len()) { + for i in (0us .. self.len()) { res = res + unsafe { self.unsafe_at(i) * other.unsafe_at(i) }; } res @@ -486,7 +486,7 @@ macro_rules! small_dvec_from_impl ( let mut at: [N; $dim] = [ $( $zeros, )* ]; - for i in range(0, dim) { + for i in (0 .. dim) { at[i] = f(i); } diff --git a/src/structs/mat_macros.rs b/src/structs/mat_macros.rs index 53ae02a5..6bf7386d 100644 --- a/src/structs/mat_macros.rs +++ b/src/structs/mat_macros.rs @@ -419,7 +419,7 @@ macro_rules! diag_impl( #[inline] fn set_diag(&mut self, diag: &$tv) { - for i in range(0, $dim) { + for i in (0 .. $dim) { unsafe { self.unsafe_set((i, i), diag.unsafe_at(i)) } } } @@ -428,7 +428,7 @@ macro_rules! diag_impl( fn diag(&self) -> $tv { let mut diag: $tv = ::zero(); - for i in range(0, $dim) { + for i in (0 .. $dim) { unsafe { diag.unsafe_set(i, self.unsafe_at((i, i))) } } @@ -447,12 +447,12 @@ macro_rules! mat_mul_mat_impl( // careful! we need to comute other * self here (self is the rhs). let mut res: $t = ::zero(); - for i in range(0us, $dim) { - for j in range(0us, $dim) { + for i in (0us .. $dim) { + for j in (0us .. $dim) { let mut acc: N = ::zero(); unsafe { - for k in range(0us, $dim) { + for k in (0us .. $dim) { acc = acc + self.at_fast((i, k)) * right.at_fast((k, j)); } @@ -476,8 +476,8 @@ macro_rules! vec_mul_mat_impl( fn mul(self, right: $t) -> $v { let mut res : $v = $zero(); - for i in range(0us, $dim) { - for j in range(0us, $dim) { + for i in (0us .. $dim) { + for j in (0us .. $dim) { unsafe { let val = res.at_fast(i) + self.at_fast(j) * right.at_fast((j, i)); res.set_fast(i, val) @@ -500,8 +500,8 @@ macro_rules! mat_mul_vec_impl( fn mul(self, right: $v) -> $v { let mut res : $v = $zero(); - for i in range(0us, $dim) { - for j in range(0us, $dim) { + for i in (0us .. $dim) { + for j in (0us .. $dim) { unsafe { let val = res.at_fast(i) + self.at_fast((i, j)) * right.at_fast(j); res.set_fast(i, val) @@ -546,7 +546,7 @@ macro_rules! inv_impl( let mut res: $t = ::one(); // inversion using Gauss-Jordan elimination - for k in range(0us, $dim) { + for k in (0us .. $dim) { // search a non-zero value on the k-th column // FIXME: would it be worth it to spend some more time searching for the // max instead? @@ -567,7 +567,7 @@ macro_rules! inv_impl( // swap pivot line if n0 != k { - for j in range(0us, $dim) { + for j in (0us .. $dim) { self.swap((n0, j), (k, j)); res.swap((n0, j), (k, j)); } @@ -575,26 +575,26 @@ macro_rules! inv_impl( let pivot = self.at((k, k)); - for j in range(k, $dim) { + for j in (k .. $dim) { let selfval = self.at((k, j)) / pivot; self.set((k, j), selfval); } - for j in range(0us, $dim) { + for j in (0us .. $dim) { let resval = res.at((k, j)) / pivot; res.set((k, j), resval); } - for l in range(0us, $dim) { + for l in (0us .. $dim) { if l != k { let normalizer = self.at((l, k)); - for j in range(k, $dim) { + for j in (k .. $dim) { let selfval = self.at((l, j)) - self.at((k, j)) * normalizer; self.set((l, j), selfval); } - for j in range(0us, $dim) { + for j in (0us .. $dim) { let resval = res.at((l, j)) - res.at((k, j)) * normalizer; res.set((l, j), resval); } @@ -623,8 +623,8 @@ macro_rules! transpose_impl( #[inline] fn transpose(&mut self) { - for i in range(1us, $dim) { - for j in range(0us, i) { + for i in (1us .. $dim) { + for j in (0us .. i) { self.swap((i, j), (j, i)) } } @@ -668,8 +668,8 @@ macro_rules! to_homogeneous_impl( fn to_homogeneous(&self) -> $t2 { let mut res: $t2 = ::one(); - for i in range(0us, $dim) { - for j in range(0us, $dim) { + for i in (0us .. $dim) { + for j in (0us .. $dim) { res.set((i, j), self.at((i, j))) } } @@ -687,8 +687,8 @@ macro_rules! from_homogeneous_impl( fn from(m: &$t2) -> $t { let mut res: $t = ::one(); - for i in range(0us, $dim2) { - for j in range(0us, $dim2) { + for i in (0us .. $dim2) { + for j in (0us .. $dim2) { res.set((i, j), m.at((i, j))) } } @@ -708,8 +708,8 @@ macro_rules! outer_impl( #[inline] fn outer(&self, other: &$t) -> $m { let mut res: $m = ::zero(); - for i in range(0us, Dim::dim(None::<$t>)) { - for j in range(0us, Dim::dim(None::<$t>)) { + for i in (0us .. Dim::dim(None::<$t>)) { + for j in (0us .. Dim::dim(None::<$t>)) { res.set((i, j), self.at(i) * other.at(j)) } } diff --git a/src/structs/rot.rs b/src/structs/rot.rs index e80733a0..384cf2c4 100644 --- a/src/structs/rot.rs +++ b/src/structs/rot.rs @@ -270,8 +270,7 @@ Rotation> for Rot3 { } } -impl -Rand for Rot3 { +impl Rand for Rot3 { #[inline] fn rand(rng: &mut R) -> Rot3 { Rot3::new(rng.gen()) diff --git a/src/structs/vec_macros.rs b/src/structs/vec_macros.rs index 013e831b..4f083b5b 100644 --- a/src/structs/vec_macros.rs +++ b/src/structs/vec_macros.rs @@ -310,7 +310,7 @@ macro_rules! basis_impl( impl> Basis for $t { #[inline] fn canonical_basis) -> bool>(mut f: F) { - for i in range(0us, $dim) { + for i in (0us .. $dim) { if !f(Basis::canonical_basis_element(i).unwrap()) { return } } } @@ -321,7 +321,7 @@ macro_rules! basis_impl( // orthogonalization algorithm let mut basis: Vec<$t> = Vec::new(); - for i in range(0us, $dim) { + for i in (0us .. $dim) { let mut basis_element : $t = ::zero(); unsafe { diff --git a/tests/mat.rs b/tests/mat.rs index b1c884fc..c67e6985 100644 --- a/tests/mat.rs +++ b/tests/mat.rs @@ -6,7 +6,7 @@ use na::{Vec1, Vec3, Mat1, Mat2, Mat3, Mat4, Mat5, Mat6, Rot3, Persp3, PerspMat3 macro_rules! test_inv_mat_impl( ($t: ty) => ( - for _ in range(0us, 10000) { + for _ in (0us .. 10000) { let randmat : $t = random(); match na::inv(&randmat) { @@ -19,7 +19,7 @@ macro_rules! test_inv_mat_impl( macro_rules! test_transpose_mat_impl( ($t: ty) => ( - for _ in range(0us, 10000) { + for _ in (0us .. 10000) { let randmat : $t = random(); assert!(na::transpose(&na::transpose(&randmat)) == randmat); @@ -29,7 +29,7 @@ macro_rules! test_transpose_mat_impl( macro_rules! test_qr_impl( ($t: ty) => ( - for _ in range(0us, 10000) { + for _ in (0us .. 10000) { let randmat : $t = random(); let (q, r) = na::qr(&randmat); @@ -43,7 +43,7 @@ macro_rules! test_qr_impl( // NOTE: deactivated untile we get a better convergence rate. // macro_rules! test_eigen_qr_impl( // ($t: ty) => { -// for _ in range(0us, 10000) { +// for _ in (0us .. 10000) { // let randmat : $t = random(); // // Make it symetric so that we can recompose the matrix to test at the end. // let randmat = na::transpose(&randmat) * randmat; @@ -125,7 +125,7 @@ fn test_inv_mat6() { #[test] fn test_rotation2() { - for _ in range(0us, 10000) { + for _ in (0us .. 10000) { let randmat: na::Rot2 = na::one(); let ang = Vec1::new(na::abs(&random::()) % BaseFloat::pi()); @@ -142,7 +142,7 @@ fn test_index_mat2() { #[test] fn test_inv_rotation3() { - for _ in range(0us, 10000) { + for _ in (0us .. 10000) { let randmat: Rot3 = na::one(); let dir: Vec3 = random(); let ang = na::normalize(&dir) * (na::abs(&random::()) % BaseFloat::pi()); @@ -250,7 +250,7 @@ fn test_dmat_from_vec() { /* FIXME: review qr decomposition to make it work with DMat. #[test] fn test_qr() { - for _ in range(0us, 10) { + for _ in (0us .. 10) { let dim1: usize = random(); let dim2: usize = random(); let rows = min(40, max(dim1, dim2)); diff --git a/tests/quat.rs b/tests/quat.rs index df8a34c0..c9f76b30 100644 --- a/tests/quat.rs +++ b/tests/quat.rs @@ -5,7 +5,7 @@ use std::rand::random; #[test] fn test_quat_as_mat() { - for _ in range(0us, 10000) { + for _ in (0us .. 10000) { let axis_angle: Vec3 = random(); assert!(na::approx_eq(&UnitQuat::new(axis_angle).to_rot(), &Rot3::new(axis_angle))) @@ -14,7 +14,7 @@ fn test_quat_as_mat() { #[test] fn test_quat_mul_vec_or_pnt_as_mat() { - for _ in range(0us, 10000) { + for _ in (0us .. 10000) { let axis_angle: Vec3 = random(); let vec: Vec3 = random(); let pnt: Pnt3 = random(); @@ -31,7 +31,7 @@ fn test_quat_mul_vec_or_pnt_as_mat() { #[test] fn test_quat_div_quat() { - for _ in range(0us, 10000) { + for _ in (0us .. 10000) { let axis_angle1: Vec3 = random(); let axis_angle2: Vec3 = random(); @@ -47,7 +47,7 @@ fn test_quat_div_quat() { #[test] fn test_quat_to_axis_angle() { - for _ in range(0us, 10000) { + for _ in (0us .. 10000) { let axis_angle: Vec3 = random(); let q = UnitQuat::new(axis_angle); @@ -59,7 +59,7 @@ fn test_quat_to_axis_angle() { #[test] fn test_quat_euler_angles() { - for _ in range(0us, 10000) { + for _ in (0us .. 10000) { let angles: Vec3 = random(); let q = UnitQuat::new_with_euler_angles(angles.x, angles.y, angles.z); diff --git a/tests/vec.rs b/tests/vec.rs index 44105f08..dab3e9a4 100644 --- a/tests/vec.rs +++ b/tests/vec.rs @@ -5,7 +5,7 @@ use na::{Vec0, Vec1, Vec2, Vec3, Vec4, Vec5, Vec6, Mat3, Iterable, IterableMut}; macro_rules! test_iterator_impl( ($t: ty, $n: ty) => ( - for _ in range(0us, 10000) { + for _ in (0us .. 10000) { let v: $t = random(); let mut mv: $t = v.clone(); let n: $n = random(); @@ -23,7 +23,7 @@ macro_rules! test_iterator_impl( macro_rules! test_commut_dot_impl( ($t: ty) => ( - for _ in range(0us, 10000) { + for _ in (0us .. 10000) { let v1 : $t = random(); let v2 : $t = random(); @@ -34,7 +34,7 @@ macro_rules! test_commut_dot_impl( macro_rules! test_scalar_op_impl( ($t: ty, $n: ty) => ( - for _ in range(0us, 10000) { + for _ in (0us .. 10000) { let v1 : $t = random(); let n : $n = random(); @@ -57,7 +57,7 @@ macro_rules! test_scalar_op_impl( macro_rules! test_basis_impl( ($t: ty) => ( - for _ in range(0us, 10000) { + for _ in (0us .. 10000) { na::canonical_basis(|e1: $t| { na::canonical_basis(|e2: $t| { assert!(e1 == e2 || na::approx_eq(&na::dot(&e1, &e2), &na::zero())); @@ -75,7 +75,7 @@ macro_rules! test_basis_impl( macro_rules! test_subspace_basis_impl( ($t: ty) => ( - for _ in range(0us, 10000) { + for _ in (0us .. 10000) { let v : $t = random(); let v1 = na::normalize(&v); @@ -99,7 +99,7 @@ macro_rules! test_subspace_basis_impl( #[test] fn test_cross_vec3() { - for _ in range(0us, 10000) { + for _ in (0us .. 10000) { let v1 : Vec3 = random(); let v2 : Vec3 = random(); let v3 : Vec3 = na::cross(&v1, &v2);