Search code examples
c++matrixlapackintel-mklxeon-phi

cBLAS matrix multiply call not working for 1XN and NxN matrices


I'm attempting to use cblas_dgemm to perform matrix multiplication on a 1 x N and an N x N matrix. My call is as follows:

cblas_dgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans,
    1, width, width, 1.0, A, width, B, width,
    0.0, C, width);

however what I get in C is simply a copy of A.

Here is the documentation for the method: https://software.intel.com/en-us/node/429920

I've gone through the parameters a number of times and they all seem fine so I was wondering if anyone could pinpoint something stupid I'm doing?


Solution

  • I simply needed to transpose matrix B or set CblasColMajor since my matrix B was already stored in col major order.