Hello,
I have trouble getting mkl_?csrmm to output the correct answer to my program. I am wondering if I am using or inputting the correct parameters for what I want to do for the sparse routine. Any assistance would be greatly appreciated.
#include <stdio.h> #include <stdlib.h> #include "mkl.h" #define NNZ 8 #define M 6 #define N 2 #define K 3 /* This program tries to multiply : [5.0 0.0 1.0] [0.0 2.0 0.0] x [5.0 1.0] [0.0 3.0 0.0] [2.0 2.0] [0.0 0.0 1.0] [6.0 6.0] [1.0 0.0 0.0] [2.0 0.0 5.0] */ int main() { char transa = 'n'; MKL_INT m = M; MKL_INT n = N; MKL_INT k = K; float alpha = 1.0; char matdescra[5]; matdescra[0] = 'g'; matdescra[3] = 'f'; float val[NNZ] = { 5.0, 1.0, 2.0, 3.0, 1.0, 1.0, 2.0, 5.0 }; MKL_INT col[NNZ] = { 1, 3, 2, 2, 3, 1, 1, 3 }; MKL_INT ind[7] = { 1, 3, 4, 5, 6, 7, 9 }; float b[K][N] = { { 5.0 , 1.0 },{ 2.0 , 2.0 },{ 6.0 , 6.0 } }; MKL_INT ldb = K; float beta = 0.0; float c[M][N] = { { 0.0, 0.0 },{ 0.0, 0.0 },{ 0.0, 0.0 },{ 0.0, 0.0 },{ 0.0, 0.0 },{ 0.0, 0.0 } }; MKL_INT ldc = M; mkl_scsrmm(&transa, &m, &n, &k, &alpha, matdescra, val, col, ind, &(ind[1]), &(b[0][0]), &ldb, &beta, &(c[0][0]), &ldc); int i, j; for (i = 0; i < m; i++) { for (j = 0; j < n; j++) { printf("\n c[%d][%d] = %7.1f", i, j, c[i][j]); } } getchar(); return 0; }