2018 edition.
This commit is contained in:
parent
ce24ea972e
commit
3cbe60523a
|
@ -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"]
|
||||
|
||||
|
|
|
@ -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()))
|
||||
}
|
||||
|
|
|
@ -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)))
|
||||
}
|
||||
|
|
|
@ -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())))
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ readme = "../README.md"
|
|||
categories = [ "science" ]
|
||||
keywords = [ "linear", "algebra", "matrix", "vector", "math" ]
|
||||
license = "BSD-3-Clause"
|
||||
edition = "2018"
|
||||
|
||||
[features]
|
||||
default = [ "std" ]
|
||||
|
|
|
@ -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`.
|
||||
///
|
||||
|
|
|
@ -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};
|
||||
|
||||
|
||||
|
|
|
@ -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.
|
||||
///
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use aliases::TMat4;
|
||||
use crate::aliases::TMat4;
|
||||
use na::{Real};
|
||||
|
||||
//pub fn frustum<N: Real>(left: N, right: N, bottom: N, top: N, near: N, far: N) -> TMat4<N> {
|
||||
|
@ -95,7 +95,7 @@ pub fn ortho_lh<N: Real>(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<N: Real>(left: N, right: N, bottom: N, top: N, znear: N, zfar: N) -> TMat4<N> {
|
||||
let two : N = ::convert(2.0);
|
||||
let two : N = crate::convert(2.0);
|
||||
let mut mat : TMat4<N> = TMat4::<N>::identity();
|
||||
|
||||
mat[(0, 0)] = two / (right - left);
|
||||
|
@ -121,7 +121,7 @@ pub fn ortho_lh_no<N: Real>(left: N, right: N, bottom: N, top: N, znear: N, zfar
|
|||
///
|
||||
pub fn ortho_lh_zo<N: Real>(left: N, right: N, bottom: N, top: N, znear: N, zfar: N) -> TMat4<N> {
|
||||
let one : N = N::one();
|
||||
let two : N = ::convert(2.0);
|
||||
let two : N = crate::convert(2.0);
|
||||
let mut mat : TMat4<N> = TMat4::<N>::identity();
|
||||
|
||||
mat[(0, 0)] = two / (right - left);
|
||||
|
@ -176,7 +176,7 @@ pub fn ortho_rh<N: Real>(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<N: Real>(left: N, right: N, bottom: N, top: N, znear: N, zfar: N) -> TMat4<N> {
|
||||
let two : N = ::convert(2.0);
|
||||
let two : N = crate::convert(2.0);
|
||||
let mut mat : TMat4<N> = TMat4::<N>::identity();
|
||||
|
||||
mat[(0, 0)] = two / (right - left);
|
||||
|
@ -202,7 +202,7 @@ pub fn ortho_rh_no<N: Real>(left: N, right: N, bottom: N, top: N, znear: N, zfar
|
|||
///
|
||||
pub fn ortho_rh_zo<N: Real>(left: N, right: N, bottom: N, top: N, znear: N, zfar: N) -> TMat4<N> {
|
||||
let one : N = N::one();
|
||||
let two : N = ::convert(2.0);
|
||||
let two : N = crate::convert(2.0);
|
||||
let mut mat : TMat4<N> = TMat4::<N>::identity();
|
||||
|
||||
mat[(0, 0)] = two / (right - left);
|
||||
|
@ -285,13 +285,13 @@ pub fn perspective_fov_lh_no<N: Real>(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<N: Real>(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<N: Real>(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<N: Real>(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<N: Real>(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<N> = TMat4::zeros();
|
||||
|
||||
let tan_half_fovy = (fovy / two).tan();
|
||||
|
@ -558,7 +558,7 @@ pub fn perspective_lh_zo<N: Real>(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<N> = TMat4::zeros();
|
||||
|
||||
let tan_half_fovy = (fovy / two).tan();
|
||||
|
@ -625,7 +625,7 @@ pub fn perspective_rh_no<N: Real>(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<N: Real>(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();
|
||||
|
|
|
@ -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.
|
||||
///
|
||||
|
|
|
@ -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.
|
||||
///
|
||||
|
|
|
@ -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<N: Number, D: Dimension>() -> TMat<N, D, D>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use na::{self, Real, Unit};
|
||||
|
||||
use aliases::Qua;
|
||||
use crate::aliases::Qua;
|
||||
|
||||
/// The conjugate of `q`.
|
||||
pub fn quat_conjugate<N: Real>(q: &Qua<N>) -> Qua<N> {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use na::Real;
|
||||
|
||||
use aliases::Qua;
|
||||
use crate::aliases::Qua;
|
||||
|
||||
/// Multiplies two quaternions.
|
||||
pub fn quat_cross<N: Real>(q1: &Qua<N>, q2: &Qua<N>) -> Qua<N> {
|
||||
|
|
|
@ -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<N: Real>(x: &Qua<N>, y: &Qua<N>) -> TVec<bool, U4> {
|
||||
::equal(&x.coords, &y.coords)
|
||||
crate::equal(&x.coords, &y.coords)
|
||||
}
|
||||
|
||||
/// Component-wise approximate equality comparison between two quaternions.
|
||||
pub fn quat_equal_eps<N: Real>(x: &Qua<N>, y: &Qua<N>, epsilon: N) -> TVec<bool, U4> {
|
||||
::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<N: Real>(x: &Qua<N>, y: &Qua<N>) -> TVec<bool, U4> {
|
||||
::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<N: Real>(x: &Qua<N>, y: &Qua<N>, epsilon: N) -> TVec<bool, U4> {
|
||||
::not_equal_eps(&x.coords, &y.coords, epsilon)
|
||||
crate::not_equal_eps(&x.coords, &y.coords, epsilon)
|
||||
}
|
||||
|
|
|
@ -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<N: Real>(q: &Qua<N>) -> Qua<N> {
|
||||
|
|
|
@ -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<N: Real>(x: &Qua<N>) -> N {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use na;
|
||||
|
||||
use traits::Number;
|
||||
use crate::traits::Number;
|
||||
|
||||
/// Returns the maximum among three values.
|
||||
///
|
||||
|
|
|
@ -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.
|
||||
///
|
||||
|
|
|
@ -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.
|
||||
///
|
||||
|
|
|
@ -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<N: Number, D: Dimension>(x: &TVec3<N>, y: &TVec3<N>) -> TVec3<N> {
|
||||
|
|
|
@ -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!()
|
||||
|
|
|
@ -227,7 +227,7 @@ pub fn root_three<N: Real>() -> N {
|
|||
/// * [`root_five`](fn.root_five.html)
|
||||
/// * [`root_three`](fn.root_three.html)
|
||||
pub fn root_two<N: Real>() -> 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()
|
||||
}
|
||||
|
||||
|
|
|
@ -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<N: Number, D: Dimension>(x: &TVec<N, D>, y: &TVec<N, D>, epsilon: N) -> TVec<bool, D>
|
||||
|
|
|
@ -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<N: Scalar, D: Dimension>(x: &TVec<N, D>) -> TVec<i32, D>
|
||||
// where DefaultAllocator: Alloc<N, D> {
|
||||
|
|
|
@ -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`.
|
||||
///
|
||||
|
|
|
@ -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<N: Real, D: Dimension>(m: TMat<N, D, D>) -> TMat<N, D, D>
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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<N: Real>(x: &Qua<N>) -> TVec3<N> {
|
||||
|
@ -11,27 +11,27 @@ pub fn quat_euler_angles<N: Real>(x: &Qua<N>) -> TVec3<N> {
|
|||
|
||||
/// Component-wise `>` comparison between two quaternions.
|
||||
pub fn quat_greater_than<N: Real>(x: &Qua<N>, y: &Qua<N>) -> TVec<bool, U4> {
|
||||
::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<N: Real>(x: &Qua<N>, y: &Qua<N>) -> TVec<bool, U4> {
|
||||
::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<N: Real>(x: &Qua<N>, y: &Qua<N>) -> TVec<bool, U4> {
|
||||
::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<N: Real>(x: &Qua<N>, y: &Qua<N>) -> TVec<bool, U4> {
|
||||
::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<N: Real>(x: &Qua<N>) -> TMat4<N> {
|
||||
::quat_to_mat4(x)
|
||||
crate::quat_to_mat4(x)
|
||||
}
|
||||
|
||||
/// Computes a right hand look-at quaternion
|
||||
|
|
|
@ -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<T>(v: T, Multiple: T) -> T {
|
||||
|
|
|
@ -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<N: Scalar>(ptr: &[N]) -> TMat2<N> {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use na::{Scalar, U2};
|
||||
|
||||
use aliases::TVec;
|
||||
use crate::aliases::TVec;
|
||||
|
||||
|
||||
pub fn float_distance<T>(x: T, y: T) -> u64 {
|
||||
|
|
|
@ -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.
|
||||
///
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use na::{Real, U3, U4};
|
||||
|
||||
use aliases::{TVec, TMat};
|
||||
use crate::aliases::{TVec, TMat};
|
||||
|
||||
pub fn derivedEulerAngleX<N: Real>(angleX: N, angularVelocityX: N) -> TMat4<N> {
|
||||
unimplemented!()
|
||||
|
|
|
@ -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<N: Number>(v: &TVec2<N>, u: &TVec2<N>) -> N {
|
||||
|
|
|
@ -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.
|
||||
///
|
||||
|
|
|
@ -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<N: Real>(x: &TVec3<N>) -> TMat3<N> {
|
|||
///
|
||||
/// * [`matrix_cross3`](fn.matrix_cross3.html)
|
||||
pub fn matrix_cross<N: Real>(x: &TVec3<N>) -> TMat4<N> {
|
||||
::mat3_to_mat4(&x.cross_matrix())
|
||||
crate::mat3_to_mat4(&x.cross_matrix())
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
///
|
||||
|
|
|
@ -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<N, D> {
|
|||
/// * [`l2_norm`](fn.l2_norm.html)
|
||||
pub fn l1_norm<N: Real, D: Dimension>(v: &TVec<N, D>) -> N
|
||||
where DefaultAllocator: Alloc<N, D> {
|
||||
::comp_add(&v.abs())
|
||||
crate::comp_add(&v.abs())
|
||||
}
|
||||
|
||||
/// The l2-norm of `x - y`.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use na::Real;
|
||||
|
||||
use aliases::TVec3;
|
||||
use crate::aliases::TVec3;
|
||||
|
||||
/// The normal vector of the given triangle.
|
||||
///
|
||||
|
|
|
@ -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`.
|
||||
///
|
||||
|
|
|
@ -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<N: Real>(q: &Qua<N>, v: &TVec3<N>) -> TVec3<N> {
|
||||
|
|
|
@ -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.
|
||||
///
|
||||
|
|
|
@ -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<N: Real>(normal: &TVec3<N>, up: &TVec3<N>) -> TMat4<N> {
|
||||
|
|
|
@ -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.
|
||||
///
|
||||
|
|
|
@ -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<N: Number>(m: &TMat3<N>, normal: &TVec2<N>) -> TMat3<N> {
|
||||
|
|
|
@ -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`.
|
||||
///
|
||||
|
|
|
@ -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<N: Real, D: Dimension>(x: &TVec<N, D>, y: &TVec<N, D>) -> N
|
||||
|
|
|
@ -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).
|
||||
///
|
||||
|
|
|
@ -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<T>(v: T) -> i32 {
|
||||
unimplemented!()
|
||||
|
|
|
@ -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,
|
||||
};
|
||||
|
|
|
@ -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<N: Real, D: Dimension>(m: &TMat<N, D, D>) -> N
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use na::Scalar;
|
||||
|
||||
use aliases::{Vec2, Vec4, UVec2};
|
||||
use crate::aliases::{Vec2, Vec4, UVec2};
|
||||
|
||||
|
||||
pub fn packDouble2x32<N: Scalar>(v: &UVec2) -> f64 {
|
||||
|
|
|
@ -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<N: Real, D: Dimension>(x: &TVec<N, D>) -> TVec<N, D>
|
||||
|
|
|
@ -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`.
|
||||
///
|
||||
|
|
|
@ -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"]
|
||||
|
|
|
@ -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<N, D, D> + Allocator<N, D>
|
|||
|
||||
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<N, D, D> + Allocator<N, D>
|
|||
|
||||
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',
|
||||
|
|
|
@ -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<N, D, D> + Allocator<N, DimDiff<D, U1>>
|
|||
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);
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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<N, R, C>
|
|||
&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,
|
||||
|
|
|
@ -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<N, D, D> + Allocator<N, D>
|
|||
);
|
||||
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',
|
||||
|
|
|
@ -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(),
|
||||
|
|
|
@ -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<N, D, D> + Allocator<N, D>
|
|||
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,
|
||||
|
|
|
@ -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;
|
||||
|
||||
/*
|
||||
*
|
||||
|
|
|
@ -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;
|
||||
|
||||
/*
|
||||
*
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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,
|
||||
};
|
||||
|
||||
|
|
|
@ -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<N, R1, C1, R2, C2> = MatrixSum<N, R1, C1, R2, C2>;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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<N, R, C>
|
|||
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<N, R, C>
|
|||
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."
|
||||
);
|
||||
|
||||
|
|
|
@ -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};
|
||||
|
||||
/*
|
||||
*
|
||||
|
|
|
@ -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<N1, N2, R1, C1, R2, C2> SubsetOf<MatrixMN<N2, R2, C2>> for MatrixMN<N1, R1, C1>
|
||||
|
|
|
@ -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};
|
||||
|
||||
/*
|
||||
*
|
||||
|
|
|
@ -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;
|
||||
|
||||
/*
|
||||
*
|
||||
|
|
|
@ -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<N: Scalar + Zero, R: Dim, C: Dim, S: Storage<N, R, C>> Matrix<N, R, C, S> {
|
||||
/// Extracts the upper triangular part of this matrix (including the diagonal).
|
||||
|
|
|
@ -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<D: Dim> DimRange<D> 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<D: Dim> DimRange<D> for ops::Range<usize> {
|
|||
#[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<D: Dim> DimRange<D> for ops::RangeFrom<usize> {
|
|||
#[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<T>
|
|||
|
||||
#[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<D: Dim> DimRange<D> 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<D: Dim> DimRange<D> for ops::RangeInclusive<usize> {
|
|||
#[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<D: Dim> DimRange<D> for ops::RangeTo<usize>
|
|||
#[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<D: Dim> DimRange<D> for ops::RangeToInclusive<usize>
|
|||
#[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<N, $R, $C, S>) -> 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<N, $R, $C, S>) -> Self::OutputMut {
|
||||
use base::SliceStorageMut;
|
||||
use crate::base::SliceStorageMut;
|
||||
|
||||
let (rows, cols) = self;
|
||||
let (nrows, ncols) = matrix.data.shape();
|
||||
|
|
|
@ -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) => {
|
||||
|
|
|
@ -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<N, D, S> = Matrix<N, D, D, S>;
|
||||
|
@ -1111,7 +1111,7 @@ impl<N: Complex, D: Dim, S: Storage<N, D, D>> SquareMatrix<N, D, S> {
|
|||
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<N: Complex, D: Dim, S: Storage<N, D, D>> SquareMatrix<N, D, S> {
|
|||
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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};
|
||||
|
||||
/*
|
||||
*
|
||||
|
|
|
@ -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)) => {
|
||||
|
|
|
@ -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<N: Complex> Norm<N> for LpNorm {
|
|||
where R: Dim, C: Dim, S: Storage<N, R, C> {
|
||||
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<N: Complex> Norm<N> 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)))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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};
|
||||
|
||||
/*
|
||||
*
|
||||
|
|
|
@ -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<N: Scalar, R: Dim, C: Dim, S: Storage<N, R, C>> Matrix<N, R, C, S> {
|
||||
/// Indicates if this is an empty matrix.
|
||||
|
|
|
@ -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<N: Scalar, R: Dim, C: Dim, S: Storage<N, R, C>> Matrix<N, R, C, S> {
|
||||
/// Returns a row vector where each element is the result of the application of `f` on the
|
||||
|
@ -155,7 +155,7 @@ impl<N: Scalar + Field + SupersetOf<f64>, R: Dim, C: Dim, S: Storage<N, R, C>> 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<N: Scalar + Field + SupersetOf<f64>, R: Dim, C: Dim, S: Storage<N, R, C>> 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<N: Scalar + Field + SupersetOf<f64>, R: Dim, C: Dim, S: Storage<N, R, C>> 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<N: Scalar + Field + SupersetOf<f64>, R: Dim, C: Dim, S: Storage<N, R, C>> M
|
|||
pub fn column_mean(&self) -> VectorN<N, R>
|
||||
where DefaultAllocator: Allocator<N, R> {
|
||||
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())
|
||||
})
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -104,8 +104,8 @@ impl<T: NormedSpace> Unit<T> {
|
|||
#[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]
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)]
|
||||
|
|
|
@ -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)]
|
||||
|
|
|
@ -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<N, D>
|
|||
R: SubsetOf<MatrixN<N, DimNameSum<D, U1>>>,
|
||||
DefaultAllocator: Allocator<N, DimNameSum<D, U1>, DimNameSum<D, U1>>,
|
||||
{
|
||||
let mut res: MatrixN<N, _> = ::convert_ref(&self.rotation);
|
||||
let mut res: MatrixN<N, _> = crate::convert_ref(&self.rotation);
|
||||
res.fixed_slice_mut::<D, U1>(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, "}}")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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};
|
||||
|
||||
/*
|
||||
*
|
||||
|
|
|
@ -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<N> = Isometry<N, U2, UnitComplex<N>>;
|
||||
|
|
|
@ -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
|
||||
};
|
||||
|
|
|
@ -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<N2, D, R2>) -> bool {
|
||||
::is_convertible::<_, Translation<N1, D>>(&iso.translation)
|
||||
&& ::is_convertible::<_, R1>(&iso.rotation)
|
||||
crate::is_convertible::<_, Translation<N1, D>>(&iso.translation)
|
||||
&& crate::is_convertible::<_, R1>(&iso.rotation)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
@ -60,12 +60,12 @@ where
|
|||
|
||||
#[inline]
|
||||
fn is_in_subset(sim: &Similarity<N2, D, R2>) -> bool {
|
||||
::is_convertible::<_, Isometry<N1, D, R1>>(&sim.isometry) && sim.scaling() == N2::one()
|
||||
crate::is_convertible::<_, Isometry<N1, D, R1>>(&sim.isometry) && sim.scaling() == N2::one()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
unsafe fn from_superset_unchecked(sim: &Similarity<N2, D, R2>) -> 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::<N1>::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<N2, DimNameSum<D, U1>>) -> Self {
|
||||
let t = m.fixed_slice::<D, U1>(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()))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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>`
|
||||
|
|
|
@ -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<N: Real> {
|
||||
|
@ -150,7 +150,7 @@ impl<N: Real> Orthographic3<N> {
|
|||
"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<N: Real> Orthographic3<N> {
|
|||
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<N: Real> Orthographic3<N> {
|
|||
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<N: Real> Orthographic3<N> {
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue