Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove concat_ident! for module expressions, enable building on stable #12

Merged
merged 1 commit into from
Dec 2, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright 2014 Michael Yang. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
#![feature(concat_idents)]

//! BLAS bindings and wrappers.
//!
Expand Down
169 changes: 118 additions & 51 deletions src/matrix/ll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,55 +4,122 @@

//! Bindings for matrix functions.

use libc::{c_double, c_float, c_int, c_void};

use attribute::{
Order,
Transpose,
Symmetry,
Diagonal,
Side,
};

extern {
// Multiply
pub fn cblas_sgemm(order: Order, trans_a: Transpose, trans_b: Transpose, m: c_int, n: c_int, k: c_int, alpha: c_float, a: *const c_float, lda: c_int, b: *const c_float, ldb: c_int, beta: c_float, c: *mut c_float, ldc: c_int);
pub fn cblas_dgemm(order: Order, trans_a: Transpose, trans_b: Transpose, m: c_int, n: c_int, k: c_int, alpha: c_double, a: *const c_double, lda: c_int, b: *const c_double, ldb: c_int, beta: c_double, c: *mut c_double, ldc: c_int);
pub fn cblas_cgemm(order: Order, trans_a: Transpose, trans_b: Transpose, m: c_int, n: c_int, k: c_int, alpha: *const c_void, a: *const c_void, lda: c_int, b: *const c_void, ldb: c_int, beta: *const c_void, c: *mut c_void, ldc: c_int);
pub fn cblas_zgemm(order: Order, trans_a: Transpose, trans_b: Transpose, m: c_int, n: c_int, k: c_int, alpha: *const c_void, a: *const c_void, lda: c_int, b: *const c_void, ldb: c_int, beta: *const c_void, c: *mut c_void, ldc: c_int);

pub fn cblas_ssymm(order: Order, side: Side, sym: Symmetry, m: c_int, n: c_int, alpha: c_float, a: *const c_float, lda: c_int, b: *const c_float, ldb: c_int, beta: c_float, c: *mut c_float, ldc: c_int);
pub fn cblas_dsymm(order: Order, side: Side, sym: Symmetry, m: c_int, n: c_int, alpha: c_double, a: *const c_double, lda: c_int, b: *const c_double, ldb: c_int, beta: c_double, c: *mut c_double, ldc: c_int);
pub fn cblas_csymm(order: Order, side: Side, sym: Symmetry, m: c_int, n: c_int, alpha: *const c_void, a: *const c_void, lda: c_int, b: *const c_void, ldb: c_int, beta: *const c_void, c: *mut c_void, ldc: c_int);
pub fn cblas_zsymm(order: Order, side: Side, sym: Symmetry, m: c_int, n: c_int, alpha: *const c_void, a: *const c_void, lda: c_int, b: *const c_void, ldb: c_int, beta: *const c_void, c: *mut c_void, ldc: c_int);

pub fn cblas_chemm(order: Order, side: Side, sym: Symmetry, m: c_int, n: c_int, alpha: *const c_void, a: *const c_void, lda: c_int, b: *const c_void, ldb: c_int, beta: *const c_void, c: *mut c_void, ldc: c_int);
pub fn cblas_zhemm(order: Order, side: Side, sym: Symmetry, m: c_int, n: c_int, alpha: *const c_void, a: *const c_void, lda: c_int, b: *const c_void, ldb: c_int, beta: *const c_void, c: *mut c_void, ldc: c_int);

pub fn cblas_strmm(order: Order, side: Side, sym: Symmetry, trans: Transpose, diag: Diagonal, m: c_int, n: c_int, alpha: c_float, a: *const c_float, lda: c_int, b: *mut c_float, ldb: c_int);
pub fn cblas_dtrmm(order: Order, side: Side, sym: Symmetry, trans: Transpose, diag: Diagonal, m: c_int, n: c_int, alpha: c_double, a: *const c_double, lda: c_int, b: *mut c_double, ldb: c_int);
pub fn cblas_ctrmm(order: Order, side: Side, sym: Symmetry, trans: Transpose, diag: Diagonal, m: c_int, n: c_int, alpha: *const c_void, a: *const c_void, lda: c_int, b: *mut c_void, ldb: c_int);
pub fn cblas_ztrmm(order: Order, side: Side, sym: Symmetry, trans: Transpose, diag: Diagonal, m: c_int, n: c_int, alpha: *const c_void, a: *const c_void, lda: c_int, b: *mut c_void, ldb: c_int);

pub fn cblas_strsm(order: Order, side: Side, sym: Symmetry, trans: Transpose, diag: Diagonal, m: c_int, n: c_int, alpha: c_float, a: *const c_float, lda: c_int, b: *mut c_float, ldb: c_int);
pub fn cblas_dtrsm(order: Order, side: Side, sym: Symmetry, trans: Transpose, diag: Diagonal, m: c_int, n: c_int, alpha: c_double, a: *const c_double, lda: c_int, b: *mut c_double, ldb: c_int);
pub fn cblas_ctrsm(order: Order, side: Side, sym: Symmetry, trans: Transpose, diag: Diagonal, m: c_int, n: c_int, alpha: *const c_void, a: *const c_void, lda: c_int, b: *mut c_void, ldb: c_int);
pub fn cblas_ztrsm(order: Order, side: Side, sym: Symmetry, trans: Transpose, diag: Diagonal, m: c_int, n: c_int, alpha: *const c_void, a: *const c_void, lda: c_int, b: *mut c_void, ldb: c_int);

// Rank Update
pub fn cblas_cherk(order: Order, sym: Symmetry, Trans: Transpose, n: c_int, k: c_int, alpha: c_float, a: *const c_void, lda: c_int, beta: c_float, c: *mut c_void, ldc: c_int);
pub fn cblas_zherk(order: Order, sym: Symmetry, Trans: Transpose, n: c_int, k: c_int, alpha: c_double, a: *const c_void, lda: c_int, beta: c_double, c: *mut c_void, ldc: c_int);

pub fn cblas_cher2k(order: Order, sym: Symmetry, Trans: Transpose, n: c_int, k: c_int, alpha: *const c_void, a: *const c_void, lda: c_int, b: *const c_void, ldb: c_int, beta: c_float, c: *mut c_void, ldc: c_int);
pub fn cblas_zher2k(order: Order, sym: Symmetry, Trans: Transpose, n: c_int, k: c_int, alpha: *const c_void, a: *const c_void, lda: c_int, b: *const c_void, ldb: c_int, beta: c_double, c: *mut c_void, ldc: c_int);

pub fn cblas_ssyrk(order: Order, sym: Symmetry, Trans: Transpose, n: c_int, k: c_int, alpha: c_float, a: *const c_float, lda: c_int, beta: c_float, c: *mut c_float, ldc: c_int);
pub fn cblas_dsyrk(order: Order, sym: Symmetry, Trans: Transpose, n: c_int, k: c_int, alpha: c_double, a: *const c_double, lda: c_int, beta: c_double, c: *mut c_double, ldc: c_int);
pub fn cblas_csyrk(order: Order, sym: Symmetry, Trans: Transpose, n: c_int, k: c_int, alpha: *const c_void, a: *const c_void, lda: c_int, beta: *const c_void, c: *mut c_void, ldc: c_int);
pub fn cblas_zsyrk(order: Order, sym: Symmetry, Trans: Transpose, n: c_int, k: c_int, alpha: *const c_void, a: *const c_void, lda: c_int, beta: *const c_void, c: *mut c_void, ldc: c_int);

pub fn cblas_ssyr2k(order: Order, sym: Symmetry, Trans: Transpose, n: c_int, k: c_int, alpha: c_float, a: *const c_float, lda: c_int, b: *const c_float, ldb: c_int, beta: c_float, c: *mut c_float, ldc: c_int);
pub fn cblas_dsyr2k(order: Order, sym: Symmetry, Trans: Transpose, n: c_int, k: c_int, alpha: c_double, a: *const c_double, lda: c_int, b: *const c_double, ldb: c_int, beta: c_double, c: *mut c_double, ldc: c_int);
pub fn cblas_csyr2k(order: Order, sym: Symmetry, Trans: Transpose, n: c_int, k: c_int, alpha: *const c_void, a: *const c_void, lda: c_int, b: *const c_void, ldb: c_int, beta: *const c_void, c: *mut c_void, ldc: c_int);
pub fn cblas_zsyr2k(order: Order, sym: Symmetry, Trans: Transpose, n: c_int, k: c_int, alpha: *const c_void, a: *const c_void, lda: c_int, b: *const c_void, ldb: c_int, beta: *const c_void, c: *mut c_void, ldc: c_int);
pub mod cblas_s {
use libc::{c_float, c_int};
use attribute::{
Order,
Transpose,
Symmetry,
Diagonal,
Side,
};

pub use self::cblas_sgemm as gemm;
pub use self::cblas_ssymm as symm;
pub use self::cblas_strmm as trmm;
pub use self::cblas_strsm as strsm;
pub use self::cblas_ssyrk as syrk;
pub use self::cblas_ssyr2k as syr2k;

extern {
pub fn cblas_sgemm(order: Order, trans_a: Transpose, trans_b: Transpose, m: c_int, n: c_int, k: c_int, alpha: c_float, a: *const c_float, lda: c_int, b: *const c_float, ldb: c_int, beta: c_float, c: *mut c_float, ldc: c_int);
pub fn cblas_ssymm(order: Order, side: Side, sym: Symmetry, m: c_int, n: c_int, alpha: c_float, a: *const c_float, lda: c_int, b: *const c_float, ldb: c_int, beta: c_float, c: *mut c_float, ldc: c_int);
pub fn cblas_strmm(order: Order, side: Side, sym: Symmetry, trans: Transpose, diag: Diagonal, m: c_int, n: c_int, alpha: c_float, a: *const c_float, lda: c_int, b: *mut c_float, ldb: c_int);
pub fn cblas_strsm(order: Order, side: Side, sym: Symmetry, trans: Transpose, diag: Diagonal, m: c_int, n: c_int, alpha: c_float, a: *const c_float, lda: c_int, b: *mut c_float, ldb: c_int);
pub fn cblas_ssyrk(order: Order, sym: Symmetry, Trans: Transpose, n: c_int, k: c_int, alpha: c_float, a: *const c_float, lda: c_int, beta: c_float, c: *mut c_float, ldc: c_int);
pub fn cblas_ssyr2k(order: Order, sym: Symmetry, Trans: Transpose, n: c_int, k: c_int, alpha: c_float, a: *const c_float, lda: c_int, b: *const c_float, ldb: c_int, beta: c_float, c: *mut c_float, ldc: c_int);
}
}

pub mod cblas_d {
use libc::{c_double, c_int};
use attribute::{
Order,
Transpose,
Symmetry,
Diagonal,
Side,
};

pub use self::cblas_dgemm as gemm;
pub use self::cblas_dsymm as symm;
pub use self::cblas_dtrmm as trmm;
pub use self::cblas_dtrsm as strsm;
pub use self::cblas_dsyrk as syrk;
pub use self::cblas_dsyr2k as syr2k;

extern {
pub fn cblas_dgemm(order: Order, trans_a: Transpose, trans_b: Transpose, m: c_int, n: c_int, k: c_int, alpha: c_double, a: *const c_double, lda: c_int, b: *const c_double, ldb: c_int, beta: c_double, c: *mut c_double, ldc: c_int);
pub fn cblas_dsymm(order: Order, side: Side, sym: Symmetry, m: c_int, n: c_int, alpha: c_double, a: *const c_double, lda: c_int, b: *const c_double, ldb: c_int, beta: c_double, c: *mut c_double, ldc: c_int);
pub fn cblas_dtrmm(order: Order, side: Side, sym: Symmetry, trans: Transpose, diag: Diagonal, m: c_int, n: c_int, alpha: c_double, a: *const c_double, lda: c_int, b: *mut c_double, ldb: c_int);
pub fn cblas_dtrsm(order: Order, side: Side, sym: Symmetry, trans: Transpose, diag: Diagonal, m: c_int, n: c_int, alpha: c_double, a: *const c_double, lda: c_int, b: *mut c_double, ldb: c_int);
pub fn cblas_dsyrk(order: Order, sym: Symmetry, Trans: Transpose, n: c_int, k: c_int, alpha: c_double, a: *const c_double, lda: c_int, beta: c_double, c: *mut c_double, ldc: c_int);
pub fn cblas_dsyr2k(order: Order, sym: Symmetry, Trans: Transpose, n: c_int, k: c_int, alpha: c_double, a: *const c_double, lda: c_int, b: *const c_double, ldb: c_int, beta: c_double, c: *mut c_double, ldc: c_int);
}
}

pub mod cblas_c {
use libc::{c_float, c_int, c_void};
use attribute::{
Order,
Transpose,
Symmetry,
Diagonal,
Side,
};

pub use self::cblas_cgemm as gemm;
pub use self::cblas_csymm as symm;
pub use self::cblas_chemm as hemm;
pub use self::cblas_ctrmm as trmm;
pub use self::cblas_ctrsm as trsm;
pub use self::cblas_cherk as herk;
pub use self::cblas_cher2k as her2k;
pub use self::cblas_csyrk as syrk;
pub use self::cblas_csyr2k as syr2k;

extern {
pub fn cblas_cgemm(order: Order, trans_a: Transpose, trans_b: Transpose, m: c_int, n: c_int, k: c_int, alpha: *const c_void, a: *const c_void, lda: c_int, b: *const c_void, ldb: c_int, beta: *const c_void, c: *mut c_void, ldc: c_int);
pub fn cblas_csymm(order: Order, side: Side, sym: Symmetry, m: c_int, n: c_int, alpha: *const c_void, a: *const c_void, lda: c_int, b: *const c_void, ldb: c_int, beta: *const c_void, c: *mut c_void, ldc: c_int);
pub fn cblas_chemm(order: Order, side: Side, sym: Symmetry, m: c_int, n: c_int, alpha: *const c_void, a: *const c_void, lda: c_int, b: *const c_void, ldb: c_int, beta: *const c_void, c: *mut c_void, ldc: c_int);
pub fn cblas_ctrmm(order: Order, side: Side, sym: Symmetry, trans: Transpose, diag: Diagonal, m: c_int, n: c_int, alpha: *const c_void, a: *const c_void, lda: c_int, b: *mut c_void, ldb: c_int);
pub fn cblas_ctrsm(order: Order, side: Side, sym: Symmetry, trans: Transpose, diag: Diagonal, m: c_int, n: c_int, alpha: *const c_void, a: *const c_void, lda: c_int, b: *mut c_void, ldb: c_int);
pub fn cblas_cherk(order: Order, sym: Symmetry, Trans: Transpose, n: c_int, k: c_int, alpha: c_float, a: *const c_void, lda: c_int, beta: c_float, c: *mut c_void, ldc: c_int);
pub fn cblas_cher2k(order: Order, sym: Symmetry, Trans: Transpose, n: c_int, k: c_int, alpha: *const c_void, a: *const c_void, lda: c_int, b: *const c_void, ldb: c_int, beta: c_float, c: *mut c_void, ldc: c_int);
pub fn cblas_csyrk(order: Order, sym: Symmetry, Trans: Transpose, n: c_int, k: c_int, alpha: *const c_void, a: *const c_void, lda: c_int, beta: *const c_void, c: *mut c_void, ldc: c_int);
pub fn cblas_csyr2k(order: Order, sym: Symmetry, Trans: Transpose, n: c_int, k: c_int, alpha: *const c_void, a: *const c_void, lda: c_int, b: *const c_void, ldb: c_int, beta: *const c_void, c: *mut c_void, ldc: c_int);
}
}

pub mod cblas_z {
use libc::{c_double, c_int, c_void};
use attribute::{
Order,
Transpose,
Symmetry,
Diagonal,
Side,
};

pub use self::cblas_zgemm as gemm;
pub use self::cblas_zsymm as symm;
pub use self::cblas_zhemm as hemm;
pub use self::cblas_ztrmm as trmm;
pub use self::cblas_ztrsm as trsm;
pub use self::cblas_zherk as herk;
pub use self::cblas_zher2k as her2k;
pub use self::cblas_zsyrk as syrk;
pub use self::cblas_zsyr2k as syr2k;

extern {
pub fn cblas_zgemm(order: Order, trans_a: Transpose, trans_b: Transpose, m: c_int, n: c_int, k: c_int, alpha: *const c_void, a: *const c_void, lda: c_int, b: *const c_void, ldb: c_int, beta: *const c_void, c: *mut c_void, ldc: c_int);
pub fn cblas_zsymm(order: Order, side: Side, sym: Symmetry, m: c_int, n: c_int, alpha: *const c_void, a: *const c_void, lda: c_int, b: *const c_void, ldb: c_int, beta: *const c_void, c: *mut c_void, ldc: c_int);
pub fn cblas_zhemm(order: Order, side: Side, sym: Symmetry, m: c_int, n: c_int, alpha: *const c_void, a: *const c_void, lda: c_int, b: *const c_void, ldb: c_int, beta: *const c_void, c: *mut c_void, ldc: c_int);
pub fn cblas_ztrmm(order: Order, side: Side, sym: Symmetry, trans: Transpose, diag: Diagonal, m: c_int, n: c_int, alpha: *const c_void, a: *const c_void, lda: c_int, b: *mut c_void, ldb: c_int);
pub fn cblas_ztrsm(order: Order, side: Side, sym: Symmetry, trans: Transpose, diag: Diagonal, m: c_int, n: c_int, alpha: *const c_void, a: *const c_void, lda: c_int, b: *mut c_void, ldb: c_int);
pub fn cblas_zherk(order: Order, sym: Symmetry, Trans: Transpose, n: c_int, k: c_int, alpha: c_double, a: *const c_void, lda: c_int, beta: c_double, c: *mut c_void, ldc: c_int);
pub fn cblas_zher2k(order: Order, sym: Symmetry, Trans: Transpose, n: c_int, k: c_int, alpha: *const c_void, a: *const c_void, lda: c_int, b: *const c_void, ldb: c_int, beta: c_double, c: *mut c_void, ldc: c_int);
pub fn cblas_zsyrk(order: Order, sym: Symmetry, Trans: Transpose, n: c_int, k: c_int, alpha: *const c_void, a: *const c_void, lda: c_int, beta: *const c_void, c: *mut c_void, ldc: c_int);
pub fn cblas_zsyr2k(order: Order, sym: Symmetry, Trans: Transpose, n: c_int, k: c_int, alpha: *const c_void, a: *const c_void, lda: c_int, b: *const c_void, ldb: c_int, beta: *const c_void, c: *mut c_void, ldc: c_int);
}
}
Loading