Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Intel Community
- Software Development SDKs and Libraries
- Intel® oneAPI Math Kernel Library & Intel® Math Kernel Library
- Dense-Sparse Matrix Multiplication routine instead if sparse-dense multiplication

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

Tripathi__Shailesh

Beginner

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

11-30-2017
01:51 PM

76 Views

Dense-Sparse Matrix Multiplication routine instead if sparse-dense multiplication

Hello,

I have a problem where I need to multiply a dense matrix by a sparse matrix. The function "* mkl_?csrmm*" asks for the first matrix to be sparse and the second to be dense. But my case is opposite.

Problem: **C = A * B + C , **where A is dense and B is sparse.

I know that I can use "mkl_?csrmm" after taking the transpose of both matrices **A **and **B **but the transpose operation will be costly. Is there a better way or existing routine for dense-sparse matrix multiplication?

I am beginner so kindly forgive for mistakes. Thanks in advance!

Regards

Shailesh Tripathi

Link Copied

2 Replies

Zhen_Z_Intel

Employee

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

11-30-2017
07:45 PM

76 Views

Hi Tripathi,

I do not understand why you would like to be multiplied by sparse matrix. MKL only provide mm API that 1st matrix is sparse, and 2nd is dense. For the "mkl_sparse_?_mm" function, you can control transposition(A or A^{T}) and layout(row-major or col-major) for both A and B, that would be easier for you. Thanks.

Best regards,

Fiona

Tripathi__Shailesh

Beginner

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

11-30-2017
09:06 PM

76 Views

Hello Fiona,

Thanks a lot you for your help. So you mean to say that if my dense matrix is row major but during the function call, if I treat it as column major (which means transpose), I would inherently get the product of two transpose (sparse also transposed). And the result matrix will also be returned as column major but it is basically the transpose of the row major. So basically, that would yield me what I want. Am I right?

Thanks in advance!

Regards

Shailesh Tripathi

For more complete information about compiler optimizations, see our Optimization Notice.