1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
extern crate libc;
use libc::*;
#[derive(Clone, Copy, Debug)]
#[repr(C)]
pub enum CblasOrder {
RowMajor = 101,
ColMajor = 102,
}
#[derive(Clone, Copy, Debug)]
#[repr(C)]
pub enum CblasTranspose {
NoTrans = 111,
Trans = 112,
ConjTrans = 113,
ConjNoTrans = 114,
}
#[derive(Clone, Copy, Debug)]
#[repr(C)]
pub enum CblasUpLo {
Upper = 121,
Lower = 122,
}
#[derive(Clone, Copy, Debug)]
#[repr(C)]
pub enum CblasDiag {
NonUnit = 131,
Unit = 132,
}
#[derive(Clone, Copy, Debug)]
#[repr(C)]
pub enum CblasSide {
Left = 141,
Right = 142,
}
extern "C" {
pub fn cblas_snrm2(
n: c_int,
x: *const c_float,
incx: c_int,
) -> c_float;
pub fn cblas_sdot(
n: c_int,
alpha: c_float,
x: *const c_float,
incx: c_int,
y: *const c_float,
incy: c_int,
) -> c_float;
pub fn cblas_sscal(
n: c_int,
alpha: c_float,
x: *mut c_float,
incx: c_int,
);
pub fn cblas_saxpy(
n: c_int,
alpha: c_float,
x: *const c_float,
incx: c_int,
y: *mut c_float,
incy: c_int,
);
pub fn cblas_sgemv(
order: CblasOrder,
trans: CblasTranspose,
m: c_int,
n: c_int,
alpha: c_float,
a: *const c_float,
lda: c_int,
x: *const c_float,
incx: c_int,
beta: c_float,
y: *mut c_float,
incy: c_int,
);
pub fn cblas_sgemm(
order: CblasOrder,
trans_a: CblasTranspose,
trans_b: CblasTranspose,
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,
);
}