MCPcopy Create free account
hub / github.com/numpy/numpy / gemm

Function gemm

numpy/core/src/common/cblasfuncs.c:26–54  ·  view source on GitHub ↗

* Helper: dispatch to appropriate cblas_?gemm for typenum. */

Source from the content-addressed store, hash-verified

24 * Helper: dispatch to appropriate cblas_?gemm for typenum.
25 */
26static void
27gemm(int typenum, enum CBLAS_ORDER order,
28 enum CBLAS_TRANSPOSE transA, enum CBLAS_TRANSPOSE transB,
29 npy_intp m, npy_intp n, npy_intp k,
30 PyArrayObject *A, npy_intp lda, PyArrayObject *B, npy_intp ldb, PyArrayObject *R)
31{
32 const void *Adata = PyArray_DATA(A), *Bdata = PyArray_DATA(B);
33 void *Rdata = PyArray_DATA(R);
34 npy_intp ldc = PyArray_DIM(R, 1) > 1 ? PyArray_DIM(R, 1) : 1;
35
36 switch (typenum) {
37 case NPY_DOUBLE:
38 CBLAS_FUNC(cblas_dgemm)(order, transA, transB, m, n, k, 1.,
39 Adata, lda, Bdata, ldb, 0., Rdata, ldc);
40 break;
41 case NPY_FLOAT:
42 CBLAS_FUNC(cblas_sgemm)(order, transA, transB, m, n, k, 1.f,
43 Adata, lda, Bdata, ldb, 0.f, Rdata, ldc);
44 break;
45 case NPY_CDOUBLE:
46 CBLAS_FUNC(cblas_zgemm)(order, transA, transB, m, n, k, oneD,
47 Adata, lda, Bdata, ldb, zeroD, Rdata, ldc);
48 break;
49 case NPY_CFLOAT:
50 CBLAS_FUNC(cblas_cgemm)(order, transA, transB, m, n, k, oneF,
51 Adata, lda, Bdata, ldb, zeroF, Rdata, ldc);
52 break;
53 }
54}
55
56
57/*

Callers 1

cblas_matrixproductFunction · 0.85

Calls 2

PyArray_DATAFunction · 0.85
PyArray_DIMFunction · 0.85

Tested by

no test coverage detected