lapack_traits/blas/
gemm.rs1use crate::Scalar;
2use cblas::{Layout, Transpose, sgemm, dgemm, cgemm, zgemm};
3use num_complex::Complex32 as c32;
4use num_complex::Complex64 as c64;
5
6pub trait Tgemm : Scalar {
7 unsafe fn gemm(
8 layout: Layout,
9 transa: Transpose,
10 transb: Transpose,
11 m: i32,
12 n: i32,
13 k: i32,
14 alpha: Self,
15 a: &[Self],
16 lda: i32,
17 b: &[Self],
18 ldb: i32,
19 beta: Self,
20 c: &mut [Self],
21 ldc: i32,
22 );
23}
24
25macro_rules! impl_tgemm {
26 ($N: ty, $tgemm: path) => (
27 impl Tgemm for $N{
28 #[inline]
29 unsafe fn gemm(
30 layout: Layout,
31 transa: Transpose,
32 transb: Transpose,
33 m: i32,
34 n: i32,
35 k: i32,
36 alpha: Self,
37 a: &[Self],
38 lda: i32,
39 b: &[Self],
40 ldb: i32,
41 beta: Self,
42 c: &mut [Self],
43 ldc: i32,
44 ){
45 $tgemm(layout, transa, transb, m, n, k, alpha,
46 a, lda, b, ldb, beta, c ,ldc);
47 }
48 }
49 )
50}
51
52impl_tgemm!(f32, sgemm);
53impl_tgemm!(f64, dgemm);
54impl_tgemm!(c32, cgemm);
55impl_tgemm!(c64, zgemm);