cblas-wrappers.h
Go to the documentation of this file.
1 // matrix/cblas-wrappers.h
2 
3 // Copyright 2012 Johns Hopkins University (author: Daniel Povey);
4 // Haihua Xu; Wei Shi
5 
6 // See ../../COPYING for clarification regarding multiple authors
7 //
8 // Licensed under the Apache License, Version 2.0 (the "License");
9 // you may not use this file except in compliance with the License.
10 // You may obtain a copy of the License at
11 
12 // http://www.apache.org/licenses/LICENSE-2.0
13 
14 // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 // KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
16 // WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
17 // MERCHANTABLITY OR NON-INFRINGEMENT.
18 // See the Apache 2 License for the specific language governing permissions and
19 // limitations under the License.
20 #ifndef KALDI_MATRIX_CBLAS_WRAPPERS_H_
21 #define KALDI_MATRIX_CBLAS_WRAPPERS_H_ 1
22 
23 
24 #include <limits>
25 #include "matrix/sp-matrix.h"
26 #include "matrix/kaldi-vector.h"
27 #include "matrix/kaldi-matrix.h"
29 #include "matrix/kaldi-blas.h"
30 
31 // Do not include this file directly. It is to be included
32 // by .cc files in this directory.
33 
34 namespace kaldi {
35 
36 
37 inline void cblas_Xcopy(const int N, const float *X, const int incX, float *Y,
38  const int incY) {
39  cblas_scopy(N, X, incX, Y, incY);
40 }
41 
42 inline void cblas_Xcopy(const int N, const double *X, const int incX, double *Y,
43  const int incY) {
44  cblas_dcopy(N, X, incX, Y, incY);
45 }
46 
47 
48 inline float cblas_Xasum(const int N, const float *X, const int incX) {
49  return cblas_sasum(N, X, incX);
50 }
51 
52 inline double cblas_Xasum(const int N, const double *X, const int incX) {
53  return cblas_dasum(N, X, incX);
54 }
55 
56 inline void cblas_Xrot(const int N, float *X, const int incX, float *Y,
57  const int incY, const float c, const float s) {
58  cblas_srot(N, X, incX, Y, incY, c, s);
59 }
60 inline void cblas_Xrot(const int N, double *X, const int incX, double *Y,
61  const int incY, const double c, const double s) {
62  cblas_drot(N, X, incX, Y, incY, c, s);
63 }
64 inline float cblas_Xdot(const int N, const float *const X,
65  const int incX, const float *const Y,
66  const int incY) {
67  return cblas_sdot(N, X, incX, Y, incY);
68 }
69 inline double cblas_Xdot(const int N, const double *const X,
70  const int incX, const double *const Y,
71  const int incY) {
72  return cblas_ddot(N, X, incX, Y, incY);
73 }
74 inline void cblas_Xaxpy(const int N, const float alpha, const float *X,
75  const int incX, float *Y, const int incY) {
76  cblas_saxpy(N, alpha, X, incX, Y, incY);
77 }
78 inline void cblas_Xaxpy(const int N, const double alpha, const double *X,
79  const int incX, double *Y, const int incY) {
80  cblas_daxpy(N, alpha, X, incX, Y, incY);
81 }
82 inline void cblas_Xscal(const int N, const float alpha, float *data,
83  const int inc) {
84  cblas_sscal(N, alpha, data, inc);
85 }
86 inline void cblas_Xscal(const int N, const double alpha, double *data,
87  const int inc) {
88  cblas_dscal(N, alpha, data, inc);
89 }
90 inline void cblas_Xspmv(const float alpha, const int num_rows, const float *Mdata,
91  const float *v, const int v_inc,
92  const float beta, float *y, const int y_inc) {
93  cblas_sspmv(CblasRowMajor, CblasLower, num_rows, alpha, Mdata, v, v_inc, beta, y, y_inc);
94 }
95 inline void cblas_Xspmv(const double alpha, const int num_rows, const double *Mdata,
96  const double *v, const int v_inc,
97  const double beta, double *y, const int y_inc) {
98  cblas_dspmv(CblasRowMajor, CblasLower, num_rows, alpha, Mdata, v, v_inc, beta, y, y_inc);
99 }
100 inline void cblas_Xtpmv(MatrixTransposeType trans, const float *Mdata,
101  const int num_rows, float *y, const int y_inc) {
102  cblas_stpmv(CblasRowMajor, CblasLower, static_cast<CBLAS_TRANSPOSE>(trans),
103  CblasNonUnit, num_rows, Mdata, y, y_inc);
104 }
105 inline void cblas_Xtpmv(MatrixTransposeType trans, const double *Mdata,
106  const int num_rows, double *y, const int y_inc) {
107  cblas_dtpmv(CblasRowMajor, CblasLower, static_cast<CBLAS_TRANSPOSE>(trans),
108  CblasNonUnit, num_rows, Mdata, y, y_inc);
109 }
110 
111 
112 inline void cblas_Xtpsv(MatrixTransposeType trans, const float *Mdata,
113  const int num_rows, float *y, const int y_inc) {
114  cblas_stpsv(CblasRowMajor, CblasLower, static_cast<CBLAS_TRANSPOSE>(trans),
115  CblasNonUnit, num_rows, Mdata, y, y_inc);
116 }
117 inline void cblas_Xtpsv(MatrixTransposeType trans, const double *Mdata,
118  const int num_rows, double *y, const int y_inc) {
119  cblas_dtpsv(CblasRowMajor, CblasLower, static_cast<CBLAS_TRANSPOSE>(trans),
120  CblasNonUnit, num_rows, Mdata, y, y_inc);
121 }
122 
123 // x = alpha * M * y + beta * x
124 inline void cblas_Xspmv(MatrixIndexT dim, float alpha, const float *Mdata,
125  const float *ydata, MatrixIndexT ystride,
126  float beta, float *xdata, MatrixIndexT xstride) {
127  cblas_sspmv(CblasRowMajor, CblasLower, dim, alpha, Mdata,
128  ydata, ystride, beta, xdata, xstride);
129 }
130 inline void cblas_Xspmv(MatrixIndexT dim, double alpha, const double *Mdata,
131  const double *ydata, MatrixIndexT ystride,
132  double beta, double *xdata, MatrixIndexT xstride) {
133  cblas_dspmv(CblasRowMajor, CblasLower, dim, alpha, Mdata,
134  ydata, ystride, beta, xdata, xstride);
135 }
136 
137 // Implements A += alpha * (x y' + y x'); A is symmetric matrix.
138 inline void cblas_Xspr2(MatrixIndexT dim, float alpha, const float *Xdata,
139  MatrixIndexT incX, const float *Ydata, MatrixIndexT incY,
140  float *Adata) {
141  cblas_sspr2(CblasRowMajor, CblasLower, dim, alpha, Xdata,
142  incX, Ydata, incY, Adata);
143 }
144 inline void cblas_Xspr2(MatrixIndexT dim, double alpha, const double *Xdata,
145  MatrixIndexT incX, const double *Ydata, MatrixIndexT incY,
146  double *Adata) {
147  cblas_dspr2(CblasRowMajor, CblasLower, dim, alpha, Xdata,
148  incX, Ydata, incY, Adata);
149 }
150 
151 // Implements A += alpha * (x x'); A is symmetric matrix.
152 inline void cblas_Xspr(MatrixIndexT dim, float alpha, const float *Xdata,
153  MatrixIndexT incX, float *Adata) {
154  cblas_sspr(CblasRowMajor, CblasLower, dim, alpha, Xdata, incX, Adata);
155 }
156 inline void cblas_Xspr(MatrixIndexT dim, double alpha, const double *Xdata,
157  MatrixIndexT incX, double *Adata) {
158  cblas_dspr(CblasRowMajor, CblasLower, dim, alpha, Xdata, incX, Adata);
159 }
160 
161 // sgemv,dgemv: y = alpha M x + beta y.
162 inline void cblas_Xgemv(MatrixTransposeType trans, MatrixIndexT num_rows,
163  MatrixIndexT num_cols, float alpha, const float *Mdata,
164  MatrixIndexT stride, const float *xdata,
165  MatrixIndexT incX, float beta, float *ydata, MatrixIndexT incY) {
166  cblas_sgemv(CblasRowMajor, static_cast<CBLAS_TRANSPOSE>(trans), num_rows,
167  num_cols, alpha, Mdata, stride, xdata, incX, beta, ydata, incY);
168 }
169 inline void cblas_Xgemv(MatrixTransposeType trans, MatrixIndexT num_rows,
170  MatrixIndexT num_cols, double alpha, const double *Mdata,
171  MatrixIndexT stride, const double *xdata,
172  MatrixIndexT incX, double beta, double *ydata, MatrixIndexT incY) {
173  cblas_dgemv(CblasRowMajor, static_cast<CBLAS_TRANSPOSE>(trans), num_rows,
174  num_cols, alpha, Mdata, stride, xdata, incX, beta, ydata, incY);
175 }
176 
177 // sgbmv, dgmmv: y = alpha M x + + beta * y.
178 inline void cblas_Xgbmv(MatrixTransposeType trans, MatrixIndexT num_rows,
179  MatrixIndexT num_cols, MatrixIndexT num_below,
180  MatrixIndexT num_above, float alpha, const float *Mdata,
181  MatrixIndexT stride, const float *xdata,
182  MatrixIndexT incX, float beta, float *ydata, MatrixIndexT incY) {
183  cblas_sgbmv(CblasRowMajor, static_cast<CBLAS_TRANSPOSE>(trans), num_rows,
184  num_cols, num_below, num_above, alpha, Mdata, stride, xdata,
185  incX, beta, ydata, incY);
186 }
187 inline void cblas_Xgbmv(MatrixTransposeType trans, MatrixIndexT num_rows,
188  MatrixIndexT num_cols, MatrixIndexT num_below,
189  MatrixIndexT num_above, double alpha, const double *Mdata,
190  MatrixIndexT stride, const double *xdata,
191  MatrixIndexT incX, double beta, double *ydata, MatrixIndexT incY) {
192  cblas_dgbmv(CblasRowMajor, static_cast<CBLAS_TRANSPOSE>(trans), num_rows,
193  num_cols, num_below, num_above, alpha, Mdata, stride, xdata,
194  incX, beta, ydata, incY);
195 }
196 
197 
198 template<typename Real>
200  MatrixIndexT num_cols, Real alpha, const Real *Mdata,
201  MatrixIndexT stride, const Real *xdata,
202  MatrixIndexT incX, Real beta, Real *ydata,
203  MatrixIndexT incY) {
204  if (trans == kNoTrans) {
205  if (beta != 1.0) cblas_Xscal(num_rows, beta, ydata, incY);
206  for (MatrixIndexT i = 0; i < num_cols; i++) {
207  Real x_i = xdata[i * incX];
208  if (x_i == 0.0) continue;
209  // Add to ydata, the i'th column of M, times alpha * x_i
210  cblas_Xaxpy(num_rows, x_i * alpha, Mdata + i, stride, ydata, incY);
211  }
212  } else {
213  if (beta != 1.0) cblas_Xscal(num_cols, beta, ydata, incY);
214  for (MatrixIndexT i = 0; i < num_rows; i++) {
215  Real x_i = xdata[i * incX];
216  if (x_i == 0.0) continue;
217  // Add to ydata, the i'th row of M, times alpha * x_i
218  cblas_Xaxpy(num_cols, x_i * alpha,
219  Mdata + (i * stride), 1, ydata, incY);
220  }
221  }
222 }
223 
224 inline void cblas_Xgemm(const float alpha,
225  MatrixTransposeType transA,
226  const float *Adata,
227  MatrixIndexT a_num_rows, MatrixIndexT a_num_cols, MatrixIndexT a_stride,
228  MatrixTransposeType transB,
229  const float *Bdata, MatrixIndexT b_stride,
230  const float beta,
231  float *Mdata,
232  MatrixIndexT num_rows, MatrixIndexT num_cols,MatrixIndexT stride) {
233  cblas_sgemm(CblasRowMajor, static_cast<CBLAS_TRANSPOSE>(transA),
234  static_cast<CBLAS_TRANSPOSE>(transB),
235  num_rows, num_cols, transA == kNoTrans ? a_num_cols : a_num_rows,
236  alpha, Adata, a_stride, Bdata, b_stride,
237  beta, Mdata, stride);
238 }
239 inline void cblas_Xgemm(const double alpha,
240  MatrixTransposeType transA,
241  const double *Adata,
242  MatrixIndexT a_num_rows, MatrixIndexT a_num_cols, MatrixIndexT a_stride,
243  MatrixTransposeType transB,
244  const double *Bdata, MatrixIndexT b_stride,
245  const double beta,
246  double *Mdata,
247  MatrixIndexT num_rows, MatrixIndexT num_cols,MatrixIndexT stride) {
248  cblas_dgemm(CblasRowMajor, static_cast<CBLAS_TRANSPOSE>(transA),
249  static_cast<CBLAS_TRANSPOSE>(transB),
250  num_rows, num_cols, transA == kNoTrans ? a_num_cols : a_num_rows,
251  alpha, Adata, a_stride, Bdata, b_stride,
252  beta, Mdata, stride);
253 }
254 
255 
256 inline void cblas_Xsymm(const float alpha,
257  MatrixIndexT sz,
258  const float *Adata,MatrixIndexT a_stride,
259  const float *Bdata,MatrixIndexT b_stride,
260  const float beta,
261  float *Mdata, MatrixIndexT stride) {
262  cblas_ssymm(CblasRowMajor, CblasLeft, CblasLower, sz, sz, alpha, Adata,
263  a_stride, Bdata, b_stride, beta, Mdata, stride);
264 }
265 inline void cblas_Xsymm(const double alpha,
266  MatrixIndexT sz,
267  const double *Adata,MatrixIndexT a_stride,
268  const double *Bdata,MatrixIndexT b_stride,
269  const double beta,
270  double *Mdata, MatrixIndexT stride) {
271  cblas_dsymm(CblasRowMajor, CblasLeft, CblasLower, sz, sz, alpha, Adata,
272  a_stride, Bdata, b_stride, beta, Mdata, stride);
273 }
274 // ger: M += alpha x y^T.
275 inline void cblas_Xger(MatrixIndexT num_rows, MatrixIndexT num_cols, float alpha,
276  const float *xdata, MatrixIndexT incX, const float *ydata,
277  MatrixIndexT incY, float *Mdata, MatrixIndexT stride) {
278  cblas_sger(CblasRowMajor, num_rows, num_cols, alpha, xdata, 1, ydata, 1,
279  Mdata, stride);
280 }
281 inline void cblas_Xger(MatrixIndexT num_rows, MatrixIndexT num_cols, double alpha,
282  const double *xdata, MatrixIndexT incX, const double *ydata,
283  MatrixIndexT incY, double *Mdata, MatrixIndexT stride) {
284  cblas_dger(CblasRowMajor, num_rows, num_cols, alpha, xdata, 1, ydata, 1,
285  Mdata, stride);
286 }
287 
288 // syrk: symmetric rank-k update.
289 // if trans==kNoTrans, then C = alpha A A^T + beta C
290 // else C = alpha A^T A + beta C.
291 // note: dim_c is dim(C), other_dim_a is the "other" dimension of A, i.e.
292 // num-cols(A) if kNoTrans, or num-rows(A) if kTrans.
293 // We only need the row-major and lower-triangular option of this, and this
294 // is hard-coded.
295 inline void cblas_Xsyrk (
296  const MatrixTransposeType trans, const MatrixIndexT dim_c,
297  const MatrixIndexT other_dim_a, const float alpha, const float *A,
298  const MatrixIndexT a_stride, const float beta, float *C,
299  const MatrixIndexT c_stride) {
300  cblas_ssyrk(CblasRowMajor, CblasLower, static_cast<CBLAS_TRANSPOSE>(trans),
301  dim_c, other_dim_a, alpha, A, a_stride, beta, C, c_stride);
302 }
303 
304 inline void cblas_Xsyrk(
305  const MatrixTransposeType trans, const MatrixIndexT dim_c,
306  const MatrixIndexT other_dim_a, const double alpha, const double *A,
307  const MatrixIndexT a_stride, const double beta, double *C,
308  const MatrixIndexT c_stride) {
309  cblas_dsyrk(CblasRowMajor, CblasLower, static_cast<CBLAS_TRANSPOSE>(trans),
310  dim_c, other_dim_a, alpha, A, a_stride, beta, C, c_stride);
311 }
312 
317 inline void cblas_Xsbmv1(
318  const MatrixIndexT dim,
319  const double *A,
320  const double alpha,
321  const double *x,
322  const double beta,
323  double *y) {
324  cblas_dsbmv(CblasRowMajor, CblasLower, dim, 0, alpha, A,
325  1, x, 1, beta, y, 1);
326 }
327 
328 inline void cblas_Xsbmv1(
329  const MatrixIndexT dim,
330  const float *A,
331  const float alpha,
332  const float *x,
333  const float beta,
334  float *y) {
335  cblas_ssbmv(CblasRowMajor, CblasLower, dim, 0, alpha, A,
336  1, x, 1, beta, y, 1);
337 }
338 
341 inline void mul_elements(
342  const MatrixIndexT dim,
343  const double *a,
344  double *b) { // does b *= a, elementwise.
345  double c1, c2, c3, c4;
346  MatrixIndexT i;
347  for (i = 0; i + 4 <= dim; i += 4) {
348  c1 = a[i] * b[i];
349  c2 = a[i+1] * b[i+1];
350  c3 = a[i+2] * b[i+2];
351  c4 = a[i+3] * b[i+3];
352  b[i] = c1;
353  b[i+1] = c2;
354  b[i+2] = c3;
355  b[i+3] = c4;
356  }
357  for (; i < dim; i++)
358  b[i] *= a[i];
359 }
360 
361 inline void mul_elements(
362  const MatrixIndexT dim,
363  const float *a,
364  float *b) { // does b *= a, elementwise.
365  float c1, c2, c3, c4;
366  MatrixIndexT i;
367  for (i = 0; i + 4 <= dim; i += 4) {
368  c1 = a[i] * b[i];
369  c2 = a[i+1] * b[i+1];
370  c3 = a[i+2] * b[i+2];
371  c4 = a[i+3] * b[i+3];
372  b[i] = c1;
373  b[i+1] = c2;
374  b[i+2] = c3;
375  b[i+3] = c4;
376  }
377  for (; i < dim; i++)
378  b[i] *= a[i];
379 }
380 
381 
382 
383 // add clapack here
384 #if !defined(HAVE_ATLAS)
385 inline void clapack_Xtptri(KaldiBlasInt *num_rows, float *Mdata, KaldiBlasInt *result) {
386  stptri_(const_cast<char *>("U"), const_cast<char *>("N"), num_rows, Mdata, result);
387 }
388 inline void clapack_Xtptri(KaldiBlasInt *num_rows, double *Mdata, KaldiBlasInt *result) {
389  dtptri_(const_cast<char *>("U"), const_cast<char *>("N"), num_rows, Mdata, result);
390 }
391 //
392 inline void clapack_Xgetrf2(KaldiBlasInt *num_rows, KaldiBlasInt *num_cols,
393  float *Mdata, KaldiBlasInt *stride, KaldiBlasInt *pivot,
394  KaldiBlasInt *result) {
395  sgetrf_(num_rows, num_cols, Mdata, stride, pivot, result);
396 }
397 inline void clapack_Xgetrf2(KaldiBlasInt *num_rows, KaldiBlasInt *num_cols,
398  double *Mdata, KaldiBlasInt *stride, KaldiBlasInt *pivot,
399  KaldiBlasInt *result) {
400  dgetrf_(num_rows, num_cols, Mdata, stride, pivot, result);
401 }
402 
403 //
404 inline void clapack_Xgetri2(KaldiBlasInt *num_rows, float *Mdata, KaldiBlasInt *stride,
405  KaldiBlasInt *pivot, float *p_work,
406  KaldiBlasInt *l_work, KaldiBlasInt *result) {
407  sgetri_(num_rows, Mdata, stride, pivot, p_work, l_work, result);
408 }
409 inline void clapack_Xgetri2(KaldiBlasInt *num_rows, double *Mdata, KaldiBlasInt *stride,
410  KaldiBlasInt *pivot, double *p_work,
411  KaldiBlasInt *l_work, KaldiBlasInt *result) {
412  dgetri_(num_rows, Mdata, stride, pivot, p_work, l_work, result);
413 }
414 //
415 inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
416  KaldiBlasInt *num_rows, float *Mdata, KaldiBlasInt *stride,
417  float *sv, float *Vdata, KaldiBlasInt *vstride,
418  float *Udata, KaldiBlasInt *ustride, float *p_work,
419  KaldiBlasInt *l_work, KaldiBlasInt *result) {
420  sgesvd_(v, u,
421  num_cols, num_rows, Mdata, stride,
422  sv, Vdata, vstride, Udata, ustride,
423  p_work, l_work, result);
424 }
425 inline void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols,
426  KaldiBlasInt *num_rows, double *Mdata, KaldiBlasInt *stride,
427  double *sv, double *Vdata, KaldiBlasInt *vstride,
428  double *Udata, KaldiBlasInt *ustride, double *p_work,
429  KaldiBlasInt *l_work, KaldiBlasInt *result) {
430  dgesvd_(v, u,
431  num_cols, num_rows, Mdata, stride,
432  sv, Vdata, vstride, Udata, ustride,
433  p_work, l_work, result);
434 }
435 //
436 void inline clapack_Xsptri(KaldiBlasInt *num_rows, float *Mdata,
437  KaldiBlasInt *ipiv, float *work, KaldiBlasInt *result) {
438  ssptri_(const_cast<char *>("U"), num_rows, Mdata, ipiv, work, result);
439 }
440 void inline clapack_Xsptri(KaldiBlasInt *num_rows, double *Mdata,
441  KaldiBlasInt *ipiv, double *work, KaldiBlasInt *result) {
442  dsptri_(const_cast<char *>("U"), num_rows, Mdata, ipiv, work, result);
443 }
444 //
445 void inline clapack_Xsptrf(KaldiBlasInt *num_rows, float *Mdata,
446  KaldiBlasInt *ipiv, KaldiBlasInt *result) {
447  ssptrf_(const_cast<char *>("U"), num_rows, Mdata, ipiv, result);
448 }
449 void inline clapack_Xsptrf(KaldiBlasInt *num_rows, double *Mdata,
450  KaldiBlasInt *ipiv, KaldiBlasInt *result) {
451  dsptrf_(const_cast<char *>("U"), num_rows, Mdata, ipiv, result);
452 }
453 #else
454 inline void clapack_Xgetrf(MatrixIndexT num_rows, MatrixIndexT num_cols,
455  float *Mdata, MatrixIndexT stride,
456  int *pivot, int *result) {
457  *result = clapack_sgetrf(CblasColMajor, num_rows, num_cols,
458  Mdata, stride, pivot);
459 }
460 
461 inline void clapack_Xgetrf(MatrixIndexT num_rows, MatrixIndexT num_cols,
462  double *Mdata, MatrixIndexT stride,
463  int *pivot, int *result) {
464  *result = clapack_dgetrf(CblasColMajor, num_rows, num_cols,
465  Mdata, stride, pivot);
466 }
467 //
468 inline int clapack_Xtrtri(int num_rows, float *Mdata, MatrixIndexT stride) {
469  return clapack_strtri(CblasColMajor, CblasUpper, CblasNonUnit, num_rows,
470  Mdata, stride);
471 }
472 
473 inline int clapack_Xtrtri(int num_rows, double *Mdata, MatrixIndexT stride) {
474  return clapack_dtrtri(CblasColMajor, CblasUpper, CblasNonUnit, num_rows,
475  Mdata, stride);
476 }
477 //
478 inline void clapack_Xgetri(MatrixIndexT num_rows, float *Mdata, MatrixIndexT stride,
479  int *pivot, int *result) {
480  *result = clapack_sgetri(CblasColMajor, num_rows, Mdata, stride, pivot);
481 }
482 inline void clapack_Xgetri(MatrixIndexT num_rows, double *Mdata, MatrixIndexT stride,
483  int *pivot, int *result) {
484  *result = clapack_dgetri(CblasColMajor, num_rows, Mdata, stride, pivot);
485 }
486 #endif
487 
488 }
489 // namespace kaldi
490 
491 #endif
void cblas_Xsbmv1(const MatrixIndexT dim, const double *A, const double alpha, const double *x, const double beta, double *y)
matrix-vector multiply using a banded matrix; we always call this with b = 1 meaning we&#39;re multiplyin...
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
Definition: chain.dox:20
void cblas_Xsyrk(const MatrixTransposeType trans, const MatrixIndexT dim_c, const MatrixIndexT other_dim_a, const float alpha, const float *A, const MatrixIndexT a_stride, const float beta, float *C, const MatrixIndexT c_stride)
float cblas_Xasum(const int N, const float *X, const int incX)
void clapack_Xgetri2(KaldiBlasInt *num_rows, float *Mdata, KaldiBlasInt *stride, KaldiBlasInt *pivot, float *p_work, KaldiBlasInt *l_work, KaldiBlasInt *result)
void clapack_Xsptri(KaldiBlasInt *num_rows, float *Mdata, KaldiBlasInt *ipiv, float *work, KaldiBlasInt *result)
void cblas_Xtpmv(MatrixTransposeType trans, const float *Mdata, const int num_rows, float *y, const int y_inc)
void cblas_Xspr2(MatrixIndexT dim, float alpha, const float *Xdata, MatrixIndexT incX, const float *Ydata, MatrixIndexT incY, float *Adata)
void cblas_Xtpsv(MatrixTransposeType trans, const float *Mdata, const int num_rows, float *y, const int y_inc)
void Xgemv_sparsevec(MatrixTransposeType trans, MatrixIndexT num_rows, MatrixIndexT num_cols, Real alpha, const Real *Mdata, MatrixIndexT stride, const Real *xdata, MatrixIndexT incX, Real beta, Real *ydata, MatrixIndexT incY)
void clapack_Xgetrf2(KaldiBlasInt *num_rows, KaldiBlasInt *num_cols, float *Mdata, KaldiBlasInt *stride, KaldiBlasInt *pivot, KaldiBlasInt *result)
void cblas_Xcopy(const int N, const float *X, const int incX, float *Y, const int incY)
void clapack_Xgesvd(char *v, char *u, KaldiBlasInt *num_cols, KaldiBlasInt *num_rows, float *Mdata, KaldiBlasInt *stride, float *sv, float *Vdata, KaldiBlasInt *vstride, float *Udata, KaldiBlasInt *ustride, float *p_work, KaldiBlasInt *l_work, KaldiBlasInt *result)
void mul_elements(const MatrixIndexT dim, const double *a, double *b)
This is not really a wrapper for CBLAS as CBLAS does not have this; in future we could extend this so...
float cblas_Xdot(const int N, const float *const X, const int incX, const float *const Y, const int incY)
void clapack_Xtptri(KaldiBlasInt *num_rows, float *Mdata, KaldiBlasInt *result)
int32 MatrixIndexT
Definition: matrix-common.h:98
void cblas_Xscal(const int N, const float alpha, float *data, const int inc)
void cblas_Xsymm(const float alpha, MatrixIndexT sz, const float *Adata, MatrixIndexT a_stride, const float *Bdata, MatrixIndexT b_stride, const float beta, float *Mdata, MatrixIndexT stride)
void cblas_Xspr(MatrixIndexT dim, float alpha, const float *Xdata, MatrixIndexT incX, float *Adata)
void cblas_Xgemm(const float alpha, MatrixTransposeType transA, const float *Adata, MatrixIndexT a_num_rows, MatrixIndexT a_num_cols, MatrixIndexT a_stride, MatrixTransposeType transB, const float *Bdata, MatrixIndexT b_stride, const float beta, float *Mdata, MatrixIndexT num_rows, MatrixIndexT num_cols, MatrixIndexT stride)
void cblas_Xaxpy(const int N, const float alpha, const float *X, const int incX, float *Y, const int incY)
void cblas_Xgemv(MatrixTransposeType trans, MatrixIndexT num_rows, MatrixIndexT num_cols, float alpha, const float *Mdata, MatrixIndexT stride, const float *xdata, MatrixIndexT incX, float beta, float *ydata, MatrixIndexT incY)
MatrixTransposeType
Definition: matrix-common.h:32
void cblas_Xspmv(const float alpha, const int num_rows, const float *Mdata, const float *v, const int v_inc, const float beta, float *y, const int y_inc)
void cblas_Xgbmv(MatrixTransposeType trans, MatrixIndexT num_rows, MatrixIndexT num_cols, MatrixIndexT num_below, MatrixIndexT num_above, float alpha, const float *Mdata, MatrixIndexT stride, const float *xdata, MatrixIndexT incX, float beta, float *ydata, MatrixIndexT incY)
void clapack_Xsptrf(KaldiBlasInt *num_rows, float *Mdata, KaldiBlasInt *ipiv, KaldiBlasInt *result)
void cblas_Xger(MatrixIndexT num_rows, MatrixIndexT num_cols, float alpha, const float *xdata, MatrixIndexT incX, const float *ydata, MatrixIndexT incY, float *Mdata, MatrixIndexT stride)
void cblas_Xrot(const int N, float *X, const int incX, float *Y, const int incY, const float c, const float s)