From 7b9a3f2bb9d30c4d59e2bd33486b6eaf06a13fbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Crozet?= Date: Sat, 5 Jul 2014 10:24:43 +0200 Subject: [PATCH] Update to the last rust-nightly. Version of rustc: 0.11.0-nightly (459f155f81291c46633e86a480628b50304ffb1c 2014-07-04 23:46:44 +0000). --- Cargo.toml | 2 +- src/bench/mat.rs | 8 ++--- src/bench/vec.rs | 2 +- src/lib.rs | 8 ++--- src/na.rs | 20 ++++++------ src/structs/rot_macros.rs | 2 +- src/tests/mat.rs | 68 +++++++++++++++++++-------------------- src/tests/vec.rs | 34 ++++++++++---------- 8 files changed, 72 insertions(+), 72 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 682bde73..34029620 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "nalgebra" version = "0.1.0" -authors = [ "developer@crozet.re" ] +authors = [ "Sébastien Crozet " ] # FIXME: add the contributors. [[lib]] diff --git a/src/bench/mat.rs b/src/bench/mat.rs index 3b0e2fe1..613afb41 100644 --- a/src/bench/mat.rs +++ b/src/bench/mat.rs @@ -9,7 +9,7 @@ macro_rules! bench_mul_mat( let mut b: $t = random(); $bh.iter(|| { - for _ in range(0, 1000) { + for _ in range(0u, 1000) { b = a * b; } }) @@ -49,7 +49,7 @@ macro_rules! bench_mul_dmat( let mut b: DMat = DMat::new_random($nrows, $ncols); $bh.iter(|| { - for _ in range(0, 1000) { + for _ in range(0u, 1000) { b = a * b; } }) @@ -89,7 +89,7 @@ macro_rules! bench_mul_mat_vec( let mut v : $tv = random(); $bh.iter(|| { - for _ in range(0, 1000) { + for _ in range(0u, 1000) { v = m * v } }) @@ -129,7 +129,7 @@ macro_rules! bench_mul_dmat_dvec( let mut v : DVec = DVec::new_random($ncols); $bh.iter(|| { - for _ in range(0, 1000) { + for _ in range(0u, 1000) { v = m * v } }) diff --git a/src/bench/vec.rs b/src/bench/vec.rs index 2de2546e..6ea055d6 100644 --- a/src/bench/vec.rs +++ b/src/bench/vec.rs @@ -11,7 +11,7 @@ macro_rules! bench_dot_vec( let mut d = 0.0; $bh.iter(|| { - for _ in range(0, 1000) { + for _ in range(0u, 1000) { d = d + na::dot(&a, &b); } }) diff --git a/src/lib.rs b/src/lib.rs index ec36cc99..ba5b4d65 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -63,10 +63,10 @@ fn main() { let v: Vec3 = na::zero(); let m: Mat3 = na::one(); - let _ = m * v; // matrix-vector multiplication. - let _ = v * m; // vector-matrix multiplication. - let _ = m * m; // matrix-matrix multiplication. - let _ = v * 2.0; // vector-scalar multiplication. + let _ = m * v; // matrix-vector multiplication. + let _ = v * m; // vector-matrix multiplication. + let _ = m * m; // matrix-matrix multiplication. + let _ = v * 2.0f64; // vector-scalar multiplication. } ``` diff --git a/src/na.rs b/src/na.rs index a5702e49..3c03868e 100644 --- a/src/na.rs +++ b/src/na.rs @@ -245,7 +245,7 @@ pub fn perspective3d + Zero + One>(width: N, height: N, /// use nalgebra::na; /// /// fn main() { -/// let t = Iso3::new(Vec3::new(1.0, 1.0, 1.0), na::zero()); +/// let t = Iso3::new(Vec3::new(1.0f64, 1.0, 1.0), na::zero()); /// let trans = na::translation(&t); /// /// assert!(trans == Vec3::new(1.0, 1.0, 1.0)); @@ -264,7 +264,7 @@ pub fn translation>(m: &M) -> V { /// use nalgebra::na; /// /// fn main() { -/// let t = Iso3::new(Vec3::new(1.0, 1.0, 1.0), na::zero()); +/// let t = Iso3::new(Vec3::new(1.0f64, 1.0, 1.0), na::zero()); /// let itrans = na::inv_translation(&t); /// /// assert!(itrans == Vec3::new(-1.0, -1.0, -1.0)); @@ -293,7 +293,7 @@ pub fn append_translation>(m: &M, v: &V) -> M { /// use nalgebra::na; /// /// fn main() { -/// let t = Iso3::new(Vec3::new(1.0, 1.0, 1.0), na::zero()); +/// let t = Iso3::new(Vec3::new(1.0f64, 1.0, 1.0), na::zero()); /// let v = Vec3::new(2.0, 2.0, 2.0); /// /// let tv = na::translate(&t, &v); @@ -314,7 +314,7 @@ pub fn translate>(m: &M, v: &V) -> V { /// use nalgebra::na; /// /// fn main() { -/// let t = Iso3::new(Vec3::new(1.0, 1.0, 1.0), na::zero()); +/// let t = Iso3::new(Vec3::new(1.0f64, 1.0, 1.0), na::zero()); /// let v = Vec3::new(2.0, 2.0, 2.0); /// /// let tv = na::inv_translate(&t, &v); @@ -338,7 +338,7 @@ pub fn inv_translate>(m: &M, v: &V) -> V { /// use nalgebra::na; /// /// fn main() { -/// let t = Rot3::new(Vec3::new(1.0, 1.0, 1.0)); +/// let t = Rot3::new(Vec3::new(1.0f64, 1.0, 1.0)); /// /// assert!(na::approx_eq(&na::rotation(&t), &Vec3::new(1.0, 1.0, 1.0))); /// } @@ -357,7 +357,7 @@ pub fn rotation>(m: &M) -> V { /// use nalgebra::na; /// /// fn main() { -/// let t = Rot3::new(Vec3::new(1.0, 1.0, 1.0)); +/// let t = Rot3::new(Vec3::new(1.0f64, 1.0, 1.0)); /// /// assert!(na::approx_eq(&na::inv_rotation(&t), &Vec3::new(-1.0, -1.0, -1.0))); /// } @@ -376,7 +376,7 @@ pub fn inv_rotation>(m: &M) -> V { /// use nalgebra::na; /// /// fn main() { -/// let t = Rot3::new(Vec3::new(0.0, 0.0, 0.0)); +/// let t = Rot3::new(Vec3::new(0.0f64, 0.0, 0.0)); /// let v = Vec3::new(1.0, 1.0, 1.0); /// let rt = na::append_rotation(&t, &v); /// @@ -397,7 +397,7 @@ pub fn append_rotation>(m: &M, v: &V) -> M { /// use nalgebra::na; /// /// fn main() { -/// let t = Rot3::new(Vec3::new(0.0, 0.0, 0.0)); +/// let t = Rot3::new(Vec3::new(0.0f64, 0.0, 0.0)); /// let v = Vec3::new(1.0, 1.0, 1.0); /// let rt = na::prepend_rotation(&t, &v); /// @@ -422,7 +422,7 @@ pub fn prepend_rotation>(m: &M, v: &V) -> M { /// use nalgebra::na; /// /// fn main() { -/// let t = Rot3::new(Vec3::new(0.0, 0.0, 0.5 * Float::pi())); +/// let t = Rot3::new(Vec3::new(0.0f64, 0.0, 0.5 * Float::pi())); /// let v = Vec3::new(1.0, 0.0, 0.0); /// /// let tv = na::rotate(&t, &v); @@ -445,7 +445,7 @@ pub fn rotate>(m: &M, v: &V) -> V { /// use nalgebra::na; /// /// fn main() { -/// let t = Rot3::new(Vec3::new(0.0, 0.0, 0.5 * Float::pi())); +/// let t = Rot3::new(Vec3::new(0.0f64, 0.0, 0.5 * Float::pi())); /// let v = Vec3::new(1.0, 0.0, 0.0); /// /// let tv = na::inv_rotate(&t, &v); diff --git a/src/structs/rot_macros.rs b/src/structs/rot_macros.rs index 1a168080..7bcf8b38 100644 --- a/src/structs/rot_macros.rs +++ b/src/structs/rot_macros.rs @@ -5,7 +5,7 @@ macro_rules! submat_impl( impl $t { #[inline] pub fn submat<'r>(&'r self) -> &'r $submat { - &'r self.submat + &self.submat } } ) diff --git a/src/tests/mat.rs b/src/tests/mat.rs index 11730fc0..699305ed 100644 --- a/src/tests/mat.rs +++ b/src/tests/mat.rs @@ -7,7 +7,7 @@ use std::cmp::{min, max}; macro_rules! test_inv_mat_impl( ($t: ty) => ( - for _ in range(0, 10000) { + for _ in range(0u, 10000) { let randmat : $t = random(); assert!(na::approx_eq(&(na::inv(&randmat).unwrap() * randmat), &na::one())); @@ -17,7 +17,7 @@ macro_rules! test_inv_mat_impl( macro_rules! test_transpose_mat_impl( ($t: ty) => ( - for _ in range(0, 10000) { + for _ in range(0u, 10000) { let randmat : $t = random(); assert!(na::transpose(&na::transpose(&randmat)) == randmat); @@ -27,7 +27,7 @@ macro_rules! test_transpose_mat_impl( macro_rules! test_decomp_qr_impl( ($t: ty) => ( - for _ in range(0, 10000) { + for _ in range(0u, 10000) { let randmat : $t = random(); let (q, r) = decomp_qr(&randmat); @@ -100,7 +100,7 @@ fn test_inv_mat6() { #[test] fn test_rotation2() { - for _ in range(0, 10000) { + for _ in range(0u, 10000) { let randmat: na::Rot2 = na::one(); let ang = Vec1::new(abs::(random()) % Float::pi()); @@ -117,7 +117,7 @@ fn test_index_mat2() { #[test] fn test_inv_rotation3() { - for _ in range(0, 10000) { + for _ in range(0u, 10000) { let randmat: Rot3 = na::one(); let dir: Vec3 = random(); let ang = na::normalize(&dir) * (abs::(random()) % Float::pi()); @@ -148,11 +148,11 @@ fn test_cov_dmat() { 5, 3, [ - 4.0, 2.0, 0.60, - 4.2, 2.1, 0.59, - 3.9, 2.0, 0.58, - 4.3, 2.1, 0.62, - 4.1, 2.2, 0.63 + 4.0f64, 2.0, 0.60, + 4.2f64, 2.1, 0.59, + 3.9f64, 2.0, 0.58, + 4.3f64, 2.1, 0.62, + 4.1f64, 2.2, 0.63 ] ); @@ -160,9 +160,9 @@ fn test_cov_dmat() { 3, 3, [ - 0.025, 0.0075, 0.00175, - 0.0075, 0.007, 0.00135, - 0.00175, 0.00135, 0.00043 + 0.025f64, 0.0075, 0.00175, + 0.0075f64, 0.007, 0.00135, + 0.00175f64, 0.00135, 0.00043 ] ); @@ -175,14 +175,14 @@ fn test_transpose_dmat() { 8, 4, [ - 1, 2, 3, 4, - 5, 6, 7, 8, - 9, 10, 11, 12, - 13, 14, 15, 16, - 17, 18, 19, 20, - 21, 22, 23, 24, - 25, 26, 27, 28, - 29, 30, 31, 32 + 1u32,2, 3, 4, + 5, 6, 7, 8, + 9, 10, 11, 12, + 13, 14, 15, 16, + 17, 18, 19, 20, + 21, 22, 23, 24, + 25, 26, 27, 28, + 29, 30, 31, 32 ] ); @@ -195,14 +195,14 @@ fn test_dmat_from_vec() { 8, 4, [ - 1, 2, 3, 4, - 5, 6, 7, 8, - 9, 10, 11, 12, - 13, 14, 15, 16, - 17, 18, 19, 20, - 21, 22, 23, 24, - 25, 26, 27, 28, - 29, 30, 31, 32 + 1i32, 2, 3, 4, + 5, 6, 7, 8, + 9, 10, 11, 12, + 13, 14, 15, 16, + 17, 18, 19, 20, + 21, 22, 23, 24, + 25, 26, 27, 28, + 29, 30, 31, 32 ] ); @@ -210,10 +210,10 @@ fn test_dmat_from_vec() { 8, 4, [ - 1, 5, 9, 13, 17, 21, 25, 29, - 2, 6, 10, 14, 18, 22, 26, 30, - 3, 7, 11, 15, 19, 23, 27, 31, - 4, 8, 12, 16, 20, 24, 28, 32 + 1i32, 5, 9, 13, 17, 21, 25, 29, + 2i32, 6, 10, 14, 18, 22, 26, 30, + 3i32, 7, 11, 15, 19, 23, 27, 31, + 4i32, 8, 12, 16, 20, 24, 28, 32 ] ); @@ -224,7 +224,7 @@ fn test_dmat_from_vec() { #[test] fn test_decomp_qr() { - for _ in range(0, 10) { + for _ in range(0u, 10) { let dim1: uint = random(); let dim2: uint = random(); let rows = min(40, max(dim1, dim2)); diff --git a/src/tests/vec.rs b/src/tests/vec.rs index 99efd08e..97bb94e0 100644 --- a/src/tests/vec.rs +++ b/src/tests/vec.rs @@ -5,7 +5,7 @@ use na; macro_rules! test_iterator_impl( ($t: ty, $n: ty) => ( - for _ in range(0, 10000) { + for _ in range(0u, 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(0, 10000) { + for _ in range(0u, 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(0, 10000) { + for _ in range(0u, 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(0, 10000) { + for _ in range(0u, 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(0, 10000) { + for _ in range(0u, 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(0, 10000) { + for _ in range(0u, 10000) { let v1 : Vec3 = random(); let v2 : Vec3 = random(); let v3 : Vec3 = na::cross(&v1, &v2); @@ -287,30 +287,30 @@ fn test_iterator_vec6() { #[test] fn test_ord_vec3() { // equality - assert!(Vec3::new(0.5, 0.5, 0.5) == Vec3::new(0.5, 0.5, 0.5)); - assert!(!(Vec3::new(1.5, 0.5, 0.5) == Vec3::new(0.5, 0.5, 0.5))); - assert!(Vec3::new(1.5, 0.5, 0.5) != Vec3::new(0.5, 0.5, 0.5)); + assert!(Vec3::new(0.5f64, 0.5, 0.5) == Vec3::new(0.5, 0.5, 0.5)); + assert!(!(Vec3::new(1.5f64, 0.5, 0.5) == Vec3::new(0.5, 0.5, 0.5))); + assert!(Vec3::new(1.5f64, 0.5, 0.5) != Vec3::new(0.5, 0.5, 0.5)); // comparable - assert!(na::partial_cmp(&Vec3::new(0.5, 0.3, 0.3), &Vec3::new(1.0, 2.0, 1.0)).is_le()); - assert!(na::partial_cmp(&Vec3::new(0.5, 0.3, 0.3), &Vec3::new(1.0, 2.0, 1.0)).is_lt()); - assert!(na::partial_cmp(&Vec3::new(2.0, 4.0, 2.0), &Vec3::new(1.0, 2.0, 1.0)).is_ge()); - assert!(na::partial_cmp(&Vec3::new(2.0, 4.0, 2.0), &Vec3::new(1.0, 2.0, 1.0)).is_gt()); + assert!(na::partial_cmp(&Vec3::new(0.5f64, 0.3, 0.3), &Vec3::new(1.0, 2.0, 1.0)).is_le()); + assert!(na::partial_cmp(&Vec3::new(0.5f64, 0.3, 0.3), &Vec3::new(1.0, 2.0, 1.0)).is_lt()); + assert!(na::partial_cmp(&Vec3::new(2.0f64, 4.0, 2.0), &Vec3::new(1.0, 2.0, 1.0)).is_ge()); + assert!(na::partial_cmp(&Vec3::new(2.0f64, 4.0, 2.0), &Vec3::new(1.0, 2.0, 1.0)).is_gt()); // not comparable - assert!(na::partial_cmp(&Vec3::new(0.0, 3.0, 0.0), &Vec3::new(1.0, 2.0, 1.0)).is_not_comparable()); + assert!(na::partial_cmp(&Vec3::new(0.0f64, 3.0, 0.0), &Vec3::new(1.0, 2.0, 1.0)).is_not_comparable()); } #[test] fn test_min_max_vec3() { - assert_eq!(na::sup(&Vec3::new(1.0, 2.0, 3.0), &Vec3::new(3.0, 2.0, 1.0)), Vec3::new(3.0, 2.0, 3.0)); - assert_eq!(na::inf(&Vec3::new(1.0, 2.0, 3.0), &Vec3::new(3.0, 2.0, 1.0)), Vec3::new(1.0, 2.0, 1.0)); + assert_eq!(na::sup(&Vec3::new(1.0f64, 2.0, 3.0), &Vec3::new(3.0, 2.0, 1.0)), Vec3::new(3.0, 2.0, 3.0)); + assert_eq!(na::inf(&Vec3::new(1.0f64, 2.0, 3.0), &Vec3::new(3.0, 2.0, 1.0)), Vec3::new(1.0, 2.0, 1.0)); } #[test] fn test_outer_vec3() { assert_eq!( - na::outer(&Vec3::new(1.0, 2.0, 3.0), &Vec3::new(4.0, 5.0, 6.0)), + na::outer(&Vec3::new(1.0f64, 2.0, 3.0), &Vec3::new(4.0, 5.0, 6.0)), Mat3::new( 4.0, 5.0, 6.0, 8.0, 10.0, 12.0,