Fix compilation of benchmarks
This commit is contained in:
parent
73cc9882b2
commit
b8811d3545
@ -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)
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
@ -116,8 +116,8 @@ fn mat10_mul_mat10(bench: &mut criterion::Criterion) {
|
||||
}
|
||||
|
||||
fn mat10_mul_mat10_static(bench: &mut criterion::Criterion) {
|
||||
let a = OMatrix::<f64, U10>::new_random();
|
||||
let b = OMatrix::<f64, U10>::new_random();
|
||||
let a = OMatrix::<f64, U10, U10>::new_random();
|
||||
let b = OMatrix::<f64, U10, U10>::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));
|
||||
})
|
||||
});
|
||||
}
|
||||
|
@ -1,8 +1,7 @@
|
||||
use na::{DVector, OVector, Vector2, Vector3, Vector4};
|
||||
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<f32>, normalize);
|
||||
bench_unop!(vec3_normalize, Vector3<f32>, normalize);
|
||||
bench_unop!(vec4_normalize, Vector4<f32>, normalize);
|
||||
|
||||
bench_binop_ref!(vec10000_dot_f64, OVector<f64, U10000>, OVector<f64, U10000>, dot);
|
||||
bench_binop_ref!(vec10000_dot_f32, OVector<f32, U10000>, OVector<f32, U10000>, dot);
|
||||
bench_binop_ref!(vec10000_dot_f64, SVector<f64, 10000>, SVector<f64, 10000>, dot);
|
||||
bench_binop_ref!(vec10000_dot_f32, SVector<f32, 10000>, SVector<f32, 10000>, 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::<U10000>(0);
|
||||
let b = b.fixed_rows::<U10000>(0);
|
||||
let mut a = a.fixed_rows_mut::<10000>(0);
|
||||
let b = b.fixed_rows::<10000>(0);
|
||||
|
||||
a.axpy(n, &b, 1.0)
|
||||
})
|
||||
@ -93,8 +92,8 @@ 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 = OVector::<f64, U10000>::new_random();
|
||||
let b = OVector::<f64, U10000>::new_random();
|
||||
let mut a = SVector::<f64, 10000>::new_random();
|
||||
let b = SVector::<f64, 10000>::new_random();
|
||||
let n = rng.gen::<f64>();
|
||||
|
||||
// NOTE: for some reasons, it is much faster if the arument are boxed (Box::new(OVector...)).
|
||||
|
@ -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;
|
||||
|
@ -7,35 +7,35 @@ mod macros;
|
||||
fn bidiagonalize_100x100(bh: &mut criterion::Criterion) {
|
||||
let m = DMatrix::<f64>::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::<f64>::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::<f64>::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::<f64>::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::<f64>::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())))
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -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())))
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -4,21 +4,21 @@ use na::{DMatrix, DVector, FullPivLU};
|
||||
fn full_piv_lu_decompose_10x10(bh: &mut criterion::Criterion) {
|
||||
let m = DMatrix::<f64>::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::<f64>::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::<f64>::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()))
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -7,28 +7,28 @@ mod macros;
|
||||
fn hessenberg_decompose_4x4(bh: &mut criterion::Criterion) {
|
||||
let m = Matrix4::<f64>::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::<f64>::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::<f64>::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::<f64>::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())))
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -4,21 +4,21 @@ use na::{DMatrix, DVector, LU};
|
||||
fn lu_decompose_10x10(bh: &mut criterion::Criterion) {
|
||||
let m = DMatrix::<f64>::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::<f64>::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::<f64>::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::<f64>::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!(
|
||||
|
@ -7,35 +7,35 @@ mod macros;
|
||||
fn qr_decompose_100x100(bh: &mut criterion::Criterion) {
|
||||
let m = DMatrix::<f64>::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::<f64>::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::<f64>::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::<f64>::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::<f64>::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()))
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -3,56 +3,56 @@ use na::{Matrix4, Schur};
|
||||
fn schur_decompose_4x4(bh: &mut criterion::Criterion) {
|
||||
let m = Matrix4::<f64>::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::<f64>::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()))
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -3,112 +3,112 @@ use na::{Matrix4, SVD};
|
||||
fn svd_decompose_4x4(bh: &mut criterion::Criterion) {
|
||||
let m = Matrix4::<f64>::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::<f64>::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::<f64>::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::<f64>::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)))
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -3,28 +3,28 @@ use na::{Matrix4, SymmetricEigen};
|
||||
fn symmetric_eigen_decompose_4x4(bh: &mut criterion::Criterion) {
|
||||
let m = Matrix4::<f64>::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())))
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -5,17 +5,17 @@ use test::{self, Bencher};
|
||||
#[bench]
|
||||
fn hessenberg_decompose_100x100(bh: &mut Bencher) {
|
||||
let m = DMatrix::<f64>::new_random(100, 100);
|
||||
bh.iter(|| test::black_box(Hessenberg::new(m.clone())))
|
||||
bh.iter(|| std::hint::black_box(Hessenberg::new(m.clone())))
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn hessenberg_decompose_4x4(bh: &mut Bencher) {
|
||||
let m = Matrix4::<f64>::new_random();
|
||||
bh.iter(|| test::black_box(Hessenberg::new(m.clone())))
|
||||
bh.iter(|| std::hint::black_box(Hessenberg::new(m.clone())))
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn hessenberg_decompose_500x500(bh: &mut Bencher) {
|
||||
let m = DMatrix::<f64>::new_random(500, 500);
|
||||
bh.iter(|| test::black_box(Hessenberg::new(m.clone())))
|
||||
bh.iter(|| std::hint::black_box(Hessenberg::new(m.clone())))
|
||||
}
|
||||
|
@ -5,29 +5,29 @@ use test::{self, Bencher};
|
||||
#[bench]
|
||||
fn lu_decompose_100x100(bh: &mut Bencher) {
|
||||
let m = DMatrix::<f64>::new_random(100, 100);
|
||||
bh.iter(|| test::black_box(LU::new(m.clone())))
|
||||
bh.iter(|| std::hint::black_box(LU::new(m.clone())))
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn lu_decompose_100x500(bh: &mut Bencher) {
|
||||
let m = DMatrix::<f64>::new_random(100, 500);
|
||||
bh.iter(|| test::black_box(LU::new(m.clone())))
|
||||
bh.iter(|| std::hint::black_box(LU::new(m.clone())))
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn lu_decompose_4x4(bh: &mut Bencher) {
|
||||
let m = Matrix4::<f64>::new_random();
|
||||
bh.iter(|| test::black_box(LU::new(m.clone())))
|
||||
bh.iter(|| std::hint::black_box(LU::new(m.clone())))
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn lu_decompose_500x100(bh: &mut Bencher) {
|
||||
let m = DMatrix::<f64>::new_random(500, 100);
|
||||
bh.iter(|| test::black_box(LU::new(m.clone())))
|
||||
bh.iter(|| std::hint::black_box(LU::new(m.clone())))
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn lu_decompose_500x500(bh: &mut Bencher) {
|
||||
let m = DMatrix::<f64>::new_random(500, 500);
|
||||
bh.iter(|| test::black_box(LU::new(m.clone())))
|
||||
bh.iter(|| std::hint::black_box(LU::new(m.clone())))
|
||||
}
|
||||
|
@ -5,29 +5,29 @@ use test::{self, Bencher};
|
||||
#[bench]
|
||||
fn qr_decompose_100x100(bh: &mut Bencher) {
|
||||
let m = DMatrix::<f64>::new_random(100, 100);
|
||||
bh.iter(|| test::black_box(QR::new(m.clone())))
|
||||
bh.iter(|| std::hint::black_box(QR::new(m.clone())))
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn qr_decompose_100x500(bh: &mut Bencher) {
|
||||
let m = DMatrix::<f64>::new_random(100, 500);
|
||||
bh.iter(|| test::black_box(QR::new(m.clone())))
|
||||
bh.iter(|| std::hint::black_box(QR::new(m.clone())))
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn qr_decompose_4x4(bh: &mut Bencher) {
|
||||
let m = Matrix4::<f64>::new_random();
|
||||
bh.iter(|| test::black_box(QR::new(m.clone())))
|
||||
bh.iter(|| std::hint::black_box(QR::new(m.clone())))
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn qr_decompose_500x100(bh: &mut Bencher) {
|
||||
let m = DMatrix::<f64>::new_random(500, 100);
|
||||
bh.iter(|| test::black_box(QR::new(m.clone())))
|
||||
bh.iter(|| std::hint::black_box(QR::new(m.clone())))
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn qr_decompose_500x500(bh: &mut Bencher) {
|
||||
let m = DMatrix::<f64>::new_random(500, 500);
|
||||
bh.iter(|| test::black_box(QR::new(m.clone())))
|
||||
bh.iter(|| std::hint::black_box(QR::new(m.clone())))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user