Skip to content

Commit

Permalink
Add benchmarks for Cholesky::solve
Browse files Browse the repository at this point in the history
  • Loading branch information
Andlon committed Feb 17, 2017
1 parent 69479fd commit 25046d6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions benches/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#![feature(test)]

#[macro_use]
extern crate rulinalg;
extern crate num as libnum;
extern crate test;
Expand Down
20 changes: 20 additions & 0 deletions benches/linalg/cholesky.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,23 @@ fn cholesky_500x500(b: &mut Bencher) {
x.cholesky().expect("Matrix is invertible")
})
}

#[bench]
fn cholesky_solve_1000x1000(b: &mut Bencher) {
let n = 1000;
let x = Matrix::identity(n);
let cholesky = Cholesky::decompose(x).unwrap();
b.iter(|| {
cholesky.solve(vector![0.0; n])
});
}

#[bench]
fn cholesky_solve_100x100(b: &mut Bencher) {
let n = 100;
let x = Matrix::identity(n);
let cholesky = Cholesky::decompose(x).unwrap();
b.iter(|| {
cholesky.solve(vector![0.0; n])
});
}

0 comments on commit 25046d6

Please sign in to comment.