<p dir="auto">It would be useful to us and I'm pretty sure to other people to be able to call gemm in C.<br>
There is the file numpy/core/src/multiarray/cblasfuncs.c that contain this function:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="static void
gemm(int typenum, enum CBLAS_ORDER order,
     enum CBLAS_TRANSPOSE transA, enum CBLAS_TRANSPOSE transB,
     int m, int n, int k,
     PyArrayObject *A, int lda, PyArrayObject *B, int ldb, PyArrayObject *R)"><pre class="notranslate"><code class="notranslate">static void
gemm(int typenum, enum CBLAS_ORDER order,
     enum CBLAS_TRANSPOSE transA, enum CBLAS_TRANSPOSE transB,
     int m, int n, int k,
     PyArrayObject *A, int lda, PyArrayObject *B, int ldb, PyArrayObject *R)
</code></pre></div>
<p dir="auto">Giving access to it would solve this, this function is currently private and do not do error checking. The function:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="NPY_NO_EXPORT PyObject *
cblas_matrixproduct(int typenum, PyArrayObject *ap1, PyArrayObject *ap2,
                    PyArrayObject *out)"><pre class="notranslate"><code class="notranslate">NPY_NO_EXPORT PyObject *
cblas_matrixproduct(int typenum, PyArrayObject *ap1, PyArrayObject *ap2,
                    PyArrayObject *out)
</code></pre></div>
<p dir="auto">In the same file does the error checking, but do not allow the alpha and beta parameter.</p>
<p dir="auto">Before going further and plan how to implement it. Would a PR that add a public function PyArray_Gemm that take the 3 ndarray + alpha + beta be accepted?</p>
<p dir="auto">I was wondering if it's possible for the relevant Numpy DLLs (e.g. lapack_lite or _umath_linalg) to export the CBLAS functions, so that other software can call into them using e.g. ctypes. Under Linux they are exported by default, but not under Windows (AFAIK you have to explicitly export symbols on Windows, by default "global" symbols in a shared library are private to the library).</p>
<p dir="auto">Or perhaps I'm missing another way of accessing those functions at runtime?</p>