2017-08-03 01:37:44 +08:00
|
|
|
use na::{DMatrix, DVector};
|
|
|
|
|
2019-03-24 02:07:16 +08:00
|
|
|
fn solve_l_triangular_100x100(bh: &mut criterion::Criterion) {
|
2017-08-03 01:37:44 +08:00
|
|
|
let m = DMatrix::<f64>::new_random(100, 100);
|
|
|
|
let v = DVector::<f64>::new_random(100);
|
|
|
|
|
2020-04-06 00:49:48 +08:00
|
|
|
bh.bench_function("solve_l_triangular_100x100", move |bh| {
|
|
|
|
bh.iter(|| {
|
|
|
|
let _ = m.solve_lower_triangular(&v);
|
|
|
|
})
|
|
|
|
});
|
2017-08-03 01:37:44 +08:00
|
|
|
}
|
|
|
|
|
2019-03-24 02:07:16 +08:00
|
|
|
fn solve_l_triangular_1000x1000(bh: &mut criterion::Criterion) {
|
2017-08-03 01:37:44 +08:00
|
|
|
let m = DMatrix::<f64>::new_random(1000, 1000);
|
|
|
|
let v = DVector::<f64>::new_random(1000);
|
|
|
|
|
2020-04-06 00:49:48 +08:00
|
|
|
bh.bench_function("solve_l_triangular_1000x1000", move |bh| {
|
|
|
|
bh.iter(|| {
|
|
|
|
let _ = m.solve_lower_triangular(&v);
|
|
|
|
})
|
|
|
|
});
|
2017-08-03 01:37:44 +08:00
|
|
|
}
|
|
|
|
|
2019-03-24 02:07:16 +08:00
|
|
|
fn tr_solve_l_triangular_100x100(bh: &mut criterion::Criterion) {
|
2017-08-03 01:37:44 +08:00
|
|
|
let m = DMatrix::<f64>::new_random(100, 100);
|
|
|
|
let v = DVector::<f64>::new_random(100);
|
|
|
|
|
2020-04-06 00:49:48 +08:00
|
|
|
bh.bench_function("tr_solve_l_triangular_100x100", move |bh| {
|
|
|
|
bh.iter(|| {
|
|
|
|
let _ = m.tr_solve_lower_triangular(&v);
|
|
|
|
})
|
|
|
|
});
|
2017-08-03 01:37:44 +08:00
|
|
|
}
|
|
|
|
|
2019-03-24 02:07:16 +08:00
|
|
|
fn tr_solve_l_triangular_1000x1000(bh: &mut criterion::Criterion) {
|
2017-08-03 01:37:44 +08:00
|
|
|
let m = DMatrix::<f64>::new_random(1000, 1000);
|
|
|
|
let v = DVector::<f64>::new_random(1000);
|
|
|
|
|
2020-04-06 00:49:48 +08:00
|
|
|
bh.bench_function("tr_solve_l_triangular_1000x1000", move |bh| {
|
|
|
|
bh.iter(|| {
|
|
|
|
let _ = m.tr_solve_lower_triangular(&v);
|
|
|
|
})
|
|
|
|
});
|
2017-08-03 01:37:44 +08:00
|
|
|
}
|
|
|
|
|
2019-03-24 02:07:16 +08:00
|
|
|
fn solve_u_triangular_100x100(bh: &mut criterion::Criterion) {
|
2017-08-03 01:37:44 +08:00
|
|
|
let m = DMatrix::<f64>::new_random(100, 100);
|
|
|
|
let v = DVector::<f64>::new_random(100);
|
|
|
|
|
2020-04-06 00:49:48 +08:00
|
|
|
bh.bench_function("solve_u_triangular_100x100", move |bh| {
|
|
|
|
bh.iter(|| {
|
|
|
|
let _ = m.solve_upper_triangular(&v);
|
|
|
|
})
|
|
|
|
});
|
2017-08-03 01:37:44 +08:00
|
|
|
}
|
|
|
|
|
2019-03-24 02:07:16 +08:00
|
|
|
fn solve_u_triangular_1000x1000(bh: &mut criterion::Criterion) {
|
2017-08-03 01:37:44 +08:00
|
|
|
let m = DMatrix::<f64>::new_random(1000, 1000);
|
|
|
|
let v = DVector::<f64>::new_random(1000);
|
|
|
|
|
2020-04-06 00:49:48 +08:00
|
|
|
bh.bench_function("solve_u_triangular_1000x1000", move |bh| {
|
|
|
|
bh.iter(|| {
|
|
|
|
let _ = m.solve_upper_triangular(&v);
|
|
|
|
})
|
|
|
|
});
|
2017-08-03 01:37:44 +08:00
|
|
|
}
|
|
|
|
|
2019-03-24 02:07:16 +08:00
|
|
|
fn tr_solve_u_triangular_100x100(bh: &mut criterion::Criterion) {
|
2017-08-03 01:37:44 +08:00
|
|
|
let m = DMatrix::<f64>::new_random(100, 100);
|
|
|
|
let v = DVector::<f64>::new_random(100);
|
|
|
|
|
2020-04-06 00:49:48 +08:00
|
|
|
bh.bench_function("tr_solve_u_triangular_100x100", move |bh| {
|
|
|
|
bh.iter(|| {
|
|
|
|
let _ = m.tr_solve_upper_triangular(&v);
|
|
|
|
})
|
|
|
|
});
|
2017-08-03 01:37:44 +08:00
|
|
|
}
|
|
|
|
|
2019-03-24 02:07:16 +08:00
|
|
|
fn tr_solve_u_triangular_1000x1000(bh: &mut criterion::Criterion) {
|
2017-08-03 01:37:44 +08:00
|
|
|
let m = DMatrix::<f64>::new_random(1000, 1000);
|
|
|
|
let v = DVector::<f64>::new_random(1000);
|
|
|
|
|
2020-04-06 00:49:48 +08:00
|
|
|
bh.bench_function("tr_solve_u_triangular_1000x1000", move |bh| {
|
|
|
|
bh.iter(|| {
|
|
|
|
let _ = m.tr_solve_upper_triangular(&v);
|
|
|
|
})
|
|
|
|
});
|
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!(
|
|
|
|
solve,
|
2019-03-24 02:07:16 +08:00
|
|
|
solve_l_triangular_100x100,
|
|
|
|
solve_l_triangular_1000x1000,
|
|
|
|
tr_solve_l_triangular_100x100,
|
|
|
|
tr_solve_l_triangular_1000x1000,
|
|
|
|
solve_u_triangular_100x100,
|
|
|
|
solve_u_triangular_1000x1000,
|
|
|
|
tr_solve_u_triangular_100x100,
|
|
|
|
tr_solve_u_triangular_1000x1000
|
2020-04-06 00:49:48 +08:00
|
|
|
);
|