-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathblas_wrapper.h
86 lines (66 loc) · 1.4 KB
/
blas_wrapper.h
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
/*
* Wrapper for CBLAS routines.
*
* copyright@ Yimin Zhong. [email protected]. All Rights Reserved.
*
*/
#ifndef LINALG_AUX_H
#define LINALG_AUX_H
#include "linalg.h"
using namespace bbfmm;
/*
* wrapper of blas.
*/
/*
* x = ax
*/
void dscal(scalar_t alpha, Vector &v);
void dscal(scalar_t alpha, Matrix &v);
/*
* y = ax + y
*/
void daxpy(scalar_t a, Vector &x, Vector &y);
/*
* unsafe case
*/
void daxpy(scalar_t a, Vector &x, scalar_t *y);
/*
* y = ax + y
*/
void daxpy(scalar_t a, Matrix &x, Matrix &y);
/*
* C = aAB + bC
*/
void dgemm(scalar_t alpha, Matrix &A, Matrix &B, scalar_t beta, Matrix &C);
/*
* C = aABt + bC
*/
void dgemm_t(scalar_t alpha, Matrix &A, Matrix &B, scalar_t beta, Matrix &C);
/*
* C = aAtB + bC
*/
void t_dgemm(scalar_t alpha, Matrix &A, Matrix &B, scalar_t beta, Matrix &C);
/*
* rank-1 update
* A = a x * y' + A
*/
void dger(scalar_t alpha, Vector &X, Vector &Y, Matrix &A);
/*
* y = a Ax + b y
*/
void dgemv(scalar_t alpha, Matrix &A, Vector &x, scalar_t beta, Vector &y);
/*
* y = a Atx + b y
*/
void dgemv_t(scalar_t alpha, Matrix &A, Vector &x, scalar_t beta, Vector &y);
/*
* hadamard product
*/
void dsbmv(scalar_t alpha, Vector &A, Vector &x, scalar_t beta, Vector &y);
/*
* unsafe case
*/
void dsbmv(scalar_t alpha, Vector &A, Vector &x, scalar_t beta, scalar_t *y);
scalar_t nrm2(Vector &x);
scalar_t ddot(Vector &x, Vector &y);
#endif