- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Dear all,

For my Krylov subspace basis build up, I am doing some sparse matrix - dense matrix multiplications. That is fine. I use mkl_dcsrmm for this. But the question now is I am keeping my Krylov vectors in a

std::vector

conceptually, the vectors are the columns of my dense matrix. However, the above interface is considering all the matrices in row major order, is there a way to change this. Since I keep my basis in an array of arrays, I should somehow make it interpreted colum-wise. Is there a work around for this? Or both matrix ordering should be the same when using the routine so one could not be row major(the sparse matrix) and the dense matrix, column major? This is far more efficient and easy to use if there is a work-around for this task.

For instance for the below simple code, I would like b to be interpreted column wise not row-wise while a is still row-wise.

int main()

{

double a[] = {1.e0,2.e0,3.e0};

int ia[] = {0,1,2,3};

int ja[] = {0,1,2};

double b[] = {1.e0,4.e0,2.e0,5.e0,3.e0,6.e0};

double c[] = {0,0,0,0,0,0};

MKL_INT m = 3;

MKL_INT k= 3;

MKL_INT n = 2;

double alpha = 1.0;

double beta = 0.0;

//

char matdescra[6];

matdescra[0]= 'g';

matdescra[1]= 'l';

matdescra[2]= 'u';

matdescra[3]= 'c';

char transa = 'N';

mkl_dcsrmm(&transa,

&m, &n, &k,

&alpha,

matdescra,

a, ja, ia,

ia+1, b,

&n, &beta, c, &n);

//

for(int z=0;z<6;z++)

std::cout << c

return 0;

}

Link Copied

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

It appears that there's an undocumented "feature" in the mkl_dcsrmm and mkl_scsrmm family of functions. If the sparse matrix uses zero-based indexing, MKL treates the dense matrices as row-major. If the sparse matrix uses one-based indexing MKL treats the desnce matrices as column-major. If you wish to use column-major dense matrices you must use one-based indexing for the CSR matrix.

See http://software.intel.com/en-us/forums/topic/456104#comment-1749818

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

You are right, c.f. http://software.intel.com/en-us/forums/topic/365430#comment-1724980 from an answer from an Intel employee.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page