Multithreaded sparse matrix multiplication in Matlab

后端 未结 3 1792
故里飘歌
故里飘歌 2021-01-11 21:21

I am performing several matrix multiplications of an NxN sparse (~1-2%) matrix, let\'s call it B, with an NxM dense matrix, let\'s call it A (where M < N). N is large, as

3条回答
  •  情歌与酒
    2021-01-11 21:58

    I ended up writing my own mex file with OpenMP for multithreading. Code as follows. Don't forget to use -largeArrayDims and /openmp (or -fopenmp) flags when compiling.

    #include 
    #include "mex.h"
    #include "matrix.h"
    
    #define ll long long
    
    void omp_smm(double* A, double*B, double* C, ll m, ll p, ll n, ll* irs, ll* jcs)
    {
        for (ll j=0; j

提交回复
热议问题