#include #include "mex.h" #include "blasfeo_d_blas.h" // void dgemm_(char *ta, char *tb, int *m, int *n, int *k, double *alpha, double *A, int *lda, double *B, int *ldb, double *beta, double *C, int *ldc); void mexFunction( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) { // char *opA[1], *opB[1]; int numRowsA, numColsA, numColsB, M, N, K; int lda, ldb, ldc; double alpha, beta; double *matA, *matB, *matC; char opA[] = "N"; char opB[] = "N"; // Validate Input // Number of Input // if( nrhs != 2 && nrhs != 3 && nrhs != 4 && nrhs != 5 && nrhs != 7){ // mexErrMsgIdAndTxt("BLASFEODGEMM:BLASFEODGEMM:nrhs", "Number of inputs must be 2, 3, 4, 5, or 7"); // } // Validate output // if( nlhs > 1 ) // { // mexErrMsgIdAndTxt("BLASFEODGEMM:BLASFEODGEMM:nlhs", "Output must be single or none (In place operation)"); // } numRowsA = (int)mxGetM(prhs[0]); numColsA = (int)mxGetN(prhs[0]); // Equals to numRowsB = mxGetM(prhs[1]); numColsB = (int)mxGetN(prhs[1]); matA = (double *)(mxGetData(prhs[0])); matB = (double *)(mxGetData(prhs[1])); matC = (double *)(mxGetData(prhs[2])); alpha = 1.0; beta = 0.0; M = numRowsA; K = numColsA; N = numColsB; lda = numRowsA; ldb = numColsA; ldc = numRowsA; // Allocating / Setting Output // if( nlhs == 1 && nrhs == 3 ) // { // plhs[0] = mxDuplicateArray(prhs[2]); // } // if( nlhs == 1 && nrhs == 2 ) // { // plhs[0] = mxCreateDoubleMatrix(M, N, mxREAL); // } // dgemm_(opA, opB, &M, &N, &K, &alpha, matA, &lda, matB, &ldb, &beta, matC, &ldc); blasfeo_dgemm(opA, opB, &M, &N, &K, &alpha, matA, &lda, matB, &ldb, &beta, matC, &ldc); }