nalgebra/benches/linalg/hessenberg.rs

76 lines
2.3 KiB
Rust
Raw Permalink Normal View History

2018-02-02 19:26:35 +08:00
use na::{DMatrix, Hessenberg, Matrix4};
2018-02-02 19:26:35 +08:00
#[path = "../common/macros.rs"]
mod macros;
// Without unpack.
fn hessenberg_decompose_4x4(bh: &mut criterion::Criterion) {
let m = Matrix4::<f64>::new_random();
2020-04-06 00:49:48 +08:00
bh.bench_function("hessenberg_decompose_4x4", move |bh| {
bh.iter(|| test::black_box(Hessenberg::new(m.clone())))
});
}
fn hessenberg_decompose_100x100(bh: &mut criterion::Criterion) {
let m = DMatrix::<f64>::new_random(100, 100);
2020-04-06 00:49:48 +08:00
bh.bench_function("hessenberg_decompose_100x100", move |bh| {
bh.iter(|| test::black_box(Hessenberg::new(m.clone())))
});
}
fn hessenberg_decompose_200x200(bh: &mut criterion::Criterion) {
let m = DMatrix::<f64>::new_random(200, 200);
2020-04-06 00:49:48 +08:00
bh.bench_function("hessenberg_decompose_200x200", move |bh| {
bh.iter(|| test::black_box(Hessenberg::new(m.clone())))
});
}
fn hessenberg_decompose_500x500(bh: &mut criterion::Criterion) {
let m = DMatrix::<f64>::new_random(500, 500);
2020-04-06 00:49:48 +08:00
bh.bench_function("hessenberg_decompose_500x500", move |bh| {
bh.iter(|| test::black_box(Hessenberg::new(m.clone())))
});
}
// With unpack.
fn hessenberg_decompose_unpack_100x100(bh: &mut criterion::Criterion) {
let m = DMatrix::<f64>::new_random(100, 100);
2020-04-06 00:49:48 +08:00
bh.bench_function("hessenberg_decompose_unpack_100x100", move |bh| {
bh.iter(|| {
let hess = Hessenberg::new(m.clone());
let _ = hess.unpack();
})
});
}
fn hessenberg_decompose_unpack_200x200(bh: &mut criterion::Criterion) {
let m = DMatrix::<f64>::new_random(200, 200);
2020-04-06 00:49:48 +08:00
bh.bench_function("hessenberg_decompose_unpack_200x200", move |bh| {
bh.iter(|| {
let hess = Hessenberg::new(m.clone());
let _ = hess.unpack();
})
});
}
fn hessenberg_decompose_unpack_500x500(bh: &mut criterion::Criterion) {
let m = DMatrix::<f64>::new_random(500, 500);
2020-04-06 00:49:48 +08:00
bh.bench_function("hessenberg_decompose_unpack_500x500", move |bh| {
bh.iter(|| {
let hess = Hessenberg::new(m.clone());
let _ = hess.unpack();
})
});
}
2020-04-06 00:49:48 +08:00
criterion_group!(
hessenberg,
hessenberg_decompose_4x4,
hessenberg_decompose_100x100,
hessenberg_decompose_200x200,
2020-04-06 00:49:48 +08:00
// hessenberg_decompose_500x500,
hessenberg_decompose_unpack_100x100,
hessenberg_decompose_unpack_200x200,
2020-04-06 00:49:48 +08:00
// hessenberg_decompose_unpack_500x500
);