How can I implement BCRS 2x2 format for sparse matrices in C++?

Click For Summary
SUMMARY

This discussion focuses on implementing the Block Compressed Row Storage (BCRS) format with 2x2 sub-blocks for sparse matrices in C++. The user seeks guidance on algorithms and code for converting a standard 2-D floating-point matrix to the BCRS 2x2 format and performing Matrix-Vector multiplication. It is concluded that BCRS 2x2 may exhibit worse performance compared to the Compressed Row Storage (CRS) format due to the complexity of accessing specific matrix elements, emphasizing that sparse matrix storage modes prioritize space efficiency over time efficiency.

PREREQUISITES
  • Understanding of sparse matrix storage formats, specifically Compressed Row Storage (CRS) and Block Compressed Row Storage (BCRS).
  • Proficiency in C++ programming for implementing algorithms.
  • Familiarity with matrix operations, particularly Matrix-Vector multiplication.
  • Knowledge of floating-point arithmetic and its implications on performance.
NEXT STEPS
  • Research the algorithm for Block Compressed Row Storage (BCRS) specifically for 2x2 sub-blocks.
  • Learn about optimizing Matrix-Vector multiplication in sparse matrix formats.
  • Explore performance metrics for sparse matrix storage formats, focusing on computational time versus space efficiency.
  • Review resources on matrix compression algorithms, such as those available at http://www.nr.com/oldverswitcher.html and http://www.cs.utk.edu/~dongarra/etemplates/node372.html.
USEFUL FOR

Developers and researchers working with sparse matrices, particularly those interested in matrix compression algorithms and performance optimization in C++. This discussion is beneficial for anyone looking to implement or understand BCRS 2x2 format and its implications on computational efficiency.

dinaharchery
Messages
22
Reaction score
0
Hello All,

I am trying to learn matrix compression algorithms for sparse matrices. I understand the Compressed Row Storage (CRS) format but I am having difficulty with the Block Compressed Row Storage (BCRS) format - where the size of the sub-block(s) are 2x2.

Can anyone please point me to an algorithm/code for implementing BCRS 2x2? I am looking to take a standard 2-D floating-point matrix in C++ and converting it to the BCRS 2x2 format as well as Matrix-Vector multiplication using the BCRS 2x2 format.

I know there are a lot of programs for this out there but I really would like know the algorithm myself, so that I can learn this rather than re-implement someone elses code - although at this point I will take what I can get.

Thanks.
 
Technology news on Phys.org
Well, I seemed to have figured-out the issue of programming a Matrix-Vector multiplication on sparse matrices using both Compressed Row Storage and Block Compressed Row Storage formats. I have a bigger question now though.

Regardless of the size of my sparse matrix (randomly generated values), Block Compressed Row Storage (with 2x2 sub-blocks) seems to perform worse than the standard Compressed Row Storage format. Is this something that I should expect or is something else going on? If it is to be expected, does this increase in computational time occur because of the potential for increased floating-point operations? If not, why?

Thanks again.
 
How do you define 'performance'. If you mean the computational time, then yes BCRS is worse then CRS because it is 'harder' to find a specific matrix element.

Remember: sparse matrix storage modes are SPACE-savers, not TIME-savers

Have you tried http://www.nr.com/oldverswitcher.html" , you can freely access the obsolete versions and read about the algorithm to code specific storage formats.

Also http://www.cs.utk.edu/~dongarra/etemplates/node372.html" might be helpful
 
Last edited by a moderator:

Similar threads

  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 8 ·
Replies
8
Views
5K
  • · Replies 28 ·
Replies
28
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 8 ·
Replies
8
Views
6K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 7 ·
Replies
7
Views
3K
Replies
3
Views
2K
Replies
5
Views
3K
  • · Replies 7 ·
Replies
7
Views
3K