Skip to content

Commit 287f515

Browse files
committed
Add ImplOuter
1 parent d6b2bef commit 287f515

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ keywords = ["ndarray", "lapack", "matrix"]
1010
license = "MIT"
1111

1212
[dependencies]
13-
lapack = "0.11.1"
13+
lapack = "0.11"
14+
blas = "0.15"
1415
num-traits = "0.1.36"
1516

1617
[dependencies.ndarray]

src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
//! - [symmetric square root](hermite/trait.HermiteMatrix.html#tymethod.ssqrt)
3333
//! - [Cholesky factorization](hermite/trait.HermiteMatrix.html#tymethod.cholesky)
3434
35+
extern crate blas;
3536
extern crate lapack;
3637
extern crate num_traits;
3738
#[macro_use(s)]
@@ -45,6 +46,7 @@ pub mod square;
4546
pub mod hermite;
4647
pub mod triangular;
4748

49+
pub mod outer;
4850
pub mod qr;
4951
pub mod svd;
5052
pub mod eigh;

src/outer.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
2+
use blas::c::{Layout, dger, sger};
3+
4+
pub trait ImplOuter: Sized {
5+
fn outer(m: usize, n: usize, a: &[Self], b: &[Self], ab: &mut [Self]);
6+
}
7+
8+
macro_rules! impl_cholesky {
9+
($scalar:ty, $ger:path) => {
10+
impl ImplOuter for $scalar {
11+
fn outer(m: usize, n: usize, a: &[Self], b: &[Self], mut ab: &mut [Self]) {
12+
$ger(Layout::ColumnMajor, m as i32, n as i32, 1.0, a, 1, b, 1, ab, m as i32);
13+
}
14+
}
15+
}} // end macro_rules
16+
17+
impl_cholesky!(f64, dger);
18+
impl_cholesky!(f32, sger);

0 commit comments

Comments
 (0)