Block Sparse Matrix

I would like to deal with very large sparse matrices with dense sub-blocks; for example, block arrow-head matrices, or a block periodic tridiagonal matrices.

I know about the BlockArrays package. That supports blocking of sparse matrices. I found a package called “BlockSparseArrays” but it seems to be abandoned.

It is not convenient for me to first create a sparse matrix and then block it using BlockArrays. The converse of starting with an uninitialized BlockArray is also not scalable for me as I have a large number of partitions, and I am assuming BlockArray will allocate O(N^2) pointers at least.

Before I start writing my own BlockSparseMatrix code I was wondering if someone had a way to use SparseArrays and BlockArrays to achieve what I want?

Thanks.
–shiv–

It took me a while to find this, I recalled the first package that I put at the top of the list (maybe none applies to you, but posting just in case, what I found while searching):

If a) your block sparse matrix does not change and b) your dense sublocks are not full, and c) you iterate with your matrices (not just a single multiplication), consider the CompressedSparseBlocks package.

If the sub-blocks have to be dense, it is a trivial exercise to define a CSC matrix datatype where the elements are dense matrices. Give it a try and we can help you out.

1 Like