Guest User

spmm

a guest
Apr 13th, 2011
157
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. #include "/opt/intel/mkl/include/mkl.h"
  5. #include "/opt/intel/mkl/include/mkl_spblas.h"
  6. #include "/opt/intel/mkl/include/mkl.h"
  7.  
  8. int main(int argc, char *argv[])
  9. {
  10. int info=1;
  11. int i;
  12. // mkl_scsrmultcsr(&trans, &request, &sort, &m, &n, &k, a, ja, ia, b, jb, ib, c, jc, ic, &nzmax, &info);
  13.  
  14. int m = 2,nnz = 2;
  15.  
  16. float a[] = {2,3};
  17. int ja[] = {0,1};
  18. int ia[] = {0,1,2};
  19.  
  20. int *ic = (int *)malloc(sizeof(int)*(m+1));
  21. float *c;
  22. int *jc;
  23.  
  24. char trans = 'N';
  25. int request = 1;
  26. int sort = 8;
  27. int nzmax = 0;
  28.  
  29. mkl_scsrmultcsr(&trans, &request, &sort, &m, &m, &m, a, ja, ia, a, ja, ia, c, jc, ic, &nzmax, &info);
  30.  
  31. printf("Result nnz = %d\n",ic[m]);
  32. for(i=0;i<=m;i++)
  33. {
  34. printf("ic[%d] = %d\n",i,ic[i]);
  35. }
  36.  
  37. c = (float *)malloc(sizeof(float)*ic[m]);
  38. jc = (int *)malloc(sizeof(int)*ic[m]);
  39.  
  40. request = 2;
  41.  
  42. mkl_scsrmultcsr(&trans, &request, &sort, &m, &m, &m, a, ja, ia, a, ja, ia, c, jc, ic, &nzmax, &info);
  43.  
  44. for(i=0;i<ic[m];i++)
  45. {
  46. printf("%f %d\n",c[i],jc[i]);
  47. }
  48.  
  49. }
RAW Paste Data