• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef RS_COMPATIBILITY_LIB
2 #include "cblas.h"
3 #else
4 #include <dlfcn.h>
5 /*
6  * The following enums are based on cblas.h
7  */
8 enum CBLAS_ORDER {CblasRowMajor=101, CblasColMajor=102};
9 enum CBLAS_TRANSPOSE {CblasNoTrans=111, CblasTrans=112, CblasConjTrans=113};
10 enum CBLAS_UPLO {CblasUpper=121, CblasLower=122};
11 enum CBLAS_DIAG {CblasNonUnit=131, CblasUnit=132};
12 enum CBLAS_SIDE {CblasLeft=141, CblasRight=142};
13 #endif
14 
15 /*
16  * ===========================================================================
17  * Prototypes for level 2 BLAS
18  * ===========================================================================
19  */
20 
21 /*
22  * Routines with standard 4 prefixes (S, D, C, Z)
23  */
24 typedef void (*FnPtr_cblas_sgemv)(const enum CBLAS_ORDER order,
25                                   const enum CBLAS_TRANSPOSE TransA, const int M, const int N,
26                                   const float alpha, const float *A, const int lda,
27                                   const float *X, const int incX, const float beta,
28                                   float *Y, const int incY);
29 typedef void (*FnPtr_cblas_sgbmv)(const enum CBLAS_ORDER order,
30                                   const enum CBLAS_TRANSPOSE TransA, const int M, const int N,
31                                   const int KL, const int KU, const float alpha,
32                                   const float *A, const int lda, const float *X,
33                                   const int incX, const float beta, float *Y, const int incY);
34 typedef void (*FnPtr_cblas_strmv)(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
35                                   const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag,
36                                   const int N, const float *A, const int lda,
37                                   float *X, const int incX);
38 typedef void (*FnPtr_cblas_stbmv)(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
39                                   const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag,
40                                   const int N, const int K, const float *A, const int lda,
41                                   float *X, const int incX);
42 typedef void (*FnPtr_cblas_stpmv)(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
43                                   const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag,
44                                   const int N, const float *Ap, float *X, const int incX);
45 typedef void (*FnPtr_cblas_strsv)(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
46                                   const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag,
47                                   const int N, const float *A, const int lda, float *X,
48                                   const int incX);
49 typedef void (*FnPtr_cblas_stbsv)(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
50                                   const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag,
51                                   const int N, const int K, const float *A, const int lda,
52                                   float *X, const int incX);
53 typedef void (*FnPtr_cblas_stpsv)(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
54                                   const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag,
55                                   const int N, const float *Ap, float *X, const int incX);
56 
57 typedef void (*FnPtr_cblas_dgemv)(const enum CBLAS_ORDER order,
58                                   const enum CBLAS_TRANSPOSE TransA, const int M, const int N,
59                                   const double alpha, const double *A, const int lda,
60                                   const double *X, const int incX, const double beta,
61                                   double *Y, const int incY);
62 typedef void (*FnPtr_cblas_dgbmv)(const enum CBLAS_ORDER order,
63                                   const enum CBLAS_TRANSPOSE TransA, const int M, const int N,
64                                   const int KL, const int KU, const double alpha,
65                                   const double *A, const int lda, const double *X,
66                                   const int incX, const double beta, double *Y, const int incY);
67 typedef void (*FnPtr_cblas_dtrmv)(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
68                                   const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag,
69                                   const int N, const double *A, const int lda,
70                                   double *X, const int incX);
71 typedef void (*FnPtr_cblas_dtbmv)(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
72                                   const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag,
73                                   const int N, const int K, const double *A, const int lda,
74                                   double *X, const int incX);
75 typedef void (*FnPtr_cblas_dtpmv)(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
76                                   const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag,
77                                   const int N, const double *Ap, double *X, const int incX);
78 typedef void (*FnPtr_cblas_dtrsv)(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
79                                   const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag,
80                                   const int N, const double *A, const int lda, double *X,
81                                   const int incX);
82 typedef void (*FnPtr_cblas_dtbsv)(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
83                                   const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag,
84                                   const int N, const int K, const double *A, const int lda,
85                                   double *X, const int incX);
86 typedef void (*FnPtr_cblas_dtpsv)(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
87                                   const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag,
88                                   const int N, const double *Ap, double *X, const int incX);
89 
90 typedef void (*FnPtr_cblas_cgemv)(const enum CBLAS_ORDER order,
91                                   const enum CBLAS_TRANSPOSE TransA, const int M, const int N,
92                                   const void *alpha, const void *A, const int lda,
93                                   const void *X, const int incX, const void *beta,
94                                   void *Y, const int incY);
95 typedef void (*FnPtr_cblas_cgbmv)(const enum CBLAS_ORDER order,
96                                   const enum CBLAS_TRANSPOSE TransA, const int M, const int N,
97                                   const int KL, const int KU, const void *alpha,
98                                   const void *A, const int lda, const void *X,
99                                   const int incX, const void *beta, void *Y, const int incY);
100 typedef void (*FnPtr_cblas_ctrmv)(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
101                                   const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag,
102                                   const int N, const void *A, const int lda,
103                                   void *X, const int incX);
104 typedef void (*FnPtr_cblas_ctbmv)(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
105                                   const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag,
106                                   const int N, const int K, const void *A, const int lda,
107                                   void *X, const int incX);
108 typedef void (*FnPtr_cblas_ctpmv)(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
109                                   const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag,
110                                   const int N, const void *Ap, void *X, const int incX);
111 typedef void (*FnPtr_cblas_ctrsv)(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
112                                   const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag,
113                                   const int N, const void *A, const int lda, void *X,
114                                   const int incX);
115 typedef void (*FnPtr_cblas_ctbsv)(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
116                                   const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag,
117                                   const int N, const int K, const void *A, const int lda,
118                                   void *X, const int incX);
119 typedef void (*FnPtr_cblas_ctpsv)(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
120                                   const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag,
121                                   const int N, const void *Ap, void *X, const int incX);
122 
123 typedef void (*FnPtr_cblas_zgemv)(const enum CBLAS_ORDER order,
124                                   const enum CBLAS_TRANSPOSE TransA, const int M, const int N,
125                                   const void *alpha, const void *A, const int lda,
126                                   const void *X, const int incX, const void *beta,
127                                   void *Y, const int incY);
128 typedef void (*FnPtr_cblas_zgbmv)(const enum CBLAS_ORDER order,
129                                   const enum CBLAS_TRANSPOSE TransA, const int M, const int N,
130                                   const int KL, const int KU, const void *alpha,
131                                   const void *A, const int lda, const void *X,
132                                   const int incX, const void *beta, void *Y, const int incY);
133 typedef void (*FnPtr_cblas_ztrmv)(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
134                                   const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag,
135                                   const int N, const void *A, const int lda,
136                                   void *X, const int incX);
137 typedef void (*FnPtr_cblas_ztbmv)(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
138                                   const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag,
139                                   const int N, const int K, const void *A, const int lda,
140                                   void *X, const int incX);
141 typedef void (*FnPtr_cblas_ztpmv)(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
142                                   const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag,
143                                   const int N, const void *Ap, void *X, const int incX);
144 typedef void (*FnPtr_cblas_ztrsv)(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
145                                   const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag,
146                                   const int N, const void *A, const int lda, void *X,
147                                   const int incX);
148 typedef void (*FnPtr_cblas_ztbsv)(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
149                                   const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag,
150                                   const int N, const int K, const void *A, const int lda,
151                                   void *X, const int incX);
152 typedef void (*FnPtr_cblas_ztpsv)(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
153                                   const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag,
154                                   const int N, const void *Ap, void *X, const int incX);
155 
156 
157 /*
158  * Routines with S and D prefixes only
159  */
160 typedef void (*FnPtr_cblas_ssymv)(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
161                                   const int N, const float alpha, const float *A,
162                                   const int lda, const float *X, const int incX,
163                                   const float beta, float *Y, const int incY);
164 typedef void (*FnPtr_cblas_ssbmv)(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
165                                   const int N, const int K, const float alpha, const float *A,
166                                   const int lda, const float *X, const int incX,
167                                   const float beta, float *Y, const int incY);
168 typedef void (*FnPtr_cblas_sspmv)(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
169                                   const int N, const float alpha, const float *Ap,
170                                   const float *X, const int incX,
171                                   const float beta, float *Y, const int incY);
172 typedef void (*FnPtr_cblas_sger)(const enum CBLAS_ORDER order, const int M, const int N,
173                                  const float alpha, const float *X, const int incX,
174                                  const float *Y, const int incY, float *A, const int lda);
175 typedef void (*FnPtr_cblas_ssyr)(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
176                                  const int N, const float alpha, const float *X,
177                                  const int incX, float *A, const int lda);
178 typedef void (*FnPtr_cblas_sspr)(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
179                                  const int N, const float alpha, const float *X,
180                                  const int incX, float *Ap);
181 typedef void (*FnPtr_cblas_ssyr2)(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
182                                   const int N, const float alpha, const float *X,
183                                   const int incX, const float *Y, const int incY, float *A,
184                                   const int lda);
185 typedef void (*FnPtr_cblas_sspr2)(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
186                                   const int N, const float alpha, const float *X,
187                                   const int incX, const float *Y, const int incY, float *A);
188 
189 typedef void (*FnPtr_cblas_dsymv)(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
190                                   const int N, const double alpha, const double *A,
191                                   const int lda, const double *X, const int incX,
192                                   const double beta, double *Y, const int incY);
193 typedef void (*FnPtr_cblas_dsbmv)(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
194                                   const int N, const int K, const double alpha, const double *A,
195                                   const int lda, const double *X, const int incX,
196                                   const double beta, double *Y, const int incY);
197 typedef void (*FnPtr_cblas_dspmv)(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
198                                   const int N, const double alpha, const double *Ap,
199                                   const double *X, const int incX,
200                                   const double beta, double *Y, const int incY);
201 typedef void (*FnPtr_cblas_dger)(const enum CBLAS_ORDER order, const int M, const int N,
202                                  const double alpha, const double *X, const int incX,
203                                  const double *Y, const int incY, double *A, const int lda);
204 typedef void (*FnPtr_cblas_dsyr)(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
205                                  const int N, const double alpha, const double *X,
206                                  const int incX, double *A, const int lda);
207 typedef void (*FnPtr_cblas_dspr)(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
208                                  const int N, const double alpha, const double *X,
209                                  const int incX, double *Ap);
210 typedef void (*FnPtr_cblas_dsyr2)(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
211                                   const int N, const double alpha, const double *X,
212                                   const int incX, const double *Y, const int incY, double *A,
213                                   const int lda);
214 typedef void (*FnPtr_cblas_dspr2)(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
215                                   const int N, const double alpha, const double *X,
216                                   const int incX, const double *Y, const int incY, double *A);
217 
218 
219 /*
220  * Routines with C and Z prefixes only
221  */
222 typedef void (*FnPtr_cblas_chemv)(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
223                                   const int N, const void *alpha, const void *A,
224                                   const int lda, const void *X, const int incX,
225                                   const void *beta, void *Y, const int incY);
226 typedef void (*FnPtr_cblas_chbmv)(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
227                                   const int N, const int K, const void *alpha, const void *A,
228                                   const int lda, const void *X, const int incX,
229                                   const void *beta, void *Y, const int incY);
230 typedef void (*FnPtr_cblas_chpmv)(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
231                                   const int N, const void *alpha, const void *Ap,
232                                   const void *X, const int incX,
233                                   const void *beta, void *Y, const int incY);
234 typedef void (*FnPtr_cblas_cgeru)(const enum CBLAS_ORDER order, const int M, const int N,
235                                   const void *alpha, const void *X, const int incX,
236                                   const void *Y, const int incY, void *A, const int lda);
237 typedef void (*FnPtr_cblas_cgerc)(const enum CBLAS_ORDER order, const int M, const int N,
238                                   const void *alpha, const void *X, const int incX,
239                                   const void *Y, const int incY, void *A, const int lda);
240 typedef void (*FnPtr_cblas_cher)(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
241                                  const int N, const float alpha, const void *X, const int incX,
242                                  void *A, const int lda);
243 typedef void (*FnPtr_cblas_chpr)(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
244                                  const int N, const float alpha, const void *X,
245                                  const int incX, void *A);
246 typedef void (*FnPtr_cblas_cher2)(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, const int N,
247                                   const void *alpha, const void *X, const int incX,
248                                   const void *Y, const int incY, void *A, const int lda);
249 typedef void (*FnPtr_cblas_chpr2)(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, const int N,
250                                   const void *alpha, const void *X, const int incX,
251                                   const void *Y, const int incY, void *Ap);
252 
253 typedef void (*FnPtr_cblas_zhemv)(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
254                                   const int N, const void *alpha, const void *A,
255                                   const int lda, const void *X, const int incX,
256                                   const void *beta, void *Y, const int incY);
257 typedef void (*FnPtr_cblas_zhbmv)(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
258                                   const int N, const int K, const void *alpha, const void *A,
259                                   const int lda, const void *X, const int incX,
260                                   const void *beta, void *Y, const int incY);
261 typedef void (*FnPtr_cblas_zhpmv)(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
262                                   const int N, const void *alpha, const void *Ap,
263                                   const void *X, const int incX,
264                                   const void *beta, void *Y, const int incY);
265 typedef void (*FnPtr_cblas_zgeru)(const enum CBLAS_ORDER order, const int M, const int N,
266                                   const void *alpha, const void *X, const int incX,
267                                   const void *Y, const int incY, void *A, const int lda);
268 typedef void (*FnPtr_cblas_zgerc)(const enum CBLAS_ORDER order, const int M, const int N,
269                                   const void *alpha, const void *X, const int incX,
270                                   const void *Y, const int incY, void *A, const int lda);
271 typedef void (*FnPtr_cblas_zher)(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
272                                  const int N, const double alpha, const void *X, const int incX,
273                                  void *A, const int lda);
274 typedef void (*FnPtr_cblas_zhpr)(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
275                                  const int N, const double alpha, const void *X,
276                                  const int incX, void *A);
277 typedef void (*FnPtr_cblas_zher2)(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, const int N,
278                                   const void *alpha, const void *X, const int incX,
279                                   const void *Y, const int incY, void *A, const int lda);
280 typedef void (*FnPtr_cblas_zhpr2)(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, const int N,
281                                   const void *alpha, const void *X, const int incX,
282                                   const void *Y, const int incY, void *Ap);
283 
284 /*
285  * ===========================================================================
286  * Prototypes for level 3 BLAS
287  * ===========================================================================
288  */
289 
290 /*
291  * Routines with standard 4 prefixes (S, D, C, Z)
292  */
293 typedef void (*FnPtr_cblas_sgemm)(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA,
294                                   const enum CBLAS_TRANSPOSE TransB, const int M, const int N,
295                                   const int K, const float alpha, const float *A,
296                                   const int lda, const float *B, const int ldb,
297                                   const float beta, float *C, const int ldc);
298 typedef void (*FnPtr_cblas_ssymm)(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side,
299                                   const enum CBLAS_UPLO Uplo, const int M, const int N,
300                                   const float alpha, const float *A, const int lda,
301                                   const float *B, const int ldb, const float beta,
302                                   float *C, const int ldc);
303 typedef void (*FnPtr_cblas_ssyrk)(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo,
304                                   const enum CBLAS_TRANSPOSE Trans, const int N, const int K,
305                                   const float alpha, const float *A, const int lda,
306                                   const float beta, float *C, const int ldc);
307 typedef void (*FnPtr_cblas_ssyr2k)(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo,
308                                    const enum CBLAS_TRANSPOSE Trans, const int N, const int K,
309                                    const float alpha, const float *A, const int lda,
310                                    const float *B, const int ldb, const float beta,
311                                    float *C, const int ldc);
312 typedef void (*FnPtr_cblas_strmm)(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side,
313                                   const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE TransA,
314                                   const enum CBLAS_DIAG Diag, const int M, const int N,
315                                   const float alpha, const float *A, const int lda,
316                                   float *B, const int ldb);
317 typedef void (*FnPtr_cblas_strsm)(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side,
318                                   const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE TransA,
319                                   const enum CBLAS_DIAG Diag, const int M, const int N,
320                                   const float alpha, const float *A, const int lda,
321                                   float *B, const int ldb);
322 
323 typedef void (*FnPtr_cblas_dgemm)(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA,
324                                   const enum CBLAS_TRANSPOSE TransB, const int M, const int N,
325                                   const int K, const double alpha, const double *A,
326                                   const int lda, const double *B, const int ldb,
327                                   const double beta, double *C, const int ldc);
328 typedef void (*FnPtr_cblas_dsymm)(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side,
329                                   const enum CBLAS_UPLO Uplo, const int M, const int N,
330                                   const double alpha, const double *A, const int lda,
331                                   const double *B, const int ldb, const double beta,
332                                   double *C, const int ldc);
333 typedef void (*FnPtr_cblas_dsyrk)(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo,
334                                   const enum CBLAS_TRANSPOSE Trans, const int N, const int K,
335                                   const double alpha, const double *A, const int lda,
336                                   const double beta, double *C, const int ldc);
337 typedef void (*FnPtr_cblas_dsyr2k)(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo,
338                                    const enum CBLAS_TRANSPOSE Trans, const int N, const int K,
339                                    const double alpha, const double *A, const int lda,
340                                    const double *B, const int ldb, const double beta,
341                                    double *C, const int ldc);
342 typedef void (*FnPtr_cblas_dtrmm)(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side,
343                                   const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE TransA,
344                                   const enum CBLAS_DIAG Diag, const int M, const int N,
345                                   const double alpha, const double *A, const int lda,
346                                   double *B, const int ldb);
347 typedef void (*FnPtr_cblas_dtrsm)(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side,
348                                   const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE TransA,
349                                   const enum CBLAS_DIAG Diag, const int M, const int N,
350                                   const double alpha, const double *A, const int lda,
351                                   double *B, const int ldb);
352 
353 typedef void (*FnPtr_cblas_cgemm)(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA,
354                                   const enum CBLAS_TRANSPOSE TransB, const int M, const int N,
355                                   const int K, const void *alpha, const void *A,
356                                   const int lda, const void *B, const int ldb,
357                                   const void *beta, void *C, const int ldc);
358 typedef void (*FnPtr_cblas_csymm)(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side,
359                                   const enum CBLAS_UPLO Uplo, const int M, const int N,
360                                   const void *alpha, const void *A, const int lda,
361                                   const void *B, const int ldb, const void *beta,
362                                   void *C, const int ldc);
363 typedef void (*FnPtr_cblas_csyrk)(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo,
364                                   const enum CBLAS_TRANSPOSE Trans, const int N, const int K,
365                                   const void *alpha, const void *A, const int lda,
366                                   const void *beta, void *C, const int ldc);
367 typedef void (*FnPtr_cblas_csyr2k)(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo,
368                                    const enum CBLAS_TRANSPOSE Trans, const int N, const int K,
369                                    const void *alpha, const void *A, const int lda,
370                                    const void *B, const int ldb, const void *beta,
371                                    void *C, const int ldc);
372 typedef void (*FnPtr_cblas_ctrmm)(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side,
373                                   const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE TransA,
374                                   const enum CBLAS_DIAG Diag, const int M, const int N,
375                                   const void *alpha, const void *A, const int lda,
376                                   void *B, const int ldb);
377 typedef void (*FnPtr_cblas_ctrsm)(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side,
378                                   const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE TransA,
379                                   const enum CBLAS_DIAG Diag, const int M, const int N,
380                                   const void *alpha, const void *A, const int lda,
381                                   void *B, const int ldb);
382 
383 typedef void (*FnPtr_cblas_zgemm)(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA,
384                                   const enum CBLAS_TRANSPOSE TransB, const int M, const int N,
385                                   const int K, const void *alpha, const void *A,
386                                   const int lda, const void *B, const int ldb,
387                                   const void *beta, void *C, const int ldc);
388 typedef void (*FnPtr_cblas_zsymm)(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side,
389                                   const enum CBLAS_UPLO Uplo, const int M, const int N,
390                                   const void *alpha, const void *A, const int lda,
391                                   const void *B, const int ldb, const void *beta,
392                                   void *C, const int ldc);
393 typedef void (*FnPtr_cblas_zsyrk)(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo,
394                                   const enum CBLAS_TRANSPOSE Trans, const int N, const int K,
395                                   const void *alpha, const void *A, const int lda,
396                                   const void *beta, void *C, const int ldc);
397 typedef void (*FnPtr_cblas_zsyr2k)(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo,
398                                    const enum CBLAS_TRANSPOSE Trans, const int N, const int K,
399                                    const void *alpha, const void *A, const int lda,
400                                    const void *B, const int ldb, const void *beta,
401                                    void *C, const int ldc);
402 typedef void (*FnPtr_cblas_ztrmm)(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side,
403                                   const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE TransA,
404                                   const enum CBLAS_DIAG Diag, const int M, const int N,
405                                   const void *alpha, const void *A, const int lda,
406                                   void *B, const int ldb);
407 typedef void (*FnPtr_cblas_ztrsm)(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side,
408                                   const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE TransA,
409                                   const enum CBLAS_DIAG Diag, const int M, const int N,
410                                   const void *alpha, const void *A, const int lda,
411                                   void *B, const int ldb);
412 
413 
414 /*
415  * Routines with prefixes C and Z only
416  */
417 typedef void (*FnPtr_cblas_chemm)(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side,
418                                   const enum CBLAS_UPLO Uplo, const int M, const int N,
419                                   const void *alpha, const void *A, const int lda,
420                                   const void *B, const int ldb, const void *beta,
421                                   void *C, const int ldc);
422 typedef void (*FnPtr_cblas_cherk)(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo,
423                                   const enum CBLAS_TRANSPOSE Trans, const int N, const int K,
424                                   const float alpha, const void *A, const int lda,
425                                   const float beta, void *C, const int ldc);
426 typedef void (*FnPtr_cblas_cher2k)(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo,
427                                    const enum CBLAS_TRANSPOSE Trans, const int N, const int K,
428                                    const void *alpha, const void *A, const int lda,
429                                    const void *B, const int ldb, const float beta,
430                                    void *C, const int ldc);
431 
432 typedef void (*FnPtr_cblas_zhemm)(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side,
433                                   const enum CBLAS_UPLO Uplo, const int M, const int N,
434                                   const void *alpha, const void *A, const int lda,
435                                   const void *B, const int ldb, const void *beta,
436                                   void *C, const int ldc);
437 typedef void (*FnPtr_cblas_zherk)(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo,
438                                   const enum CBLAS_TRANSPOSE Trans, const int N, const int K,
439                                   const double alpha, const void *A, const int lda,
440                                   const double beta, void *C, const int ldc);
441 typedef void (*FnPtr_cblas_zher2k)(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo,
442                                    const enum CBLAS_TRANSPOSE Trans, const int N, const int K,
443                                    const void *alpha, const void *A, const int lda,
444                                    const void *B, const int ldb, const double beta,
445                                    void *C, const int ldc);
446 
447 
448 #ifdef RS_COMPATIBILITY_LIB
449 // Macros to help declare our function pointers for the dispatch table.
450 #define RS_APPLY_MACRO_TO(x) \
451     FnPtr_##x x;
452 #include "rsCpuBLAS.inc"
453 
loadBLASLib()454 bool loadBLASLib() {
455     void* handle = NULL;
456     handle = dlopen("libblasV8.so", RTLD_LAZY | RTLD_LOCAL);
457 
458     if (handle == NULL) {
459         return false;
460     }
461 
462 // Macros to help load the function pointers.
463 #define RS_APPLY_MACRO_TO(x) \
464     x = (FnPtr_##x)dlsym(handle, #x); \
465     if ((x) == nullptr) { \
466         ALOGE("Failed to load " #x " for RS BLAS implementation."); \
467         return false; \
468     }
469 #include "rsCpuBLAS.inc"
470     return true;
471 }
472 #endif
473