diff --git a/Cargo.toml b/Cargo.toml
index a67c5839..15bf01fb 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -36,7 +36,7 @@ no_unsound_assume_init = [ ]
# Conversion
convert-mint = [ "mint" ]
convert-glam = [ "glam" ]
-convert-glam-unchecked = [ "convert-glam" ] # Unable edgy conversions like Mat4 -> Isometry3
+convert-glam-unchecked = [ "convert-glam" ] # Enable edgy conversions like Mat4 -> Isometry3
convert-bytemuck = [ "bytemuck" ]
# Serialization
@@ -54,7 +54,6 @@ slow-tests = []
[dependencies]
typenum = "1.12"
-generic-array = "0.14"
rand-package = { package = "rand", version = "0.8", optional = true, default-features = false }
num-traits = { version = "0.2", default-features = false }
num-complex = { version = "0.3", default-features = false }
diff --git a/README.md b/README.md
index 08350907..bed6183d 100644
--- a/README.md
+++ b/README.md
@@ -30,10 +30,10 @@
-----
-## Gold sponsors
+## Platinum sponsors
Rapier is supported by:
-
+
diff --git a/benches/common/macros.rs b/benches/common/macros.rs
index 43bcf59d..3f775958 100644
--- a/benches/common/macros.rs
+++ b/benches/common/macros.rs
@@ -60,7 +60,7 @@ macro_rules! bench_unop_na(
i = (i + 1) & (LEN - 1);
unsafe {
- test::black_box(na::$unop(elems.get_unchecked(i)))
+ std::hint::black_box(na::$unop(elems.get_unchecked(i)))
}
}));
}
@@ -82,7 +82,7 @@ macro_rules! bench_unop(
i = (i + 1) & (LEN - 1);
unsafe {
- test::black_box(elems.get_unchecked_mut(i).$unop())
+ std::hint::black_box(elems.get_unchecked_mut(i).$unop())
}
}));
}
@@ -105,7 +105,7 @@ macro_rules! bench_construction(
unsafe {
let res = $constructor($(*$args.get_unchecked(i),)*);
- test::black_box(res)
+ std::hint::black_box(res)
}
}));
}
diff --git a/benches/core/matrix.rs b/benches/core/matrix.rs
index 7f4432e3..df4a5a5b 100644
--- a/benches/core/matrix.rs
+++ b/benches/core/matrix.rs
@@ -1,4 +1,4 @@
-use na::{DMatrix, DVector, Matrix2, Matrix3, Matrix4, MatrixN, Vector2, Vector3, Vector4, U10};
+use na::{DMatrix, DVector, Matrix2, Matrix3, Matrix4, OMatrix, Vector2, Vector3, Vector4, U10};
use rand::Rng;
use rand_isaac::IsaacRng;
use std::ops::{Add, Div, Mul, Sub};
@@ -116,8 +116,8 @@ fn mat10_mul_mat10(bench: &mut criterion::Criterion) {
}
fn mat10_mul_mat10_static(bench: &mut criterion::Criterion) {
- let a = MatrixN::::new_random();
- let b = MatrixN::::new_random();
+ let a = OMatrix::::new_random();
+ let b = OMatrix::::new_random();
bench.bench_function("mat10_mul_mat10_static", move |bh| bh.iter(|| &a * &b));
}
@@ -198,7 +198,7 @@ fn mat_mul_mat(bench: &mut criterion::Criterion) {
bench.bench_function("mat_mul_mat", move |bh| {
bh.iter(|| {
- test::black_box(a.mul_to(&b, &mut ab));
+ std::hint::black_box(a.mul_to(&b, &mut ab));
})
});
}
diff --git a/benches/core/vector.rs b/benches/core/vector.rs
index 2806d034..66025bc5 100644
--- a/benches/core/vector.rs
+++ b/benches/core/vector.rs
@@ -1,8 +1,7 @@
-use na::{DVector, Vector2, Vector3, Vector4, VectorN};
+use na::{DVector, SVector, Vector2, Vector3, Vector4};
use rand::Rng;
use rand_isaac::IsaacRng;
use std::ops::{Add, Div, Mul, Sub};
-use typenum::U10000;
#[path = "../common/macros.rs"]
mod macros;
@@ -45,8 +44,8 @@ bench_unop!(vec2_normalize, Vector2, normalize);
bench_unop!(vec3_normalize, Vector3, normalize);
bench_unop!(vec4_normalize, Vector4, normalize);
-bench_binop_ref!(vec10000_dot_f64, VectorN, VectorN, dot);
-bench_binop_ref!(vec10000_dot_f32, VectorN, VectorN, dot);
+bench_binop_ref!(vec10000_dot_f64, SVector, SVector, dot);
+bench_binop_ref!(vec10000_dot_f32, SVector, SVector, dot);
fn vec10000_axpy_f64(bh: &mut criterion::Criterion) {
use rand::SeedableRng;
@@ -82,8 +81,8 @@ fn vec10000_axpy_f64_slice(bh: &mut criterion::Criterion) {
bh.bench_function("vec10000_axpy_f64_slice", move |bh| {
bh.iter(|| {
- let mut a = a.fixed_rows_mut::(0);
- let b = b.fixed_rows::(0);
+ let mut a = a.fixed_rows_mut::<10000>(0);
+ let b = b.fixed_rows::<10000>(0);
a.axpy(n, &b, 1.0)
})
@@ -93,11 +92,11 @@ fn vec10000_axpy_f64_slice(bh: &mut criterion::Criterion) {
fn vec10000_axpy_f64_static(bh: &mut criterion::Criterion) {
use rand::SeedableRng;
let mut rng = IsaacRng::seed_from_u64(0);
- let mut a = VectorN::::new_random();
- let b = VectorN::::new_random();
+ let mut a = SVector::::new_random();
+ let b = SVector::::new_random();
let n = rng.gen::();
- // NOTE: for some reasons, it is much faster if the arument are boxed (Box::new(VectorN...)).
+ // NOTE: for some reasons, it is much faster if the arument are boxed (Box::new(OVector...)).
bh.bench_function("vec10000_axpy_f64_static", move |bh| {
bh.iter(|| a.axpy(n, &b, 1.0))
});
diff --git a/benches/lib.rs b/benches/lib.rs
index e4215a12..a77cc743 100644
--- a/benches/lib.rs
+++ b/benches/lib.rs
@@ -2,10 +2,7 @@
#![allow(unused_macros)]
extern crate nalgebra as na;
-extern crate rand;
-extern crate rand_isaac;
-extern crate test;
-extern crate typenum;
+extern crate rand_package as rand;
#[macro_use]
extern crate criterion;
diff --git a/benches/linalg/bidiagonal.rs b/benches/linalg/bidiagonal.rs
index ad875264..fe96c772 100644
--- a/benches/linalg/bidiagonal.rs
+++ b/benches/linalg/bidiagonal.rs
@@ -7,35 +7,35 @@ mod macros;
fn bidiagonalize_100x100(bh: &mut criterion::Criterion) {
let m = DMatrix::::new_random(100, 100);
bh.bench_function("bidiagonalize_100x100", move |bh| {
- bh.iter(|| test::black_box(Bidiagonal::new(m.clone())))
+ bh.iter(|| std::hint::black_box(Bidiagonal::new(m.clone())))
});
}
fn bidiagonalize_100x500(bh: &mut criterion::Criterion) {
let m = DMatrix::::new_random(100, 500);
bh.bench_function("bidiagonalize_100x500", move |bh| {
- bh.iter(|| test::black_box(Bidiagonal::new(m.clone())))
+ bh.iter(|| std::hint::black_box(Bidiagonal::new(m.clone())))
});
}
fn bidiagonalize_4x4(bh: &mut criterion::Criterion) {
let m = Matrix4::::new_random();
bh.bench_function("bidiagonalize_4x4", move |bh| {
- bh.iter(|| test::black_box(Bidiagonal::new(m.clone())))
+ bh.iter(|| std::hint::black_box(Bidiagonal::new(m.clone())))
});
}
fn bidiagonalize_500x100(bh: &mut criterion::Criterion) {
let m = DMatrix::::new_random(500, 100);
bh.bench_function("bidiagonalize_500x100", move |bh| {
- bh.iter(|| test::black_box(Bidiagonal::new(m.clone())))
+ bh.iter(|| std::hint::black_box(Bidiagonal::new(m.clone())))
});
}
fn bidiagonalize_500x500(bh: &mut criterion::Criterion) {
let m = DMatrix::::new_random(500, 500);
bh.bench_function("bidiagonalize_500x500", move |bh| {
- bh.iter(|| test::black_box(Bidiagonal::new(m.clone())))
+ bh.iter(|| std::hint::black_box(Bidiagonal::new(m.clone())))
});
}
diff --git a/benches/linalg/cholesky.rs b/benches/linalg/cholesky.rs
index a03888f5..09c80642 100644
--- a/benches/linalg/cholesky.rs
+++ b/benches/linalg/cholesky.rs
@@ -5,7 +5,7 @@ fn cholesky_100x100(bh: &mut criterion::Criterion) {
let m = &m * m.transpose();
bh.bench_function("cholesky_100x100", move |bh| {
- bh.iter(|| test::black_box(Cholesky::new(m.clone())))
+ bh.iter(|| std::hint::black_box(Cholesky::new(m.clone())))
});
}
@@ -14,7 +14,7 @@ fn cholesky_500x500(bh: &mut criterion::Criterion) {
let m = &m * m.transpose();
bh.bench_function("cholesky_500x500", move |bh| {
- bh.iter(|| test::black_box(Cholesky::new(m.clone())))
+ bh.iter(|| std::hint::black_box(Cholesky::new(m.clone())))
});
}
diff --git a/benches/linalg/full_piv_lu.rs b/benches/linalg/full_piv_lu.rs
index dfd176da..748b6b05 100644
--- a/benches/linalg/full_piv_lu.rs
+++ b/benches/linalg/full_piv_lu.rs
@@ -4,21 +4,21 @@ use na::{DMatrix, DVector, FullPivLU};
fn full_piv_lu_decompose_10x10(bh: &mut criterion::Criterion) {
let m = DMatrix::::new_random(10, 10);
bh.bench_function("full_piv_lu_decompose_10x10", move |bh| {
- bh.iter(|| test::black_box(FullPivLU::new(m.clone())))
+ bh.iter(|| std::hint::black_box(FullPivLU::new(m.clone())))
});
}
fn full_piv_lu_decompose_100x100(bh: &mut criterion::Criterion) {
let m = DMatrix::::new_random(100, 100);
bh.bench_function("full_piv_lu_decompose_100x100", move |bh| {
- bh.iter(|| test::black_box(FullPivLU::new(m.clone())))
+ bh.iter(|| std::hint::black_box(FullPivLU::new(m.clone())))
});
}
fn full_piv_lu_decompose_500x500(bh: &mut criterion::Criterion) {
let m = DMatrix::::new_random(500, 500);
bh.bench_function("full_piv_lu_decompose_500x500", move |bh| {
- bh.iter(|| test::black_box(FullPivLU::new(m.clone())))
+ bh.iter(|| std::hint::black_box(FullPivLU::new(m.clone())))
});
}
@@ -63,7 +63,7 @@ fn full_piv_lu_inverse_10x10(bh: &mut criterion::Criterion) {
let lu = FullPivLU::new(m.clone());
bh.bench_function("full_piv_lu_inverse_10x10", move |bh| {
- bh.iter(|| test::black_box(lu.try_inverse()))
+ bh.iter(|| std::hint::black_box(lu.try_inverse()))
});
}
@@ -72,7 +72,7 @@ fn full_piv_lu_inverse_100x100(bh: &mut criterion::Criterion) {
let lu = FullPivLU::new(m.clone());
bh.bench_function("full_piv_lu_inverse_100x100", move |bh| {
- bh.iter(|| test::black_box(lu.try_inverse()))
+ bh.iter(|| std::hint::black_box(lu.try_inverse()))
});
}
@@ -81,7 +81,7 @@ fn full_piv_lu_inverse_500x500(bh: &mut criterion::Criterion) {
let lu = FullPivLU::new(m.clone());
bh.bench_function("full_piv_lu_inverse_500x500", move |bh| {
- bh.iter(|| test::black_box(lu.try_inverse()))
+ bh.iter(|| std::hint::black_box(lu.try_inverse()))
});
}
@@ -90,7 +90,7 @@ fn full_piv_lu_determinant_10x10(bh: &mut criterion::Criterion) {
let lu = FullPivLU::new(m.clone());
bh.bench_function("full_piv_lu_determinant_10x10", move |bh| {
- bh.iter(|| test::black_box(lu.determinant()))
+ bh.iter(|| std::hint::black_box(lu.determinant()))
});
}
@@ -99,7 +99,7 @@ fn full_piv_lu_determinant_100x100(bh: &mut criterion::Criterion) {
let lu = FullPivLU::new(m.clone());
bh.bench_function("full_piv_lu_determinant_100x100", move |bh| {
- bh.iter(|| test::black_box(lu.determinant()))
+ bh.iter(|| std::hint::black_box(lu.determinant()))
});
}
@@ -108,7 +108,7 @@ fn full_piv_lu_determinant_500x500(bh: &mut criterion::Criterion) {
let lu = FullPivLU::new(m.clone());
bh.bench_function("full_piv_lu_determinant_500x500", move |bh| {
- bh.iter(|| test::black_box(lu.determinant()))
+ bh.iter(|| std::hint::black_box(lu.determinant()))
});
}
diff --git a/benches/linalg/hessenberg.rs b/benches/linalg/hessenberg.rs
index a989616c..a2aabb80 100644
--- a/benches/linalg/hessenberg.rs
+++ b/benches/linalg/hessenberg.rs
@@ -7,28 +7,28 @@ mod macros;
fn hessenberg_decompose_4x4(bh: &mut criterion::Criterion) {
let m = Matrix4::::new_random();
bh.bench_function("hessenberg_decompose_4x4", move |bh| {
- bh.iter(|| test::black_box(Hessenberg::new(m.clone())))
+ bh.iter(|| std::hint::black_box(Hessenberg::new(m.clone())))
});
}
fn hessenberg_decompose_100x100(bh: &mut criterion::Criterion) {
let m = DMatrix::::new_random(100, 100);
bh.bench_function("hessenberg_decompose_100x100", move |bh| {
- bh.iter(|| test::black_box(Hessenberg::new(m.clone())))
+ bh.iter(|| std::hint::black_box(Hessenberg::new(m.clone())))
});
}
fn hessenberg_decompose_200x200(bh: &mut criterion::Criterion) {
let m = DMatrix::::new_random(200, 200);
bh.bench_function("hessenberg_decompose_200x200", move |bh| {
- bh.iter(|| test::black_box(Hessenberg::new(m.clone())))
+ bh.iter(|| std::hint::black_box(Hessenberg::new(m.clone())))
});
}
fn hessenberg_decompose_500x500(bh: &mut criterion::Criterion) {
let m = DMatrix::::new_random(500, 500);
bh.bench_function("hessenberg_decompose_500x500", move |bh| {
- bh.iter(|| test::black_box(Hessenberg::new(m.clone())))
+ bh.iter(|| std::hint::black_box(Hessenberg::new(m.clone())))
});
}
diff --git a/benches/linalg/lu.rs b/benches/linalg/lu.rs
index c42cd499..2b2ab972 100644
--- a/benches/linalg/lu.rs
+++ b/benches/linalg/lu.rs
@@ -4,21 +4,21 @@ use na::{DMatrix, DVector, LU};
fn lu_decompose_10x10(bh: &mut criterion::Criterion) {
let m = DMatrix::::new_random(10, 10);
bh.bench_function("lu_decompose_10x10", move |bh| {
- bh.iter(|| test::black_box(LU::new(m.clone())))
+ bh.iter(|| std::hint::black_box(LU::new(m.clone())))
});
}
fn lu_decompose_100x100(bh: &mut criterion::Criterion) {
let m = DMatrix::::new_random(100, 100);
bh.bench_function("lu_decompose_100x100", move |bh| {
- bh.iter(|| test::black_box(LU::new(m.clone())))
+ bh.iter(|| std::hint::black_box(LU::new(m.clone())))
});
}
fn lu_decompose_500x500(bh: &mut criterion::Criterion) {
let m = DMatrix::::new_random(500, 500);
bh.bench_function("lu_decompose_500x500", move |bh| {
- bh.iter(|| test::black_box(LU::new(m.clone())))
+ bh.iter(|| std::hint::black_box(LU::new(m.clone())))
});
}
@@ -63,7 +63,7 @@ fn lu_inverse_10x10(bh: &mut criterion::Criterion) {
let lu = LU::new(m.clone());
bh.bench_function("lu_inverse_10x10", move |bh| {
- bh.iter(|| test::black_box(lu.try_inverse()))
+ bh.iter(|| std::hint::black_box(lu.try_inverse()))
});
}
@@ -72,7 +72,7 @@ fn lu_inverse_100x100(bh: &mut criterion::Criterion) {
let lu = LU::new(m.clone());
bh.bench_function("lu_inverse_100x100", move |bh| {
- bh.iter(|| test::black_box(lu.try_inverse()))
+ bh.iter(|| std::hint::black_box(lu.try_inverse()))
});
}
@@ -81,7 +81,7 @@ fn lu_inverse_500x500(bh: &mut criterion::Criterion) {
let lu = LU::new(m.clone());
bh.bench_function("lu_inverse_500x500", move |bh| {
- bh.iter(|| test::black_box(lu.try_inverse()))
+ bh.iter(|| std::hint::black_box(lu.try_inverse()))
});
}
@@ -90,7 +90,7 @@ fn lu_determinant_10x10(bh: &mut criterion::Criterion) {
let lu = LU::new(m.clone());
bh.bench_function("lu_determinant_10x10", move |bh| {
- bh.iter(|| test::black_box(lu.determinant()))
+ bh.iter(|| std::hint::black_box(lu.determinant()))
});
}
@@ -99,7 +99,7 @@ fn lu_determinant_100x100(bh: &mut criterion::Criterion) {
let lu = LU::new(m.clone());
bh.bench_function("lu_determinant_100x100", move |bh| {
- bh.iter(|| test::black_box(lu.determinant()))
+ bh.iter(|| std::hint::black_box(lu.determinant()))
});
}
@@ -107,7 +107,9 @@ fn lu_determinant_500x500(bh: &mut criterion::Criterion) {
let m = DMatrix::::new_random(500, 500);
let lu = LU::new(m.clone());
- bh.bench_function("", move |bh| bh.iter(|| test::black_box(lu.determinant())));
+ bh.bench_function("", move |bh| {
+ bh.iter(|| std::hint::black_box(lu.determinant()))
+ });
}
criterion_group!(
diff --git a/benches/linalg/qr.rs b/benches/linalg/qr.rs
index d896f978..0c62b9ea 100644
--- a/benches/linalg/qr.rs
+++ b/benches/linalg/qr.rs
@@ -7,35 +7,35 @@ mod macros;
fn qr_decompose_100x100(bh: &mut criterion::Criterion) {
let m = DMatrix::::new_random(100, 100);
bh.bench_function("qr_decompose_100x100", move |bh| {
- bh.iter(|| test::black_box(QR::new(m.clone())))
+ bh.iter(|| std::hint::black_box(QR::new(m.clone())))
});
}
fn qr_decompose_100x500(bh: &mut criterion::Criterion) {
let m = DMatrix::::new_random(100, 500);
bh.bench_function("qr_decompose_100x500", move |bh| {
- bh.iter(|| test::black_box(QR::new(m.clone())))
+ bh.iter(|| std::hint::black_box(QR::new(m.clone())))
});
}
fn qr_decompose_4x4(bh: &mut criterion::Criterion) {
let m = Matrix4::::new_random();
bh.bench_function("qr_decompose_4x4", move |bh| {
- bh.iter(|| test::black_box(QR::new(m.clone())))
+ bh.iter(|| std::hint::black_box(QR::new(m.clone())))
});
}
fn qr_decompose_500x100(bh: &mut criterion::Criterion) {
let m = DMatrix::::new_random(500, 100);
bh.bench_function("qr_decompose_500x100", move |bh| {
- bh.iter(|| test::black_box(QR::new(m.clone())))
+ bh.iter(|| std::hint::black_box(QR::new(m.clone())))
});
}
fn qr_decompose_500x500(bh: &mut criterion::Criterion) {
let m = DMatrix::::new_random(500, 500);
bh.bench_function("qr_decompose_500x500", move |bh| {
- bh.iter(|| test::black_box(QR::new(m.clone())))
+ bh.iter(|| std::hint::black_box(QR::new(m.clone())))
});
}
@@ -121,7 +121,7 @@ fn qr_inverse_10x10(bh: &mut criterion::Criterion) {
let qr = QR::new(m.clone());
bh.bench_function("qr_inverse_10x10", move |bh| {
- bh.iter(|| test::black_box(qr.try_inverse()))
+ bh.iter(|| std::hint::black_box(qr.try_inverse()))
});
}
@@ -130,7 +130,7 @@ fn qr_inverse_100x100(bh: &mut criterion::Criterion) {
let qr = QR::new(m.clone());
bh.bench_function("qr_inverse_100x100", move |bh| {
- bh.iter(|| test::black_box(qr.try_inverse()))
+ bh.iter(|| std::hint::black_box(qr.try_inverse()))
});
}
@@ -139,7 +139,7 @@ fn qr_inverse_500x500(bh: &mut criterion::Criterion) {
let qr = QR::new(m.clone());
bh.bench_function("qr_inverse_500x500", move |bh| {
- bh.iter(|| test::black_box(qr.try_inverse()))
+ bh.iter(|| std::hint::black_box(qr.try_inverse()))
});
}
diff --git a/benches/linalg/schur.rs b/benches/linalg/schur.rs
index e4193a25..2014f145 100644
--- a/benches/linalg/schur.rs
+++ b/benches/linalg/schur.rs
@@ -3,56 +3,56 @@ use na::{Matrix4, Schur};
fn schur_decompose_4x4(bh: &mut criterion::Criterion) {
let m = Matrix4::::new_random();
bh.bench_function("schur_decompose_4x4", move |bh| {
- bh.iter(|| test::black_box(Schur::new(m.clone())))
+ bh.iter(|| std::hint::black_box(Schur::new(m.clone())))
});
}
fn schur_decompose_10x10(bh: &mut criterion::Criterion) {
let m = crate::reproductible_dmatrix(10, 10);
bh.bench_function("schur_decompose_10x10", move |bh| {
- bh.iter(|| test::black_box(Schur::new(m.clone())))
+ bh.iter(|| std::hint::black_box(Schur::new(m.clone())))
});
}
fn schur_decompose_100x100(bh: &mut criterion::Criterion) {
let m = crate::reproductible_dmatrix(100, 100);
bh.bench_function("schur_decompose_100x100", move |bh| {
- bh.iter(|| test::black_box(Schur::new(m.clone())))
+ bh.iter(|| std::hint::black_box(Schur::new(m.clone())))
});
}
fn schur_decompose_200x200(bh: &mut criterion::Criterion) {
let m = crate::reproductible_dmatrix(200, 200);
bh.bench_function("schur_decompose_200x200", move |bh| {
- bh.iter(|| test::black_box(Schur::new(m.clone())))
+ bh.iter(|| std::hint::black_box(Schur::new(m.clone())))
});
}
fn eigenvalues_4x4(bh: &mut criterion::Criterion) {
let m = Matrix4::::new_random();
bh.bench_function("eigenvalues_4x4", move |bh| {
- bh.iter(|| test::black_box(m.complex_eigenvalues()))
+ bh.iter(|| std::hint::black_box(m.complex_eigenvalues()))
});
}
fn eigenvalues_10x10(bh: &mut criterion::Criterion) {
let m = crate::reproductible_dmatrix(10, 10);
bh.bench_function("eigenvalues_10x10", move |bh| {
- bh.iter(|| test::black_box(m.complex_eigenvalues()))
+ bh.iter(|| std::hint::black_box(m.complex_eigenvalues()))
});
}
fn eigenvalues_100x100(bh: &mut criterion::Criterion) {
let m = crate::reproductible_dmatrix(100, 100);
bh.bench_function("eigenvalues_100x100", move |bh| {
- bh.iter(|| test::black_box(m.complex_eigenvalues()))
+ bh.iter(|| std::hint::black_box(m.complex_eigenvalues()))
});
}
fn eigenvalues_200x200(bh: &mut criterion::Criterion) {
let m = crate::reproductible_dmatrix(200, 200);
bh.bench_function("eigenvalues_200x200", move |bh| {
- bh.iter(|| test::black_box(m.complex_eigenvalues()))
+ bh.iter(|| std::hint::black_box(m.complex_eigenvalues()))
});
}
diff --git a/benches/linalg/svd.rs b/benches/linalg/svd.rs
index aec18fd8..b84f60d6 100644
--- a/benches/linalg/svd.rs
+++ b/benches/linalg/svd.rs
@@ -3,112 +3,112 @@ use na::{Matrix4, SVD};
fn svd_decompose_4x4(bh: &mut criterion::Criterion) {
let m = Matrix4::::new_random();
bh.bench_function("svd_decompose_4x4", move |bh| {
- bh.iter(|| test::black_box(SVD::new(m.clone(), true, true)))
+ bh.iter(|| std::hint::black_box(SVD::new(m.clone(), true, true)))
});
}
fn svd_decompose_10x10(bh: &mut criterion::Criterion) {
let m = crate::reproductible_dmatrix(10, 10);
bh.bench_function("svd_decompose_10x10", move |bh| {
- bh.iter(|| test::black_box(SVD::new(m.clone(), true, true)))
+ bh.iter(|| std::hint::black_box(SVD::new(m.clone(), true, true)))
});
}
fn svd_decompose_100x100(bh: &mut criterion::Criterion) {
let m = crate::reproductible_dmatrix(100, 100);
bh.bench_function("svd_decompose_100x100", move |bh| {
- bh.iter(|| test::black_box(SVD::new(m.clone(), true, true)))
+ bh.iter(|| std::hint::black_box(SVD::new(m.clone(), true, true)))
});
}
fn svd_decompose_200x200(bh: &mut criterion::Criterion) {
let m = crate::reproductible_dmatrix(200, 200);
bh.bench_function("svd_decompose_200x200", move |bh| {
- bh.iter(|| test::black_box(SVD::new(m.clone(), true, true)))
+ bh.iter(|| std::hint::black_box(SVD::new(m.clone(), true, true)))
});
}
fn rank_4x4(bh: &mut criterion::Criterion) {
let m = Matrix4::::new_random();
bh.bench_function("rank_4x4", move |bh| {
- bh.iter(|| test::black_box(m.rank(1.0e-10)))
+ bh.iter(|| std::hint::black_box(m.rank(1.0e-10)))
});
}
fn rank_10x10(bh: &mut criterion::Criterion) {
let m = crate::reproductible_dmatrix(10, 10);
bh.bench_function("rank_10x10", move |bh| {
- bh.iter(|| test::black_box(m.rank(1.0e-10)))
+ bh.iter(|| std::hint::black_box(m.rank(1.0e-10)))
});
}
fn rank_100x100(bh: &mut criterion::Criterion) {
let m = crate::reproductible_dmatrix(100, 100);
bh.bench_function("rank_100x100", move |bh| {
- bh.iter(|| test::black_box(m.rank(1.0e-10)))
+ bh.iter(|| std::hint::black_box(m.rank(1.0e-10)))
});
}
fn rank_200x200(bh: &mut criterion::Criterion) {
let m = crate::reproductible_dmatrix(200, 200);
bh.bench_function("rank_200x200", move |bh| {
- bh.iter(|| test::black_box(m.rank(1.0e-10)))
+ bh.iter(|| std::hint::black_box(m.rank(1.0e-10)))
});
}
fn singular_values_4x4(bh: &mut criterion::Criterion) {
let m = Matrix4::::new_random();
bh.bench_function("singular_values_4x4", move |bh| {
- bh.iter(|| test::black_box(m.singular_values()))
+ bh.iter(|| std::hint::black_box(m.singular_values()))
});
}
fn singular_values_10x10(bh: &mut criterion::Criterion) {
let m = crate::reproductible_dmatrix(10, 10);
bh.bench_function("singular_values_10x10", move |bh| {
- bh.iter(|| test::black_box(m.singular_values()))
+ bh.iter(|| std::hint::black_box(m.singular_values()))
});
}
fn singular_values_100x100(bh: &mut criterion::Criterion) {
let m = crate::reproductible_dmatrix(100, 100);
bh.bench_function("singular_values_100x100", move |bh| {
- bh.iter(|| test::black_box(m.singular_values()))
+ bh.iter(|| std::hint::black_box(m.singular_values()))
});
}
fn singular_values_200x200(bh: &mut criterion::Criterion) {
let m = crate::reproductible_dmatrix(200, 200);
bh.bench_function("singular_values_200x200", move |bh| {
- bh.iter(|| test::black_box(m.singular_values()))
+ bh.iter(|| std::hint::black_box(m.singular_values()))
});
}
fn pseudo_inverse_4x4(bh: &mut criterion::Criterion) {
let m = Matrix4::::new_random();
bh.bench_function("pseudo_inverse_4x4", move |bh| {
- bh.iter(|| test::black_box(m.clone().pseudo_inverse(1.0e-10)))
+ bh.iter(|| std::hint::black_box(m.clone().pseudo_inverse(1.0e-10)))
});
}
fn pseudo_inverse_10x10(bh: &mut criterion::Criterion) {
let m = crate::reproductible_dmatrix(10, 10);
bh.bench_function("pseudo_inverse_10x10", move |bh| {
- bh.iter(|| test::black_box(m.clone().pseudo_inverse(1.0e-10)))
+ bh.iter(|| std::hint::black_box(m.clone().pseudo_inverse(1.0e-10)))
});
}
fn pseudo_inverse_100x100(bh: &mut criterion::Criterion) {
let m = crate::reproductible_dmatrix(100, 100);
bh.bench_function("pseudo_inverse_100x100", move |bh| {
- bh.iter(|| test::black_box(m.clone().pseudo_inverse(1.0e-10)))
+ bh.iter(|| std::hint::black_box(m.clone().pseudo_inverse(1.0e-10)))
});
}
fn pseudo_inverse_200x200(bh: &mut criterion::Criterion) {
let m = crate::reproductible_dmatrix(200, 200);
bh.bench_function("pseudo_inverse_200x200", move |bh| {
- bh.iter(|| test::black_box(m.clone().pseudo_inverse(1.0e-10)))
+ bh.iter(|| std::hint::black_box(m.clone().pseudo_inverse(1.0e-10)))
});
}
diff --git a/benches/linalg/symmetric_eigen.rs b/benches/linalg/symmetric_eigen.rs
index 3b52ba5c..07ecc2a2 100644
--- a/benches/linalg/symmetric_eigen.rs
+++ b/benches/linalg/symmetric_eigen.rs
@@ -3,28 +3,28 @@ use na::{Matrix4, SymmetricEigen};
fn symmetric_eigen_decompose_4x4(bh: &mut criterion::Criterion) {
let m = Matrix4::::new_random();
bh.bench_function("symmetric_eigen_decompose_4x4", move |bh| {
- bh.iter(|| test::black_box(SymmetricEigen::new(m.clone())))
+ bh.iter(|| std::hint::black_box(SymmetricEigen::new(m.clone())))
});
}
fn symmetric_eigen_decompose_10x10(bh: &mut criterion::Criterion) {
let m = crate::reproductible_dmatrix(10, 10);
bh.bench_function("symmetric_eigen_decompose_10x10", move |bh| {
- bh.iter(|| test::black_box(SymmetricEigen::new(m.clone())))
+ bh.iter(|| std::hint::black_box(SymmetricEigen::new(m.clone())))
});
}
fn symmetric_eigen_decompose_100x100(bh: &mut criterion::Criterion) {
let m = crate::reproductible_dmatrix(100, 100);
bh.bench_function("symmetric_eigen_decompose_100x100", move |bh| {
- bh.iter(|| test::black_box(SymmetricEigen::new(m.clone())))
+ bh.iter(|| std::hint::black_box(SymmetricEigen::new(m.clone())))
});
}
fn symmetric_eigen_decompose_200x200(bh: &mut criterion::Criterion) {
let m = crate::reproductible_dmatrix(200, 200);
bh.bench_function("symmetric_eigen_decompose_200x200", move |bh| {
- bh.iter(|| test::black_box(SymmetricEigen::new(m.clone())))
+ bh.iter(|| std::hint::black_box(SymmetricEigen::new(m.clone())))
});
}
diff --git a/examples/dimensional_genericity.rs b/examples/dimensional_genericity.rs
index 00c40f14..1fdd5a5f 100644
--- a/examples/dimensional_genericity.rs
+++ b/examples/dimensional_genericity.rs
@@ -2,26 +2,26 @@ extern crate nalgebra as na;
use na::allocator::Allocator;
use na::dimension::Dim;
-use na::{DefaultAllocator, RealField, Unit, Vector2, Vector3, VectorN};
+use na::{DefaultAllocator, OVector, RealField, Unit, Vector2, Vector3};
/// Reflects a vector wrt. the hyperplane with normal `plane_normal`.
-fn reflect_wrt_hyperplane_with_dimensional_genericity(
- plane_normal: &Unit>,
- vector: &VectorN,
-) -> VectorN
+fn reflect_wrt_hyperplane_with_dimensional_genericity(
+ plane_normal: &Unit>,
+ vector: &OVector,
+) -> OVector
where
- N: RealField,
+ T: RealField,
D: Dim,
- DefaultAllocator: Allocator,
+ DefaultAllocator: Allocator,
{
let n = plane_normal.as_ref(); // Get the underlying V.
vector - n * (n.dot(vector) * na::convert(2.0))
}
/// Reflects a 2D vector wrt. the 2D line with normal `plane_normal`.
-fn reflect_wrt_hyperplane2(plane_normal: &Unit>, vector: &Vector2) -> Vector2
+fn reflect_wrt_hyperplane2(plane_normal: &Unit>, vector: &Vector2) -> Vector2
where
- N: RealField,
+ T: RealField,
{
let n = plane_normal.as_ref(); // Get the underlying Vector2
vector - n * (n.dot(vector) * na::convert(2.0))
@@ -29,9 +29,9 @@ where
/// Reflects a 3D vector wrt. the 3D plane with normal `plane_normal`.
/// /!\ This is an exact replicate of `reflect_wrt_hyperplane2, but for 3D.
-fn reflect_wrt_hyperplane3(plane_normal: &Unit>, vector: &Vector3) -> Vector3
+fn reflect_wrt_hyperplane3(plane_normal: &Unit>, vector: &Vector3) -> Vector3
where
- N: RealField,
+ T: RealField,
{
let n = plane_normal.as_ref(); // Get the underlying Vector3
vector - n * (n.dot(vector) * na::convert(2.0))
diff --git a/examples/matrixcompare.rs b/examples/matrixcompare.rs
index 713be25f..293739de 100644
--- a/examples/matrixcompare.rs
+++ b/examples/matrixcompare.rs
@@ -2,20 +2,20 @@ extern crate nalgebra as na;
use matrixcompare::comparators::{AbsoluteElementwiseComparator, ExactElementwiseComparator};
use matrixcompare::compare_matrices;
-use na::{MatrixMN, U3, U4};
+use na::{OMatrix, U3, U4};
fn compare_integers_fail() {
println!("Comparing two integer matrices.");
#[rustfmt::skip]
- let a = MatrixMN::<_, U3, U4>::from_row_slice(&[
+ let a = OMatrix::<_, U3, U4>::from_row_slice(&[
0, 1, 2, 3,
4, 5, 6, 7,
8, 9, -2, 11
]);
#[rustfmt::skip]
- let b = MatrixMN::<_, U3, U4>::from_row_slice(&[
+ let b = OMatrix::<_, U3, U4>::from_row_slice(&[
0, 1, 2, 3,
4, 5, 6, 7,
8, 9, 10, 11
@@ -29,14 +29,14 @@ fn compare_integers_fail() {
fn compare_different_size() {
println!("Comparing matrices of different size.");
#[rustfmt::skip]
- let a = MatrixMN::<_, U3, U3>::from_row_slice(&[
+ let a = OMatrix::<_, U3, U3>::from_row_slice(&[
0, 1, 2,
4, 5, 6,
8, 9, 10,
]);
#[rustfmt::skip]
- let b = MatrixMN::<_, U3, U4>::from_row_slice(&[
+ let b = OMatrix::<_, U3, U4>::from_row_slice(&[
0, 1, 2, 3,
4, 5, 6, 7,
8, 9, 10, 11
@@ -51,14 +51,14 @@ fn compare_f64_abs_tol_fail() {
println!("Comparing two f64 matrices.");
#[rustfmt::skip]
- let a = MatrixMN::::from_row_slice(&[
+ let a = OMatrix::::from_row_slice(&[
0.0, 1.0, 2.0 + 1e-10,
4.0, 5.0, 6.0,
8.0, 9.0, 10.0,
]);
#[rustfmt::skip]
- let b = MatrixMN::<_, U3, U3>::from_row_slice(&[
+ let b = OMatrix::<_, U3, U3>::from_row_slice(&[
0.0, 1.0, 2.0,
4.0, 5.0, 6.0,
8.0, 9.0, 10.0
diff --git a/examples/reshaping.rs b/examples/reshaping.rs
index 60cb9bdd..b2178e79 100644
--- a/examples/reshaping.rs
+++ b/examples/reshaping.rs
@@ -2,7 +2,7 @@
extern crate nalgebra as na;
-use na::{DMatrix, Dynamic, Matrix2x3, Matrix3x2, U2, U3};
+use na::{DMatrix, Dynamic, Matrix2x3, Matrix3x2, Const};
fn main() {
// Matrices can be reshaped in-place without moving or copying values.
@@ -16,7 +16,7 @@ fn main() {
1.2, 2.3
);
- let m3 = m1.reshape_generic(U3, U2);
+ let m3 = m1.reshape_generic(Const::<3>, Const::<2>);
assert_eq!(m3, m2);
// Note that, for statically sized matrices, invalid reshapes will not compile:
diff --git a/examples/scalar_genericity.rs b/examples/scalar_genericity.rs
index 403f9ec2..58559ec6 100644
--- a/examples/scalar_genericity.rs
+++ b/examples/scalar_genericity.rs
@@ -3,15 +3,15 @@ extern crate nalgebra as na;
use na::{Scalar, Vector3};
use simba::scalar::RealField;
-fn print_vector(m: &Vector3) {
+fn print_vector(m: &Vector3) {
println!("{:?}", m)
}
-fn print_norm(v: &Vector3) {
+fn print_norm(v: &Vector3) {
// NOTE: alternatively, nalgebra already defines `v.norm()`.
let norm = v.dot(v).sqrt();
- // The RealField bound implies that N is Display so we can
+ // The RealField bound implies that T is Display so we can
// use "{}" instead of "{:?}" for the format string.
println!("{}", norm)
}
diff --git a/nalgebra-glm/src/aliases.rs b/nalgebra-glm/src/aliases.rs
index 206a8abe..0bf7b639 100644
--- a/nalgebra-glm/src/aliases.rs
+++ b/nalgebra-glm/src/aliases.rs
@@ -1,9 +1,9 @@
use na::{
Matrix2, Matrix2x3, Matrix2x4, Matrix3, Matrix3x2, Matrix3x4, Matrix4, Matrix4x2, Matrix4x3,
- MatrixMN, Quaternion, VectorN, U1, U2, U3, U4,
+ Quaternion, SMatrix, SVector,
};
-/// A matrix with components of type `N`. It has `R` rows, and `C` columns.
+/// A matrix with components of type `T`. It has `R` rows, and `C` columns.
///
/// In this library, vectors, represented as [`TVec`](type.TVec.html) and
/// friends, are also matrices. Operations that operate on a matrix will
@@ -24,8 +24,8 @@ use na::{
/// * [`TMat4x3`](type.TMat4x3.html)
/// * [`TMat4x4`](type.TMat4x4.html)
/// * [`TVec`](type.TVec.html)
-pub type TMat = MatrixMN;
-/// A column vector with components of type `N`. It has `D` rows (and one column).
+pub type TMat = SMatrix;
+/// A column vector with components of type `T`. It has `D` rows (and one column).
///
/// In this library, vectors are represented as a single column matrix, so
/// operations on [`TMat`](type.TMat.html) are also valid on vectors.
@@ -37,11 +37,11 @@ pub type TMat = MatrixMN;
/// * [`TVec2`](type.TVec2.html)
/// * [`TVec3`](type.TVec3.html)
/// * [`TVec4`](type.TVec4.html)
-pub type TVec = VectorN;
-/// A quaternion with components of type `N`.
-pub type Qua = Quaternion;
+pub type TVec = SVector;
+/// A quaternion with components of type `T`.
+pub type Qua = Quaternion;
-/// A 1D vector with components of type `N`.
+/// A 1D vector with components of type `T`.
///
/// # See also:
///
@@ -69,8 +69,8 @@ pub type Qua = Quaternion;
/// * [`U64Vec1`](type.U64Vec1.html)
/// * [`U8Vec1`](type.U8Vec1.html)
/// * [`Vec1`](type.Vec1.html)
-pub type TVec1 = TVec;
-/// A 2D vector with components of type `N`.
+pub type TVec1 = TVec;
+/// A 2D vector with components of type `T`.
///
/// # See also:
///
@@ -99,8 +99,8 @@ pub type TVec1 = TVec;
/// * [`U64Vec2`](type.U64Vec2.html)
/// * [`U8Vec2`](type.U8Vec2.html)
/// * [`Vec2`](type.Vec2.html)
-pub type TVec2 = TVec;
-/// A 3D vector with components of type `N`.
+pub type TVec2 = TVec;
+/// A 3D vector with components of type `T`.
///
/// # See also:
///
@@ -129,8 +129,8 @@ pub type TVec2 = TVec;
/// * [`U64Vec3`](type.U64Vec3.html)
/// * [`U8Vec3`](type.U8Vec3.html)
/// * [`Vec3`](type.Vec3.html)
-pub type TVec3 = TVec;
-/// A 4D vector with components of type `N`.
+pub type TVec3 = TVec;
+/// A 4D vector with components of type `T`.
///
/// # See also:
///
@@ -158,7 +158,7 @@ pub type TVec3 = TVec;
/// * [`U64Vec4`](type.U64Vec4.html)
/// * [`U8Vec4`](type.U8Vec4.html)
/// * [`Vec4`](type.Vec4.html)
-pub type TVec4 = TVec;
+pub type TVec4 = TVec;
/// A 1D vector with boolean components.
pub type BVec1 = TVec1;
/// A 2D vector with boolean components.
@@ -268,31 +268,31 @@ pub type I8Vec3 = TVec3;
/// A 4D vector with `i8` components.
pub type I8Vec4 = TVec4;
-/// A 2x2 matrix with components of type `N`.
-pub type TMat2 = Matrix2;
-/// A 2x2 matrix with components of type `N`.
-pub type TMat2x2 = Matrix2;
-/// A 2x3 matrix with components of type `N`.
-pub type TMat2x3 = Matrix2x3;
-/// A 2x4 matrix with components of type `N`.
-pub type TMat2x4 = Matrix2x4;
-/// A 3x3 matrix with components of type `N`.
-pub type TMat3 = Matrix3;
-/// A 3x2 matrix with components of type `N`.
-pub type TMat3x2 = Matrix3x2;
-/// A 3x3 matrix with components of type `N`.
-pub type TMat3x3 = Matrix3;
-/// A 3x4 matrix with components of type `N`.
-pub type TMat3x4 = Matrix3x4;
-/// A 4x4 matrix with components of type `N`.
-pub type TMat4 = Matrix4;
-/// A 4x2 matrix with components of type `N`.
-pub type TMat4x2 = Matrix4x2;
-/// A 4x3 matrix with components of type `N`.
-pub type TMat4x3 = Matrix4x3;
-/// A 4x4 matrix with components of type `N`.
-pub type TMat4x4 = Matrix4;
-/// A 2x2 matrix with components of type `N`.
+/// A 2x2 matrix with components of type `T`.
+pub type TMat2 = Matrix2;
+/// A 2x2 matrix with components of type `T`.
+pub type TMat2x2 = Matrix2;
+/// A 2x3 matrix with components of type `T`.
+pub type TMat2x3 = Matrix2x3;
+/// A 2x4 matrix with components of type `T`.
+pub type TMat2x4 = Matrix2x4;
+/// A 3x3 matrix with components of type `T`.
+pub type TMat3 = Matrix3;
+/// A 3x2 matrix with components of type `T`.
+pub type TMat3x2 = Matrix3x2;
+/// A 3x3 matrix with components of type `T`.
+pub type TMat3x3 = Matrix3;
+/// A 3x4 matrix with components of type `T`.
+pub type TMat3x4 = Matrix3x4;
+/// A 4x4 matrix with components of type `T`.
+pub type TMat4 = Matrix4;
+/// A 4x2 matrix with components of type `T`.
+pub type TMat4x2 = Matrix4x2;
+/// A 4x3 matrix with components of type `T`.
+pub type TMat4x3 = Matrix4x3;
+/// A 4x4 matrix with components of type `T`.
+pub type TMat4x4 = Matrix4;
+/// A 2x2 matrix with components of type `T`.
pub type DMat2 = Matrix2;
/// A 2x2 matrix with `f64` components.
pub type DMat2x2 = Matrix2;
diff --git a/nalgebra-glm/src/common.rs b/nalgebra-glm/src/common.rs
index 2df38714..1efa80a3 100644
--- a/nalgebra-glm/src/common.rs
+++ b/nalgebra-glm/src/common.rs
@@ -1,9 +1,9 @@
use core::mem;
-use na::{self, DefaultAllocator, RealField};
+use na::{self, RealField};
use num::FromPrimitive;
use crate::aliases::{TMat, TVec};
-use crate::traits::{Alloc, Dimension, Number};
+use crate::traits::Number;
/// For each matrix or vector component `x` if `x >= 0`; otherwise, it returns `-x`.
///
@@ -21,10 +21,7 @@ use crate::traits::{Alloc, Dimension, Number};
/// # See also:
///
/// * [`sign`](fn.sign.html)
-pub fn abs(x: &TMat) -> TMat
-where
- DefaultAllocator: Alloc,
-{
+pub fn abs(x: &TMat) -> TMat {
x.abs()
}
@@ -45,10 +42,7 @@ where
/// * [`fract`](fn.fract.html)
/// * [`round`](fn.round.html)
/// * [`trunc`](fn.trunc.html)
-pub fn ceil(x: &TVec) -> TVec
-where
- DefaultAllocator: Alloc,
-{
+pub fn ceil(x: &TVec) -> TVec {
x.map(|x| x.ceil())
}
@@ -73,7 +67,7 @@ where
///
/// * [`clamp`](fn.clamp.html)
/// * [`clamp_vec`](fn.clamp_vec.html)
-pub fn clamp_scalar(x: N, min_val: N, max_val: N) -> N {
+pub fn clamp_scalar(x: T, min_val: T, max_val: T) -> T {
na::clamp(x, min_val, max_val)
}
@@ -97,10 +91,7 @@ pub fn clamp_scalar(x: N, min_val: N, max_val: N) -> N {
///
/// * [`clamp_scalar`](fn.clamp_scalar.html)
/// * [`clamp_vec`](fn.clamp_vec.html)
-pub fn clamp(x: &TVec, min_val: N, max_val: N) -> TVec
-where
- DefaultAllocator: Alloc,
-{
+pub fn clamp(x: &TVec, min_val: T, max_val: T) -> TVec {
x.map(|x| na::clamp(x, min_val, max_val))
}
@@ -131,14 +122,11 @@ where
///
/// * [`clamp_scalar`](fn.clamp_scalar.html)
/// * [`clamp`](fn.clamp.html)
-pub fn clamp_vec(
- x: &TVec,
- min_val: &TVec,
- max_val: &TVec,
-) -> TVec
-where
- DefaultAllocator: Alloc,
-{
+pub fn clamp_vec(
+ x: &TVec,
+ min_val: &TVec,
+ max_val: &TVec,
+) -> TVec {
x.zip_zip_map(min_val, max_val, |a, min, max| na::clamp(a, min, max))
}
@@ -172,10 +160,7 @@ pub fn float_bits_to_int(v: f32) -> i32 {
/// * [`int_bits_to_float_vec`](fn.int_bits_to_float_vec.html)
/// * [`uint_bits_to_float`](fn.uint_bits_to_float.html)
/// * [`uint_bits_to_float_scalar`](fn.uint_bits_to_float_scalar.html)
-pub fn float_bits_to_int_vec(v: &TVec) -> TVec
-where
- DefaultAllocator: Alloc,
-{
+pub fn float_bits_to_int_vec(v: &TVec) -> TVec {
v.map(float_bits_to_int)
}
@@ -209,10 +194,7 @@ pub fn float_bits_to_uint(v: f32) -> u32 {
/// * [`int_bits_to_float_vec`](fn.int_bits_to_float_vec.html)
/// * [`uint_bits_to_float`](fn.uint_bits_to_float.html)
/// * [`uint_bits_to_float_scalar`](fn.uint_bits_to_float_scalar.html)
-pub fn float_bits_to_uint_vec(v: &TVec) -> TVec
-where
- DefaultAllocator: Alloc,
-{
+pub fn float_bits_to_uint_vec(v: &TVec) -> TVec {
v.map(float_bits_to_uint)
}
@@ -232,15 +214,12 @@ where
/// * [`fract`](fn.fract.html)
/// * [`round`](fn.round.html)
/// * [`trunc`](fn.trunc.html)
-pub fn floor(x: &TVec) -> TVec
-where
- DefaultAllocator: Alloc,
-{
+pub fn floor(x: &TVec) -> TVec {
x.map(|x| x.floor())
}
//// TODO: should be implemented for TVec/TMat?
-//pub fn fma(a: N, b: N, c: N) -> N {
+//pub fn fma(a: T, b: T, c: T) -> T {
// // TODO: use an actual FMA
// a * b + c
//}
@@ -261,16 +240,13 @@ where
/// * [`floor`](fn.floor.html)
/// * [`round`](fn.round.html)
/// * [`trunc`](fn.trunc.html)
-pub fn fract(x: &TVec) -> TVec
-where
- DefaultAllocator: Alloc,
-{
+pub fn fract(x: &TVec) -> TVec {
x.map(|x| x.fract())
}
//// TODO: should be implemented for TVec/TMat?
///// Returns the (significant, exponent) of this float number.
-//pub fn frexp(x: N, exp: N) -> (N, N) {
+//pub fn frexp(x: T, exp: T) -> (T, T) {
// // TODO: is there a better approach?
// let e = x.log2().ceil();
// (x * (-e).exp2(), e)
@@ -306,27 +282,22 @@ pub fn int_bits_to_float(v: i32) -> f32 {
/// * [`int_bits_to_float`](fn.int_bits_to_float.html)
/// * [`uint_bits_to_float`](fn.uint_bits_to_float.html)
/// * [`uint_bits_to_float_scalar`](fn.uint_bits_to_float_scalar.html)
-pub fn int_bits_to_float_vec(v: &TVec) -> TVec
-where
- DefaultAllocator: Alloc,
-{
+pub fn int_bits_to_float_vec(v: &TVec) -> TVec {
v.map(int_bits_to_float)
}
-//pub fn isinf(x: &TVec) -> TVec