Showing results for

- Intel Community
- Software
- Software Development SDKs and Libraries
- Intel® oneAPI Math Kernel Library
- Sparse matrix and dense matrix 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

Wei_W_

Beginner

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

07-17-2014
03:08 AM

73 Views

Sparse matrix and dense matrix multiplication

Hi,

Have a quick question to ask, I need to do A x B where A is a sparse matrix stored in CSR format, B is a symmetric dense matrix. Now I am using csrmm to compute the multiplication, but have to convert B into full dense matrix first, which doubles the memory for B. Is there any routine in MKL that can handles this?

Many thanks!

Link Copied

4 Replies

Wei_W_

Beginner

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

07-18-2014
06:08 AM

73 Views

Any help would be appreciated, thanks!

mecej4

Black Belt

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

07-18-2014
07:55 AM

73 Views

Some questions that are relevant to the request:

- How is the symmetric matrix B currently stored (before being converted to full, dense)?
- What do you intend to do with A x B , after computing the product matrix?
- How do you wish to store the product matrix?

Wei_W_

Beginner

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

07-18-2014
08:06 AM

73 Views

Thanks for reply.

1. The B matrix is stored column wise, packed form (upper triangle) before converting to full dense matrix.

2. After computing AxB=C, I will do a for loop i=1:n, for each i, I need to do D_i x C, where D_i is also a sparse matrix. Here I use csrmm for sure since the dense C matrix is not symmetric.

3. The product matrix C is not symmetric, so just the regular way to store it, we use column major to store dense matrix in our code.

Ying_H_Intel

Employee

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

07-20-2014
06:26 PM

73 Views

Hi Wei,

It seems there is no good function can operate a spase matrix A*B (parcked upper triangle) form. You may either convert B to dense matrix. Then use mkl_?csrmm. Get sparse C matrix. Then call mkl_?csrmultd. to compute D_i *C.

Or convert B to sparse matrix. use mkl_?csrmultd. to compute C= A*B. Then mkl_?csrmm do D_i*C. But if convert B to sparse matrix. it still need double memory.

or call mkl_?csrgemv to compute ci=A*bi (B's colum vector). , then call csrmm do D_i*C.

Best Regards,

Ying

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

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