2017-08-03 01:38:28 +08:00
|
|
|
use na::{DMatrix, Matrix4};
|
|
|
|
use nl::LU;
|
2018-10-22 13:00:10 +08:00
|
|
|
use test::{self, Bencher};
|
2017-08-03 01:38:28 +08:00
|
|
|
|
|
|
|
#[bench]
|
|
|
|
fn lu_decompose_100x100(bh: &mut Bencher) {
|
|
|
|
let m = DMatrix::<f64>::new_random(100, 100);
|
2021-04-12 16:52:17 +08:00
|
|
|
bh.iter(|| std::hint::black_box(LU::new(m.clone())))
|
2017-08-03 01:38:28 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#[bench]
|
|
|
|
fn lu_decompose_100x500(bh: &mut Bencher) {
|
|
|
|
let m = DMatrix::<f64>::new_random(100, 500);
|
2021-04-12 16:52:17 +08:00
|
|
|
bh.iter(|| std::hint::black_box(LU::new(m.clone())))
|
2017-08-03 01:38:28 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#[bench]
|
|
|
|
fn lu_decompose_4x4(bh: &mut Bencher) {
|
|
|
|
let m = Matrix4::<f64>::new_random();
|
2021-04-12 16:52:17 +08:00
|
|
|
bh.iter(|| std::hint::black_box(LU::new(m.clone())))
|
2017-08-03 01:38:28 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#[bench]
|
|
|
|
fn lu_decompose_500x100(bh: &mut Bencher) {
|
|
|
|
let m = DMatrix::<f64>::new_random(500, 100);
|
2021-04-12 16:52:17 +08:00
|
|
|
bh.iter(|| std::hint::black_box(LU::new(m.clone())))
|
2017-08-03 01:38:28 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#[bench]
|
|
|
|
fn lu_decompose_500x500(bh: &mut Bencher) {
|
|
|
|
let m = DMatrix::<f64>::new_random(500, 500);
|
2021-04-12 16:52:17 +08:00
|
|
|
bh.iter(|| std::hint::black_box(LU::new(m.clone())))
|
2017-08-03 01:38:28 +08:00
|
|
|
}
|