nalgebra/benches/linalg/schur.rs

70 lines
2.1 KiB
Rust
Raw Normal View History

use na::{Matrix4, Schur};
fn schur_decompose_4x4(bh: &mut criterion::Criterion) {
let m = Matrix4::<f64>::new_random();
2020-04-06 00:49:48 +08:00
bh.bench_function("schur_decompose_4x4", move |bh| {
2021-04-12 16:52:17 +08:00
bh.iter(|| std::hint::black_box(Schur::new(m.clone())))
2020-04-06 00:49:48 +08:00
});
}
fn schur_decompose_10x10(bh: &mut criterion::Criterion) {
2019-03-23 21:29:07 +08:00
let m = crate::reproductible_dmatrix(10, 10);
2020-04-06 00:49:48 +08:00
bh.bench_function("schur_decompose_10x10", move |bh| {
2021-04-12 16:52:17 +08:00
bh.iter(|| std::hint::black_box(Schur::new(m.clone())))
2020-04-06 00:49:48 +08:00
});
}
fn schur_decompose_100x100(bh: &mut criterion::Criterion) {
2019-03-23 21:29:07 +08:00
let m = crate::reproductible_dmatrix(100, 100);
2020-04-06 00:49:48 +08:00
bh.bench_function("schur_decompose_100x100", move |bh| {
2021-04-12 16:52:17 +08:00
bh.iter(|| std::hint::black_box(Schur::new(m.clone())))
2020-04-06 00:49:48 +08:00
});
}
fn schur_decompose_200x200(bh: &mut criterion::Criterion) {
2019-03-23 21:29:07 +08:00
let m = crate::reproductible_dmatrix(200, 200);
2020-04-06 00:49:48 +08:00
bh.bench_function("schur_decompose_200x200", move |bh| {
2021-04-12 16:52:17 +08:00
bh.iter(|| std::hint::black_box(Schur::new(m.clone())))
2020-04-06 00:49:48 +08:00
});
}
fn eigenvalues_4x4(bh: &mut criterion::Criterion) {
let m = Matrix4::<f64>::new_random();
2020-04-06 00:49:48 +08:00
bh.bench_function("eigenvalues_4x4", move |bh| {
2021-04-12 16:52:17 +08:00
bh.iter(|| std::hint::black_box(m.complex_eigenvalues()))
2020-04-06 00:49:48 +08:00
});
}
fn eigenvalues_10x10(bh: &mut criterion::Criterion) {
2019-03-23 21:29:07 +08:00
let m = crate::reproductible_dmatrix(10, 10);
2020-04-06 00:49:48 +08:00
bh.bench_function("eigenvalues_10x10", move |bh| {
2021-04-12 16:52:17 +08:00
bh.iter(|| std::hint::black_box(m.complex_eigenvalues()))
2020-04-06 00:49:48 +08:00
});
}
fn eigenvalues_100x100(bh: &mut criterion::Criterion) {
2019-03-23 21:29:07 +08:00
let m = crate::reproductible_dmatrix(100, 100);
2020-04-06 00:49:48 +08:00
bh.bench_function("eigenvalues_100x100", move |bh| {
2021-04-12 16:52:17 +08:00
bh.iter(|| std::hint::black_box(m.complex_eigenvalues()))
2020-04-06 00:49:48 +08:00
});
}
fn eigenvalues_200x200(bh: &mut criterion::Criterion) {
2019-03-23 21:29:07 +08:00
let m = crate::reproductible_dmatrix(200, 200);
2020-04-06 00:49:48 +08:00
bh.bench_function("eigenvalues_200x200", move |bh| {
2021-04-12 16:52:17 +08:00
bh.iter(|| std::hint::black_box(m.complex_eigenvalues()))
2020-04-06 00:49:48 +08:00
});
}
2020-04-06 00:49:48 +08:00
criterion_group!(
schur,
schur_decompose_4x4,
schur_decompose_10x10,
schur_decompose_100x100,
schur_decompose_200x200,
eigenvalues_4x4,
eigenvalues_10x10,
eigenvalues_100x100,
eigenvalues_200x200
2020-04-06 00:49:48 +08:00
);