From 9c37c512039059281b210521cfd53e931f5fa0b5 Mon Sep 17 00:00:00 2001 From: George Burton Date: Tue, 18 Dec 2018 14:44:53 +0000 Subject: [PATCH 1/3] Update dependencies, and fix tests from fallout --- Cargo.toml | 11 ++++++----- nalgebra-lapack/Cargo.toml | 4 ++-- src/geometry/quaternion_construction.rs | 5 +++-- src/geometry/rotation_specialization.rs | 8 +++++--- src/geometry/unit_complex.rs | 3 ++- 5 files changed, 18 insertions(+), 13 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index f80c5f79..47c3efe9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,21 +28,22 @@ alloc = [ ] [dependencies] typenum = "1.10" -generic-array = "0.11" -rand = { version = "0.5", default-features = false } +generic-array = "0.12" +rand = { version = "0.6", default-features = false } num-traits = { version = "0.2", default-features = false } num-complex = { version = "0.2", default-features = false } approx = { version = "0.3", default-features = false } alga = { version = "0.7", default-features = false } -matrixmultiply = { version = "0.1", optional = true } +matrixmultiply = { version = "0.2", optional = true } serde = { version = "1.0", optional = true } serde_derive = { version = "1.0", optional = true } -abomonation = { version = "0.5", optional = true } +abomonation = { version = "0.7", optional = true } mint = { version = "0.5", optional = true } -quickcheck = { version = "0.6", optional = true } +quickcheck = { version = "0.7", optional = true } [dev-dependencies] serde_json = "1.0" +rand_xorshift = "0.1" [workspace] members = [ "nalgebra-lapack", "nalgebra-glm" ] diff --git a/nalgebra-lapack/Cargo.toml b/nalgebra-lapack/Cargo.toml index e21891c1..c59211ab 100644 --- a/nalgebra-lapack/Cargo.toml +++ b/nalgebra-lapack/Cargo.toml @@ -34,6 +34,6 @@ lapack-src = { version = "0.2", default-features = false } [dev-dependencies] nalgebra = { version = "0.16", path = "..", features = [ "arbitrary" ] } -quickcheck = "0.6" +quickcheck = "0.7" approx = "0.3" -rand = "0.5" +rand = "0.6" diff --git a/src/geometry/quaternion_construction.rs b/src/geometry/quaternion_construction.rs index e48bfaae..122eb883 100644 --- a/src/geometry/quaternion_construction.rs +++ b/src/geometry/quaternion_construction.rs @@ -693,12 +693,13 @@ where #[cfg(test)] mod tests { + extern crate rand_xorshift; use super::*; - use rand::{self, SeedableRng}; + use rand::SeedableRng; #[test] fn random_unit_quats_are_unit() { - let mut rng = rand::prng::XorShiftRng::from_seed([0xAB; 16]); + let mut rng = rand_xorshift::XorShiftRng::from_seed([0xAB; 16]); for _ in 0..1000 { let x = rng.gen::>(); assert!(relative_eq!(x.into_inner().norm(), 1.0)) diff --git a/src/geometry/rotation_specialization.rs b/src/geometry/rotation_specialization.rs index fa75ca04..960b3a4e 100644 --- a/src/geometry/rotation_specialization.rs +++ b/src/geometry/rotation_specialization.rs @@ -107,9 +107,10 @@ impl Rotation2 { /// /// # Example /// ``` + /// # #[macro_use] extern crate approx; /// # use nalgebra::Rotation2; /// let rot = Rotation2::new(1.78); - /// assert_eq!(rot.angle(), 1.78); + /// assert_relative_eq!(rot.angle(), 1.78); /// ``` #[inline] pub fn angle(&self) -> N { @@ -158,10 +159,11 @@ impl Rotation2 { /// /// # Example /// ``` + /// # #[macro_use] extern crate approx; /// # use nalgebra::Rotation2; /// let rot = Rotation2::new(0.78); /// let pow = rot.powf(2.0); - /// assert_eq!(pow.angle(), 2.0 * 0.78); + /// assert_relative_eq!(pow.angle(), 2.0 * 0.78); /// ``` #[inline] pub fn powf(&self, n: N) -> Rotation2 { @@ -566,7 +568,7 @@ impl Rotation3 { /// # use nalgebra::{Unit, Rotation3, Vector3}; /// let axis = Unit::new_normalize(Vector3::new(1.0, 2.0, 3.0)); /// let rot = Rotation3::from_axis_angle(&axis, 1.78); - /// assert_relative_eq!(rot.angle(), 1.78); + /// assert_eq!(rot.angle(), 1.78); /// ``` #[inline] pub fn angle(&self) -> N { diff --git a/src/geometry/unit_complex.rs b/src/geometry/unit_complex.rs index 14b31d2f..1f83d7f6 100644 --- a/src/geometry/unit_complex.rs +++ b/src/geometry/unit_complex.rs @@ -212,10 +212,11 @@ impl UnitComplex { /// /// # Example /// ``` + /// # #[macro_use] extern crate approx; /// # use nalgebra::UnitComplex; /// let rot = UnitComplex::new(0.78); /// let pow = rot.powf(2.0); - /// assert_eq!(pow.angle(), 2.0 * 0.78); + /// assert_relative_eq!(pow.angle(), 2.0 * 0.78); /// ``` #[inline] pub fn powf(&self, n: N) -> Self { From 6a4323d0ea66e2641edb40b5b1a64e3ae16549a9 Mon Sep 17 00:00:00 2001 From: George Burton Date: Tue, 18 Dec 2018 14:46:29 +0000 Subject: [PATCH 2/3] Fix unintentional change --- src/geometry/rotation_specialization.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/geometry/rotation_specialization.rs b/src/geometry/rotation_specialization.rs index 960b3a4e..ac7f4d63 100644 --- a/src/geometry/rotation_specialization.rs +++ b/src/geometry/rotation_specialization.rs @@ -568,7 +568,7 @@ impl Rotation3 { /// # use nalgebra::{Unit, Rotation3, Vector3}; /// let axis = Unit::new_normalize(Vector3::new(1.0, 2.0, 3.0)); /// let rot = Rotation3::from_axis_angle(&axis, 1.78); - /// assert_eq!(rot.angle(), 1.78); + /// assert_relative_eq!(rot.angle(), 1.78); /// ``` #[inline] pub fn angle(&self) -> N { From be8d1ce3ce59312cab3e15ab88d0397f83b9433e Mon Sep 17 00:00:00 2001 From: sebcrozet Date: Sat, 29 Dec 2018 14:22:24 +0100 Subject: [PATCH 3/3] Fix compilation errors related to rand. --- src/debug/random_orthogonal.rs | 1 + src/debug/random_sdp.rs | 1 + src/geometry/unit_complex_construction.rs | 3 +-- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/debug/random_orthogonal.rs b/src/debug/random_orthogonal.rs index da06805b..6d393a24 100644 --- a/src/debug/random_orthogonal.rs +++ b/src/debug/random_orthogonal.rs @@ -48,6 +48,7 @@ where Owned: Clone + Send, { fn arbitrary(g: &mut G) -> Self { + use rand::Rng; let dim = D::try_to_usize().unwrap_or(g.gen_range(1, 50)); Self::new(D::from_usize(dim), || N::arbitrary(g)) } diff --git a/src/debug/random_sdp.rs b/src/debug/random_sdp.rs index c78d1fd1..7835c775 100644 --- a/src/debug/random_sdp.rs +++ b/src/debug/random_sdp.rs @@ -49,6 +49,7 @@ where Owned: Clone + Send, { fn arbitrary(g: &mut G) -> Self { + use rand::Rng; let dim = D::try_to_usize().unwrap_or(g.gen_range(1, 50)); Self::new(D::from_usize(dim), || N::arbitrary(g)) } diff --git a/src/geometry/unit_complex_construction.rs b/src/geometry/unit_complex_construction.rs index d8917e41..fa4a0451 100644 --- a/src/geometry/unit_complex_construction.rs +++ b/src/geometry/unit_complex_construction.rs @@ -7,10 +7,9 @@ use rand::distributions::{Distribution, OpenClosed01, Standard}; use rand::Rng; use alga::general::Real; -use base::allocator::Allocator; use base::dimension::{U1, U2}; use base::storage::Storage; -use base::{DefaultAllocator, Unit, Vector}; +use base::{Unit, Vector}; use geometry::{Rotation2, UnitComplex}; impl UnitComplex {