diff --git a/Cargo.toml b/Cargo.toml index d44431c1..736b9738 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,6 +11,7 @@ readme = "README.md" categories = [ "science" ] keywords = [ "linear", "algebra", "matrix", "vector", "math" ] license = "BSD-3-Clause" +edition = "2018" exclude = ["/ci/*", "/.travis.yml", "/Makefile"] diff --git a/benches/linalg/schur.rs b/benches/linalg/schur.rs index ce0b741f..024e6114 100644 --- a/benches/linalg/schur.rs +++ b/benches/linalg/schur.rs @@ -9,19 +9,19 @@ fn schur_decompose_4x4(bh: &mut Bencher) { #[bench] fn schur_decompose_10x10(bh: &mut Bencher) { - let m = ::reproductible_dmatrix(10, 10); + let m = crate::reproductible_dmatrix(10, 10); bh.iter(|| test::black_box(Schur::new(m.clone()))) } #[bench] fn schur_decompose_100x100(bh: &mut Bencher) { - let m = ::reproductible_dmatrix(100, 100); + let m = crate::reproductible_dmatrix(100, 100); bh.iter(|| test::black_box(Schur::new(m.clone()))) } #[bench] fn schur_decompose_200x200(bh: &mut Bencher) { - let m = ::reproductible_dmatrix(200, 200); + let m = crate::reproductible_dmatrix(200, 200); bh.iter(|| test::black_box(Schur::new(m.clone()))) } @@ -33,18 +33,18 @@ fn eigenvalues_4x4(bh: &mut Bencher) { #[bench] fn eigenvalues_10x10(bh: &mut Bencher) { - let m = ::reproductible_dmatrix(10, 10); + let m = crate::reproductible_dmatrix(10, 10); bh.iter(|| test::black_box(m.complex_eigenvalues())) } #[bench] fn eigenvalues_100x100(bh: &mut Bencher) { - let m = ::reproductible_dmatrix(100, 100); + let m = crate::reproductible_dmatrix(100, 100); bh.iter(|| test::black_box(m.complex_eigenvalues())) } #[bench] fn eigenvalues_200x200(bh: &mut Bencher) { - let m = ::reproductible_dmatrix(200, 200); + let m = crate::reproductible_dmatrix(200, 200); bh.iter(|| test::black_box(m.complex_eigenvalues())) } diff --git a/benches/linalg/svd.rs b/benches/linalg/svd.rs index 47023804..956ba4a7 100644 --- a/benches/linalg/svd.rs +++ b/benches/linalg/svd.rs @@ -9,19 +9,19 @@ fn svd_decompose_4x4(bh: &mut Bencher) { #[bench] fn svd_decompose_10x10(bh: &mut Bencher) { - let m = ::reproductible_dmatrix(10, 10); + let m = crate::reproductible_dmatrix(10, 10); bh.iter(|| test::black_box(SVD::new(m.clone(), true, true))) } #[bench] fn svd_decompose_100x100(bh: &mut Bencher) { - let m = ::reproductible_dmatrix(100, 100); + let m = crate::reproductible_dmatrix(100, 100); bh.iter(|| test::black_box(SVD::new(m.clone(), true, true))) } #[bench] fn svd_decompose_200x200(bh: &mut Bencher) { - let m = ::reproductible_dmatrix(200, 200); + let m = crate::reproductible_dmatrix(200, 200); bh.iter(|| test::black_box(SVD::new(m.clone(), true, true))) } @@ -33,19 +33,19 @@ fn rank_4x4(bh: &mut Bencher) { #[bench] fn rank_10x10(bh: &mut Bencher) { - let m = ::reproductible_dmatrix(10, 10); + let m = crate::reproductible_dmatrix(10, 10); bh.iter(|| test::black_box(m.rank(1.0e-10))) } #[bench] fn rank_100x100(bh: &mut Bencher) { - let m = ::reproductible_dmatrix(100, 100); + let m = crate::reproductible_dmatrix(100, 100); bh.iter(|| test::black_box(m.rank(1.0e-10))) } #[bench] fn rank_200x200(bh: &mut Bencher) { - let m = ::reproductible_dmatrix(200, 200); + let m = crate::reproductible_dmatrix(200, 200); bh.iter(|| test::black_box(m.rank(1.0e-10))) } @@ -57,19 +57,19 @@ fn singular_values_4x4(bh: &mut Bencher) { #[bench] fn singular_values_10x10(bh: &mut Bencher) { - let m = ::reproductible_dmatrix(10, 10); + let m = crate::reproductible_dmatrix(10, 10); bh.iter(|| test::black_box(m.singular_values())) } #[bench] fn singular_values_100x100(bh: &mut Bencher) { - let m = ::reproductible_dmatrix(100, 100); + let m = crate::reproductible_dmatrix(100, 100); bh.iter(|| test::black_box(m.singular_values())) } #[bench] fn singular_values_200x200(bh: &mut Bencher) { - let m = ::reproductible_dmatrix(200, 200); + let m = crate::reproductible_dmatrix(200, 200); bh.iter(|| test::black_box(m.singular_values())) } @@ -81,18 +81,18 @@ fn pseudo_inverse_4x4(bh: &mut Bencher) { #[bench] fn pseudo_inverse_10x10(bh: &mut Bencher) { - let m = ::reproductible_dmatrix(10, 10); + let m = crate::reproductible_dmatrix(10, 10); bh.iter(|| test::black_box(m.clone().pseudo_inverse(1.0e-10))) } #[bench] fn pseudo_inverse_100x100(bh: &mut Bencher) { - let m = ::reproductible_dmatrix(100, 100); + let m = crate::reproductible_dmatrix(100, 100); bh.iter(|| test::black_box(m.clone().pseudo_inverse(1.0e-10))) } #[bench] fn pseudo_inverse_200x200(bh: &mut Bencher) { - let m = ::reproductible_dmatrix(200, 200); + let m = crate::reproductible_dmatrix(200, 200); bh.iter(|| test::black_box(m.clone().pseudo_inverse(1.0e-10))) } diff --git a/benches/linalg/symmetric_eigen.rs b/benches/linalg/symmetric_eigen.rs index 2a9058da..7f19eb78 100644 --- a/benches/linalg/symmetric_eigen.rs +++ b/benches/linalg/symmetric_eigen.rs @@ -9,18 +9,18 @@ fn symmetric_eigen_decompose_4x4(bh: &mut Bencher) { #[bench] fn symmetric_eigen_decompose_10x10(bh: &mut Bencher) { - let m = ::reproductible_dmatrix(10, 10); + let m = crate::reproductible_dmatrix(10, 10); bh.iter(|| test::black_box(SymmetricEigen::new(m.clone()))) } #[bench] fn symmetric_eigen_decompose_100x100(bh: &mut Bencher) { - let m = ::reproductible_dmatrix(100, 100); + let m = crate::reproductible_dmatrix(100, 100); bh.iter(|| test::black_box(SymmetricEigen::new(m.clone()))) } #[bench] fn symmetric_eigen_decompose_200x200(bh: &mut Bencher) { - let m = ::reproductible_dmatrix(200, 200); + let m = crate::reproductible_dmatrix(200, 200); bh.iter(|| test::black_box(SymmetricEigen::new(m.clone()))) } diff --git a/nalgebra-glm/Cargo.toml b/nalgebra-glm/Cargo.toml index 1da1333d..042c75fb 100644 --- a/nalgebra-glm/Cargo.toml +++ b/nalgebra-glm/Cargo.toml @@ -11,6 +11,7 @@ readme = "../README.md" categories = [ "science" ] keywords = [ "linear", "algebra", "matrix", "vector", "math" ] license = "BSD-3-Clause" +edition = "2018" [features] default = [ "std" ] diff --git a/nalgebra-glm/src/common.rs b/nalgebra-glm/src/common.rs index 021ac3ef..23103299 100644 --- a/nalgebra-glm/src/common.rs +++ b/nalgebra-glm/src/common.rs @@ -2,8 +2,8 @@ use na::{self, DefaultAllocator, Real}; use num::FromPrimitive; use std::mem; -use aliases::{TMat, TVec}; -use traits::{Alloc, Dimension, Number}; +use crate::aliases::{TMat, TVec}; +use crate::traits::{Alloc, Dimension, Number}; /// For each matrix or vector component `x` if `x >= 0`; otherwise, it returns `-x`. /// diff --git a/nalgebra-glm/src/constructors.rs b/nalgebra-glm/src/constructors.rs index 1651dd20..fb692d5c 100644 --- a/nalgebra-glm/src/constructors.rs +++ b/nalgebra-glm/src/constructors.rs @@ -1,7 +1,7 @@ #![cfg_attr(rustfmt, rustfmt_skip)] use na::{Scalar, Real, U2, U3, U4}; -use aliases::{TMat, Qua, TVec1, TVec2, TVec3, TVec4, TMat2, TMat2x3, TMat2x4, TMat3, TMat3x2, TMat3x4, +use crate::aliases::{TMat, Qua, TVec1, TVec2, TVec3, TVec4, TMat2, TMat2x3, TMat2x4, TMat3, TMat3x2, TMat3x4, TMat4, TMat4x2, TMat4x3}; diff --git a/nalgebra-glm/src/exponential.rs b/nalgebra-glm/src/exponential.rs index 21b716f2..e080805d 100644 --- a/nalgebra-glm/src/exponential.rs +++ b/nalgebra-glm/src/exponential.rs @@ -1,6 +1,6 @@ -use aliases::TVec; +use crate::aliases::TVec; use na::{DefaultAllocator, Real}; -use traits::{Alloc, Dimension}; +use crate::traits::{Alloc, Dimension}; /// Component-wise exponential. /// diff --git a/nalgebra-glm/src/ext/matrix_clip_space.rs b/nalgebra-glm/src/ext/matrix_clip_space.rs index 02179759..fe7cc973 100644 --- a/nalgebra-glm/src/ext/matrix_clip_space.rs +++ b/nalgebra-glm/src/ext/matrix_clip_space.rs @@ -1,4 +1,4 @@ -use aliases::TMat4; +use crate::aliases::TMat4; use na::{Real}; //pub fn frustum(left: N, right: N, bottom: N, top: N, near: N, far: N) -> TMat4 { @@ -95,7 +95,7 @@ pub fn ortho_lh(left: N, right: N, bottom: N, top: N, znear: N, zfar: N /// * `zfar` - Distance from the viewer to the far clipping plane /// pub fn ortho_lh_no(left: N, right: N, bottom: N, top: N, znear: N, zfar: N) -> TMat4 { - let two : N = ::convert(2.0); + let two : N = crate::convert(2.0); let mut mat : TMat4 = TMat4::::identity(); mat[(0, 0)] = two / (right - left); @@ -121,7 +121,7 @@ pub fn ortho_lh_no(left: N, right: N, bottom: N, top: N, znear: N, zfar /// pub fn ortho_lh_zo(left: N, right: N, bottom: N, top: N, znear: N, zfar: N) -> TMat4 { let one : N = N::one(); - let two : N = ::convert(2.0); + let two : N = crate::convert(2.0); let mut mat : TMat4 = TMat4::::identity(); mat[(0, 0)] = two / (right - left); @@ -176,7 +176,7 @@ pub fn ortho_rh(left: N, right: N, bottom: N, top: N, znear: N, zfar: N /// * `zfar` - Distance from the viewer to the far clipping plane /// pub fn ortho_rh_no(left: N, right: N, bottom: N, top: N, znear: N, zfar: N) -> TMat4 { - let two : N = ::convert(2.0); + let two : N = crate::convert(2.0); let mut mat : TMat4 = TMat4::::identity(); mat[(0, 0)] = two / (right - left); @@ -202,7 +202,7 @@ pub fn ortho_rh_no(left: N, right: N, bottom: N, top: N, znear: N, zfar /// pub fn ortho_rh_zo(left: N, right: N, bottom: N, top: N, znear: N, zfar: N) -> TMat4 { let one : N = N::one(); - let two : N = ::convert(2.0); + let two : N = crate::convert(2.0); let mut mat : TMat4 = TMat4::::identity(); mat[(0, 0)] = two / (right - left); @@ -285,13 +285,13 @@ pub fn perspective_fov_lh_no(fov: N, width: N, height: N, near: N, far: let mut mat = TMat4::zeros(); let rad = fov; - let h = (rad * ::convert(0.5)).cos() / (rad * ::convert(0.5)).sin(); + let h = (rad * crate::convert(0.5)).cos() / (rad * crate::convert(0.5)).sin(); let w = h * height / width; mat[(0, 0)] = w; mat[(1, 1)] = h; mat[(2, 2)] = (far + near) / (far - near); - mat[(2, 3)] = - (far * near * ::convert(2.0)) / (far - near); + mat[(2, 3)] = - (far * near * crate::convert(2.0)) / (far - near); mat[(3, 2)] = N::one(); mat @@ -324,7 +324,7 @@ pub fn perspective_fov_lh_zo(fov: N, width: N, height: N, near: N, far: let mut mat = TMat4::zeros(); let rad = fov; - let h = (rad * ::convert(0.5)).cos() / (rad * ::convert(0.5)).sin(); + let h = (rad * crate::convert(0.5)).cos() / (rad * crate::convert(0.5)).sin(); let w = h * height / width; mat[(0, 0)] = w; @@ -391,13 +391,13 @@ pub fn perspective_fov_rh_no(fov: N, width: N, height: N, near: N, far: let mut mat = TMat4::zeros(); let rad = fov; - let h = (rad * ::convert(0.5)).cos() / (rad * ::convert(0.5)).sin(); + let h = (rad * crate::convert(0.5)).cos() / (rad * crate::convert(0.5)).sin(); let w = h * height / width; mat[(0, 0)] = w; mat[(1, 1)] = h; mat[(2, 2)] = - (far + near) / (far - near); - mat[(2, 3)] = - (far * near * ::convert(2.0)) / (far - near); + mat[(2, 3)] = - (far * near * crate::convert(2.0)) / (far - near); mat[(3, 2)] = -N::one(); mat @@ -430,7 +430,7 @@ pub fn perspective_fov_rh_zo(fov: N, width: N, height: N, near: N, far: let mut mat = TMat4::zeros(); let rad = fov; - let h = (rad * ::convert(0.5)).cos() / (rad * ::convert(0.5)).sin(); + let h = (rad * crate::convert(0.5)).cos() / (rad * crate::convert(0.5)).sin(); let w = h * height / width; mat[(0, 0)] = w; @@ -522,7 +522,7 @@ pub fn perspective_lh_no(aspect: N, fovy: N, near: N, far: N) -> TMat4< ); let one = N::one(); - let two: N = ::convert( 2.0); + let two: N = crate::convert( 2.0); let mut mat : TMat4 = TMat4::zeros(); let tan_half_fovy = (fovy / two).tan(); @@ -558,7 +558,7 @@ pub fn perspective_lh_zo(aspect: N, fovy: N, near: N, far: N) -> TMat4< ); let one = N::one(); - let two: N = ::convert( 2.0); + let two: N = crate::convert( 2.0); let mut mat: TMat4 = TMat4::zeros(); let tan_half_fovy = (fovy / two).tan(); @@ -625,7 +625,7 @@ pub fn perspective_rh_no(aspect: N, fovy: N, near: N, far: N) -> TMat4< let negone = -N::one(); let one = N::one(); - let two: N = ::convert( 2.0); + let two: N = crate::convert( 2.0); let mut mat = TMat4::zeros(); let tan_half_fovy = (fovy / two).tan(); @@ -662,7 +662,7 @@ pub fn perspective_rh_zo(aspect: N, fovy: N, near: N, far: N) -> TMat4< let negone = -N::one(); let one = N::one(); - let two = ::convert( 2.0); + let two = crate::convert( 2.0); let mut mat = TMat4::zeros(); let tan_half_fovy = (fovy / two).tan(); diff --git a/nalgebra-glm/src/ext/matrix_projection.rs b/nalgebra-glm/src/ext/matrix_projection.rs index 4ed23fb3..8083b1eb 100644 --- a/nalgebra-glm/src/ext/matrix_projection.rs +++ b/nalgebra-glm/src/ext/matrix_projection.rs @@ -1,6 +1,6 @@ use na::{self, Real, U3}; -use aliases::{TMat4, TVec2, TVec3, TVec4}; +use crate::aliases::{TMat4, TVec2, TVec3, TVec4}; /// Define a picking region. /// diff --git a/nalgebra-glm/src/ext/matrix_relationnal.rs b/nalgebra-glm/src/ext/matrix_relationnal.rs index 80fb8b6f..7866e72a 100644 --- a/nalgebra-glm/src/ext/matrix_relationnal.rs +++ b/nalgebra-glm/src/ext/matrix_relationnal.rs @@ -1,7 +1,7 @@ use na::DefaultAllocator; -use aliases::{TMat, TVec}; -use traits::{Alloc, Dimension, Number}; +use crate::aliases::{TMat, TVec}; +use crate::traits::{Alloc, Dimension, Number}; /// Perform a component-wise equal-to comparison of two matrices. /// diff --git a/nalgebra-glm/src/ext/matrix_transform.rs b/nalgebra-glm/src/ext/matrix_transform.rs index 82926249..8265cc19 100644 --- a/nalgebra-glm/src/ext/matrix_transform.rs +++ b/nalgebra-glm/src/ext/matrix_transform.rs @@ -1,7 +1,7 @@ use na::{DefaultAllocator, Point3, Real, Rotation3, Unit}; -use aliases::{TMat, TMat4, TVec, TVec3}; -use traits::{Alloc, Dimension, Number}; +use crate::aliases::{TMat, TMat4, TVec, TVec3}; +use crate::traits::{Alloc, Dimension, Number}; /// The identity matrix. pub fn identity() -> TMat diff --git a/nalgebra-glm/src/ext/quaternion_common.rs b/nalgebra-glm/src/ext/quaternion_common.rs index 3a91d0c7..29150bf6 100644 --- a/nalgebra-glm/src/ext/quaternion_common.rs +++ b/nalgebra-glm/src/ext/quaternion_common.rs @@ -1,6 +1,6 @@ use na::{self, Real, Unit}; -use aliases::Qua; +use crate::aliases::Qua; /// The conjugate of `q`. pub fn quat_conjugate(q: &Qua) -> Qua { diff --git a/nalgebra-glm/src/ext/quaternion_geometric.rs b/nalgebra-glm/src/ext/quaternion_geometric.rs index a67de587..29356869 100644 --- a/nalgebra-glm/src/ext/quaternion_geometric.rs +++ b/nalgebra-glm/src/ext/quaternion_geometric.rs @@ -1,6 +1,6 @@ use na::Real; -use aliases::Qua; +use crate::aliases::Qua; /// Multiplies two quaternions. pub fn quat_cross(q1: &Qua, q2: &Qua) -> Qua { diff --git a/nalgebra-glm/src/ext/quaternion_relational.rs b/nalgebra-glm/src/ext/quaternion_relational.rs index e459054f..ff4c6b01 100644 --- a/nalgebra-glm/src/ext/quaternion_relational.rs +++ b/nalgebra-glm/src/ext/quaternion_relational.rs @@ -1,23 +1,23 @@ use na::{Real, U4}; -use aliases::{Qua, TVec}; +use crate::aliases::{Qua, TVec}; /// Component-wise equality comparison between two quaternions. pub fn quat_equal(x: &Qua, y: &Qua) -> TVec { - ::equal(&x.coords, &y.coords) + crate::equal(&x.coords, &y.coords) } /// Component-wise approximate equality comparison between two quaternions. pub fn quat_equal_eps(x: &Qua, y: &Qua, epsilon: N) -> TVec { - ::equal_eps(&x.coords, &y.coords, epsilon) + crate::equal_eps(&x.coords, &y.coords, epsilon) } /// Component-wise non-equality comparison between two quaternions. pub fn quat_not_equal(x: &Qua, y: &Qua) -> TVec { - ::not_equal(&x.coords, &y.coords) + crate::not_equal(&x.coords, &y.coords) } /// Component-wise approximate non-equality comparison between two quaternions. pub fn quat_not_equal_eps(x: &Qua, y: &Qua, epsilon: N) -> TVec { - ::not_equal_eps(&x.coords, &y.coords, epsilon) + crate::not_equal_eps(&x.coords, &y.coords, epsilon) } diff --git a/nalgebra-glm/src/ext/quaternion_transform.rs b/nalgebra-glm/src/ext/quaternion_transform.rs index a4a60210..4f3f4211 100644 --- a/nalgebra-glm/src/ext/quaternion_transform.rs +++ b/nalgebra-glm/src/ext/quaternion_transform.rs @@ -1,6 +1,6 @@ use na::{Real, Unit, UnitQuaternion}; -use aliases::{Qua, TVec3}; +use crate::aliases::{Qua, TVec3}; /// Computes the quaternion exponential. pub fn quat_exp(q: &Qua) -> Qua { diff --git a/nalgebra-glm/src/ext/quaternion_trigonometric.rs b/nalgebra-glm/src/ext/quaternion_trigonometric.rs index 762bd9e9..42833f05 100644 --- a/nalgebra-glm/src/ext/quaternion_trigonometric.rs +++ b/nalgebra-glm/src/ext/quaternion_trigonometric.rs @@ -1,6 +1,6 @@ use na::{Real, Unit, UnitQuaternion}; -use aliases::{Qua, TVec3}; +use crate::aliases::{Qua, TVec3}; /// The rotation angle of this quaternion assumed to be normalized. pub fn quat_angle(x: &Qua) -> N { diff --git a/nalgebra-glm/src/ext/scalar_common.rs b/nalgebra-glm/src/ext/scalar_common.rs index 48d3255d..11104ce2 100644 --- a/nalgebra-glm/src/ext/scalar_common.rs +++ b/nalgebra-glm/src/ext/scalar_common.rs @@ -1,6 +1,6 @@ use na; -use traits::Number; +use crate::traits::Number; /// Returns the maximum among three values. /// diff --git a/nalgebra-glm/src/ext/vector_common.rs b/nalgebra-glm/src/ext/vector_common.rs index c0318067..a6418ef8 100644 --- a/nalgebra-glm/src/ext/vector_common.rs +++ b/nalgebra-glm/src/ext/vector_common.rs @@ -1,7 +1,7 @@ use na::{self, DefaultAllocator}; -use aliases::TVec; -use traits::{Alloc, Dimension, Number}; +use crate::aliases::TVec; +use crate::traits::{Alloc, Dimension, Number}; /// Component-wise maximum between a vector and a scalar. /// diff --git a/nalgebra-glm/src/ext/vector_relational.rs b/nalgebra-glm/src/ext/vector_relational.rs index ee418588..a5071336 100644 --- a/nalgebra-glm/src/ext/vector_relational.rs +++ b/nalgebra-glm/src/ext/vector_relational.rs @@ -1,7 +1,7 @@ use na::DefaultAllocator; -use aliases::TVec; -use traits::{Alloc, Dimension, Number}; +use crate::aliases::TVec; +use crate::traits::{Alloc, Dimension, Number}; /// Component-wise approximate equality of two vectors, using a scalar epsilon. /// diff --git a/nalgebra-glm/src/geometric.rs b/nalgebra-glm/src/geometric.rs index 998709d6..a0706f75 100644 --- a/nalgebra-glm/src/geometric.rs +++ b/nalgebra-glm/src/geometric.rs @@ -1,7 +1,7 @@ use na::{DefaultAllocator, Real}; -use aliases::{TVec, TVec3}; -use traits::{Alloc, Dimension, Number}; +use crate::aliases::{TVec, TVec3}; +use crate::traits::{Alloc, Dimension, Number}; /// The cross product of two vectors. pub fn cross(x: &TVec3, y: &TVec3) -> TVec3 { diff --git a/nalgebra-glm/src/gtc/bitfield.rs b/nalgebra-glm/src/gtc/bitfield.rs index 65fbcce0..bdf18552 100644 --- a/nalgebra-glm/src/gtc/bitfield.rs +++ b/nalgebra-glm/src/gtc/bitfield.rs @@ -1,7 +1,7 @@ use na::{Scalar, DefaultAllocator}; -use traits::{Alloc, Dimension}; -use aliases::*; +use crate::traits::{Alloc, Dimension}; +use crate::aliases::*; pub fn bitfieldDeinterleave(x: u16) -> U8Vec2 { unimplemented!() diff --git a/nalgebra-glm/src/gtc/constants.rs b/nalgebra-glm/src/gtc/constants.rs index 5e2e1b0d..9407cf29 100644 --- a/nalgebra-glm/src/gtc/constants.rs +++ b/nalgebra-glm/src/gtc/constants.rs @@ -227,7 +227,7 @@ pub fn root_three() -> N { /// * [`root_five`](fn.root_five.html) /// * [`root_three`](fn.root_three.html) pub fn root_two() -> N { - // FIXME: there should be a ::sqrt_2() on the Real trait. + // FIXME: there should be a crate::sqrt_2() on the Real trait. na::convert::<_, N>(2.0).sqrt() } diff --git a/nalgebra-glm/src/gtc/epsilon.rs b/nalgebra-glm/src/gtc/epsilon.rs index 4fd7138a..81ac2e6c 100644 --- a/nalgebra-glm/src/gtc/epsilon.rs +++ b/nalgebra-glm/src/gtc/epsilon.rs @@ -4,8 +4,8 @@ use approx::AbsDiffEq; use na::DefaultAllocator; -use traits::{Alloc, Number, Dimension}; -use aliases::TVec; +use crate::traits::{Alloc, Number, Dimension}; +use crate::aliases::TVec; /// Component-wise approximate equality beween two vectors. pub fn epsilon_equal(x: &TVec, y: &TVec, epsilon: N) -> TVec diff --git a/nalgebra-glm/src/gtc/integer.rs b/nalgebra-glm/src/gtc/integer.rs index df65843f..a972a4ab 100644 --- a/nalgebra-glm/src/gtc/integer.rs +++ b/nalgebra-glm/src/gtc/integer.rs @@ -1,7 +1,7 @@ //use na::{Scalar, DefaultAllocator}; // -//use traits::{Alloc, Dimension}; -//use aliases::TVec; +//use crate::traits::{Alloc, Dimension}; +//use crate::aliases::TVec; //pub fn iround(x: &TVec) -> TVec // where DefaultAllocator: Alloc { diff --git a/nalgebra-glm/src/gtc/matrix_access.rs b/nalgebra-glm/src/gtc/matrix_access.rs index 3eabf5e2..f61d9782 100644 --- a/nalgebra-glm/src/gtc/matrix_access.rs +++ b/nalgebra-glm/src/gtc/matrix_access.rs @@ -1,7 +1,7 @@ use na::{DefaultAllocator, Scalar}; -use aliases::{TMat, TVec}; -use traits::{Alloc, Dimension}; +use crate::aliases::{TMat, TVec}; +use crate::traits::{Alloc, Dimension}; /// The `index`-th column of the matrix `m`. /// diff --git a/nalgebra-glm/src/gtc/matrix_inverse.rs b/nalgebra-glm/src/gtc/matrix_inverse.rs index 4fc305e0..ca390bb9 100644 --- a/nalgebra-glm/src/gtc/matrix_inverse.rs +++ b/nalgebra-glm/src/gtc/matrix_inverse.rs @@ -1,7 +1,7 @@ use na::{DefaultAllocator, Real}; -use aliases::TMat; -use traits::{Alloc, Dimension}; +use crate::aliases::TMat; +use crate::traits::{Alloc, Dimension}; /// Fast matrix inverse for affine matrix. pub fn affine_inverse(m: TMat) -> TMat diff --git a/nalgebra-glm/src/gtc/packing.rs b/nalgebra-glm/src/gtc/packing.rs index b0261239..ab6019b3 100644 --- a/nalgebra-glm/src/gtc/packing.rs +++ b/nalgebra-glm/src/gtc/packing.rs @@ -1,7 +1,7 @@ use na::{Scalar, Real, DefaultAllocator, U3, U4}; -use traits::{Alloc, Dimension}; -use aliases::*; +use crate::traits::{Alloc, Dimension}; +use crate::aliases::*; pub fn packF2x11_1x10(v: &Vec3) -> i32 { diff --git a/nalgebra-glm/src/gtc/quaternion.rs b/nalgebra-glm/src/gtc/quaternion.rs index d31a0bcb..9322ec0a 100644 --- a/nalgebra-glm/src/gtc/quaternion.rs +++ b/nalgebra-glm/src/gtc/quaternion.rs @@ -1,6 +1,6 @@ use na::{Real, UnitQuaternion, U4}; -use aliases::{Qua, TMat4, TVec, TVec3}; +use crate::aliases::{Qua, TMat4, TVec, TVec3}; /// Euler angles of the quaternion `q` as (pitch, yaw, roll). pub fn quat_euler_angles(x: &Qua) -> TVec3 { @@ -11,27 +11,27 @@ pub fn quat_euler_angles(x: &Qua) -> TVec3 { /// Component-wise `>` comparison between two quaternions. pub fn quat_greater_than(x: &Qua, y: &Qua) -> TVec { - ::greater_than(&x.coords, &y.coords) + crate::greater_than(&x.coords, &y.coords) } /// Component-wise `>=` comparison between two quaternions. pub fn quat_greater_than_equal(x: &Qua, y: &Qua) -> TVec { - ::greater_than_equal(&x.coords, &y.coords) + crate::greater_than_equal(&x.coords, &y.coords) } /// Component-wise `<` comparison between two quaternions. pub fn quat_less_than(x: &Qua, y: &Qua) -> TVec { - ::less_than(&x.coords, &y.coords) + crate::less_than(&x.coords, &y.coords) } /// Component-wise `<=` comparison between two quaternions. pub fn quat_less_than_equal(x: &Qua, y: &Qua) -> TVec { - ::less_than_equal(&x.coords, &y.coords) + crate::less_than_equal(&x.coords, &y.coords) } /// Convert a quaternion to a rotation matrix in homogeneous coordinates. pub fn quat_cast(x: &Qua) -> TMat4 { - ::quat_to_mat4(x) + crate::quat_to_mat4(x) } /// Computes a right hand look-at quaternion diff --git a/nalgebra-glm/src/gtc/round.rs b/nalgebra-glm/src/gtc/round.rs index 75bd4462..8dde578d 100644 --- a/nalgebra-glm/src/gtc/round.rs +++ b/nalgebra-glm/src/gtc/round.rs @@ -1,7 +1,7 @@ use na::{Scalar, Real, U3, DefaultAllocator}; -use traits::{Number, Alloc, Dimension}; -use aliases::TVec; +use crate::traits::{Number, Alloc, Dimension}; +use crate::aliases::TVec; pub fn ceilMultiple(v: T, Multiple: T) -> T { diff --git a/nalgebra-glm/src/gtc/type_ptr.rs b/nalgebra-glm/src/gtc/type_ptr.rs index ed901f20..48ef9da5 100644 --- a/nalgebra-glm/src/gtc/type_ptr.rs +++ b/nalgebra-glm/src/gtc/type_ptr.rs @@ -1,10 +1,10 @@ use na::{DefaultAllocator, Quaternion, Real, Scalar}; -use aliases::{ +use crate::aliases::{ Qua, TMat, TMat2, TMat2x3, TMat2x4, TMat3, TMat3x2, TMat3x4, TMat4, TMat4x2, TMat4x3, TVec1, TVec2, TVec3, TVec4, }; -use traits::{Alloc, Dimension, Number}; +use crate::traits::{Alloc, Dimension, Number}; /// Creates a 2x2 matrix from a slice arranged in column-major order. pub fn make_mat2(ptr: &[N]) -> TMat2 { diff --git a/nalgebra-glm/src/gtc/ulp.rs b/nalgebra-glm/src/gtc/ulp.rs index 860d73be..8258d0df 100644 --- a/nalgebra-glm/src/gtc/ulp.rs +++ b/nalgebra-glm/src/gtc/ulp.rs @@ -1,6 +1,6 @@ use na::{Scalar, U2}; -use aliases::TVec; +use crate::aliases::TVec; pub fn float_distance(x: T, y: T) -> u64 { diff --git a/nalgebra-glm/src/gtx/component_wise.rs b/nalgebra-glm/src/gtx/component_wise.rs index 338f4380..7c4af7a0 100644 --- a/nalgebra-glm/src/gtx/component_wise.rs +++ b/nalgebra-glm/src/gtx/component_wise.rs @@ -1,7 +1,7 @@ use na::{self, DefaultAllocator}; -use aliases::TMat; -use traits::{Alloc, Dimension, Number}; +use crate::aliases::TMat; +use crate::traits::{Alloc, Dimension, Number}; /// The sum of every component of the given matrix or vector. /// diff --git a/nalgebra-glm/src/gtx/euler_angles.rs b/nalgebra-glm/src/gtx/euler_angles.rs index 2c4940a6..30be40bf 100644 --- a/nalgebra-glm/src/gtx/euler_angles.rs +++ b/nalgebra-glm/src/gtx/euler_angles.rs @@ -1,6 +1,6 @@ use na::{Real, U3, U4}; -use aliases::{TVec, TMat}; +use crate::aliases::{TVec, TMat}; pub fn derivedEulerAngleX(angleX: N, angularVelocityX: N) -> TMat4 { unimplemented!() diff --git a/nalgebra-glm/src/gtx/exterior_product.rs b/nalgebra-glm/src/gtx/exterior_product.rs index cc58597b..a95c557b 100644 --- a/nalgebra-glm/src/gtx/exterior_product.rs +++ b/nalgebra-glm/src/gtx/exterior_product.rs @@ -1,5 +1,5 @@ -use aliases::TVec2; -use traits::Number; +use crate::aliases::TVec2; +use crate::traits::Number; /// The 2D perpendicular product between two vectors. pub fn cross2d(v: &TVec2, u: &TVec2) -> N { diff --git a/nalgebra-glm/src/gtx/handed_coordinate_space.rs b/nalgebra-glm/src/gtx/handed_coordinate_space.rs index ee1979ad..22d25056 100644 --- a/nalgebra-glm/src/gtx/handed_coordinate_space.rs +++ b/nalgebra-glm/src/gtx/handed_coordinate_space.rs @@ -1,5 +1,5 @@ -use aliases::TVec3; -use traits::Number; +use crate::aliases::TVec3; +use crate::traits::Number; /// Returns `true` if `{a, b, c}` forms a left-handed trihedron. /// diff --git a/nalgebra-glm/src/gtx/matrix_cross_product.rs b/nalgebra-glm/src/gtx/matrix_cross_product.rs index 7d70d438..ac113e42 100644 --- a/nalgebra-glm/src/gtx/matrix_cross_product.rs +++ b/nalgebra-glm/src/gtx/matrix_cross_product.rs @@ -1,6 +1,6 @@ use na::Real; -use aliases::{TMat3, TMat4, TVec3}; +use crate::aliases::{TMat3, TMat4, TVec3}; /// Builds a 3x3 matrix `m` such that for any `v`: `m * v == cross(x, v)`. /// @@ -17,5 +17,5 @@ pub fn matrix_cross3(x: &TVec3) -> TMat3 { /// /// * [`matrix_cross3`](fn.matrix_cross3.html) pub fn matrix_cross(x: &TVec3) -> TMat4 { - ::mat3_to_mat4(&x.cross_matrix()) + crate::mat3_to_mat4(&x.cross_matrix()) } diff --git a/nalgebra-glm/src/gtx/matrix_operation.rs b/nalgebra-glm/src/gtx/matrix_operation.rs index 954607ef..cc051273 100644 --- a/nalgebra-glm/src/gtx/matrix_operation.rs +++ b/nalgebra-glm/src/gtx/matrix_operation.rs @@ -1,7 +1,7 @@ -use aliases::{ +use crate::aliases::{ TMat2, TMat2x3, TMat2x4, TMat3, TMat3x2, TMat3x4, TMat4, TMat4x2, TMat4x3, TVec2, TVec3, TVec4, }; -use traits::Number; +use crate::traits::Number; /// Builds a 2x2 diagonal matrix. /// diff --git a/nalgebra-glm/src/gtx/norm.rs b/nalgebra-glm/src/gtx/norm.rs index 0a287530..4450cdff 100644 --- a/nalgebra-glm/src/gtx/norm.rs +++ b/nalgebra-glm/src/gtx/norm.rs @@ -1,7 +1,7 @@ use na::{DefaultAllocator, Real}; -use aliases::TVec; -use traits::{Alloc, Dimension}; +use crate::aliases::TVec; +use crate::traits::{Alloc, Dimension}; /// The squared distance between two points. /// @@ -37,7 +37,7 @@ where DefaultAllocator: Alloc { /// * [`l2_norm`](fn.l2_norm.html) pub fn l1_norm(v: &TVec) -> N where DefaultAllocator: Alloc { - ::comp_add(&v.abs()) + crate::comp_add(&v.abs()) } /// The l2-norm of `x - y`. diff --git a/nalgebra-glm/src/gtx/normal.rs b/nalgebra-glm/src/gtx/normal.rs index 63fc9246..da3287fb 100644 --- a/nalgebra-glm/src/gtx/normal.rs +++ b/nalgebra-glm/src/gtx/normal.rs @@ -1,6 +1,6 @@ use na::Real; -use aliases::TVec3; +use crate::aliases::TVec3; /// The normal vector of the given triangle. /// diff --git a/nalgebra-glm/src/gtx/normalize_dot.rs b/nalgebra-glm/src/gtx/normalize_dot.rs index df52d2c0..6bce441b 100644 --- a/nalgebra-glm/src/gtx/normalize_dot.rs +++ b/nalgebra-glm/src/gtx/normalize_dot.rs @@ -1,7 +1,7 @@ use na::{DefaultAllocator, Real}; -use aliases::TVec; -use traits::{Alloc, Dimension}; +use crate::aliases::TVec; +use crate::traits::{Alloc, Dimension}; /// The dot product of the normalized version of `x` and `y`. /// diff --git a/nalgebra-glm/src/gtx/quaternion.rs b/nalgebra-glm/src/gtx/quaternion.rs index 70005ca8..5c9a783c 100644 --- a/nalgebra-glm/src/gtx/quaternion.rs +++ b/nalgebra-glm/src/gtx/quaternion.rs @@ -1,6 +1,6 @@ use na::{Real, Rotation3, Unit, UnitQuaternion, U3}; -use aliases::{Qua, TMat3, TMat4, TVec3, TVec4}; +use crate::aliases::{Qua, TMat3, TMat4, TVec3, TVec4}; /// Rotate the vector `v` by the quaternion `q` assumed to be normalized. pub fn quat_cross_vec(q: &Qua, v: &TVec3) -> TVec3 { diff --git a/nalgebra-glm/src/gtx/rotate_normalized_axis.rs b/nalgebra-glm/src/gtx/rotate_normalized_axis.rs index 224d7bfe..6767248c 100644 --- a/nalgebra-glm/src/gtx/rotate_normalized_axis.rs +++ b/nalgebra-glm/src/gtx/rotate_normalized_axis.rs @@ -1,6 +1,6 @@ use na::{Real, Rotation3, Unit, UnitQuaternion}; -use aliases::{Qua, TMat4, TVec3}; +use crate::aliases::{Qua, TMat4, TVec3}; /// Builds a rotation 4 * 4 matrix created from a normalized axis and an angle. /// diff --git a/nalgebra-glm/src/gtx/rotate_vector.rs b/nalgebra-glm/src/gtx/rotate_vector.rs index 64ce7244..a8cdd72b 100644 --- a/nalgebra-glm/src/gtx/rotate_vector.rs +++ b/nalgebra-glm/src/gtx/rotate_vector.rs @@ -1,6 +1,6 @@ use na::{Real, Rotation3, Unit, UnitComplex}; -use aliases::{TMat4, TVec2, TVec3, TVec4}; +use crate::aliases::{TMat4, TVec2, TVec3, TVec4}; /// Build the rotation matrix needed to align `normal` and `up`. pub fn orientation(normal: &TVec3, up: &TVec3) -> TMat4 { diff --git a/nalgebra-glm/src/gtx/transform.rs b/nalgebra-glm/src/gtx/transform.rs index 85554fe5..1e3e404d 100644 --- a/nalgebra-glm/src/gtx/transform.rs +++ b/nalgebra-glm/src/gtx/transform.rs @@ -1,7 +1,7 @@ use na::{Real, Rotation2, Rotation3, Unit}; -use aliases::{TMat3, TMat4, TVec2, TVec3}; -use traits::Number; +use crate::aliases::{TMat3, TMat4, TVec2, TVec3}; +use crate::traits::Number; /// A rotation 4 * 4 matrix created from an axis of 3 scalars and an angle expressed in radians. /// diff --git a/nalgebra-glm/src/gtx/transform2.rs b/nalgebra-glm/src/gtx/transform2.rs index fa5533f7..eaa74acb 100644 --- a/nalgebra-glm/src/gtx/transform2.rs +++ b/nalgebra-glm/src/gtx/transform2.rs @@ -1,7 +1,7 @@ use na::{U2, U3}; -use aliases::{TMat3, TMat4, TVec2, TVec3}; -use traits::Number; +use crate::aliases::{TMat3, TMat4, TVec2, TVec3}; +use crate::traits::Number; /// Build planar projection matrix along normal axis and right-multiply it to `m`. pub fn proj2d(m: &TMat3, normal: &TVec2) -> TMat3 { diff --git a/nalgebra-glm/src/gtx/transform2d.rs b/nalgebra-glm/src/gtx/transform2d.rs index 3d401f56..9e80bb52 100644 --- a/nalgebra-glm/src/gtx/transform2d.rs +++ b/nalgebra-glm/src/gtx/transform2d.rs @@ -1,7 +1,7 @@ use na::{Real, UnitComplex}; -use aliases::{TMat3, TVec2}; -use traits::Number; +use crate::aliases::{TMat3, TVec2}; +use crate::traits::Number; /// Builds a 2D rotation matrix from an angle and right-multiply it to `m`. /// diff --git a/nalgebra-glm/src/gtx/vector_angle.rs b/nalgebra-glm/src/gtx/vector_angle.rs index 1ebb39a4..8cfe813b 100644 --- a/nalgebra-glm/src/gtx/vector_angle.rs +++ b/nalgebra-glm/src/gtx/vector_angle.rs @@ -1,7 +1,7 @@ use na::{DefaultAllocator, Real}; -use aliases::TVec; -use traits::{Alloc, Dimension}; +use crate::aliases::TVec; +use crate::traits::{Alloc, Dimension}; /// The angle between two vectors. pub fn angle(x: &TVec, y: &TVec) -> N diff --git a/nalgebra-glm/src/gtx/vector_query.rs b/nalgebra-glm/src/gtx/vector_query.rs index f408a4b3..da23704d 100644 --- a/nalgebra-glm/src/gtx/vector_query.rs +++ b/nalgebra-glm/src/gtx/vector_query.rs @@ -1,7 +1,7 @@ use na::{DefaultAllocator, Real}; -use aliases::{TVec, TVec2, TVec3}; -use traits::{Alloc, Dimension, Number}; +use crate::aliases::{TVec, TVec2, TVec3}; +use crate::traits::{Alloc, Dimension, Number}; /// Returns `true` if two vectors are collinear (up to an epsilon). /// diff --git a/nalgebra-glm/src/integer.rs b/nalgebra-glm/src/integer.rs index 67a0116c..dbf39cb0 100644 --- a/nalgebra-glm/src/integer.rs +++ b/nalgebra-glm/src/integer.rs @@ -1,7 +1,7 @@ use na::{Scalar, Real, U3, DefaultAllocator}; -use traits::{Number, Alloc, Dimension}; -use aliases::TVec; +use crate::traits::{Number, Alloc, Dimension}; +use crate::aliases::TVec; pub fn bitCount(v: T) -> i32 { unimplemented!() diff --git a/nalgebra-glm/src/lib.rs b/nalgebra-glm/src/lib.rs index 53830f2b..b2fe8b8f 100644 --- a/nalgebra-glm/src/lib.rs +++ b/nalgebra-glm/src/lib.rs @@ -119,7 +119,7 @@ extern crate approx; extern crate alga; extern crate nalgebra as na; -pub use aliases::*; +pub use crate::aliases::*; pub use common::{ abs, ceil, clamp, clamp_scalar, clamp_vec, float_bits_to_int, float_bits_to_int_vec, float_bits_to_uint, float_bits_to_uint_vec, floor, fract, int_bits_to_float, @@ -133,7 +133,7 @@ pub use geometric::{ cross, distance, dot, faceforward, length, magnitude, normalize, reflect_vec, refract_vec, }; pub use matrix::{determinant, inverse, matrix_comp_mult, outer_product, transpose}; -pub use traits::{Alloc, Dimension, Number}; +pub use crate::traits::{Alloc, Dimension, Number}; pub use trigonometric::{ acos, acosh, asin, asinh, atan, atan2, atanh, cos, cosh, degrees, radians, sin, sinh, tan, tanh, }; diff --git a/nalgebra-glm/src/matrix.rs b/nalgebra-glm/src/matrix.rs index 81212248..26b2f3ab 100644 --- a/nalgebra-glm/src/matrix.rs +++ b/nalgebra-glm/src/matrix.rs @@ -1,7 +1,7 @@ use na::{DefaultAllocator, Real, Scalar}; -use aliases::{TMat, TVec}; -use traits::{Alloc, Dimension, Number}; +use crate::aliases::{TMat, TVec}; +use crate::traits::{Alloc, Dimension, Number}; /// The determinant of the matrix `m`. pub fn determinant(m: &TMat) -> N diff --git a/nalgebra-glm/src/packing.rs b/nalgebra-glm/src/packing.rs index 71df195c..3273fb26 100644 --- a/nalgebra-glm/src/packing.rs +++ b/nalgebra-glm/src/packing.rs @@ -1,6 +1,6 @@ use na::Scalar; -use aliases::{Vec2, Vec4, UVec2}; +use crate::aliases::{Vec2, Vec4, UVec2}; pub fn packDouble2x32(v: &UVec2) -> f64 { diff --git a/nalgebra-glm/src/trigonometric.rs b/nalgebra-glm/src/trigonometric.rs index cf0b2652..661bd2ae 100644 --- a/nalgebra-glm/src/trigonometric.rs +++ b/nalgebra-glm/src/trigonometric.rs @@ -1,7 +1,7 @@ use na::{self, DefaultAllocator, Real}; -use aliases::TVec; -use traits::{Alloc, Dimension}; +use crate::aliases::TVec; +use crate::traits::{Alloc, Dimension}; /// Component-wise arc-cosinus. pub fn acos(x: &TVec) -> TVec diff --git a/nalgebra-glm/src/vector_relational.rs b/nalgebra-glm/src/vector_relational.rs index c92f69fe..844936fe 100644 --- a/nalgebra-glm/src/vector_relational.rs +++ b/nalgebra-glm/src/vector_relational.rs @@ -1,7 +1,7 @@ use na::DefaultAllocator; -use aliases::TVec; -use traits::{Alloc, Dimension, Number}; +use crate::aliases::TVec; +use crate::traits::{Alloc, Dimension, Number}; /// Checks that all the vector components are `true`. /// diff --git a/nalgebra-lapack/Cargo.toml b/nalgebra-lapack/Cargo.toml index ac54589c..e3b34cd1 100644 --- a/nalgebra-lapack/Cargo.toml +++ b/nalgebra-lapack/Cargo.toml @@ -10,12 +10,13 @@ repository = "https://github.com/rustsim/nalgebra" readme = "README.md" keywords = [ "linear", "algebra", "matrix", "vector" ] license = "BSD-3-Clause" +edition = "2018" [features] serde-serialize = [ "serde", "serde_derive" ] # For BLAS/LAPACK -default = ["openblas"] +default = ["accelerate"] openblas = ["lapack-src/openblas"] netlib = ["lapack-src/netlib"] accelerate = ["lapack-src/accelerate"] diff --git a/nalgebra-lapack/src/eigen.rs b/nalgebra-lapack/src/eigen.rs index fbc49319..628b532f 100644 --- a/nalgebra-lapack/src/eigen.rs +++ b/nalgebra-lapack/src/eigen.rs @@ -10,7 +10,7 @@ use na::allocator::Allocator; use na::dimension::{Dim, U1}; use na::storage::Storage; use na::{DefaultAllocator, Matrix, MatrixN, Scalar, VectorN}; -use ComplexHelper; +use crate::ComplexHelper; use lapack; @@ -101,7 +101,7 @@ where DefaultAllocator: Allocator + Allocator lapack_check!(info); - let mut work = unsafe { ::uninitialized_vec(lwork as usize) }; + let mut work = unsafe { crate::uninitialized_vec(lwork as usize) }; match (left_eigenvectors, eigenvectors) { (true, true) => { @@ -263,7 +263,7 @@ where DefaultAllocator: Allocator + Allocator lapack_panic!(info); - let mut work = unsafe { ::uninitialized_vec(lwork as usize) }; + let mut work = unsafe { crate::uninitialized_vec(lwork as usize) }; N::xgeev( b'N', diff --git a/nalgebra-lapack/src/hessenberg.rs b/nalgebra-lapack/src/hessenberg.rs index 65a27d1e..c9f8d282 100644 --- a/nalgebra-lapack/src/hessenberg.rs +++ b/nalgebra-lapack/src/hessenberg.rs @@ -5,7 +5,7 @@ use na::allocator::Allocator; use na::dimension::{DimDiff, DimSub, U1}; use na::storage::Storage; use na::{DefaultAllocator, Matrix, MatrixN, Scalar, VectorN}; -use ComplexHelper; +use crate::ComplexHelper; use lapack; @@ -66,7 +66,7 @@ where DefaultAllocator: Allocator + Allocator> let mut info = 0; let lwork = N::xgehrd_work_size(n, 1, n, m.as_mut_slice(), n, tau.as_mut_slice(), &mut info); - let mut work = unsafe { ::uninitialized_vec(lwork as usize) }; + let mut work = unsafe { crate::uninitialized_vec(lwork as usize) }; lapack_panic!(info); diff --git a/nalgebra-lapack/src/lu.rs b/nalgebra-lapack/src/lu.rs index 21fdfb41..ada9bb34 100644 --- a/nalgebra-lapack/src/lu.rs +++ b/nalgebra-lapack/src/lu.rs @@ -5,7 +5,7 @@ use na::allocator::Allocator; use na::dimension::{Dim, DimMin, DimMinimum, U1}; use na::storage::Storage; use na::{DefaultAllocator, Matrix, MatrixMN, MatrixN, Scalar, VectorN}; -use ComplexHelper; +use crate::ComplexHelper; use lapack; @@ -283,7 +283,7 @@ where ); lapack_check!(info); - let mut work = unsafe { ::uninitialized_vec(lwork as usize) }; + let mut work = unsafe { crate::uninitialized_vec(lwork as usize) }; N::xgetri( dim, diff --git a/nalgebra-lapack/src/qr.rs b/nalgebra-lapack/src/qr.rs index 1fa9b066..5d4b3108 100644 --- a/nalgebra-lapack/src/qr.rs +++ b/nalgebra-lapack/src/qr.rs @@ -8,7 +8,7 @@ use na::allocator::Allocator; use na::dimension::{Dim, DimMin, DimMinimum, U1}; use na::storage::Storage; use na::{DefaultAllocator, Matrix, MatrixMN, Scalar, VectorN}; -use ComplexHelper; +use crate::ComplexHelper; use lapack; @@ -73,7 +73,7 @@ where DefaultAllocator: Allocator &mut info, ); - let mut work = unsafe { ::uninitialized_vec(lwork as usize) }; + let mut work = unsafe { crate::uninitialized_vec(lwork as usize) }; N::xgeqrf( nrows.value() as i32, diff --git a/nalgebra-lapack/src/schur.rs b/nalgebra-lapack/src/schur.rs index ab2423cb..f928afda 100644 --- a/nalgebra-lapack/src/schur.rs +++ b/nalgebra-lapack/src/schur.rs @@ -10,7 +10,7 @@ use na::allocator::Allocator; use na::dimension::{Dim, U1}; use na::storage::Storage; use na::{DefaultAllocator, Matrix, MatrixN, Scalar, VectorN}; -use ComplexHelper; +use crate::ComplexHelper; use lapack; @@ -98,7 +98,7 @@ where DefaultAllocator: Allocator + Allocator ); lapack_check!(info); - let mut work = unsafe { ::uninitialized_vec(lwork as usize) }; + let mut work = unsafe { crate::uninitialized_vec(lwork as usize) }; N::xgees( b'V', diff --git a/nalgebra-lapack/src/svd.rs b/nalgebra-lapack/src/svd.rs index 2d048bf3..9363fced 100644 --- a/nalgebra-lapack/src/svd.rs +++ b/nalgebra-lapack/src/svd.rs @@ -109,7 +109,7 @@ macro_rules! svd_impl( let mut work = [ 0.0 ]; let mut lwork = -1 as i32; let mut info = 0; - let mut iwork = unsafe { ::uninitialized_vec(8 * cmp::min(nrows.value(), ncols.value())) }; + let mut iwork = unsafe { crate::uninitialized_vec(8 * cmp::min(nrows.value(), ncols.value())) }; unsafe { $lapack_func(job, nrows.value() as i32, ncols.value() as i32, m.as_mut_slice(), @@ -119,7 +119,7 @@ macro_rules! svd_impl( lapack_check!(info); lwork = work[0] as i32; - let mut work = unsafe { ::uninitialized_vec(lwork as usize) }; + let mut work = unsafe { crate::uninitialized_vec(lwork as usize) }; unsafe { $lapack_func(job, nrows.value() as i32, ncols.value() as i32, m.as_mut_slice(), diff --git a/nalgebra-lapack/src/symmetric_eigen.rs b/nalgebra-lapack/src/symmetric_eigen.rs index 48e444ba..af0575fd 100644 --- a/nalgebra-lapack/src/symmetric_eigen.rs +++ b/nalgebra-lapack/src/symmetric_eigen.rs @@ -10,7 +10,7 @@ use na::allocator::Allocator; use na::dimension::{Dim, U1}; use na::storage::Storage; use na::{DefaultAllocator, Matrix, MatrixN, Scalar, VectorN}; -use ComplexHelper; +use crate::ComplexHelper; use lapack; @@ -102,7 +102,7 @@ where DefaultAllocator: Allocator + Allocator let lwork = N::xsyev_work_size(jobz, b'L', n as i32, m.as_mut_slice(), lda, &mut info); lapack_check!(info); - let mut work = unsafe { ::uninitialized_vec(lwork as usize) }; + let mut work = unsafe { crate::uninitialized_vec(lwork as usize) }; N::xsyev( jobz, diff --git a/nalgebra-lapack/tests/linalg/real_schur.rs b/nalgebra-lapack/tests/linalg/schur.rs similarity index 100% rename from nalgebra-lapack/tests/linalg/real_schur.rs rename to nalgebra-lapack/tests/linalg/schur.rs diff --git a/src/base/alias.rs b/src/base/alias.rs index f7ca2b34..a8925cf3 100644 --- a/src/base/alias.rs +++ b/src/base/alias.rs @@ -1,10 +1,10 @@ #[cfg(any(feature = "alloc", feature = "std"))] -use base::dimension::Dynamic; -use base::dimension::{U1, U2, U3, U4, U5, U6}; +use crate::base::dimension::Dynamic; +use crate::base::dimension::{U1, U2, U3, U4, U5, U6}; #[cfg(any(feature = "std", feature = "alloc"))] -use base::vec_storage::VecStorage; -use base::storage::Owned; -use base::Matrix; +use crate::base::vec_storage::VecStorage; +use crate::base::storage::Owned; +use crate::base::Matrix; /* * diff --git a/src/base/alias_slice.rs b/src/base/alias_slice.rs index 790e4e59..3a332def 100644 --- a/src/base/alias_slice.rs +++ b/src/base/alias_slice.rs @@ -1,6 +1,6 @@ -use base::dimension::{Dynamic, U1, U2, U3, U4, U5, U6}; -use base::matrix_slice::{SliceStorage, SliceStorageMut}; -use base::Matrix; +use crate::base::dimension::{Dynamic, U1, U2, U3, U4, U5, U6}; +use crate::base::matrix_slice::{SliceStorage, SliceStorageMut}; +use crate::base::Matrix; /* * diff --git a/src/base/allocator.rs b/src/base/allocator.rs index 5b17c183..0ad30981 100644 --- a/src/base/allocator.rs +++ b/src/base/allocator.rs @@ -2,10 +2,10 @@ use std::any::Any; -use base::constraint::{SameNumberOfColumns, SameNumberOfRows, ShapeConstraint}; -use base::dimension::{Dim, U1}; -use base::storage::ContiguousStorageMut; -use base::{DefaultAllocator, Scalar}; +use crate::base::constraint::{SameNumberOfColumns, SameNumberOfRows, ShapeConstraint}; +use crate::base::dimension::{Dim, U1}; +use crate::base::storage::ContiguousStorageMut; +use crate::base::{DefaultAllocator, Scalar}; /// A matrix allocator of a memory buffer that may contain `R::to_usize() * C::to_usize()` /// elements of type `N`. diff --git a/src/base/array_storage.rs b/src/base/array_storage.rs index 3beab9e1..bebb8740 100644 --- a/src/base/array_storage.rs +++ b/src/base/array_storage.rs @@ -21,11 +21,11 @@ use abomonation::Abomonation; use generic_array::{ArrayLength, GenericArray}; use typenum::Prod; -use base::allocator::Allocator; -use base::default_allocator::DefaultAllocator; -use base::dimension::{DimName, U1}; -use base::storage::{ContiguousStorage, ContiguousStorageMut, Owned, Storage, StorageMut}; -use base::Scalar; +use crate::base::allocator::Allocator; +use crate::base::default_allocator::DefaultAllocator; +use crate::base::dimension::{DimName, U1}; +use crate::base::storage::{ContiguousStorage, ContiguousStorageMut, Owned, Storage, StorageMut}; +use crate::base::Scalar; /* * @@ -330,7 +330,7 @@ where let mut out: Self::Value = unsafe { mem::uninitialized() }; let mut curr = 0; - while let Some(value) = try!(visitor.next_element()) { + while let Some(value) = visitor.next_element()? { *out.get_mut(curr).ok_or_else(|| V::Error::invalid_length(curr, &self))? = value; curr += 1; } diff --git a/src/base/blas.rs b/src/base/blas.rs index 9f919e11..cdfe4f9f 100644 --- a/src/base/blas.rs +++ b/src/base/blas.rs @@ -5,13 +5,13 @@ use num::{One, Signed, Zero}; #[cfg(feature = "std")] use std::mem; -use base::allocator::Allocator; -use base::constraint::{ +use crate::base::allocator::Allocator; +use crate::base::constraint::{ AreMultipliable, DimEq, SameNumberOfColumns, SameNumberOfRows, ShapeConstraint, }; -use base::dimension::{Dim, Dynamic, U1, U2, U3, U4}; -use base::storage::{Storage, StorageMut}; -use base::{DefaultAllocator, Matrix, Scalar, SquareMatrix, Vector, DVectorSlice}; +use crate::base::dimension::{Dim, Dynamic, U1, U2, U3, U4}; +use crate::base::storage::{Storage, StorageMut}; +use crate::base::{DefaultAllocator, Matrix, Scalar, SquareMatrix, Vector, DVectorSlice}; // FIXME: find a way to avoid code duplication just for complex number support. diff --git a/src/base/cg.rs b/src/base/cg.rs index 5883e710..5c1a7c11 100644 --- a/src/base/cg.rs +++ b/src/base/cg.rs @@ -7,14 +7,14 @@ use num::One; -use base::allocator::Allocator; -use base::dimension::{DimName, DimNameDiff, DimNameSub, U1}; -use base::storage::{Storage, StorageMut}; -use base::{ +use crate::base::allocator::Allocator; +use crate::base::dimension::{DimName, DimNameDiff, DimNameSub, U1}; +use crate::base::storage::{Storage, StorageMut}; +use crate::base::{ DefaultAllocator, Matrix3, Matrix4, MatrixN, Scalar, SquareMatrix, Unit, Vector, Vector3, VectorN, }; -use geometry::{ +use crate::geometry::{ Isometry, IsometryMatrix3, Orthographic3, Perspective3, Point, Point3, Rotation2, Rotation3, }; diff --git a/src/base/componentwise.rs b/src/base/componentwise.rs index 9081cf36..e5f4d7ec 100644 --- a/src/base/componentwise.rs +++ b/src/base/componentwise.rs @@ -5,11 +5,11 @@ use std::ops::{Add, Mul}; use alga::general::{ClosedDiv, ClosedMul}; -use base::allocator::{Allocator, SameShapeAllocator}; -use base::constraint::{SameNumberOfColumns, SameNumberOfRows, ShapeConstraint}; -use base::dimension::Dim; -use base::storage::{Storage, StorageMut}; -use base::{DefaultAllocator, Matrix, MatrixMN, MatrixSum, Scalar}; +use crate::base::allocator::{Allocator, SameShapeAllocator}; +use crate::base::constraint::{SameNumberOfColumns, SameNumberOfRows, ShapeConstraint}; +use crate::base::dimension::Dim; +use crate::base::storage::{Storage, StorageMut}; +use crate::base::{DefaultAllocator, Matrix, MatrixMN, MatrixSum, Scalar}; /// The type of the result of a matrix component-wise operation. pub type MatrixComponentOp = MatrixSum; diff --git a/src/base/constraint.rs b/src/base/constraint.rs index 3bd0540b..89226fe3 100644 --- a/src/base/constraint.rs +++ b/src/base/constraint.rs @@ -1,6 +1,6 @@ //! Compatibility constraints between matrix shapes, e.g., for addition or multiplication. -use base::dimension::{Dim, DimName, Dynamic}; +use crate::base::dimension::{Dim, DimName, Dynamic}; /// A type used in `where` clauses for enforcing constraints. pub struct ShapeConstraint; diff --git a/src/base/construction.rs b/src/base/construction.rs index aeee6121..1b05fe61 100644 --- a/src/base/construction.rs +++ b/src/base/construction.rs @@ -1,5 +1,5 @@ #[cfg(feature = "arbitrary")] -use base::storage::Owned; +use crate::base::storage::Owned; #[cfg(feature = "arbitrary")] use quickcheck::{Arbitrary, Gen}; @@ -15,10 +15,10 @@ use typenum::{self, Cmp, Greater}; use alga::general::Real; use alga::general::{ClosedAdd, ClosedMul}; -use base::allocator::Allocator; -use base::dimension::{Dim, DimName, Dynamic, U1, U2, U3, U4, U5, U6}; -use base::storage::Storage; -use base::{DefaultAllocator, Matrix, MatrixMN, MatrixN, Scalar, Unit, Vector, VectorN}; +use crate::base::allocator::Allocator; +use crate::base::dimension::{Dim, DimName, Dynamic, U1, U2, U3, U4, U5, U6}; +use crate::base::storage::Storage; +use crate::base::{DefaultAllocator, Matrix, MatrixMN, MatrixN, Scalar, Unit, Vector, VectorN}; /* * @@ -131,7 +131,7 @@ where DefaultAllocator: Allocator where N: Zero + One { let mut res = Self::zeros_generic(nrows, ncols); - for i in 0..::min(nrows.value(), ncols.value()) { + for i in 0..crate::min(nrows.value(), ncols.value()) { unsafe { *res.get_unchecked_mut((i, i)) = elt } } @@ -147,7 +147,7 @@ where DefaultAllocator: Allocator where N: Zero { let mut res = Self::zeros_generic(nrows, ncols); assert!( - elts.len() <= ::min(nrows.value(), ncols.value()), + elts.len() <= crate::min(nrows.value(), ncols.value()), "Too many diagonal elements provided." ); diff --git a/src/base/construction_slice.rs b/src/base/construction_slice.rs index 419720bf..0946653a 100644 --- a/src/base/construction_slice.rs +++ b/src/base/construction_slice.rs @@ -1,6 +1,6 @@ -use base::dimension::{Dim, DimName, Dynamic, U1}; -use base::matrix_slice::{SliceStorage, SliceStorageMut}; -use base::{MatrixSliceMN, MatrixSliceMutMN, Scalar}; +use crate::base::dimension::{Dim, DimName, Dynamic, U1}; +use crate::base::matrix_slice::{SliceStorage, SliceStorageMut}; +use crate::base::{MatrixSliceMN, MatrixSliceMutMN, Scalar}; /* * diff --git a/src/base/conversion.rs b/src/base/conversion.rs index 750739a6..4c5bb017 100644 --- a/src/base/conversion.rs +++ b/src/base/conversion.rs @@ -9,18 +9,18 @@ use generic_array::ArrayLength; use std::ops::Mul; use typenum::Prod; -use base::allocator::{Allocator, SameShapeAllocator}; -use base::constraint::{SameNumberOfColumns, SameNumberOfRows, ShapeConstraint}; -use base::dimension::{ +use crate::base::allocator::{Allocator, SameShapeAllocator}; +use crate::base::constraint::{SameNumberOfColumns, SameNumberOfRows, ShapeConstraint}; +use crate::base::dimension::{ Dim, DimName, U1, U10, U11, U12, U13, U14, U15, U16, U2, U3, U4, U5, U6, U7, U8, U9, }; #[cfg(any(feature = "std", feature = "alloc"))] -use base::dimension::Dynamic; -use base::iter::{MatrixIter, MatrixIterMut}; -use base::storage::{ContiguousStorage, ContiguousStorageMut, Storage, StorageMut}; +use crate::base::dimension::Dynamic; +use crate::base::iter::{MatrixIter, MatrixIterMut}; +use crate::base::storage::{ContiguousStorage, ContiguousStorageMut, Storage, StorageMut}; #[cfg(any(feature = "std", feature = "alloc"))] -use base::VecStorage; -use base::{DefaultAllocator, Matrix, ArrayStorage, MatrixMN, MatrixSlice, MatrixSliceMut, Scalar}; +use crate::base::VecStorage; +use crate::base::{DefaultAllocator, Matrix, ArrayStorage, MatrixMN, MatrixSlice, MatrixSliceMut, Scalar}; // FIXME: too bad this won't work allo slice conversions. impl SubsetOf> for MatrixMN diff --git a/src/base/coordinates.rs b/src/base/coordinates.rs index 986b8e9d..832723e3 100644 --- a/src/base/coordinates.rs +++ b/src/base/coordinates.rs @@ -7,9 +7,9 @@ use std::mem; use std::ops::{Deref, DerefMut}; -use base::dimension::{U1, U2, U3, U4, U5, U6}; -use base::storage::{ContiguousStorage, ContiguousStorageMut}; -use base::{Matrix, Scalar}; +use crate::base::dimension::{U1, U2, U3, U4, U5, U6}; +use crate::base::storage::{ContiguousStorage, ContiguousStorageMut}; +use crate::base::{Matrix, Scalar}; /* * diff --git a/src/base/default_allocator.rs b/src/base/default_allocator.rs index 5926f39d..c07c8708 100644 --- a/src/base/default_allocator.rs +++ b/src/base/default_allocator.rs @@ -14,15 +14,15 @@ use alloc::vec::Vec; use generic_array::ArrayLength; use typenum::Prod; -use base::allocator::{Allocator, Reallocator}; +use crate::base::allocator::{Allocator, Reallocator}; #[cfg(any(feature = "alloc", feature = "std"))] -use base::dimension::Dynamic; -use base::dimension::{Dim, DimName}; -use base::array_storage::ArrayStorage; +use crate::base::dimension::Dynamic; +use crate::base::dimension::{Dim, DimName}; +use crate::base::array_storage::ArrayStorage; #[cfg(any(feature = "std", feature = "alloc"))] -use base::vec_storage::VecStorage; -use base::storage::{Storage, StorageMut}; -use base::Scalar; +use crate::base::vec_storage::VecStorage; +use crate::base::storage::{Storage, StorageMut}; +use crate::base::Scalar; /* * diff --git a/src/base/edition.rs b/src/base/edition.rs index b95e0fcf..31489f95 100644 --- a/src/base/edition.rs +++ b/src/base/edition.rs @@ -6,17 +6,17 @@ use std::iter::ExactSizeIterator; #[cfg(any(feature = "std", feature = "alloc"))] use std::mem; -use base::allocator::{Allocator, Reallocator}; -use base::constraint::{DimEq, SameNumberOfColumns, SameNumberOfRows, ShapeConstraint}; -use base::dimension::{ +use crate::base::allocator::{Allocator, Reallocator}; +use crate::base::constraint::{DimEq, SameNumberOfColumns, SameNumberOfRows, ShapeConstraint}; +use crate::base::dimension::{ Dim, DimAdd, DimDiff, DimMin, DimMinimum, DimName, DimSub, DimSum, U1, }; #[cfg(any(feature = "std", feature = "alloc"))] -use base::dimension::Dynamic; -use base::storage::{Storage, StorageMut}; +use crate::base::dimension::Dynamic; +use crate::base::storage::{Storage, StorageMut}; #[cfg(any(feature = "std", feature = "alloc"))] -use base::DMatrix; -use base::{DefaultAllocator, Matrix, MatrixMN, RowVector, Scalar, Vector}; +use crate::base::DMatrix; +use crate::base::{DefaultAllocator, Matrix, MatrixMN, RowVector, Scalar, Vector}; impl> Matrix { /// Extracts the upper triangular part of this matrix (including the diagonal). diff --git a/src/base/indexing.rs b/src/base/indexing.rs index 976eef87..ca786530 100644 --- a/src/base/indexing.rs +++ b/src/base/indexing.rs @@ -1,7 +1,7 @@ //! Indexing -use base::{Dim, DimName, DimDiff, DimSub, Dynamic, Matrix, MatrixSlice, MatrixSliceMut, Scalar, U1}; -use base::storage::{Storage, StorageMut}; +use crate::base::{Dim, DimName, DimDiff, DimSub, Dynamic, Matrix, MatrixSlice, MatrixSliceMut, Scalar, U1}; +use crate::base::storage::{Storage, StorageMut}; use std::ops; @@ -42,7 +42,7 @@ impl DimRange for usize { #[test] fn dimrange_usize() { - use base::dimension::U0; + use crate::base::dimension::U0; assert_eq!(DimRange::contained_by(&0, U0), false); assert_eq!(DimRange::contained_by(&0, U1), true); } @@ -69,7 +69,7 @@ impl DimRange for ops::Range { #[test] fn dimrange_range_usize() { use std::usize::MAX; - use base::dimension::U0; + use crate::base::dimension::U0; assert_eq!(DimRange::contained_by(&(0..0), U0), false); assert_eq!(DimRange::contained_by(&(0..1), U0), false); assert_eq!(DimRange::contained_by(&(0..1), U1), true); @@ -101,7 +101,7 @@ impl DimRange for ops::RangeFrom { #[test] fn dimrange_rangefrom_usize() { use std::usize::MAX; - use base::dimension::U0; + use crate::base::dimension::U0; assert_eq!(DimRange::contained_by(&(0..), U0), false); assert_eq!(DimRange::contained_by(&(0..), U0), false); assert_eq!(DimRange::contained_by(&(0..), U1), true); @@ -133,7 +133,7 @@ where D: DimSub #[test] fn dimrange_rangefrom_dimname() { - use base::dimension::{U5, U4}; + use crate::base::dimension::{U5, U4}; assert_eq!(DimRange::length(&(U1..), U5), U4); } @@ -158,7 +158,7 @@ impl DimRange for ops::RangeFull { #[test] fn dimrange_rangefull() { - use base::dimension::U0; + use crate::base::dimension::U0; assert_eq!(DimRange::contained_by(&(..), U0), true); assert_eq!(DimRange::length(&(..), U1), U1); } @@ -190,7 +190,7 @@ impl DimRange for ops::RangeInclusive { #[test] fn dimrange_rangeinclusive_usize() { use std::usize::MAX; - use base::dimension::U0; + use crate::base::dimension::U0; assert_eq!(DimRange::contained_by(&(0..=0), U0), false); assert_eq!(DimRange::contained_by(&(0..=0), U1), true); assert_eq!(DimRange::contained_by(&(MAX..=MAX), Dynamic::new(MAX)), false); @@ -225,7 +225,7 @@ impl DimRange for ops::RangeTo #[test] fn dimrange_rangeto_usize() { use std::usize::MAX; - use base::dimension::U0; + use crate::base::dimension::U0; assert_eq!(DimRange::contained_by(&(..0), U0), true); assert_eq!(DimRange::contained_by(&(..1), U0), false); assert_eq!(DimRange::contained_by(&(..0), U1), true); @@ -257,7 +257,7 @@ impl DimRange for ops::RangeToInclusive #[test] fn dimrange_rangetoinclusive_usize() { use std::usize::MAX; - use base::dimension::U0; + use crate::base::dimension::U0; assert_eq!(DimRange::contained_by(&(..=0), U0), false); assert_eq!(DimRange::contained_by(&(..=1), U0), false); assert_eq!(DimRange::contained_by(&(..=0), U1), true); @@ -627,7 +627,7 @@ macro_rules! impl_index_pair { #[doc(hidden)] #[inline(always)] unsafe fn get_unchecked(self, matrix: &'a Matrix) -> Self::Output { - use base::SliceStorage; + use crate::base::SliceStorage; let (rows, cols) = self; let (nrows, ncols) = matrix.data.shape(); @@ -655,7 +655,7 @@ macro_rules! impl_index_pair { #[doc(hidden)] #[inline(always)] unsafe fn get_unchecked_mut(self, matrix: &'a mut Matrix) -> Self::OutputMut { - use base::SliceStorageMut; + use crate::base::SliceStorageMut; let (rows, cols) = self; let (nrows, ncols) = matrix.data.shape(); diff --git a/src/base/iter.rs b/src/base/iter.rs index 8a5f10ab..74e4f018 100644 --- a/src/base/iter.rs +++ b/src/base/iter.rs @@ -3,9 +3,9 @@ use std::marker::PhantomData; use std::mem; -use base::dimension::{Dim, U1}; -use base::storage::{Storage, StorageMut}; -use base::{Scalar, Matrix, MatrixSlice, MatrixSliceMut}; +use crate::base::dimension::{Dim, U1}; +use crate::base::storage::{Storage, StorageMut}; +use crate::base::{Scalar, Matrix, MatrixSlice, MatrixSliceMut}; macro_rules! iterator { (struct $Name:ident for $Storage:ident.$ptr: ident -> $Ptr:ty, $Ref:ty, $SRef: ty) => { diff --git a/src/base/matrix.rs b/src/base/matrix.rs index 77d49f42..e5060013 100644 --- a/src/base/matrix.rs +++ b/src/base/matrix.rs @@ -18,14 +18,14 @@ use abomonation::Abomonation; use alga::general::{ClosedAdd, ClosedMul, ClosedSub, Real, Ring, Complex, Field}; -use base::allocator::{Allocator, SameShapeAllocator, SameShapeC, SameShapeR}; -use base::constraint::{DimEq, SameNumberOfColumns, SameNumberOfRows, ShapeConstraint}; -use base::dimension::{Dim, DimAdd, DimSum, IsNotStaticOne, U1, U2, U3}; -use base::iter::{MatrixIter, MatrixIterMut, RowIter, RowIterMut, ColumnIter, ColumnIterMut}; -use base::storage::{ +use crate::base::allocator::{Allocator, SameShapeAllocator, SameShapeC, SameShapeR}; +use crate::base::constraint::{DimEq, SameNumberOfColumns, SameNumberOfRows, ShapeConstraint}; +use crate::base::dimension::{Dim, DimAdd, DimSum, IsNotStaticOne, U1, U2, U3}; +use crate::base::iter::{MatrixIter, MatrixIterMut, RowIter, RowIterMut, ColumnIter, ColumnIterMut}; +use crate::base::storage::{ ContiguousStorage, ContiguousStorageMut, Owned, SameShapeStorage, Storage, StorageMut, }; -use base::{DefaultAllocator, MatrixMN, MatrixN, Scalar, Unit, VectorN}; +use crate::base::{DefaultAllocator, MatrixMN, MatrixN, Scalar, Unit, VectorN}; /// A square matrix. pub type SquareMatrix = Matrix; @@ -1111,7 +1111,7 @@ impl> SquareMatrix { assert!(self.is_square(), "Cannot compute the symmetric part of a non-square matrix."); let mut tr = self.transpose(); tr += self; - tr *= ::convert::<_, N>(0.5); + tr *= crate::convert::<_, N>(0.5); tr } @@ -1123,7 +1123,7 @@ impl> SquareMatrix { let mut tr = self.adjoint(); tr += self; - tr *= ::convert::<_, N>(0.5); + tr *= crate::convert::<_, N>(0.5); tr } } @@ -1392,40 +1392,40 @@ where for i in 0..nrows { for j in 0..ncols { lengths[(i, j)] = val_width(self[(i, j)], f); - max_length = ::max(max_length, lengths[(i, j)]); + max_length = crate::max(max_length, lengths[(i, j)]); } } let max_length_with_space = max_length + 1; - try!(writeln!(f)); - try!(writeln!( + writeln!(f)?; + writeln!( f, " ┌ {:>width$} ┐", "", width = max_length_with_space * ncols - 1 - )); + )?; for i in 0..nrows { - try!(write!(f, " │")); + write!(f, " │")?; for j in 0..ncols { let number_length = lengths[(i, j)] + 1; let pad = max_length_with_space - number_length; - try!(write!(f, " {:>thepad$}", "", thepad = pad)); + write!(f, " {:>thepad$}", "", thepad = pad)?; match f.precision() { - Some(precision) => try!(write!(f, "{:.1$}", (*self)[(i, j)], precision)), - None => try!(write!(f, "{}", (*self)[(i, j)])), + Some(precision) => write!(f, "{:.1$}", (*self)[(i, j)], precision)?, + None => write!(f, "{}", (*self)[(i, j)])?, } } - try!(writeln!(f, " │")); + writeln!(f, " │")?; } - try!(writeln!( + writeln!( f, " └ {:>width$} ┘", "", width = max_length_with_space * ncols - 1 - )); + )?; writeln!(f) } } diff --git a/src/base/matrix_alga.rs b/src/base/matrix_alga.rs index 43774f17..87ab584c 100644 --- a/src/base/matrix_alga.rs +++ b/src/base/matrix_alga.rs @@ -13,10 +13,10 @@ use alga::linear::{ FiniteDimInnerSpace, FiniteDimVectorSpace, InnerSpace, NormedSpace, VectorSpace, }; -use base::allocator::Allocator; -use base::dimension::{Dim, DimName}; -use base::storage::{Storage, StorageMut}; -use base::{DefaultAllocator, MatrixMN, MatrixN, Scalar}; +use crate::base::allocator::Allocator; +use crate::base::dimension::{Dim, DimName}; +use crate::base::storage::{Storage, StorageMut}; +use crate::base::{DefaultAllocator, MatrixMN, MatrixN, Scalar}; /* * diff --git a/src/base/matrix_slice.rs b/src/base/matrix_slice.rs index a4ce1533..be53034a 100644 --- a/src/base/matrix_slice.rs +++ b/src/base/matrix_slice.rs @@ -2,12 +2,12 @@ use std::marker::PhantomData; use std::ops::{Range, RangeFrom, RangeFull, RangeTo}; use std::slice; -use base::allocator::Allocator; -use base::default_allocator::DefaultAllocator; -use base::dimension::{Dim, DimName, Dynamic, U1, IsNotStaticOne}; -use base::iter::MatrixIter; -use base::storage::{Owned, Storage, StorageMut, ContiguousStorage, ContiguousStorageMut}; -use base::{Matrix, Scalar}; +use crate::base::allocator::Allocator; +use crate::base::default_allocator::DefaultAllocator; +use crate::base::dimension::{Dim, DimName, Dynamic, U1, IsNotStaticOne}; +use crate::base::iter::MatrixIter; +use crate::base::storage::{Owned, Storage, StorageMut, ContiguousStorage, ContiguousStorageMut}; +use crate::base::{Matrix, Scalar}; macro_rules! slice_storage_impl( ($doc: expr; $Storage: ident as $SRef: ty; $T: ident.$get_addr: ident ($Ptr: ty as $Ref: ty)) => { diff --git a/src/base/norm.rs b/src/base/norm.rs index b3d695e6..91958cec 100644 --- a/src/base/norm.rs +++ b/src/base/norm.rs @@ -1,10 +1,10 @@ use num::Zero; -use allocator::Allocator; -use ::{Real, Complex}; -use storage::{Storage, StorageMut}; -use base::{DefaultAllocator, Matrix, Dim, MatrixMN}; -use constraint::{SameNumberOfRows, SameNumberOfColumns, ShapeConstraint}; +use crate::allocator::Allocator; +use crate::{Real, Complex}; +use crate::storage::{Storage, StorageMut}; +use crate::base::{DefaultAllocator, Matrix, Dim, MatrixMN}; +use crate::constraint::{SameNumberOfRows, SameNumberOfColumns, ShapeConstraint}; // FIXME: this should be be a trait on alga? @@ -54,7 +54,7 @@ impl Norm for LpNorm { where R: Dim, C: Dim, S: Storage { m.fold(N::Real::zero(), |a, b| { a + b.modulus().powi(self.0) - }).powf(::convert(1.0 / (self.0 as f64))) + }).powf(crate::convert(1.0 / (self.0 as f64))) } #[inline] @@ -65,7 +65,7 @@ impl Norm for LpNorm { m1.zip_fold(m2, N::Real::zero(), |acc, a, b| { let diff = a - b; acc + diff.modulus().powi(self.0) - }).powf(::convert(1.0 / (self.0 as f64))) + }).powf(crate::convert(1.0 / (self.0 as f64))) } } diff --git a/src/base/ops.rs b/src/base/ops.rs index f2a683c1..bfc71040 100644 --- a/src/base/ops.rs +++ b/src/base/ops.rs @@ -7,13 +7,13 @@ use std::ops::{ use alga::general::{Complex, ClosedAdd, ClosedDiv, ClosedMul, ClosedNeg, ClosedSub}; -use base::allocator::{Allocator, SameShapeAllocator, SameShapeC, SameShapeR}; -use base::constraint::{ +use crate::base::allocator::{Allocator, SameShapeAllocator, SameShapeC, SameShapeR}; +use crate::base::constraint::{ AreMultipliable, DimEq, SameNumberOfColumns, SameNumberOfRows, ShapeConstraint, }; -use base::dimension::{Dim, DimMul, DimName, DimProd}; -use base::storage::{ContiguousStorageMut, Storage, StorageMut}; -use base::{DefaultAllocator, Matrix, MatrixMN, MatrixN, MatrixSum, Scalar, VectorSliceN}; +use crate::base::dimension::{Dim, DimMul, DimName, DimProd}; +use crate::base::storage::{ContiguousStorageMut, Storage, StorageMut}; +use crate::base::{DefaultAllocator, Matrix, MatrixMN, MatrixN, MatrixSum, Scalar, VectorSliceN}; /* * diff --git a/src/base/properties.rs b/src/base/properties.rs index de6be72a..73019209 100644 --- a/src/base/properties.rs +++ b/src/base/properties.rs @@ -4,10 +4,10 @@ use num::{One, Zero}; use alga::general::{ClosedAdd, ClosedMul, Real, Complex}; -use base::allocator::Allocator; -use base::dimension::{Dim, DimMin}; -use base::storage::Storage; -use base::{DefaultAllocator, Matrix, Scalar, SquareMatrix}; +use crate::base::allocator::Allocator; +use crate::base::dimension::{Dim, DimMin}; +use crate::base::storage::Storage; +use crate::base::{DefaultAllocator, Matrix, Scalar, SquareMatrix}; impl> Matrix { /// Indicates if this is an empty matrix. diff --git a/src/base/statistics.rs b/src/base/statistics.rs index ce162340..0fe18130 100644 --- a/src/base/statistics.rs +++ b/src/base/statistics.rs @@ -1,7 +1,7 @@ -use ::{Scalar, Dim, Matrix, VectorN, RowVectorN, DefaultAllocator, U1, VectorSliceN}; +use crate::{Scalar, Dim, Matrix, VectorN, RowVectorN, DefaultAllocator, U1, VectorSliceN}; use alga::general::{Field, SupersetOf}; -use storage::Storage; -use allocator::Allocator; +use crate::storage::Storage; +use crate::allocator::Allocator; impl> Matrix { /// Returns a row vector where each element is the result of the application of `f` on the @@ -155,7 +155,7 @@ impl, R: Dim, C: Dim, S: Storage> M N::zero() } else { let val = self.iter().cloned().fold((N::zero(), N::zero()), |a, b| (a.0 + b * b, a.1 + b)); - let denom = N::one() / ::convert::<_, N>(self.len() as f64); + let denom = N::one() / crate::convert::<_, N>(self.len() as f64); val.0 * denom - (val.1 * denom) * (val.1 * denom) } } @@ -215,7 +215,7 @@ impl, R: Dim, C: Dim, S: Storage> M let mut mean = self.column_mean(); mean.apply(|e| -(e * e)); - let denom = N::one() / ::convert::<_, N>(ncols.value() as f64); + let denom = N::one() / crate::convert::<_, N>(ncols.value() as f64); self.compress_columns(mean, |out, col| { for i in 0..nrows.value() { unsafe { @@ -247,7 +247,7 @@ impl, R: Dim, C: Dim, S: Storage> M if self.len() == 0 { N::zero() } else { - self.sum() / ::convert(self.len() as f64) + self.sum() / crate::convert(self.len() as f64) } } @@ -302,7 +302,7 @@ impl, R: Dim, C: Dim, S: Storage> M pub fn column_mean(&self) -> VectorN where DefaultAllocator: Allocator { let (nrows, ncols) = self.data.shape(); - let denom = N::one() / ::convert::<_, N>(ncols.value() as f64); + let denom = N::one() / crate::convert::<_, N>(ncols.value() as f64); self.compress_columns(VectorN::zeros_generic(nrows, U1), |out, col| { out.axpy(denom, &col, N::one()) }) diff --git a/src/base/storage.rs b/src/base/storage.rs index 0a07713b..02941e47 100644 --- a/src/base/storage.rs +++ b/src/base/storage.rs @@ -3,10 +3,10 @@ use std::fmt::Debug; use std::mem; -use base::allocator::{Allocator, SameShapeC, SameShapeR}; -use base::default_allocator::DefaultAllocator; -use base::dimension::{Dim, U1}; -use base::Scalar; +use crate::base::allocator::{Allocator, SameShapeC, SameShapeR}; +use crate::base::default_allocator::DefaultAllocator; +use crate::base::dimension::{Dim, U1}; +use crate::base::Scalar; /* * Aliases for allocation results. diff --git a/src/base/swizzle.rs b/src/base/swizzle.rs index b09316d4..4c9b0b63 100644 --- a/src/base/swizzle.rs +++ b/src/base/swizzle.rs @@ -1,5 +1,5 @@ -use base::{DimName, Scalar, Vector, Vector2, Vector3}; -use storage::Storage; +use crate::base::{DimName, Scalar, Vector, Vector2, Vector3}; +use crate::storage::Storage; use typenum::{self, Cmp, Greater}; macro_rules! impl_swizzle { diff --git a/src/base/unit.rs b/src/base/unit.rs index 87a428b5..90b343e1 100644 --- a/src/base/unit.rs +++ b/src/base/unit.rs @@ -104,8 +104,8 @@ impl Unit { #[inline] pub fn renormalize_fast(&mut self) { let sq_norm = self.value.norm_squared(); - let _3: T::Real = ::convert(3.0); - let _0_5: T::Real = ::convert(0.5); + let _3: T::Real = crate::convert(3.0); + let _0_5: T::Real = crate::convert(0.5); self.value *= T::Complex::from_real(_0_5 * (_3 - sq_norm)); } } @@ -168,7 +168,7 @@ where T::Field: RelativeEq #[inline] fn is_in_subset(value: &T) -> bool { - relative_eq!(value.norm_squared(), ::one()) + relative_eq!(value.norm_squared(), crate::one()) } #[inline] diff --git a/src/base/vec_storage.rs b/src/base/vec_storage.rs index afde3677..2b4bf743 100644 --- a/src/base/vec_storage.rs +++ b/src/base/vec_storage.rs @@ -4,12 +4,12 @@ use std::io::{Result as IOResult, Write}; #[cfg(all(feature = "alloc", not(feature = "std")))] use alloc::vec::Vec; -use base::allocator::Allocator; -use base::default_allocator::DefaultAllocator; -use base::dimension::{Dim, DimName, Dynamic, U1}; -use base::storage::{ContiguousStorage, ContiguousStorageMut, Owned, Storage, StorageMut}; -use base::{Scalar, Vector}; -use base::constraint::{SameNumberOfRows, ShapeConstraint}; +use crate::base::allocator::Allocator; +use crate::base::default_allocator::DefaultAllocator; +use crate::base::dimension::{Dim, DimName, Dynamic, U1}; +use crate::base::storage::{ContiguousStorage, ContiguousStorageMut, Owned, Storage, StorageMut}; +use crate::base::{Scalar, Vector}; +use crate::base::constraint::{SameNumberOfRows, ShapeConstraint}; #[cfg(feature = "abomonation-serialize")] use abomonation::Abomonation; diff --git a/src/debug/random_orthogonal.rs b/src/debug/random_orthogonal.rs index 94035109..b14c7da4 100644 --- a/src/debug/random_orthogonal.rs +++ b/src/debug/random_orthogonal.rs @@ -1,14 +1,14 @@ #[cfg(feature = "arbitrary")] -use base::storage::Owned; +use crate::base::storage::Owned; #[cfg(feature = "arbitrary")] use quickcheck::{Arbitrary, Gen}; use alga::general::Complex; -use base::Scalar; -use base::allocator::Allocator; -use base::dimension::{Dim, Dynamic, U2}; -use base::{DefaultAllocator, MatrixN}; -use linalg::givens::GivensRotation; +use crate::base::Scalar; +use crate::base::allocator::Allocator; +use crate::base::dimension::{Dim, Dynamic, U2}; +use crate::base::{DefaultAllocator, MatrixN}; +use crate::linalg::givens::GivensRotation; /// A random orthogonal matrix. #[derive(Clone, Debug)] diff --git a/src/debug/random_sdp.rs b/src/debug/random_sdp.rs index f8ee6d30..ca3f122f 100644 --- a/src/debug/random_sdp.rs +++ b/src/debug/random_sdp.rs @@ -1,15 +1,15 @@ #[cfg(feature = "arbitrary")] -use base::storage::Owned; +use crate::base::storage::Owned; #[cfg(feature = "arbitrary")] use quickcheck::{Arbitrary, Gen}; use alga::general::Complex; -use base::Scalar; -use base::allocator::Allocator; -use base::dimension::{Dim, Dynamic}; -use base::{DefaultAllocator, MatrixN}; +use crate::base::Scalar; +use crate::base::allocator::Allocator; +use crate::base::dimension::{Dim, Dynamic}; +use crate::base::{DefaultAllocator, MatrixN}; -use debug::RandomOrthogonal; +use crate::debug::RandomOrthogonal; /// A random, well-conditioned, symmetric definite-positive matrix. #[derive(Clone, Debug)] diff --git a/src/geometry/isometry.rs b/src/geometry/isometry.rs index 0d3c6619..f77d4d60 100644 --- a/src/geometry/isometry.rs +++ b/src/geometry/isometry.rs @@ -14,11 +14,11 @@ use abomonation::Abomonation; use alga::general::{Real, SubsetOf}; use alga::linear::Rotation; -use base::allocator::Allocator; -use base::dimension::{DimName, DimNameAdd, DimNameSum, U1}; -use base::storage::Owned; -use base::{DefaultAllocator, MatrixN}; -use geometry::{Point, Translation}; +use crate::base::allocator::Allocator; +use crate::base::dimension::{DimName, DimNameAdd, DimNameSum, U1}; +use crate::base::storage::Owned; +use crate::base::{DefaultAllocator, MatrixN}; +use crate::geometry::{Point, Translation}; /// A direct isometry, i.e., a rotation followed by a translation, aka. a rigid-body motion, aka. an element of a Special Euclidean (SE) group. #[repr(C)] @@ -285,7 +285,7 @@ where DefaultAllocator: Allocator R: SubsetOf>>, DefaultAllocator: Allocator, DimNameSum>, { - let mut res: MatrixN = ::convert_ref(&self.rotation); + let mut res: MatrixN = crate::convert_ref(&self.rotation); res.fixed_slice_mut::(0, D::dim()) .copy_from(&self.translation.vector); @@ -390,9 +390,9 @@ where fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let precision = f.precision().unwrap_or(3); - try!(writeln!(f, "Isometry {{")); - try!(write!(f, "{:.*}", precision, self.translation)); - try!(write!(f, "{:.*}", precision, self.rotation)); + writeln!(f, "Isometry {{")?; + write!(f, "{:.*}", precision, self.translation)?; + write!(f, "{:.*}", precision, self.rotation)?; writeln!(f, "}}") } } diff --git a/src/geometry/isometry_alga.rs b/src/geometry/isometry_alga.rs index 246947ca..eb9a5cd5 100644 --- a/src/geometry/isometry_alga.rs +++ b/src/geometry/isometry_alga.rs @@ -8,11 +8,11 @@ use alga::linear::{ Transformation, }; -use base::allocator::Allocator; -use base::dimension::DimName; -use base::{DefaultAllocator, VectorN}; +use crate::base::allocator::Allocator; +use crate::base::dimension::DimName; +use crate::base::{DefaultAllocator, VectorN}; -use geometry::{Isometry, Point, Translation}; +use crate::geometry::{Isometry, Point, Translation}; /* * diff --git a/src/geometry/isometry_alias.rs b/src/geometry/isometry_alias.rs index a0804b5c..ba9a69e7 100644 --- a/src/geometry/isometry_alias.rs +++ b/src/geometry/isometry_alias.rs @@ -1,6 +1,6 @@ -use base::dimension::{U2, U3}; +use crate::base::dimension::{U2, U3}; -use geometry::{Isometry, Rotation2, Rotation3, UnitComplex, UnitQuaternion}; +use crate::geometry::{Isometry, Rotation2, Rotation3, UnitComplex, UnitQuaternion}; /// A 2-dimensional direct isometry using a unit complex number for its rotational part. Also known as a rigid-body motion, or as an element of SE(2). pub type Isometry2 = Isometry>; diff --git a/src/geometry/isometry_construction.rs b/src/geometry/isometry_construction.rs index 5a402c0a..3863051c 100644 --- a/src/geometry/isometry_construction.rs +++ b/src/geometry/isometry_construction.rs @@ -1,5 +1,5 @@ #[cfg(feature = "arbitrary")] -use base::storage::Owned; +use crate::base::storage::Owned; #[cfg(feature = "arbitrary")] use quickcheck::{Arbitrary, Gen}; @@ -10,11 +10,11 @@ use rand::Rng; use alga::general::Real; use alga::linear::Rotation as AlgaRotation; -use base::allocator::Allocator; -use base::dimension::{DimName, U2, U3}; -use base::{DefaultAllocator, Vector2, Vector3}; +use crate::base::allocator::Allocator; +use crate::base::dimension::{DimName, U2, U3}; +use crate::base::{DefaultAllocator, Vector2, Vector3}; -use geometry::{ +use crate::geometry::{ Isometry, Point, Point3, Rotation, Rotation2, Rotation3, Translation, UnitComplex, UnitQuaternion, Translation2, Translation3 }; diff --git a/src/geometry/isometry_conversion.rs b/src/geometry/isometry_conversion.rs index 5dc46009..0ce92aca 100644 --- a/src/geometry/isometry_conversion.rs +++ b/src/geometry/isometry_conversion.rs @@ -1,11 +1,11 @@ use alga::general::{Real, SubsetOf, SupersetOf}; use alga::linear::Rotation; -use base::allocator::Allocator; -use base::dimension::{DimMin, DimName, DimNameAdd, DimNameSum, U1}; -use base::{DefaultAllocator, MatrixN}; +use crate::base::allocator::Allocator; +use crate::base::dimension::{DimMin, DimName, DimNameAdd, DimNameSum, U1}; +use crate::base::{DefaultAllocator, MatrixN}; -use geometry::{Isometry, Point, Similarity, SuperTCategoryOf, TAffine, Transform, Translation}; +use crate::geometry::{Isometry, Point, Similarity, SuperTCategoryOf, TAffine, Transform, Translation}; /* * This file provides the following conversions: @@ -32,8 +32,8 @@ where #[inline] fn is_in_subset(iso: &Isometry) -> bool { - ::is_convertible::<_, Translation>(&iso.translation) - && ::is_convertible::<_, R1>(&iso.rotation) + crate::is_convertible::<_, Translation>(&iso.translation) + && crate::is_convertible::<_, R1>(&iso.rotation) } #[inline] @@ -60,12 +60,12 @@ where #[inline] fn is_in_subset(sim: &Similarity) -> bool { - ::is_convertible::<_, Isometry>(&sim.isometry) && sim.scaling() == N2::one() + crate::is_convertible::<_, Isometry>(&sim.isometry) && sim.scaling() == N2::one() } #[inline] unsafe fn from_superset_unchecked(sim: &Similarity) -> Self { - ::convert_ref_unchecked(&sim.isometry) + crate::convert_ref_unchecked(&sim.isometry) } } @@ -133,7 +133,7 @@ where // Scalar types agree. m.iter().all(|e| SupersetOf::::is_in_subset(e)) && // The block part is a rotation. - rot.is_special_orthogonal(N2::default_epsilon() * ::convert(100.0)) && + rot.is_special_orthogonal(N2::default_epsilon() * crate::convert(100.0)) && // The bottom row is (0, 0, ..., 1) bottom.iter().all(|e| e.is_zero()) && m[(D::dim(), D::dim())] == N2::one() } @@ -142,10 +142,10 @@ where unsafe fn from_superset_unchecked(m: &MatrixN>) -> Self { let t = m.fixed_slice::(0, D::dim()).into_owned(); let t = Translation { - vector: ::convert_unchecked(t), + vector: crate::convert_unchecked(t), }; - Self::from_parts(t, ::convert_unchecked(m.clone_owned())) + Self::from_parts(t, crate::convert_unchecked(m.clone_owned())) } } diff --git a/src/geometry/isometry_ops.rs b/src/geometry/isometry_ops.rs index 6a4b921e..b0da4b62 100644 --- a/src/geometry/isometry_ops.rs +++ b/src/geometry/isometry_ops.rs @@ -3,11 +3,11 @@ use std::ops::{Div, DivAssign, Mul, MulAssign}; use alga::general::Real; use alga::linear::Rotation as AlgaRotation; -use base::allocator::Allocator; -use base::dimension::{DimName, U1, U3, U4}; -use base::{DefaultAllocator, Unit, VectorN}; +use crate::base::allocator::Allocator; +use crate::base::dimension::{DimName, U1, U3, U4}; +use crate::base::{DefaultAllocator, Unit, VectorN}; -use geometry::{Isometry, Point, Rotation, Translation, UnitQuaternion}; +use crate::geometry::{Isometry, Point, Rotation, Translation, UnitQuaternion}; // FIXME: there are several cloning of rotations that we could probably get rid of (but we didn't // yet because that would require to add a bound like `where for<'a, 'b> &'a R: Mul<&'b R, Output = R>` diff --git a/src/geometry/orthographic.rs b/src/geometry/orthographic.rs index 3117c1b6..af86a876 100644 --- a/src/geometry/orthographic.rs +++ b/src/geometry/orthographic.rs @@ -9,12 +9,12 @@ use std::mem; use alga::general::Real; -use base::dimension::U3; -use base::helper; -use base::storage::Storage; -use base::{Matrix4, Vector, Vector3}; +use crate::base::dimension::U3; +use crate::base::helper; +use crate::base::storage::Storage; +use crate::base::{Matrix4, Vector, Vector3}; -use geometry::{Point3, Projective3}; +use crate::geometry::{Point3, Projective3}; /// A 3D orthographic projection stored as an homogeneous 4x4 matrix. pub struct Orthographic3 { @@ -150,7 +150,7 @@ impl Orthographic3 { "The apsect ratio must not be zero." ); - let half: N = ::convert(0.5); + let half: N = crate::convert(0.5); let width = zfar * (vfov * half).tan(); let height = width / aspect; @@ -623,7 +623,7 @@ impl Orthographic3 { left != right, "The left corner must not be equal to the right corner." ); - self.matrix[(0, 0)] = ::convert::<_, N>(2.0) / (right - left); + self.matrix[(0, 0)] = crate::convert::<_, N>(2.0) / (right - left); self.matrix[(0, 3)] = -(right + left) / (right - left); } @@ -648,7 +648,7 @@ impl Orthographic3 { bottom != top, "The top corner must not be equal to the bottom corner." ); - self.matrix[(1, 1)] = ::convert::<_, N>(2.0) / (top - bottom); + self.matrix[(1, 1)] = crate::convert::<_, N>(2.0) / (top - bottom); self.matrix[(1, 3)] = -(top + bottom) / (top - bottom); } @@ -673,7 +673,7 @@ impl Orthographic3 { zfar != znear, "The near-plane and far-plane must not be superimposed." ); - self.matrix[(2, 2)] = -::convert::<_, N>(2.0) / (zfar - znear); + self.matrix[(2, 2)] = -crate::convert::<_, N>(2.0) / (zfar - znear); self.matrix[(2, 3)] = -(zfar + znear) / (zfar - znear); } } diff --git a/src/geometry/perspective.rs b/src/geometry/perspective.rs index 550469be..c8125d99 100644 --- a/src/geometry/perspective.rs +++ b/src/geometry/perspective.rs @@ -10,12 +10,12 @@ use std::mem; use alga::general::Real; -use base::dimension::U3; -use base::helper; -use base::storage::Storage; -use base::{Matrix4, Scalar, Vector, Vector3}; +use crate::base::dimension::U3; +use crate::base::helper; +use crate::base::storage::Storage; +use crate::base::{Matrix4, Scalar, Vector, Vector3}; -use geometry::{Point3, Projective3}; +use crate::geometry::{Point3, Projective3}; /// A 3D perspective projection stored as an homogeneous 4x4 matrix. pub struct Perspective3 { @@ -162,7 +162,7 @@ impl Perspective3 { /// Gets the y field of view of the view frustum. #[inline] pub fn fovy(&self) -> N { - (N::one() / self.matrix[(1, 1)]).atan() * ::convert(2.0) + (N::one() / self.matrix[(1, 1)]).atan() * crate::convert(2.0) } /// Gets the near plane offset of the view frustum. @@ -170,7 +170,7 @@ impl Perspective3 { pub fn znear(&self) -> N { let ratio = (-self.matrix[(2, 2)] + N::one()) / (-self.matrix[(2, 2)] - N::one()); - self.matrix[(2, 3)] / (ratio * ::convert(2.0)) - self.matrix[(2, 3)] / ::convert(2.0) + self.matrix[(2, 3)] / (ratio * crate::convert(2.0)) - self.matrix[(2, 3)] / crate::convert(2.0) } /// Gets the far plane offset of the view frustum. @@ -178,7 +178,7 @@ impl Perspective3 { pub fn zfar(&self) -> N { let ratio = (-self.matrix[(2, 2)] + N::one()) / (-self.matrix[(2, 2)] - N::one()); - (self.matrix[(2, 3)] - ratio * self.matrix[(2, 3)]) / ::convert(2.0) + (self.matrix[(2, 3)] - ratio * self.matrix[(2, 3)]) / crate::convert(2.0) } // FIXME: add a method to retrieve znear and zfar simultaneously? @@ -235,7 +235,7 @@ impl Perspective3 { #[inline] pub fn set_fovy(&mut self, fovy: N) { let old_m22 = self.matrix[(1, 1)]; - self.matrix[(1, 1)] = N::one() / (fovy / ::convert(2.0)).tan(); + self.matrix[(1, 1)] = N::one() / (fovy / crate::convert(2.0)).tan(); self.matrix[(0, 0)] = self.matrix[(0, 0)] * (self.matrix[(1, 1)] / old_m22); } @@ -257,7 +257,7 @@ impl Perspective3 { #[inline] pub fn set_znear_and_zfar(&mut self, znear: N, zfar: N) { self.matrix[(2, 2)] = (zfar + znear) / (znear - zfar); - self.matrix[(2, 3)] = zfar * znear * ::convert(2.0) / (znear - zfar); + self.matrix[(2, 3)] = zfar * znear * crate::convert(2.0) / (znear - zfar); } } diff --git a/src/geometry/point.rs b/src/geometry/point.rs index 14ce7dc2..04338d2a 100644 --- a/src/geometry/point.rs +++ b/src/geometry/point.rs @@ -12,10 +12,10 @@ use serde::{Deserialize, Deserializer, Serialize, Serializer}; #[cfg(feature = "abomonation-serialize")] use abomonation::Abomonation; -use base::allocator::Allocator; -use base::dimension::{DimName, DimNameAdd, DimNameSum, U1}; -use base::iter::{MatrixIter, MatrixIterMut}; -use base::{DefaultAllocator, Scalar, VectorN}; +use crate::base::allocator::Allocator; +use crate::base::dimension::{DimName, DimNameAdd, DimNameSum, U1}; +use crate::base::iter::{MatrixIter, MatrixIterMut}; +use crate::base::{DefaultAllocator, Scalar, VectorN}; /// A point in a n-dimensional euclidean space. #[repr(C)] @@ -316,14 +316,14 @@ impl fmt::Display for Point where DefaultAllocator: Allocator { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - try!(write!(f, "{{")); + write!(f, "{{")?; let mut it = self.coords.iter(); - try!(write!(f, "{}", *it.next().unwrap())); + write!(f, "{}", *it.next().unwrap())?; for comp in it { - try!(write!(f, ", {}", *comp)); + write!(f, ", {}", *comp)?; } write!(f, "}}") diff --git a/src/geometry/point_alga.rs b/src/geometry/point_alga.rs index 2f81ceff..c95cb5b2 100644 --- a/src/geometry/point_alga.rs +++ b/src/geometry/point_alga.rs @@ -1,11 +1,11 @@ use alga::general::{Field, JoinSemilattice, Lattice, MeetSemilattice, Real}; use alga::linear::{AffineSpace, EuclideanSpace}; -use base::allocator::Allocator; -use base::dimension::DimName; -use base::{DefaultAllocator, Scalar, VectorN}; +use crate::base::allocator::Allocator; +use crate::base::dimension::DimName; +use crate::base::{DefaultAllocator, Scalar, VectorN}; -use geometry::Point; +use crate::geometry::Point; impl AffineSpace for Point where diff --git a/src/geometry/point_alias.rs b/src/geometry/point_alias.rs index 42086d04..83f57301 100644 --- a/src/geometry/point_alias.rs +++ b/src/geometry/point_alias.rs @@ -1,6 +1,6 @@ -use base::dimension::{U1, U2, U3, U4, U5, U6}; +use crate::base::dimension::{U1, U2, U3, U4, U5, U6}; -use geometry::Point; +use crate::geometry::Point; /// A statically sized 1-dimensional column point. pub type Point1 = Point; diff --git a/src/geometry/point_construction.rs b/src/geometry/point_construction.rs index b6c46779..2fac11d4 100644 --- a/src/geometry/point_construction.rs +++ b/src/geometry/point_construction.rs @@ -6,11 +6,11 @@ use rand::distributions::{Distribution, Standard}; use rand::Rng; use alga::general::ClosedDiv; -use base::allocator::Allocator; -use base::dimension::{DimName, DimNameAdd, DimNameSum, U1, U2, U3, U4, U5, U6}; -use base::{DefaultAllocator, Scalar, VectorN}; +use crate::base::allocator::Allocator; +use crate::base::dimension::{DimName, DimNameAdd, DimNameSum, U1, U2, U3, U4, U5, U6}; +use crate::base::{DefaultAllocator, Scalar, VectorN}; -use geometry::Point; +use crate::geometry::Point; impl Point where DefaultAllocator: Allocator @@ -28,7 +28,7 @@ where DefaultAllocator: Allocator /// ``` /// # use nalgebra::{Point2, Point3}; /// // This works in any dimension. - /// // The explicit :: type annotation may not always be needed, + /// // The explicit crate:: type annotation may not always be needed, /// // depending on the context of type inference. /// let pt = Point2::::origin(); /// assert!(pt.x == 0.0 && pt.y == 0.0); diff --git a/src/geometry/point_conversion.rs b/src/geometry/point_conversion.rs index 50a3a4d2..10438165 100644 --- a/src/geometry/point_conversion.rs +++ b/src/geometry/point_conversion.rs @@ -1,15 +1,15 @@ use alga::general::{ClosedDiv, SubsetOf, SupersetOf}; use num::{One, Zero}; -use base::allocator::Allocator; -use base::dimension::{DimName, DimNameAdd, DimNameSum, U1}; -use base::{DefaultAllocator, Matrix, Scalar, VectorN}; +use crate::base::allocator::Allocator; +use crate::base::dimension::{DimName, DimNameAdd, DimNameSum, U1}; +use crate::base::{DefaultAllocator, Matrix, Scalar, VectorN}; #[cfg(feature = "mint")] -use base::dimension::{U2, U3}; +use crate::base::dimension::{U2, U3}; #[cfg(feature = "mint")] -use base::storage::{Storage, StorageMut}; -use geometry::Point; +use crate::base::storage::{Storage, StorageMut}; +use crate::geometry::Point; #[cfg(feature = "mint")] use mint; #[cfg(feature = "mint")] @@ -67,14 +67,14 @@ where #[inline] fn is_in_subset(v: &VectorN>) -> bool { - ::is_convertible::<_, VectorN>>(v) && !v[D::dim()].is_zero() + crate::is_convertible::<_, VectorN>>(v) && !v[D::dim()].is_zero() } #[inline] unsafe fn from_superset_unchecked(v: &VectorN>) -> Self { let coords = v.fixed_slice::(0, 0) / v[D::dim()]; Self { - coords: ::convert_unchecked(coords) + coords: crate::convert_unchecked(coords) } } } diff --git a/src/geometry/point_coordinates.rs b/src/geometry/point_coordinates.rs index b24ec052..b56e120e 100644 --- a/src/geometry/point_coordinates.rs +++ b/src/geometry/point_coordinates.rs @@ -1,12 +1,12 @@ use std::mem; use std::ops::{Deref, DerefMut}; -use base::allocator::Allocator; -use base::coordinates::{X, XY, XYZ, XYZW, XYZWA, XYZWAB}; -use base::dimension::{U1, U2, U3, U4, U5, U6}; -use base::{DefaultAllocator, Scalar}; +use crate::base::allocator::Allocator; +use crate::base::coordinates::{X, XY, XYZ, XYZW, XYZWA, XYZWAB}; +use crate::base::dimension::{U1, U2, U3, U4, U5, U6}; +use crate::base::{DefaultAllocator, Scalar}; -use geometry::Point; +use crate::geometry::Point; /* * diff --git a/src/geometry/point_ops.rs b/src/geometry/point_ops.rs index 0a20bc90..b49495f8 100644 --- a/src/geometry/point_ops.rs +++ b/src/geometry/point_ops.rs @@ -5,13 +5,13 @@ use std::ops::{ use alga::general::{ClosedAdd, ClosedDiv, ClosedMul, ClosedNeg, ClosedSub}; -use base::allocator::{Allocator, SameShapeAllocator}; -use base::constraint::{AreMultipliable, SameNumberOfColumns, SameNumberOfRows, ShapeConstraint}; -use base::dimension::{Dim, DimName, U1}; -use base::storage::Storage; -use base::{DefaultAllocator, Matrix, Scalar, Vector, VectorSum}; +use crate::base::allocator::{Allocator, SameShapeAllocator}; +use crate::base::constraint::{AreMultipliable, SameNumberOfColumns, SameNumberOfRows, ShapeConstraint}; +use crate::base::dimension::{Dim, DimName, U1}; +use crate::base::storage::Storage; +use crate::base::{DefaultAllocator, Matrix, Scalar, Vector, VectorSum}; -use geometry::Point; +use crate::geometry::Point; /* * diff --git a/src/geometry/quaternion.rs b/src/geometry/quaternion.rs index b58d885c..3beab4bb 100644 --- a/src/geometry/quaternion.rs +++ b/src/geometry/quaternion.rs @@ -6,7 +6,7 @@ use std::hash; use std::io::{Result as IOResult, Write}; #[cfg(feature = "serde-serialize")] -use base::storage::Owned; +use crate::base::storage::Owned; #[cfg(feature = "serde-serialize")] use serde::{Deserialize, Deserializer, Serialize, Serializer}; @@ -15,11 +15,11 @@ use abomonation::Abomonation; use alga::general::Real; -use base::dimension::{U1, U3, U4}; -use base::storage::{CStride, RStride}; -use base::{Matrix3, MatrixN, MatrixSlice, MatrixSliceMut, Unit, Vector3, Vector4}; +use crate::base::dimension::{U1, U3, U4}; +use crate::base::storage::{CStride, RStride}; +use crate::base::{Matrix3, MatrixN, MatrixSlice, MatrixSliceMut, Unit, Vector3, Vector4}; -use geometry::Rotation; +use crate::geometry::Rotation; /// A quaternion. See the type alias `UnitQuaternion = Unit` for a quaternion /// that may be used as a rotation. @@ -225,7 +225,7 @@ impl Quaternion { /// # use nalgebra::{Vector4, Quaternion}; /// let q = Quaternion::new(1.0, 2.0, 3.0, 4.0); /// // Recall that the quaternion is stored internally as (i, j, k, w) - /// // while the ::new constructor takes the arguments as (w, i, j, k). + /// // while the crate::new constructor takes the arguments as (w, i, j, k). /// assert_eq!(*q.as_vector(), Vector4::new(2.0, 3.0, 4.0, 1.0)); /// ``` #[inline] @@ -325,7 +325,7 @@ impl Quaternion { pub fn polar_decomposition(&self) -> (N, N, Option>>) { if let Some((q, n)) = Unit::try_new_and_get(*self, N::zero()) { if let Some(axis) = Unit::try_new(self.vector().clone_owned(), N::zero()) { - let angle = q.angle() / ::convert(2.0f64); + let angle = q.angle() / crate::convert(2.0f64); (n, angle, Some(axis)) } else { @@ -607,7 +607,7 @@ impl UnitQuaternion { if w >= N::one() { N::zero() } else { - w.acos() * ::convert(2.0f64) + w.acos() * crate::convert(2.0f64) } } @@ -937,12 +937,12 @@ impl UnitQuaternion { let ii = i * i; let jj = j * j; let kk = k * k; - let ij = i * j * ::convert(2.0f64); - let wk = w * k * ::convert(2.0f64); - let wj = w * j * ::convert(2.0f64); - let ik = i * k * ::convert(2.0f64); - let jk = j * k * ::convert(2.0f64); - let wi = w * i * ::convert(2.0f64); + let ij = i * j * crate::convert(2.0f64); + let wk = w * k * crate::convert(2.0f64); + let wj = w * j * crate::convert(2.0f64); + let ik = i * k * crate::convert(2.0f64); + let jk = j * k * crate::convert(2.0f64); + let wi = w * i * crate::convert(2.0f64); Rotation::from_matrix_unchecked(Matrix3::new( ww + ii - jj - kk, diff --git a/src/geometry/quaternion_alga.rs b/src/geometry/quaternion_alga.rs index 22534b1a..b1c9a1ba 100644 --- a/src/geometry/quaternion_alga.rs +++ b/src/geometry/quaternion_alga.rs @@ -11,8 +11,8 @@ use alga::linear::{ VectorSpace, }; -use base::{Vector3, Vector4}; -use geometry::{Point3, Quaternion, UnitQuaternion}; +use crate::base::{Vector3, Vector4}; +use crate::geometry::{Point3, Quaternion, UnitQuaternion}; impl Identity for Quaternion { #[inline] diff --git a/src/geometry/quaternion_construction.rs b/src/geometry/quaternion_construction.rs index 0a30fabe..ff72061f 100644 --- a/src/geometry/quaternion_construction.rs +++ b/src/geometry/quaternion_construction.rs @@ -1,7 +1,7 @@ #[cfg(feature = "arbitrary")] -use base::dimension::U4; +use crate::base::dimension::U4; #[cfg(feature = "arbitrary")] -use base::storage::Owned; +use crate::base::storage::Owned; #[cfg(feature = "arbitrary")] use quickcheck::{Arbitrary, Gen}; @@ -11,13 +11,13 @@ use rand::Rng; use alga::general::Real; -use base::dimension::U3; -use base::storage::Storage; +use crate::base::dimension::U3; +use crate::base::storage::Storage; #[cfg(feature = "arbitrary")] -use base::Vector3; -use base::{Unit, Vector, Vector4, Matrix3}; +use crate::base::Vector3; +use crate::base::{Unit, Vector, Vector4, Matrix3}; -use geometry::{Quaternion, Rotation3, UnitQuaternion}; +use crate::geometry::{Quaternion, Rotation3, UnitQuaternion}; impl Quaternion { /// Creates a quaternion from a 4D vector. The quaternion scalar part corresponds to the `w` @@ -74,7 +74,7 @@ impl Quaternion { // FIXME: take a reference to `axis`? pub fn from_polar_decomposition(scale: N, theta: N, axis: Unit>) -> Self where SB: Storage { - let rot = UnitQuaternion::::from_axis_angle(&axis, theta * ::convert(2.0f64)); + let rot = UnitQuaternion::::from_axis_angle(&axis, theta * crate::convert(2.0f64)); rot.into_inner() * scale } @@ -186,7 +186,7 @@ impl UnitQuaternion { #[inline] pub fn from_axis_angle(axis: &Unit>, angle: N) -> Self where SB: Storage { - let (sang, cang) = (angle / ::convert(2.0f64)).sin_cos(); + let (sang, cang) = (angle / crate::convert(2.0f64)).sin_cos(); let q = Quaternion::from_parts(cang, axis.as_ref() * sang); Self::new_unchecked(q) @@ -216,9 +216,9 @@ impl UnitQuaternion { /// ``` #[inline] pub fn from_euler_angles(roll: N, pitch: N, yaw: N) -> Self { - let (sr, cr) = (roll * ::convert(0.5f64)).sin_cos(); - let (sp, cp) = (pitch * ::convert(0.5f64)).sin_cos(); - let (sy, cy) = (yaw * ::convert(0.5f64)).sin_cos(); + let (sr, cr) = (roll * crate::convert(0.5f64)).sin_cos(); + let (sp, cp) = (pitch * crate::convert(0.5f64)).sin_cos(); + let (sy, cy) = (yaw * crate::convert(0.5f64)).sin_cos(); let q = Quaternion::new( cr * cp * cy + sr * sp * sy, @@ -251,10 +251,10 @@ impl UnitQuaternion { let tr = rotmat[(0, 0)] + rotmat[(1, 1)] + rotmat[(2, 2)]; let res; - let _0_25: N = ::convert(0.25); + let _0_25: N = crate::convert(0.25); if tr > N::zero() { - let denom = (tr + N::one()).sqrt() * ::convert(2.0); + let denom = (tr + N::one()).sqrt() * crate::convert(2.0); res = Quaternion::new( _0_25 * denom, (rotmat[(2, 1)] - rotmat[(1, 2)]) / denom, @@ -263,7 +263,7 @@ impl UnitQuaternion { ); } else if rotmat[(0, 0)] > rotmat[(1, 1)] && rotmat[(0, 0)] > rotmat[(2, 2)] { let denom = (N::one() + rotmat[(0, 0)] - rotmat[(1, 1)] - rotmat[(2, 2)]).sqrt() - * ::convert(2.0); + * crate::convert(2.0); res = Quaternion::new( (rotmat[(2, 1)] - rotmat[(1, 2)]) / denom, _0_25 * denom, @@ -272,7 +272,7 @@ impl UnitQuaternion { ); } else if rotmat[(1, 1)] > rotmat[(2, 2)] { let denom = (N::one() + rotmat[(1, 1)] - rotmat[(0, 0)] - rotmat[(2, 2)]).sqrt() - * ::convert(2.0); + * crate::convert(2.0); res = Quaternion::new( (rotmat[(0, 2)] - rotmat[(2, 0)]) / denom, (rotmat[(0, 1)] + rotmat[(1, 0)]) / denom, @@ -281,7 +281,7 @@ impl UnitQuaternion { ); } else { let denom = (N::one() + rotmat[(2, 2)] - rotmat[(0, 0)] - rotmat[(1, 1)]).sqrt() - * ::convert(2.0); + * crate::convert(2.0); res = Quaternion::new( (rotmat[(1, 0)] - rotmat[(0, 1)]) / denom, (rotmat[(0, 2)] + rotmat[(2, 0)]) / denom, @@ -578,7 +578,7 @@ impl UnitQuaternion { #[inline] pub fn new(axisangle: Vector) -> Self where SB: Storage { - let two: N = ::convert(2.0f64); + let two: N = crate::convert(2.0f64); let q = Quaternion::::from_parts(N::zero(), axisangle / two).exp(); Self::new_unchecked(q) } @@ -607,7 +607,7 @@ impl UnitQuaternion { #[inline] pub fn new_eps(axisangle: Vector, eps: N) -> Self where SB: Storage { - let two: N = ::convert(2.0f64); + let two: N = crate::convert(2.0f64); let q = Quaternion::::from_parts(N::zero(), axisangle / two).exp_eps(eps); Self::new_unchecked(q) } diff --git a/src/geometry/quaternion_conversion.rs b/src/geometry/quaternion_conversion.rs index a0b44390..cd5d9f0c 100644 --- a/src/geometry/quaternion_conversion.rs +++ b/src/geometry/quaternion_conversion.rs @@ -6,9 +6,9 @@ use alga::linear::Rotation as AlgaRotation; #[cfg(feature = "mint")] use mint; -use base::dimension::U3; -use base::{Matrix3, Matrix4, Vector4}; -use geometry::{ +use crate::base::dimension::U3; +use crate::base::{Matrix3, Matrix4, Vector4}; +use crate::geometry::{ Isometry, Point3, Quaternion, Rotation, Rotation3, Similarity, SuperTCategoryOf, TAffine, Transform, Translation, UnitQuaternion, }; @@ -44,7 +44,7 @@ where #[inline] fn is_in_subset(q: &Quaternion) -> bool { - ::is_convertible::<_, Vector4>(&q.coords) + crate::is_convertible::<_, Vector4>(&q.coords) } #[inline] @@ -67,12 +67,12 @@ where #[inline] fn is_in_subset(uq: &UnitQuaternion) -> bool { - ::is_convertible::<_, Quaternion>(uq.as_ref()) + crate::is_convertible::<_, Quaternion>(uq.as_ref()) } #[inline] unsafe fn from_superset_unchecked(uq: &UnitQuaternion) -> Self { - Self::new_unchecked(::convert_ref_unchecked(uq.as_ref())) + Self::new_unchecked(crate::convert_ref_unchecked(uq.as_ref())) } } @@ -89,13 +89,13 @@ where #[inline] fn is_in_subset(rot: &Rotation3) -> bool { - ::is_convertible::<_, Rotation3>(rot) + crate::is_convertible::<_, Rotation3>(rot) } #[inline] unsafe fn from_superset_unchecked(rot: &Rotation3) -> Self { let q = UnitQuaternion::::from_rotation_matrix(rot); - ::convert_unchecked(q) + crate::convert_unchecked(q) } } @@ -107,7 +107,7 @@ where { #[inline] fn to_superset(&self) -> Isometry { - Isometry::from_parts(Translation::identity(), ::convert_ref(self)) + Isometry::from_parts(Translation::identity(), crate::convert_ref(self)) } #[inline] @@ -117,7 +117,7 @@ where #[inline] unsafe fn from_superset_unchecked(iso: &Isometry) -> Self { - ::convert_ref_unchecked(&iso.rotation) + crate::convert_ref_unchecked(&iso.rotation) } } @@ -129,7 +129,7 @@ where { #[inline] fn to_superset(&self) -> Similarity { - Similarity::from_isometry(::convert_ref(self), N2::one()) + Similarity::from_isometry(crate::convert_ref(self), N2::one()) } #[inline] @@ -139,7 +139,7 @@ where #[inline] unsafe fn from_superset_unchecked(sim: &Similarity) -> Self { - ::convert_ref_unchecked(&sim.isometry) + crate::convert_ref_unchecked(&sim.isometry) } } @@ -173,12 +173,12 @@ impl> SubsetOf> for UnitQuaterni #[inline] fn is_in_subset(m: &Matrix4) -> bool { - ::is_convertible::<_, Rotation3>(m) + crate::is_convertible::<_, Rotation3>(m) } #[inline] unsafe fn from_superset_unchecked(m: &Matrix4) -> Self { - let rot: Rotation3 = ::convert_ref_unchecked(m); + let rot: Rotation3 = crate::convert_ref_unchecked(m); Self::from_rotation_matrix(&rot) } } diff --git a/src/geometry/quaternion_coordinates.rs b/src/geometry/quaternion_coordinates.rs index 228f74bf..05d5af13 100644 --- a/src/geometry/quaternion_coordinates.rs +++ b/src/geometry/quaternion_coordinates.rs @@ -3,9 +3,9 @@ use std::ops::{Deref, DerefMut}; use alga::general::Real; -use base::coordinates::IJKW; +use crate::base::coordinates::IJKW; -use geometry::Quaternion; +use crate::geometry::Quaternion; impl Deref for Quaternion { type Target = IJKW; diff --git a/src/geometry/quaternion_ops.rs b/src/geometry/quaternion_ops.rs index 2ed72453..3fc840ff 100644 --- a/src/geometry/quaternion_ops.rs +++ b/src/geometry/quaternion_ops.rs @@ -56,12 +56,12 @@ use std::ops::{ use alga::general::Real; -use base::allocator::Allocator; -use base::dimension::{U1, U3, U4}; -use base::storage::Storage; -use base::{DefaultAllocator, Unit, Vector, Vector3}; +use crate::base::allocator::Allocator; +use crate::base::dimension::{U1, U3, U4}; +use crate::base::storage::Storage; +use crate::base::{DefaultAllocator, Unit, Vector, Vector3}; -use geometry::{Point3, Quaternion, Rotation, UnitQuaternion}; +use crate::geometry::{Point3, Quaternion, Rotation, UnitQuaternion}; impl Index for Quaternion { type Output = N; @@ -390,7 +390,7 @@ quaternion_op_impl!( self: &'a UnitQuaternion, rhs: &'b Vector, Output = Vector3 => U3, U4; { - let two: N = ::convert(2.0f64); + let two: N = crate::convert(2.0f64); let t = self.as_ref().vector().cross(rhs) * two; let cross = self.as_ref().vector().cross(&t); diff --git a/src/geometry/reflection.rs b/src/geometry/reflection.rs index 45e6381c..a13e235a 100644 --- a/src/geometry/reflection.rs +++ b/src/geometry/reflection.rs @@ -1,11 +1,11 @@ use alga::general::Complex; -use base::allocator::Allocator; -use base::constraint::{AreMultipliable, DimEq, SameNumberOfRows, ShapeConstraint}; -use base::{DefaultAllocator, Matrix, Scalar, Unit, Vector}; -use dimension::{Dim, DimName, U1}; -use storage::{Storage, StorageMut}; +use crate::base::allocator::Allocator; +use crate::base::constraint::{AreMultipliable, DimEq, SameNumberOfRows, ShapeConstraint}; +use crate::base::{DefaultAllocator, Matrix, Scalar, Unit, Vector}; +use crate::dimension::{Dim, DimName, U1}; +use crate::storage::{Storage, StorageMut}; -use geometry::Point; +use crate::geometry::Point; /// A reflection wrt. a plane. pub struct Reflection> { @@ -55,7 +55,7 @@ impl> Reflection { // NOTE: we borrow the column twice here. First it is borrowed immutably for the // dot product, and then mutably. Somehow, this allows significantly // better optimizations of the dot product from the compiler. - let m_two: N = ::convert(-2.0f64); + let m_two: N = crate::convert(-2.0f64); let factor = (self.axis.dotc(&rhs.column(i)) - self.bias) * m_two; rhs.column_mut(i).axpy(factor, &self.axis, N::one()); } @@ -72,7 +72,7 @@ impl> Reflection { // NOTE: we borrow the column twice here. First it is borrowed immutably for the // dot product, and then mutably. Somehow, this allows significantly // better optimizations of the dot product from the compiler. - let m_two = sign.scale(::convert(-2.0f64)); + let m_two = sign.scale(crate::convert(-2.0f64)); let factor = (self.axis.dotc(&rhs.column(i)) - self.bias) * m_two; rhs.column_mut(i).axpy(factor, &self.axis, sign); } @@ -95,7 +95,7 @@ impl> Reflection { work.add_scalar_mut(-self.bias); } - let m_two: N = ::convert(-2.0f64); + let m_two: N = crate::convert(-2.0f64); lhs.gerc(m_two, &work, &self.axis, N::one()); } @@ -117,7 +117,7 @@ impl> Reflection { work.add_scalar_mut(-self.bias); } - let m_two = sign.scale(::convert(-2.0f64)); + let m_two = sign.scale(crate::convert(-2.0f64)); lhs.gerc(m_two, &work, &self.axis, sign); } } diff --git a/src/geometry/rotation.rs b/src/geometry/rotation.rs index ca9d888f..21e240fe 100644 --- a/src/geometry/rotation.rs +++ b/src/geometry/rotation.rs @@ -9,16 +9,16 @@ use std::io::{Result as IOResult, Write}; use serde::{Deserialize, Deserializer, Serialize, Serializer}; #[cfg(feature = "serde-serialize")] -use base::storage::Owned; +use crate::base::storage::Owned; #[cfg(feature = "abomonation-serialize")] use abomonation::Abomonation; use alga::general::Real; -use base::allocator::Allocator; -use base::dimension::{DimName, DimNameAdd, DimNameSum, U1}; -use base::{DefaultAllocator, MatrixN, Scalar}; +use crate::base::allocator::Allocator; +use crate::base::dimension::{DimName, DimNameAdd, DimNameSum, U1}; +use crate::base::{DefaultAllocator, MatrixN, Scalar}; /// A rotation matrix. #[repr(C)] @@ -435,8 +435,8 @@ where fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let precision = f.precision().unwrap_or(3); - try!(writeln!(f, "Rotation matrix {{")); - try!(write!(f, "{:.*}", precision, self.matrix)); + writeln!(f, "Rotation matrix {{")?; + write!(f, "{:.*}", precision, self.matrix)?; writeln!(f, "}}") } } diff --git a/src/geometry/rotation_alga.rs b/src/geometry/rotation_alga.rs index 18c47b41..e5c1edad 100644 --- a/src/geometry/rotation_alga.rs +++ b/src/geometry/rotation_alga.rs @@ -7,11 +7,11 @@ use alga::linear::{ ProjectiveTransformation, Similarity, Transformation, }; -use base::allocator::Allocator; -use base::dimension::DimName; -use base::{DefaultAllocator, VectorN}; +use crate::base::allocator::Allocator; +use crate::base::dimension::DimName; +use crate::base::{DefaultAllocator, VectorN}; -use geometry::{Point, Rotation}; +use crate::geometry::{Point, Rotation}; /* * @@ -251,7 +251,7 @@ impl SquareMatrix for Rotation { #[inline] fn determinant(&self) -> Self::Field { - ::one() + crate::one() } #[inline] diff --git a/src/geometry/rotation_alias.rs b/src/geometry/rotation_alias.rs index a11bba99..9fa5c2d0 100644 --- a/src/geometry/rotation_alias.rs +++ b/src/geometry/rotation_alias.rs @@ -1,6 +1,6 @@ -use base::dimension::{U2, U3}; +use crate::base::dimension::{U2, U3}; -use geometry::Rotation; +use crate::geometry::Rotation; /// A 2-dimensional rotation matrix. pub type Rotation2 = Rotation; diff --git a/src/geometry/rotation_construction.rs b/src/geometry/rotation_construction.rs index 0da2cb29..a7779cc6 100644 --- a/src/geometry/rotation_construction.rs +++ b/src/geometry/rotation_construction.rs @@ -2,11 +2,11 @@ use num::{One, Zero}; use alga::general::{ClosedAdd, ClosedMul}; -use base::allocator::Allocator; -use base::dimension::DimName; -use base::{DefaultAllocator, MatrixN, Scalar}; +use crate::base::allocator::Allocator; +use crate::base::dimension::DimName; +use crate::base::{DefaultAllocator, MatrixN, Scalar}; -use geometry::Rotation; +use crate::geometry::Rotation; impl Rotation where diff --git a/src/geometry/rotation_conversion.rs b/src/geometry/rotation_conversion.rs index 044d85af..6adee2d8 100644 --- a/src/geometry/rotation_conversion.rs +++ b/src/geometry/rotation_conversion.rs @@ -6,11 +6,11 @@ use alga::linear::Rotation as AlgaRotation; #[cfg(feature = "mint")] use mint; -use base::allocator::Allocator; -use base::dimension::{DimMin, DimName, DimNameAdd, DimNameSum, U1}; -use base::{DefaultAllocator, Matrix2, Matrix3, Matrix4, MatrixN}; +use crate::base::allocator::Allocator; +use crate::base::dimension::{DimMin, DimName, DimNameAdd, DimNameSum, U1}; +use crate::base::{DefaultAllocator, Matrix2, Matrix3, Matrix4, MatrixN}; -use geometry::{ +use crate::geometry::{ Isometry, Point, Rotation, Rotation2, Rotation3, Similarity, SuperTCategoryOf, TAffine, Transform, Translation, UnitComplex, UnitQuaternion, }; @@ -43,7 +43,7 @@ where #[inline] fn is_in_subset(rot: &Rotation) -> bool { - ::is_convertible::<_, MatrixN>(rot.matrix()) + crate::is_convertible::<_, MatrixN>(rot.matrix()) } #[inline] @@ -65,12 +65,12 @@ where #[inline] fn is_in_subset(q: &UnitQuaternion) -> bool { - ::is_convertible::<_, UnitQuaternion>(q) + crate::is_convertible::<_, UnitQuaternion>(q) } #[inline] unsafe fn from_superset_unchecked(q: &UnitQuaternion) -> Self { - let q: UnitQuaternion = ::convert_ref_unchecked(q); + let q: UnitQuaternion = crate::convert_ref_unchecked(q); q.to_rotation_matrix() } } @@ -88,12 +88,12 @@ where #[inline] fn is_in_subset(q: &UnitComplex) -> bool { - ::is_convertible::<_, UnitComplex>(q) + crate::is_convertible::<_, UnitComplex>(q) } #[inline] unsafe fn from_superset_unchecked(q: &UnitComplex) -> Self { - let q: UnitComplex = ::convert_ref_unchecked(q); + let q: UnitComplex = crate::convert_ref_unchecked(q); q.to_rotation_matrix() } } @@ -107,7 +107,7 @@ where { #[inline] fn to_superset(&self) -> Isometry { - Isometry::from_parts(Translation::identity(), ::convert_ref(self)) + Isometry::from_parts(Translation::identity(), crate::convert_ref(self)) } #[inline] @@ -117,7 +117,7 @@ where #[inline] unsafe fn from_superset_unchecked(iso: &Isometry) -> Self { - ::convert_ref_unchecked(&iso.rotation) + crate::convert_ref_unchecked(&iso.rotation) } } @@ -130,7 +130,7 @@ where { #[inline] fn to_superset(&self) -> Similarity { - Similarity::from_parts(Translation::identity(), ::convert_ref(self), N2::one()) + Similarity::from_parts(Translation::identity(), crate::convert_ref(self), N2::one()) } #[inline] @@ -140,7 +140,7 @@ where #[inline] unsafe fn from_superset_unchecked(sim: &Similarity) -> Self { - ::convert_ref_unchecked(&sim.isometry.rotation) + crate::convert_ref_unchecked(&sim.isometry.rotation) } } @@ -198,7 +198,7 @@ where // Scalar types agree. m.iter().all(|e| SupersetOf::::is_in_subset(e)) && // The block part is a rotation. - rot.is_special_orthogonal(N2::default_epsilon() * ::convert(100.0)) && + rot.is_special_orthogonal(N2::default_epsilon() * crate::convert(100.0)) && // The bottom row is (0, 0, ..., 1) bottom.iter().all(|e| e.is_zero()) && m[(D::dim(), D::dim())] == N2::one() } @@ -206,7 +206,7 @@ where #[inline] unsafe fn from_superset_unchecked(m: &MatrixN>) -> Self { let r = m.fixed_slice::(0, 0); - Self::from_matrix_unchecked(::convert_unchecked(r.into_owned())) + Self::from_matrix_unchecked(crate::convert_unchecked(r.into_owned())) } } diff --git a/src/geometry/rotation_ops.rs b/src/geometry/rotation_ops.rs index fae70921..ed555b6b 100644 --- a/src/geometry/rotation_ops.rs +++ b/src/geometry/rotation_ops.rs @@ -22,13 +22,13 @@ use std::ops::{Div, DivAssign, Index, Mul, MulAssign}; use alga::general::{ClosedAdd, ClosedMul}; -use base::allocator::Allocator; -use base::constraint::{AreMultipliable, ShapeConstraint}; -use base::dimension::{Dim, DimName, U1}; -use base::storage::Storage; -use base::{DefaultAllocator, Matrix, MatrixMN, Scalar, Unit, Vector, VectorN}; +use crate::base::allocator::Allocator; +use crate::base::constraint::{AreMultipliable, ShapeConstraint}; +use crate::base::dimension::{Dim, DimName, U1}; +use crate::base::storage::Storage; +use crate::base::{DefaultAllocator, Matrix, MatrixMN, Scalar, Unit, Vector, VectorN}; -use geometry::{Point, Rotation}; +use crate::geometry::{Point, Rotation}; impl Index<(usize, usize)> for Rotation where DefaultAllocator: Allocator diff --git a/src/geometry/rotation_specialization.rs b/src/geometry/rotation_specialization.rs index 0aeb3041..95fa3c07 100644 --- a/src/geometry/rotation_specialization.rs +++ b/src/geometry/rotation_specialization.rs @@ -1,5 +1,5 @@ #[cfg(feature = "arbitrary")] -use base::storage::Owned; +use crate::base::storage::Owned; #[cfg(feature = "arbitrary")] use quickcheck::{Arbitrary, Gen}; @@ -9,11 +9,11 @@ use rand::distributions::{Distribution, OpenClosed01, Standard}; use rand::Rng; use std::ops::Neg; -use base::dimension::{U1, U2, U3}; -use base::storage::Storage; -use base::{Matrix2, Matrix3, MatrixN, Unit, Vector, Vector1, Vector3, VectorN}; +use crate::base::dimension::{U1, U2, U3}; +use crate::base::storage::Storage; +use crate::base::{Matrix2, Matrix3, MatrixN, Unit, Vector, Vector1, Vector3, VectorN}; -use geometry::{Rotation2, Rotation3, UnitComplex, UnitQuaternion}; +use crate::geometry::{Rotation2, Rotation3, UnitComplex, UnitQuaternion}; /* * @@ -113,7 +113,7 @@ impl Rotation2 { SB: Storage, SC: Storage, { - ::convert(UnitComplex::rotation_between(a, b).to_rotation_matrix()) + crate::convert(UnitComplex::rotation_between(a, b).to_rotation_matrix()) } /// The smallest rotation needed to make `a` and `b` collinear and point toward the same @@ -140,7 +140,7 @@ impl Rotation2 { SB: Storage, SC: Storage, { - ::convert(UnitComplex::scaled_rotation_between(a, b, s).to_rotation_matrix()) + crate::convert(UnitComplex::scaled_rotation_between(a, b, s).to_rotation_matrix()) } /// The rotation angle. @@ -682,7 +682,7 @@ impl Rotation3 { #[inline] pub fn angle(&self) -> N { ((self.matrix()[(0, 0)] + self.matrix()[(1, 1)] + self.matrix()[(2, 2)] - N::one()) - / ::convert(2.0)) + / crate::convert(2.0)) .acos() } diff --git a/src/geometry/similarity.rs b/src/geometry/similarity.rs index 1d2f50b4..f0bc6d2e 100644 --- a/src/geometry/similarity.rs +++ b/src/geometry/similarity.rs @@ -13,11 +13,11 @@ use abomonation::Abomonation; use alga::general::{Real, SubsetOf}; use alga::linear::Rotation; -use base::allocator::Allocator; -use base::dimension::{DimName, DimNameAdd, DimNameSum, U1}; -use base::storage::Owned; -use base::{DefaultAllocator, MatrixN}; -use geometry::{Isometry, Point, Translation}; +use crate::base::allocator::Allocator; +use crate::base::dimension::{DimName, DimNameAdd, DimNameSum, U1}; +use crate::base::storage::Owned; +use crate::base::{DefaultAllocator, MatrixN}; +use crate::geometry::{Isometry, Point, Translation}; /// A similarity, i.e., an uniform scaling, followed by a rotation, followed by a translation. #[repr(C)] @@ -361,9 +361,9 @@ where fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let precision = f.precision().unwrap_or(3); - try!(writeln!(f, "Similarity {{")); - try!(write!(f, "{:.*}", precision, self.isometry)); - try!(write!(f, "Scaling: {:.*}", precision, self.scaling)); + writeln!(f, "Similarity {{")?; + write!(f, "{:.*}", precision, self.isometry)?; + write!(f, "Scaling: {:.*}", precision, self.scaling)?; writeln!(f, "}}") } } diff --git a/src/geometry/similarity_alga.rs b/src/geometry/similarity_alga.rs index e8a6b154..9aaefe48 100644 --- a/src/geometry/similarity_alga.rs +++ b/src/geometry/similarity_alga.rs @@ -5,11 +5,11 @@ use alga::general::{ use alga::linear::Similarity as AlgaSimilarity; use alga::linear::{AffineTransformation, ProjectiveTransformation, Rotation, Transformation}; -use base::allocator::Allocator; -use base::dimension::DimName; -use base::{DefaultAllocator, VectorN}; +use crate::base::allocator::Allocator; +use crate::base::dimension::DimName; +use crate::base::{DefaultAllocator, VectorN}; -use geometry::{Point, Similarity, Translation}; +use crate::geometry::{Point, Similarity, Translation}; /* * diff --git a/src/geometry/similarity_alias.rs b/src/geometry/similarity_alias.rs index 9d3a2f45..c2c887ac 100644 --- a/src/geometry/similarity_alias.rs +++ b/src/geometry/similarity_alias.rs @@ -1,6 +1,6 @@ -use base::dimension::{U2, U3}; +use crate::base::dimension::{U2, U3}; -use geometry::{Rotation2, Rotation3, Similarity, UnitComplex, UnitQuaternion}; +use crate::geometry::{Rotation2, Rotation3, Similarity, UnitComplex, UnitQuaternion}; /// A 2-dimensional similarity. pub type Similarity2 = Similarity>; diff --git a/src/geometry/similarity_construction.rs b/src/geometry/similarity_construction.rs index 47bb46c7..0875c189 100644 --- a/src/geometry/similarity_construction.rs +++ b/src/geometry/similarity_construction.rs @@ -1,5 +1,5 @@ #[cfg(feature = "arbitrary")] -use base::storage::Owned; +use crate::base::storage::Owned; #[cfg(feature = "arbitrary")] use quickcheck::{Arbitrary, Gen}; @@ -10,11 +10,11 @@ use rand::Rng; use alga::general::Real; use alga::linear::Rotation as AlgaRotation; -use base::allocator::Allocator; -use base::dimension::{DimName, U2, U3}; -use base::{DefaultAllocator, Vector2, Vector3}; +use crate::base::allocator::Allocator; +use crate::base::dimension::{DimName, U2, U3}; +use crate::base::{DefaultAllocator, Vector2, Vector3}; -use geometry::{ +use crate::geometry::{ Isometry, Point, Point3, Rotation2, Rotation3, Similarity, Translation, UnitComplex, UnitQuaternion, }; diff --git a/src/geometry/similarity_conversion.rs b/src/geometry/similarity_conversion.rs index 34943fee..a040def3 100644 --- a/src/geometry/similarity_conversion.rs +++ b/src/geometry/similarity_conversion.rs @@ -1,11 +1,11 @@ use alga::general::{Real, SubsetOf, SupersetOf}; use alga::linear::Rotation; -use base::allocator::Allocator; -use base::dimension::{DimMin, DimName, DimNameAdd, DimNameSum, U1}; -use base::{DefaultAllocator, MatrixN}; +use crate::base::allocator::Allocator; +use crate::base::dimension::{DimMin, DimName, DimNameAdd, DimNameSum, U1}; +use crate::base::{DefaultAllocator, MatrixN}; -use geometry::{Isometry, Point, Similarity, SuperTCategoryOf, TAffine, Transform, Translation}; +use crate::geometry::{Isometry, Point, Similarity, SuperTCategoryOf, TAffine, Transform, Translation}; /* * This file provides the following conversions: @@ -31,8 +31,8 @@ where #[inline] fn is_in_subset(sim: &Similarity) -> bool { - ::is_convertible::<_, Isometry>(&sim.isometry) - && ::is_convertible::<_, N1>(&sim.scaling()) + crate::is_convertible::<_, Isometry>(&sim.isometry) + && crate::is_convertible::<_, N1>(&sim.scaling()) } #[inline] @@ -143,7 +143,7 @@ where let nb = mm.fixed_slice_mut::(0, 1).normalize_mut(); let nc = mm.fixed_slice_mut::(0, 2).normalize_mut(); - let mut scale = (na + nb + nc) / ::convert(3.0); // We take the mean, for robustness. + let mut scale = (na + nb + nc) / crate::convert(3.0); // We take the mean, for robustness. // FIXME: could we avoid the explicit computation of the determinant? // (its sign is needed to see if the scaling factor is negative). @@ -156,10 +156,10 @@ where let t = m.fixed_slice::(0, D::dim()).into_owned(); let t = Translation { - vector: ::convert_unchecked(t), + vector: crate::convert_unchecked(t), }; - Self::from_parts(t, ::convert_unchecked(mm), ::convert_unchecked(scale)) + Self::from_parts(t, crate::convert_unchecked(mm), crate::convert_unchecked(scale)) } } diff --git a/src/geometry/similarity_ops.rs b/src/geometry/similarity_ops.rs index 081e5133..fec4bdeb 100644 --- a/src/geometry/similarity_ops.rs +++ b/src/geometry/similarity_ops.rs @@ -3,11 +3,11 @@ use std::ops::{Div, DivAssign, Mul, MulAssign}; use alga::general::Real; use alga::linear::Rotation as AlgaRotation; -use base::allocator::Allocator; -use base::dimension::{DimName, U1, U3, U4}; -use base::{DefaultAllocator, VectorN}; +use crate::base::allocator::Allocator; +use crate::base::dimension::{DimName, U1, U3, U4}; +use crate::base::{DefaultAllocator, VectorN}; -use geometry::{Isometry, Point, Rotation, Similarity, Translation, UnitQuaternion}; +use crate::geometry::{Isometry, Point, Rotation, Similarity, Translation, UnitQuaternion}; // FIXME: there are several cloning of rotations that we could probably get rid of (but we didn't // yet because that would require to add a bound like `where for<'a, 'b> &'a R: Mul<&'b R, Output = R>` diff --git a/src/geometry/swizzle.rs b/src/geometry/swizzle.rs index 20c8dffd..d5740016 100644 --- a/src/geometry/swizzle.rs +++ b/src/geometry/swizzle.rs @@ -1,6 +1,6 @@ -use base::allocator::Allocator; -use base::{DefaultAllocator, DimName, Scalar}; -use geometry::{Point, Point2, Point3}; +use crate::base::allocator::Allocator; +use crate::base::{DefaultAllocator, DimName, Scalar}; +use crate::geometry::{Point, Point2, Point3}; use typenum::{self, Cmp, Greater}; macro_rules! impl_swizzle { diff --git a/src/geometry/transform.rs b/src/geometry/transform.rs index 0d5d9c4a..9b62d531 100644 --- a/src/geometry/transform.rs +++ b/src/geometry/transform.rs @@ -8,10 +8,10 @@ use serde::{Deserialize, Deserializer, Serialize, Serializer}; use alga::general::Real; -use base::allocator::Allocator; -use base::dimension::{DimName, DimNameAdd, DimNameSum, U1}; -use base::storage::Owned; -use base::{DefaultAllocator, MatrixN}; +use crate::base::allocator::Allocator; +use crate::base::dimension::{DimName, DimNameAdd, DimNameSum, U1}; +use crate::base::storage::Owned; +use crate::base::{DefaultAllocator, MatrixN}; /// Trait implemented by phantom types identifying the projective transformation type. /// @@ -523,7 +523,7 @@ where #[cfg(test)] mod tests { use super::*; - use base::Matrix4; + use crate::base::Matrix4; #[test] fn checks_homogeneous_invariants_of_square_identity_matrix() { diff --git a/src/geometry/transform_alga.rs b/src/geometry/transform_alga.rs index c5ba675b..0ece3862 100644 --- a/src/geometry/transform_alga.rs +++ b/src/geometry/transform_alga.rs @@ -4,11 +4,11 @@ use alga::general::{ }; use alga::linear::{ProjectiveTransformation, Transformation}; -use base::allocator::Allocator; -use base::dimension::{DimNameAdd, DimNameSum, U1}; -use base::{DefaultAllocator, VectorN}; +use crate::base::allocator::Allocator; +use crate::base::dimension::{DimNameAdd, DimNameSum, U1}; +use crate::base::{DefaultAllocator, VectorN}; -use geometry::{Point, SubTCategoryOf, TCategory, TProjective, Transform}; +use crate::geometry::{Point, SubTCategoryOf, TCategory, TProjective, Transform}; /* * diff --git a/src/geometry/transform_alias.rs b/src/geometry/transform_alias.rs index 6f529966..1ccc5f95 100644 --- a/src/geometry/transform_alias.rs +++ b/src/geometry/transform_alias.rs @@ -1,6 +1,6 @@ -use base::dimension::{U2, U3}; +use crate::base::dimension::{U2, U3}; -use geometry::{TAffine, TGeneral, TProjective, Transform}; +use crate::geometry::{TAffine, TGeneral, TProjective, Transform}; /// A 2D general transformation that may not be invertible. Stored as an homogeneous 3x3 matrix. pub type Transform2 = Transform; diff --git a/src/geometry/transform_construction.rs b/src/geometry/transform_construction.rs index 3244ad8a..55733a90 100644 --- a/src/geometry/transform_construction.rs +++ b/src/geometry/transform_construction.rs @@ -2,11 +2,11 @@ use num::One; use alga::general::Real; -use base::allocator::Allocator; -use base::dimension::{DimNameAdd, DimNameSum, U1}; -use base::{DefaultAllocator, MatrixN}; +use crate::base::allocator::Allocator; +use crate::base::dimension::{DimNameAdd, DimNameSum, U1}; +use crate::base::{DefaultAllocator, MatrixN}; -use geometry::{TCategory, Transform}; +use crate::geometry::{TCategory, Transform}; impl, C: TCategory> Transform where DefaultAllocator: Allocator, DimNameSum> diff --git a/src/geometry/transform_conversion.rs b/src/geometry/transform_conversion.rs index ab5ad5df..651ab69b 100644 --- a/src/geometry/transform_conversion.rs +++ b/src/geometry/transform_conversion.rs @@ -1,10 +1,10 @@ use alga::general::{Real, SubsetOf}; -use base::allocator::Allocator; -use base::dimension::{DimName, DimNameAdd, DimNameSum, U1}; -use base::{DefaultAllocator, MatrixN}; +use crate::base::allocator::Allocator; +use crate::base::dimension::{DimName, DimNameAdd, DimNameSum, U1}; +use crate::base::{DefaultAllocator, MatrixN}; -use geometry::{SuperTCategoryOf, TCategory, Transform}; +use crate::geometry::{SuperTCategoryOf, TCategory, Transform}; impl SubsetOf> for Transform where @@ -57,7 +57,7 @@ where #[inline] unsafe fn from_superset_unchecked(m: &MatrixN>) -> Self { - Self::from_matrix_unchecked(::convert_ref_unchecked(m)) + Self::from_matrix_unchecked(crate::convert_ref_unchecked(m)) } } diff --git a/src/geometry/transform_ops.rs b/src/geometry/transform_ops.rs index 2ede5c60..9d03038d 100644 --- a/src/geometry/transform_ops.rs +++ b/src/geometry/transform_ops.rs @@ -3,11 +3,11 @@ use std::ops::{Div, DivAssign, Index, IndexMut, Mul, MulAssign}; use alga::general::{ClosedAdd, ClosedMul, Real, SubsetOf}; -use base::allocator::Allocator; -use base::dimension::{DimName, DimNameAdd, DimNameSum, U1, U3, U4}; -use base::{DefaultAllocator, MatrixN, Scalar, VectorN}; +use crate::base::allocator::Allocator; +use crate::base::dimension::{DimName, DimNameAdd, DimNameSum, U1, U3, U4}; +use crate::base::{DefaultAllocator, MatrixN, Scalar, VectorN}; -use geometry::{ +use crate::geometry::{ Isometry, Point, Rotation, Similarity, SubTCategoryOf, SuperTCategoryOf, TAffine, TCategory, TCategoryMul, TGeneral, TProjective, Transform, Translation, UnitQuaternion, }; diff --git a/src/geometry/translation.rs b/src/geometry/translation.rs index 7b1a8957..3b620b20 100644 --- a/src/geometry/translation.rs +++ b/src/geometry/translation.rs @@ -13,10 +13,10 @@ use abomonation::Abomonation; use alga::general::{ClosedNeg, Real}; -use base::allocator::Allocator; -use base::dimension::{DimName, DimNameAdd, DimNameSum, U1}; -use base::storage::Owned; -use base::{DefaultAllocator, MatrixN, Scalar, VectorN}; +use crate::base::allocator::Allocator; +use crate::base::dimension::{DimName, DimNameAdd, DimNameSum, U1}; +use crate::base::storage::Owned; +use crate::base::{DefaultAllocator, MatrixN, Scalar, VectorN}; /// A translation. #[repr(C)] @@ -269,8 +269,8 @@ where DefaultAllocator: Allocator + Allocator fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let precision = f.precision().unwrap_or(3); - try!(writeln!(f, "Translation {{")); - try!(write!(f, "{:.*}", precision, self.vector)); + writeln!(f, "Translation {{")?; + write!(f, "{:.*}", precision, self.vector)?; writeln!(f, "}}") } } diff --git a/src/geometry/translation_alga.rs b/src/geometry/translation_alga.rs index fdd24014..00b54421 100644 --- a/src/geometry/translation_alga.rs +++ b/src/geometry/translation_alga.rs @@ -8,11 +8,11 @@ use alga::linear::{ Transformation, }; -use base::allocator::Allocator; -use base::dimension::DimName; -use base::{DefaultAllocator, VectorN}; +use crate::base::allocator::Allocator; +use crate::base::dimension::DimName; +use crate::base::{DefaultAllocator, VectorN}; -use geometry::{Point, Translation}; +use crate::geometry::{Point, Translation}; /* * diff --git a/src/geometry/translation_alias.rs b/src/geometry/translation_alias.rs index 41885db7..13db0495 100644 --- a/src/geometry/translation_alias.rs +++ b/src/geometry/translation_alias.rs @@ -1,6 +1,6 @@ -use base::dimension::{U1, U2, U3, U4, U5, U6}; +use crate::base::dimension::{U1, U2, U3, U4, U5, U6}; -use geometry::Translation; +use crate::geometry::Translation; /// A 1-dimensional translation. pub type Translation1 = Translation; diff --git a/src/geometry/translation_construction.rs b/src/geometry/translation_construction.rs index a973603d..339bdd2a 100644 --- a/src/geometry/translation_construction.rs +++ b/src/geometry/translation_construction.rs @@ -1,5 +1,5 @@ #[cfg(feature = "arbitrary")] -use base::storage::Owned; +use crate::base::storage::Owned; #[cfg(feature = "arbitrary")] use quickcheck::{Arbitrary, Gen}; @@ -9,11 +9,11 @@ use rand::Rng; use alga::general::ClosedAdd; -use base::allocator::Allocator; -use base::dimension::{DimName, U1, U2, U3, U4, U5, U6}; -use base::{DefaultAllocator, Scalar, VectorN}; +use crate::base::allocator::Allocator; +use crate::base::dimension::{DimName, U1, U2, U3, U4, U5, U6}; +use crate::base::{DefaultAllocator, Scalar, VectorN}; -use geometry::Translation; +use crate::geometry::Translation; impl Translation where DefaultAllocator: Allocator diff --git a/src/geometry/translation_conversion.rs b/src/geometry/translation_conversion.rs index d4fd9df2..9f0e9a25 100644 --- a/src/geometry/translation_conversion.rs +++ b/src/geometry/translation_conversion.rs @@ -3,11 +3,11 @@ use num::{One, Zero}; use alga::general::{Real, SubsetOf, SupersetOf}; use alga::linear::Rotation; -use base::allocator::Allocator; -use base::dimension::{DimName, DimNameAdd, DimNameSum, U1}; -use base::{DefaultAllocator, MatrixN, Scalar, VectorN}; +use crate::base::allocator::Allocator; +use crate::base::dimension::{DimName, DimNameAdd, DimNameSum, U1}; +use crate::base::{DefaultAllocator, MatrixN, Scalar, VectorN}; -use geometry::{Isometry, Point, Similarity, SuperTCategoryOf, TAffine, Transform, Translation}; +use crate::geometry::{Isometry, Point, Similarity, SuperTCategoryOf, TAffine, Transform, Translation}; /* * This file provides the following conversions: @@ -33,7 +33,7 @@ where #[inline] fn is_in_subset(rot: &Translation) -> bool { - ::is_convertible::<_, VectorN>(&rot.vector) + crate::is_convertible::<_, VectorN>(&rot.vector) } #[inline] @@ -148,7 +148,7 @@ where unsafe fn from_superset_unchecked(m: &MatrixN>) -> Self { let t = m.fixed_slice::(0, D::dim()); Self { - vector: ::convert_unchecked(t.into_owned()), + vector: crate::convert_unchecked(t.into_owned()), } } } diff --git a/src/geometry/translation_coordinates.rs b/src/geometry/translation_coordinates.rs index 01207a32..c422415c 100644 --- a/src/geometry/translation_coordinates.rs +++ b/src/geometry/translation_coordinates.rs @@ -1,12 +1,12 @@ use std::mem; use std::ops::{Deref, DerefMut}; -use base::allocator::Allocator; -use base::coordinates::{X, XY, XYZ, XYZW, XYZWA, XYZWAB}; -use base::dimension::{U1, U2, U3, U4, U5, U6}; -use base::{DefaultAllocator, Scalar}; +use crate::base::allocator::Allocator; +use crate::base::coordinates::{X, XY, XYZ, XYZW, XYZWA, XYZWAB}; +use crate::base::dimension::{U1, U2, U3, U4, U5, U6}; +use crate::base::{DefaultAllocator, Scalar}; -use geometry::Translation; +use crate::geometry::Translation; /* * diff --git a/src/geometry/translation_ops.rs b/src/geometry/translation_ops.rs index 57b8d6d1..55366a05 100644 --- a/src/geometry/translation_ops.rs +++ b/src/geometry/translation_ops.rs @@ -2,12 +2,12 @@ use std::ops::{Div, DivAssign, Mul, MulAssign}; use alga::general::{ClosedAdd, ClosedSub}; -use base::allocator::{Allocator, SameShapeAllocator}; -use base::constraint::{SameNumberOfColumns, SameNumberOfRows, ShapeConstraint}; -use base::dimension::{DimName, U1}; -use base::{DefaultAllocator, Scalar}; +use crate::base::allocator::{Allocator, SameShapeAllocator}; +use crate::base::constraint::{SameNumberOfColumns, SameNumberOfRows, ShapeConstraint}; +use crate::base::dimension::{DimName, U1}; +use crate::base::{DefaultAllocator, Scalar}; -use geometry::{Point, Translation}; +use crate::geometry::{Point, Translation}; // Translation × Translation add_sub_impl!(Mul, mul, ClosedAdd; diff --git a/src/geometry/unit_complex.rs b/src/geometry/unit_complex.rs index fe1058af..d02b46b6 100644 --- a/src/geometry/unit_complex.rs +++ b/src/geometry/unit_complex.rs @@ -3,8 +3,8 @@ use num_complex::Complex; use std::fmt; use alga::general::Real; -use base::{Matrix2, Matrix3, Unit, Vector1}; -use geometry::Rotation2; +use crate::base::{Matrix2, Matrix3, Unit, Vector1}; +use crate::geometry::Rotation2; /// A complex number with a norm equal to 1. pub type UnitComplex = Unit>; diff --git a/src/geometry/unit_complex_alga.rs b/src/geometry/unit_complex_alga.rs index 21b956d9..d49a3e57 100644 --- a/src/geometry/unit_complex_alga.rs +++ b/src/geometry/unit_complex_alga.rs @@ -7,10 +7,10 @@ use alga::linear::{ ProjectiveTransformation, Rotation, Similarity, Transformation, }; -use base::allocator::Allocator; -use base::dimension::U2; -use base::{DefaultAllocator, Vector2}; -use geometry::{Point2, UnitComplex}; +use crate::base::allocator::Allocator; +use crate::base::dimension::U2; +use crate::base::{DefaultAllocator, Vector2}; +use crate::geometry::{Point2, UnitComplex}; /* * diff --git a/src/geometry/unit_complex_construction.rs b/src/geometry/unit_complex_construction.rs index ba1d6694..7e24559c 100644 --- a/src/geometry/unit_complex_construction.rs +++ b/src/geometry/unit_complex_construction.rs @@ -7,10 +7,10 @@ use rand::distributions::{Distribution, OpenClosed01, Standard}; use rand::Rng; use alga::general::Real; -use base::dimension::{U1, U2}; -use base::storage::Storage; -use base::{Unit, Vector, Matrix2}; -use geometry::{Rotation2, UnitComplex}; +use crate::base::dimension::{U1, U2}; +use crate::base::storage::Storage; +use crate::base::{Unit, Vector, Matrix2}; +use crate::geometry::{Rotation2, UnitComplex}; impl UnitComplex { /// The unit complex number multiplicative identity. diff --git a/src/geometry/unit_complex_conversion.rs b/src/geometry/unit_complex_conversion.rs index 1751a67c..3adb372c 100644 --- a/src/geometry/unit_complex_conversion.rs +++ b/src/geometry/unit_complex_conversion.rs @@ -4,9 +4,9 @@ use num_complex::Complex; use alga::general::{Real, SubsetOf, SupersetOf}; use alga::linear::Rotation as AlgaRotation; -use base::dimension::U2; -use base::{Matrix2, Matrix3}; -use geometry::{ +use crate::base::dimension::U2; +use crate::base::{Matrix2, Matrix3}; +use crate::geometry::{ Isometry, Point2, Rotation2, Similarity, SuperTCategoryOf, TAffine, Transform, Translation, UnitComplex }; @@ -38,12 +38,12 @@ where #[inline] fn is_in_subset(uq: &UnitComplex) -> bool { - ::is_convertible::<_, Complex>(uq.as_ref()) + crate::is_convertible::<_, Complex>(uq.as_ref()) } #[inline] unsafe fn from_superset_unchecked(uq: &UnitComplex) -> Self { - Self::new_unchecked(::convert_ref_unchecked(uq.as_ref())) + Self::new_unchecked(crate::convert_ref_unchecked(uq.as_ref())) } } @@ -60,13 +60,13 @@ where #[inline] fn is_in_subset(rot: &Rotation2) -> bool { - ::is_convertible::<_, Rotation2>(rot) + crate::is_convertible::<_, Rotation2>(rot) } #[inline] unsafe fn from_superset_unchecked(rot: &Rotation2) -> Self { let q = UnitComplex::::from_rotation_matrix(rot); - ::convert_unchecked(q) + crate::convert_unchecked(q) } } @@ -78,7 +78,7 @@ where { #[inline] fn to_superset(&self) -> Isometry { - Isometry::from_parts(Translation::identity(), ::convert_ref(self)) + Isometry::from_parts(Translation::identity(), crate::convert_ref(self)) } #[inline] @@ -88,7 +88,7 @@ where #[inline] unsafe fn from_superset_unchecked(iso: &Isometry) -> Self { - ::convert_ref_unchecked(&iso.rotation) + crate::convert_ref_unchecked(&iso.rotation) } } @@ -100,7 +100,7 @@ where { #[inline] fn to_superset(&self) -> Similarity { - Similarity::from_isometry(::convert_ref(self), N2::one()) + Similarity::from_isometry(crate::convert_ref(self), N2::one()) } #[inline] @@ -110,7 +110,7 @@ where #[inline] unsafe fn from_superset_unchecked(sim: &Similarity) -> Self { - ::convert_ref_unchecked(&sim.isometry) + crate::convert_ref_unchecked(&sim.isometry) } } @@ -144,12 +144,12 @@ impl> SubsetOf> for UnitComplex< #[inline] fn is_in_subset(m: &Matrix3) -> bool { - ::is_convertible::<_, Rotation2>(m) + crate::is_convertible::<_, Rotation2>(m) } #[inline] unsafe fn from_superset_unchecked(m: &Matrix3) -> Self { - let rot: Rotation2 = ::convert_ref_unchecked(m); + let rot: Rotation2 = crate::convert_ref_unchecked(m); Self::from_rotation_matrix(&rot) } } diff --git a/src/geometry/unit_complex_ops.rs b/src/geometry/unit_complex_ops.rs index 28c9a9c3..ee8eca64 100644 --- a/src/geometry/unit_complex_ops.rs +++ b/src/geometry/unit_complex_ops.rs @@ -1,11 +1,11 @@ use std::ops::{Div, DivAssign, Mul, MulAssign}; use alga::general::Real; -use base::allocator::Allocator; -use base::dimension::{U1, U2}; -use base::storage::Storage; -use base::{DefaultAllocator, Unit, Vector, Vector2}; -use geometry::{Isometry, Point2, Rotation, Similarity, Translation, UnitComplex}; +use crate::base::allocator::Allocator; +use crate::base::dimension::{U1, U2}; +use crate::base::storage::Storage; +use crate::base::{DefaultAllocator, Unit, Vector, Vector2}; +use crate::geometry::{Isometry, Point2, Rotation, Similarity, Translation, UnitComplex}; /* * This file provides: diff --git a/src/io/matrix_market.rs b/src/io/matrix_market.rs index f4919cd4..c2653c16 100644 --- a/src/io/matrix_market.rs +++ b/src/io/matrix_market.rs @@ -2,8 +2,8 @@ use std::fs; use std::path::Path; use pest::Parser; -use sparse::CsMatrix; -use Real; +use crate::sparse::CsMatrix; +use crate::Real; #[derive(Parser)] #[grammar = "io/matrix_market.pest"] @@ -41,7 +41,7 @@ pub fn cs_matrix_from_matrix_market_str(data: &str) -> Option().ok()? - 1); cols.push(inner.next()?.as_str().parse::().ok()? - 1); - data.push(::convert(inner.next()?.as_str().parse::().ok()?)); + data.push(crate::convert(inner.next()?.as_str().parse::().ok()?)); } _ => return None, // FIXME: return an Err instead. } diff --git a/src/lib.rs b/src/lib.rs index c2bb04f2..feae7b22 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -51,7 +51,7 @@ an optimized set of tools for computer graphics and physics. Those features incl allocated on the heap. * Convenient aliases for low-dimensional matrices and vectors: `Vector1` to `Vector6` and `Matrix1x1` to `Matrix6x6`, including rectangular matrices like `Matrix2x5`. -* Points sizes known at compile time, and convenience aliases: `Point1` to `Point6`. +* Points sizes known at compile time, and convenience aliases:: `Point1` to `Point6`. * Translation (seen as a transformation that composes by multiplication): `Translation2`, `Translation3`. * Rotation matrices: `Rotation2`, `Rotation3`. @@ -144,11 +144,11 @@ pub mod sparse; note = "The 'core' module is being renamed to 'base' to avoid conflicts with the 'core' crate." )] pub use base as core; -pub use base::*; -pub use geometry::*; -pub use linalg::*; +pub use crate::base::*; +pub use crate::geometry::*; +pub use crate::linalg::*; #[cfg(feature = "sparse")] -pub use sparse::*; +pub use crate::sparse::*; use std::cmp::{self, Ordering, PartialOrd}; diff --git a/src/linalg/balancing.rs b/src/linalg/balancing.rs index 5db113ba..33dcbff6 100644 --- a/src/linalg/balancing.rs +++ b/src/linalg/balancing.rs @@ -3,10 +3,10 @@ use alga::general::Real; use std::ops::{DivAssign, MulAssign}; -use allocator::Allocator; -use base::dimension::{Dim, U1}; -use base::storage::Storage; -use base::{DefaultAllocator, MatrixN, VectorN}; +use crate::allocator::Allocator; +use crate::base::dimension::{Dim, U1}; +use crate::base::storage::Storage; +use crate::base::{DefaultAllocator, MatrixN, VectorN}; /// Applies in-place a modified Parlett and Reinsch matrix balancing with 2-norm to the matrix `m` and returns /// the corresponding diagonal transformation. @@ -17,7 +17,7 @@ where DefaultAllocator: Allocator + Allocator { assert!(m.is_square(), "Unable to balance a non-square matrix."); let dim = m.data.shape().0; - let radix: N = ::convert(2.0f64); + let radix: N = crate::convert(2.0f64); let mut d = VectorN::from_element_generic(dim, U1, N::one()); let mut converged = false; @@ -50,7 +50,7 @@ where DefaultAllocator: Allocator + Allocator { f /= radix; } - let eps: N = ::convert(0.95); + let eps: N = crate::convert(0.95); if c * c + r * r < eps * s { converged = false; d[i] *= f; diff --git a/src/linalg/bidiagonal.rs b/src/linalg/bidiagonal.rs index 9bf3cd12..09031e28 100644 --- a/src/linalg/bidiagonal.rs +++ b/src/linalg/bidiagonal.rs @@ -2,14 +2,13 @@ use serde::{Deserialize, Serialize}; use alga::general::Complex; -use allocator::Allocator; -use base::{DefaultAllocator, Matrix, MatrixMN, MatrixN, Unit, VectorN}; -use constraint::{DimEq, ShapeConstraint}; -use dimension::{Dim, DimDiff, DimMin, DimMinimum, DimSub, Dynamic, U1}; -use storage::Storage; +use crate::allocator::Allocator; +use crate::base::{DefaultAllocator, Matrix, MatrixMN, MatrixN, Unit, VectorN}; +use crate::dimension::{Dim, DimDiff, DimMin, DimMinimum, DimSub, U1}; +use crate::storage::Storage; -use geometry::Reflection; -use linalg::householder; +use crate::geometry::Reflection; +use crate::linalg::householder; /// The bidiagonalization of a general matrix. #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] diff --git a/src/linalg/cholesky.rs b/src/linalg/cholesky.rs index 4ffacc97..985abddc 100644 --- a/src/linalg/cholesky.rs +++ b/src/linalg/cholesky.rs @@ -3,11 +3,11 @@ use serde::{Deserialize, Serialize}; use alga::general::Complex; -use allocator::Allocator; -use base::{DefaultAllocator, Matrix, MatrixMN, MatrixN, SquareMatrix}; -use constraint::{SameNumberOfRows, ShapeConstraint}; -use dimension::{Dim, DimSub, Dynamic}; -use storage::{Storage, StorageMut}; +use crate::allocator::Allocator; +use crate::base::{DefaultAllocator, Matrix, MatrixMN, MatrixN, SquareMatrix}; +use crate::constraint::{SameNumberOfRows, ShapeConstraint}; +use crate::dimension::{Dim, DimSub, Dynamic}; +use crate::storage::{Storage, StorageMut}; /// The Cholesky decomposition of a symmetric-definite-positive matrix. #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] diff --git a/src/linalg/determinant.rs b/src/linalg/determinant.rs index 3b0cb73d..4d265164 100644 --- a/src/linalg/determinant.rs +++ b/src/linalg/determinant.rs @@ -1,11 +1,11 @@ use alga::general::Complex; -use base::allocator::Allocator; -use base::dimension::DimMin; -use base::storage::Storage; -use base::{DefaultAllocator, SquareMatrix}; +use crate::base::allocator::Allocator; +use crate::base::dimension::DimMin; +use crate::base::storage::Storage; +use crate::base::{DefaultAllocator, SquareMatrix}; -use linalg::LU; +use crate::linalg::LU; impl, S: Storage> SquareMatrix { /// Computes the matrix determinant. diff --git a/src/linalg/eigen.rs b/src/linalg/eigen.rs index be1812ee..970e990d 100644 --- a/src/linalg/eigen.rs +++ b/src/linalg/eigen.rs @@ -7,15 +7,15 @@ use std::cmp; use std::fmt::Display; use std::ops::MulAssign; -use allocator::Allocator; -use base::dimension::{Dim, DimDiff, DimSub, Dynamic, U1, U2, U3}; -use base::storage::Storage; -use base::{DefaultAllocator, Hessenberg, MatrixN, SquareMatrix, Unit, Vector2, Vector3, VectorN}; -use constraint::{DimEq, ShapeConstraint}; +use crate::allocator::Allocator; +use crate::base::dimension::{Dim, DimDiff, DimSub, Dynamic, U1, U2, U3}; +use crate::base::storage::Storage; +use crate::base::{DefaultAllocator, Hessenberg, MatrixN, SquareMatrix, Unit, Vector2, Vector3, VectorN}; +use crate::constraint::{DimEq, ShapeConstraint}; -use geometry::{Reflection, UnitComplex}; -use linalg::householder; -use linalg::Schur; +use crate::geometry::{Reflection, UnitComplex}; +use crate::linalg::householder; +use crate::linalg::Schur; /// Eigendecomposition of a real matrix with real eigenvalues (or complex eigen values for complex matrices). #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] diff --git a/src/linalg/full_piv_lu.rs b/src/linalg/full_piv_lu.rs index 353a5d1e..61bc227c 100644 --- a/src/linalg/full_piv_lu.rs +++ b/src/linalg/full_piv_lu.rs @@ -2,14 +2,14 @@ use serde::{Deserialize, Serialize}; use alga::general::Complex; -use allocator::Allocator; -use base::{DefaultAllocator, Matrix, MatrixMN, MatrixN}; -use constraint::{SameNumberOfRows, ShapeConstraint}; -use dimension::{Dim, DimMin, DimMinimum}; -use storage::{Storage, StorageMut}; +use crate::allocator::Allocator; +use crate::base::{DefaultAllocator, Matrix, MatrixMN, MatrixN}; +use crate::constraint::{SameNumberOfRows, ShapeConstraint}; +use crate::dimension::{Dim, DimMin, DimMinimum}; +use crate::storage::{Storage, StorageMut}; -use linalg::lu; -use linalg::PermutationSequence; +use crate::linalg::lu; +use crate::linalg::PermutationSequence; /// LU decomposition with full row and column pivoting. #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] diff --git a/src/linalg/givens.rs b/src/linalg/givens.rs index ecc9126b..0927dd26 100644 --- a/src/linalg/givens.rs +++ b/src/linalg/givens.rs @@ -3,10 +3,10 @@ use alga::general::Complex; use num::{Zero, One}; -use base::dimension::{Dim, U2}; -use base::constraint::{ShapeConstraint, DimEq}; -use base::storage::{Storage, StorageMut}; -use base::{Vector, Matrix}; +use crate::base::dimension::{Dim, U2}; +use crate::base::constraint::{ShapeConstraint, DimEq}; +use crate::base::storage::{Storage, StorageMut}; +use crate::base::{Vector, Matrix}; /// A Givens rotation. diff --git a/src/linalg/hessenberg.rs b/src/linalg/hessenberg.rs index bde3d325..56e2ace4 100644 --- a/src/linalg/hessenberg.rs +++ b/src/linalg/hessenberg.rs @@ -2,13 +2,12 @@ use serde::{Deserialize, Serialize}; use alga::general::Complex; -use allocator::Allocator; -use base::{DefaultAllocator, MatrixMN, MatrixN, SquareMatrix, VectorN}; -use constraint::{DimEq, ShapeConstraint}; -use dimension::{DimDiff, DimSub, Dynamic, U1}; -use storage::Storage; +use crate::allocator::Allocator; +use crate::base::{DefaultAllocator, MatrixMN, MatrixN, SquareMatrix, VectorN}; +use crate::dimension::{DimDiff, DimSub, U1}; +use crate::storage::Storage; -use linalg::householder; +use crate::linalg::householder; /// Hessenberg decomposition of a general matrix. #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] diff --git a/src/linalg/householder.rs b/src/linalg/householder.rs index 1dc0f7b6..3bd8f801 100644 --- a/src/linalg/householder.rs +++ b/src/linalg/householder.rs @@ -2,12 +2,12 @@ use num::Zero; use alga::general::Complex; -use allocator::Allocator; -use base::{DefaultAllocator, MatrixMN, MatrixN, Unit, Vector, VectorN}; -use dimension::Dim; -use storage::{Storage, StorageMut}; +use crate::allocator::Allocator; +use crate::base::{DefaultAllocator, MatrixMN, MatrixN, Unit, Vector, VectorN}; +use crate::dimension::Dim; +use crate::storage::{Storage, StorageMut}; -use geometry::Reflection; +use crate::geometry::Reflection; /// Replaces `column` by the axis of the householder reflection that transforms `column` into /// `(+/-|column|, 0, ..., 0)`. @@ -28,7 +28,7 @@ pub fn reflection_axis_mut>( unsafe { let (modulus, sign) = column.vget_unchecked(0).to_exp(); signed_norm = sign.scale(reflection_norm); - factor = (reflection_sq_norm + modulus * reflection_norm) * ::convert(2.0); + factor = (reflection_sq_norm + modulus * reflection_norm) * crate::convert(2.0); *column.vget_unchecked_mut(0) += signed_norm; }; diff --git a/src/linalg/inverse.rs b/src/linalg/inverse.rs index f2ccd3e6..3d6a0681 100644 --- a/src/linalg/inverse.rs +++ b/src/linalg/inverse.rs @@ -1,11 +1,11 @@ use alga::general::Complex; -use base::allocator::Allocator; -use base::dimension::Dim; -use base::storage::{Storage, StorageMut}; -use base::{DefaultAllocator, MatrixN, SquareMatrix}; +use crate::base::allocator::Allocator; +use crate::base::dimension::Dim; +use crate::base::storage::{Storage, StorageMut}; +use crate::base::{DefaultAllocator, MatrixN, SquareMatrix}; -use linalg::lu; +use crate::linalg::lu; impl> SquareMatrix { /// Attempts to invert this matrix. diff --git a/src/linalg/lu.rs b/src/linalg/lu.rs index 7e279227..fffe7148 100644 --- a/src/linalg/lu.rs +++ b/src/linalg/lu.rs @@ -2,14 +2,14 @@ use serde::{Deserialize, Serialize}; use alga::general::{Field, Complex}; -use allocator::{Allocator, Reallocator}; -use base::{DefaultAllocator, Matrix, MatrixMN, MatrixN, Scalar}; -use constraint::{SameNumberOfRows, ShapeConstraint}; -use dimension::{Dim, DimMin, DimMinimum}; +use crate::allocator::{Allocator, Reallocator}; +use crate::base::{DefaultAllocator, Matrix, MatrixMN, MatrixN, Scalar}; +use crate::constraint::{SameNumberOfRows, ShapeConstraint}; +use crate::dimension::{Dim, DimMin, DimMinimum}; use std::mem; -use storage::{Storage, StorageMut}; +use crate::storage::{Storage, StorageMut}; -use linalg::PermutationSequence; +use crate::linalg::PermutationSequence; /// LU decomposition with partial (row) pivoting. #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] diff --git a/src/linalg/permutation_sequence.rs b/src/linalg/permutation_sequence.rs index 3aef1be6..ce493905 100644 --- a/src/linalg/permutation_sequence.rs +++ b/src/linalg/permutation_sequence.rs @@ -4,12 +4,12 @@ use serde::{Deserialize, Serialize}; use alga::general::ClosedNeg; use num::One; -use allocator::Allocator; -use base::{DefaultAllocator, Matrix, Scalar, VectorN}; +use crate::allocator::Allocator; +use crate::base::{DefaultAllocator, Matrix, Scalar, VectorN}; #[cfg(any(feature = "std", feature = "alloc"))] -use dimension::Dynamic; -use dimension::{Dim, DimName, U1}; -use storage::StorageMut; +use crate::dimension::Dynamic; +use crate::dimension::{Dim, DimName, U1}; +use crate::storage::StorageMut; /// A sequence of row or column permutations. #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] diff --git a/src/linalg/qr.rs b/src/linalg/qr.rs index 12e72463..7c02d140 100644 --- a/src/linalg/qr.rs +++ b/src/linalg/qr.rs @@ -3,14 +3,14 @@ use serde::{Deserialize, Serialize}; use num::Zero; use alga::general::Complex; -use allocator::{Allocator, Reallocator}; -use base::{DefaultAllocator, Matrix, MatrixMN, MatrixN, Unit, VectorN}; -use constraint::{SameNumberOfRows, ShapeConstraint}; -use dimension::{Dim, DimMin, DimMinimum, U1}; -use storage::{Storage, StorageMut}; +use crate::allocator::{Allocator, Reallocator}; +use crate::base::{DefaultAllocator, Matrix, MatrixMN, MatrixN, Unit, VectorN}; +use crate::constraint::{SameNumberOfRows, ShapeConstraint}; +use crate::dimension::{Dim, DimMin, DimMinimum, U1}; +use crate::storage::{Storage, StorageMut}; -use geometry::Reflection; -use linalg::householder; +use crate::geometry::Reflection; +use crate::linalg::householder; /// The QR decomposition of a general matrix. #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] diff --git a/src/linalg/schur.rs b/src/linalg/schur.rs index a6521f72..ade4b2dc 100644 --- a/src/linalg/schur.rs +++ b/src/linalg/schur.rs @@ -6,16 +6,15 @@ use alga::general::{Complex, Real}; use num_complex::Complex as NumComplex; use std::cmp; -use allocator::Allocator; -use base::dimension::{Dim, DimDiff, DimSub, Dynamic, U1, U2, U3}; -use base::storage::Storage; -use base::{DefaultAllocator, MatrixN, SquareMatrix, Unit, Vector2, Vector3, VectorN}; -use constraint::{DimEq, ShapeConstraint}; +use crate::allocator::Allocator; +use crate::base::dimension::{Dim, DimDiff, DimSub, Dynamic, U1, U2, U3}; +use crate::base::storage::Storage; +use crate::base::{DefaultAllocator, MatrixN, SquareMatrix, Unit, Vector2, Vector3, VectorN}; -use geometry::Reflection; -use linalg::householder; -use linalg::Hessenberg; -use linalg::givens::GivensRotation; +use crate::geometry::Reflection; +use crate::linalg::householder; +use crate::linalg::Hessenberg; +use crate::linalg::givens::GivensRotation; /// Schur decomposition of a square matrix. /// @@ -312,14 +311,14 @@ where let tra = hnn + hmm; let det = hnn * hmm - hnm * hmn; - let discr = tra * tra * ::convert(0.25) - det; + let discr = tra * tra * crate::convert(0.25) - det; // All 2x2 blocks have negative discriminant because we already decoupled those // with positive eigenvalues.. let sqrt_discr = NumComplex::new(N::zero(), (-discr).sqrt()); - out[m] = NumComplex::new(tra * ::convert(0.5), N::zero()) + sqrt_discr; - out[m + 1] = NumComplex::new(tra * ::convert(0.5), N::zero()) - sqrt_discr; + out[m] = NumComplex::new(tra * crate::convert(0.5), N::zero()) + sqrt_discr; + out[m + 1] = NumComplex::new(tra * crate::convert(0.5), N::zero()) - sqrt_discr; m += 2; } @@ -448,11 +447,11 @@ fn compute_2x2_eigvals>( // NOTE: this discriminant computation is more stable than the // one based on the trace and determinant: 0.25 * tra * tra - det // because it ensures positiveness for symmetric matrices. - let val = (h00 - h11) * ::convert(0.5); + let val = (h00 - h11) * crate::convert(0.5); let discr = h10 * h01 + val * val; discr.try_sqrt().map(|sqrt_discr| { - let half_tra = (h00 + h11) * ::convert(0.5); + let half_tra = (h00 + h11) * crate::convert(0.5); (half_tra + sqrt_discr, half_tra - sqrt_discr) }) } diff --git a/src/linalg/solve.rs b/src/linalg/solve.rs index fad85a81..0c2bb684 100644 --- a/src/linalg/solve.rs +++ b/src/linalg/solve.rs @@ -1,10 +1,10 @@ use alga::general::Complex; -use base::allocator::Allocator; -use base::constraint::{SameNumberOfRows, ShapeConstraint}; -use base::dimension::{Dim, U1}; -use base::storage::{Storage, StorageMut}; -use base::{DefaultAllocator, Matrix, MatrixMN, SquareMatrix, Vector, DVectorSlice}; +use crate::base::allocator::Allocator; +use crate::base::constraint::{SameNumberOfRows, ShapeConstraint}; +use crate::base::dimension::{Dim, U1}; +use crate::base::storage::{Storage, StorageMut}; +use crate::base::{DefaultAllocator, Matrix, MatrixMN, SquareMatrix, Vector, DVectorSlice}; impl> SquareMatrix { /// Computes the solution of the linear system `self . x = b` where `x` is the unknown and only diff --git a/src/linalg/svd.rs b/src/linalg/svd.rs index 0b5d0509..779bcff0 100644 --- a/src/linalg/svd.rs +++ b/src/linalg/svd.rs @@ -5,15 +5,15 @@ use num::{Zero, One}; use approx::AbsDiffEq; use alga::general::{Real, Complex}; -use allocator::Allocator; -use base::{DefaultAllocator, Matrix, Matrix2x3, MatrixMN, Vector2, VectorN}; -use constraint::{SameNumberOfRows, ShapeConstraint}; -use dimension::{Dim, DimDiff, DimMin, DimMinimum, DimSub, U1, U2}; -use storage::Storage; +use crate::allocator::Allocator; +use crate::base::{DefaultAllocator, Matrix, Matrix2x3, MatrixMN, Vector2, VectorN}; +use crate::constraint::{SameNumberOfRows, ShapeConstraint}; +use crate::dimension::{Dim, DimDiff, DimMin, DimMinimum, DimSub, U1, U2}; +use crate::storage::Storage; -use linalg::symmetric_eigen; -use linalg::Bidiagonal; -use linalg::givens::GivensRotation; +use crate::linalg::symmetric_eigen; +use crate::linalg::Bidiagonal; +use crate::linalg::givens::GivensRotation; /// Singular Value Decomposition of a general matrix. #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] @@ -621,8 +621,8 @@ fn compute_2x2_uptrig_svd( compute_v: bool, ) -> (Option>, Vector2, Option>) { - let two: N::Real = ::convert(2.0f64); - let half: N::Real = ::convert(0.5f64); + let two: N::Real = crate::convert(2.0f64); + let half: N::Real = crate::convert(0.5f64); let denom = (m11 + m22).hypot(m12) + (m11 - m22).hypot(m12); diff --git a/src/linalg/symmetric_eigen.rs b/src/linalg/symmetric_eigen.rs index acdf956e..6fd1fea5 100644 --- a/src/linalg/symmetric_eigen.rs +++ b/src/linalg/symmetric_eigen.rs @@ -5,13 +5,13 @@ use num::Zero; use approx::AbsDiffEq; use alga::general::Complex; -use allocator::Allocator; -use base::{DefaultAllocator, Matrix2, MatrixN, SquareMatrix, Vector2, VectorN}; -use dimension::{Dim, DimDiff, DimSub, U1, U2}; -use storage::Storage; +use crate::allocator::Allocator; +use crate::base::{DefaultAllocator, Matrix2, MatrixN, SquareMatrix, Vector2, VectorN}; +use crate::dimension::{Dim, DimDiff, DimSub, U1, U2}; +use crate::storage::Storage; -use linalg::givens::GivensRotation; -use linalg::SymmetricTridiagonal; +use crate::linalg::givens::GivensRotation; +use crate::linalg::SymmetricTridiagonal; /// Eigendecomposition of a symmetric matrix. #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] @@ -163,7 +163,7 @@ where DefaultAllocator: Allocator + Allocator let ss = rot.s() * rot.s(); let cs = rot.c() * rot.s(); - let b = cs * ::convert(2.0) * mij; + let b = cs * crate::convert(2.0) * mij; diag[i] = (cc * mii + ss * mjj) - b; diag[j] = (ss * mii + cc * mjj) + b; @@ -292,7 +292,7 @@ pub fn wilkinson_shift(tmm: N, tnn: N, tmn: N) -> N { let sq_tmn = tmn * tmn; if !sq_tmn.is_zero() { // We have the guarantee that the denominator won't be zero. - let d = (tmm - tnn) * ::convert(0.5); + let d = (tmm - tnn) * crate::convert(0.5); tnn - sq_tmn / (d + d.signum() * (d * d + sq_tmn).sqrt()) } else { tnn @@ -342,7 +342,7 @@ where DefaultAllocator: Allocator + Allocator> + #[cfg(test)] mod test { - use base::Matrix2; + use crate::base::Matrix2; fn expected_shift(m: Matrix2) -> f64 { let vals = m.eigenvalues().unwrap(); diff --git a/src/linalg/symmetric_tridiagonal.rs b/src/linalg/symmetric_tridiagonal.rs index 76267554..386c0a6f 100644 --- a/src/linalg/symmetric_tridiagonal.rs +++ b/src/linalg/symmetric_tridiagonal.rs @@ -2,12 +2,12 @@ use serde::{Deserialize, Serialize}; use alga::general::Complex; -use allocator::Allocator; -use base::{DefaultAllocator, MatrixMN, MatrixN, SquareMatrix, VectorN}; -use dimension::{DimDiff, DimSub, U1}; -use storage::Storage; +use crate::allocator::Allocator; +use crate::base::{DefaultAllocator, MatrixMN, MatrixN, SquareMatrix, VectorN}; +use crate::dimension::{DimDiff, DimSub, U1}; +use crate::storage::Storage; -use linalg::householder; +use crate::linalg::householder; /// Tridiagonalization of a symmetric matrix. #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] @@ -75,12 +75,12 @@ where DefaultAllocator: Allocator + Allocator> if not_zero { let mut p = p.rows_range_mut(i..); - p.hegemv(::convert(2.0), &m, &axis, N::zero()); + p.hegemv(crate::convert(2.0), &m, &axis, N::zero()); let dot = axis.dotc(&p); m.hegerc(-N::one(), &p, &axis, N::one()); m.hegerc(-N::one(), &axis, &p, N::one()); - m.hegerc(dot * ::convert(2.0), &axis, &axis, N::one()); + m.hegerc(dot * crate::convert(2.0), &axis, &axis, N::one()); } } diff --git a/src/sparse/cs_matrix.rs b/src/sparse/cs_matrix.rs index 4c2983eb..2fc571c7 100644 --- a/src/sparse/cs_matrix.rs +++ b/src/sparse/cs_matrix.rs @@ -5,9 +5,9 @@ use std::marker::PhantomData; use std::ops::Range; use std::slice; -use allocator::Allocator; -use sparse::cs_utils; -use { +use crate::allocator::Allocator; +use crate::sparse::cs_utils; +use crate::{ DefaultAllocator, Dim, Dynamic, Scalar, Vector, VectorN, U1 }; diff --git a/src/sparse/cs_matrix_cholesky.rs b/src/sparse/cs_matrix_cholesky.rs index 5d834ef2..fc7e97f9 100644 --- a/src/sparse/cs_matrix_cholesky.rs +++ b/src/sparse/cs_matrix_cholesky.rs @@ -1,9 +1,9 @@ use std::iter; use std::mem; -use allocator::Allocator; -use sparse::{CsMatrix, CsStorage, CsStorageIter, CsStorageIterMut, CsVecStorage}; -use {DefaultAllocator, Dim, Real, VectorN, U1}; +use crate::allocator::Allocator; +use crate::sparse::{CsMatrix, CsStorage, CsStorageIter, CsStorageIterMut, CsVecStorage}; +use crate::{DefaultAllocator, Dim, Real, VectorN, U1}; /// The cholesky decomposition of a column compressed sparse matrix. pub struct CsCholesky diff --git a/src/sparse/cs_matrix_conversion.rs b/src/sparse/cs_matrix_conversion.rs index 0017340f..31e53796 100644 --- a/src/sparse/cs_matrix_conversion.rs +++ b/src/sparse/cs_matrix_conversion.rs @@ -1,11 +1,11 @@ use alga::general::ClosedAdd; use num::Zero; -use allocator::Allocator; -use sparse::cs_utils; -use sparse::{CsMatrix, CsStorage}; -use storage::Storage; -use {DefaultAllocator, Dim, Dynamic, Matrix, MatrixMN, Scalar}; +use crate::allocator::Allocator; +use crate::sparse::cs_utils; +use crate::sparse::{CsMatrix, CsStorage}; +use crate::storage::Storage; +use crate::{DefaultAllocator, Dim, Dynamic, Matrix, MatrixMN, Scalar}; impl<'a, N: Scalar + Zero + ClosedAdd> CsMatrix { /// Creates a column-compressed sparse matrix from a sparse matrix in triplet form. diff --git a/src/sparse/cs_matrix_ops.rs b/src/sparse/cs_matrix_ops.rs index b944c4e2..322ebb34 100644 --- a/src/sparse/cs_matrix_ops.rs +++ b/src/sparse/cs_matrix_ops.rs @@ -2,11 +2,11 @@ use alga::general::{ClosedAdd, ClosedMul}; use num::{One, Zero}; use std::ops::{Add, Mul}; -use allocator::Allocator; -use constraint::{AreMultipliable, DimEq, ShapeConstraint}; -use sparse::{CsMatrix, CsStorage, CsStorageMut, CsVector}; -use storage::StorageMut; -use {DefaultAllocator, Dim, Scalar, Vector, VectorN, U1}; +use crate::allocator::Allocator; +use crate::constraint::{AreMultipliable, DimEq, ShapeConstraint}; +use crate::sparse::{CsMatrix, CsStorage, CsStorageMut, CsVector}; +use crate::storage::StorageMut; +use crate::{DefaultAllocator, Dim, Scalar, Vector, VectorN, U1}; impl> CsMatrix { fn scatter( diff --git a/src/sparse/cs_matrix_solve.rs b/src/sparse/cs_matrix_solve.rs index 2a13188e..a6bb628d 100644 --- a/src/sparse/cs_matrix_solve.rs +++ b/src/sparse/cs_matrix_solve.rs @@ -1,8 +1,8 @@ -use allocator::Allocator; -use constraint::{SameNumberOfRows, ShapeConstraint}; -use sparse::{CsMatrix, CsStorage, CsVector}; -use storage::{Storage, StorageMut}; -use {DefaultAllocator, Dim, Matrix, MatrixMN, Real, VectorN, U1}; +use crate::allocator::Allocator; +use crate::constraint::{SameNumberOfRows, ShapeConstraint}; +use crate::sparse::{CsMatrix, CsStorage, CsVector}; +use crate::storage::{Storage, StorageMut}; +use crate::{DefaultAllocator, Dim, Matrix, MatrixMN, Real, VectorN, U1}; impl> CsMatrix { /// Solve a lower-triangular system with a dense right-hand-side. diff --git a/src/sparse/cs_utils.rs b/src/sparse/cs_utils.rs index 3c5db43e..a8a454eb 100644 --- a/src/sparse/cs_utils.rs +++ b/src/sparse/cs_utils.rs @@ -1,5 +1,5 @@ -use allocator::Allocator; -use {DefaultAllocator, Dim, VectorN}; +use crate::allocator::Allocator; +use crate::{DefaultAllocator, Dim, VectorN}; pub fn cumsum(a: &mut VectorN, b: &mut VectorN) -> usize where DefaultAllocator: Allocator { diff --git a/tests/linalg/bidiagonal.rs b/tests/linalg/bidiagonal.rs index b4c382f3..9778eea3 100644 --- a/tests/linalg/bidiagonal.rs +++ b/tests/linalg/bidiagonal.rs @@ -5,7 +5,7 @@ macro_rules! gen_tests( mod $module { use na::{DMatrix, Matrix2, Matrix3x5, Matrix4, Matrix5x3}; #[allow(unused_imports)] - use core::helper::{RandScalar, RandComplex}; + use crate::core::helper::{RandScalar, RandComplex}; quickcheck! { fn bidiagonal(m: DMatrix<$scalar>) -> bool { diff --git a/tests/linalg/cholesky.rs b/tests/linalg/cholesky.rs index 774b76b0..cefc2630 100644 --- a/tests/linalg/cholesky.rs +++ b/tests/linalg/cholesky.rs @@ -9,7 +9,7 @@ macro_rules! gen_tests( use na::{DMatrix, DVector, Matrix4x3, Vector4}; use rand::random; #[allow(unused_imports)] - use core::helper::{RandScalar, RandComplex}; + use crate::core::helper::{RandScalar, RandComplex}; use std::cmp; quickcheck! { diff --git a/tests/linalg/eigen.rs b/tests/linalg/eigen.rs index 9a1c3539..8b2f8ed1 100644 --- a/tests/linalg/eigen.rs +++ b/tests/linalg/eigen.rs @@ -9,7 +9,7 @@ mod quickcheck_tests { mod $module { use na::{DMatrix, Matrix2, Matrix3, Matrix4}; #[allow(unused_imports)] - use core::helper::{RandScalar, RandComplex}; + use crate::core::helper::{RandScalar, RandComplex}; use std::cmp; quickcheck! { diff --git a/tests/linalg/full_piv_lu.rs b/tests/linalg/full_piv_lu.rs index c0e15cde..320fe241 100644 --- a/tests/linalg/full_piv_lu.rs +++ b/tests/linalg/full_piv_lu.rs @@ -49,7 +49,7 @@ mod quickcheck_tests { use num::One; use na::{DMatrix, Matrix4, Matrix4x3, Matrix5x3, Matrix3x5, DVector, Vector4}; #[allow(unused_imports)] - use core::helper::{RandScalar, RandComplex}; + use crate::core::helper::{RandScalar, RandComplex}; quickcheck! { fn full_piv_lu(m: DMatrix<$scalar>) -> bool { diff --git a/tests/linalg/hessenberg.rs b/tests/linalg/hessenberg.rs index 03cba7d1..378fbd87 100644 --- a/tests/linalg/hessenberg.rs +++ b/tests/linalg/hessenberg.rs @@ -18,7 +18,7 @@ macro_rules! gen_tests( use na::{DMatrix, Matrix2, Matrix4}; use std::cmp; #[allow(unused_imports)] - use core::helper::{RandScalar, RandComplex}; + use crate::core::helper::{RandScalar, RandComplex}; quickcheck! { fn hessenberg(n: usize) -> bool { diff --git a/tests/linalg/lu.rs b/tests/linalg/lu.rs index 02f62c10..69c387d2 100644 --- a/tests/linalg/lu.rs +++ b/tests/linalg/lu.rs @@ -41,7 +41,7 @@ fn lu_simple_with_pivot() { #[cfg(feature = "arbitrary")] mod quickcheck_tests { #[allow(unused_imports)] - use core::helper::{RandScalar, RandComplex}; + use crate::core::helper::{RandScalar, RandComplex}; macro_rules! gen_tests( ($module: ident, $scalar: ty) => { @@ -49,7 +49,7 @@ mod quickcheck_tests { use std::cmp; use na::{DMatrix, Matrix4, Matrix4x3, Matrix5x3, Matrix3x5, DVector, Vector4}; #[allow(unused_imports)] - use core::helper::{RandScalar, RandComplex}; + use crate::core::helper::{RandScalar, RandComplex}; quickcheck! { fn lu(m: DMatrix<$scalar>) -> bool { diff --git a/tests/linalg/qr.rs b/tests/linalg/qr.rs index 76eb00d9..93cb4973 100644 --- a/tests/linalg/qr.rs +++ b/tests/linalg/qr.rs @@ -7,7 +7,7 @@ macro_rules! gen_tests( use na::{DMatrix, DVector, Matrix3x5, Matrix4, Matrix4x3, Matrix5x3, Vector4}; use std::cmp; #[allow(unused_imports)] - use core::helper::{RandScalar, RandComplex}; + use crate::core::helper::{RandScalar, RandComplex}; quickcheck! { fn qr(m: DMatrix<$scalar>) -> bool { diff --git a/tests/linalg/schur.rs b/tests/linalg/schur.rs index f607ce06..f9c923a2 100644 --- a/tests/linalg/schur.rs +++ b/tests/linalg/schur.rs @@ -22,7 +22,7 @@ mod quickcheck_tests { use std::cmp; use na::{DMatrix, Matrix2, Matrix3, Matrix4}; #[allow(unused_imports)] - use core::helper::{RandScalar, RandComplex}; + use crate::core::helper::{RandScalar, RandComplex}; quickcheck! { fn schur(n: usize) -> bool { diff --git a/tests/linalg/solve.rs b/tests/linalg/solve.rs index 3a9ff143..90b76585 100644 --- a/tests/linalg/solve.rs +++ b/tests/linalg/solve.rs @@ -6,7 +6,7 @@ macro_rules! gen_tests( mod $module { use na::{Matrix4, Matrix4x5, Complex}; #[allow(unused_imports)] - use core::helper::{RandScalar, RandComplex}; + use crate::core::helper::{RandScalar, RandComplex}; fn unzero_diagonal(a: &mut Matrix4) { for i in 0..4 { diff --git a/tests/linalg/svd.rs b/tests/linalg/svd.rs index 0eb1d69e..a9b1d1cf 100644 --- a/tests/linalg/svd.rs +++ b/tests/linalg/svd.rs @@ -12,7 +12,7 @@ mod quickcheck_tests { }; use std::cmp; #[allow(unused_imports)] - use core::helper::{RandScalar, RandComplex}; + use crate::core::helper::{RandScalar, RandComplex}; quickcheck! { fn svd(m: DMatrix<$scalar>) -> bool { diff --git a/tests/linalg/tridiagonal.rs b/tests/linalg/tridiagonal.rs index 368aba13..5d04587e 100644 --- a/tests/linalg/tridiagonal.rs +++ b/tests/linalg/tridiagonal.rs @@ -8,7 +8,7 @@ macro_rules! gen_tests( use na::{DMatrix, Matrix2, Matrix4}; #[allow(unused_imports)] - use core::helper::{RandScalar, RandComplex}; + use crate::core::helper::{RandScalar, RandComplex}; quickcheck! { fn symm_tridiagonal(n: usize) -> bool { diff --git a/tests/sparse/cs_cholesky.rs b/tests/sparse/cs_cholesky.rs index 72a9a08f..314e34f6 100644 --- a/tests/sparse/cs_cholesky.rs +++ b/tests/sparse/cs_cholesky.rs @@ -35,12 +35,12 @@ fn cs_cholesky() { 1.0, 1.0, 0.0, 0.0, 2.0 ); a.fill_upper_triangle_with_lower_triangle(); - // Test ::new, left_looking, and up_looking implementations. + // Test crate::new, left_looking, and up_looking implementations. test_cholesky(a); } fn test_cholesky(a: Matrix5) { - // Test ::new + // Test crate::new test_cholesky_variant(a, 0); // Test up-looking test_cholesky_variant(a, 1);