2018-02-02 19:26:35 +08:00
|
|
|
use na::{DMatrix, Hessenberg, Matrix4};
|
2017-08-03 01:37:44 +08:00
|
|
|
|
2018-02-02 19:26:35 +08:00
|
|
|
#[path = "../common/macros.rs"]
|
2017-08-03 01:37:44 +08:00
|
|
|
mod macros;
|
|
|
|
|
|
|
|
// Without unpack.
|
2019-03-24 02:07:16 +08:00
|
|
|
fn hessenberg_decompose_4x4(bh: &mut criterion::Criterion) {
|
2017-08-03 01:37:44 +08:00
|
|
|
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())))
|
|
|
|
});
|
2017-08-03 01:37:44 +08:00
|
|
|
}
|
|
|
|
|
2019-03-24 02:07:16 +08:00
|
|
|
fn hessenberg_decompose_100x100(bh: &mut criterion::Criterion) {
|
2017-08-03 01:37:44 +08:00
|
|
|
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())))
|
|
|
|
});
|
2017-08-03 01:37:44 +08:00
|
|
|
}
|
|
|
|
|
2019-03-24 02:07:16 +08:00
|
|
|
fn hessenberg_decompose_200x200(bh: &mut criterion::Criterion) {
|
2017-08-03 01:37:44 +08:00
|
|
|
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())))
|
|
|
|
});
|
2017-08-03 01:37:44 +08:00
|
|
|
}
|
|
|
|
|
2019-03-24 02:07:16 +08:00
|
|
|
fn hessenberg_decompose_500x500(bh: &mut criterion::Criterion) {
|
2017-08-03 01:37:44 +08:00
|
|
|
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())))
|
|
|
|
});
|
2017-08-03 01:37:44 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// With unpack.
|
2019-03-24 02:07:16 +08:00
|
|
|
fn hessenberg_decompose_unpack_100x100(bh: &mut criterion::Criterion) {
|
2017-08-03 01:37:44 +08:00
|
|
|
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();
|
|
|
|
})
|
|
|
|
});
|
2017-08-03 01:37:44 +08:00
|
|
|
}
|
|
|
|
|
2019-03-24 02:07:16 +08:00
|
|
|
fn hessenberg_decompose_unpack_200x200(bh: &mut criterion::Criterion) {
|
2017-08-03 01:37:44 +08:00
|
|
|
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();
|
|
|
|
})
|
|
|
|
});
|
2017-08-03 01:37:44 +08:00
|
|
|
}
|
|
|
|
|
2019-03-24 02:07:16 +08:00
|
|
|
fn hessenberg_decompose_unpack_500x500(bh: &mut criterion::Criterion) {
|
2017-08-03 01:37:44 +08:00
|
|
|
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();
|
|
|
|
})
|
|
|
|
});
|
2017-08-03 01:37:44 +08:00
|
|
|
}
|
2019-03-24 02:07:16 +08:00
|
|
|
|
2020-04-06 00:49:48 +08:00
|
|
|
criterion_group!(
|
|
|
|
hessenberg,
|
2019-03-24 02:07:16 +08:00
|
|
|
hessenberg_decompose_4x4,
|
|
|
|
hessenberg_decompose_100x100,
|
|
|
|
hessenberg_decompose_200x200,
|
2020-04-06 00:49:48 +08:00
|
|
|
// hessenberg_decompose_500x500,
|
2019-03-24 02:07:16 +08:00
|
|
|
hessenberg_decompose_unpack_100x100,
|
|
|
|
hessenberg_decompose_unpack_200x200,
|
2020-04-06 00:49:48 +08:00
|
|
|
// hessenberg_decompose_unpack_500x500
|
|
|
|
);
|