This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Block Sparse

Tags: None
(comma "," separated)
kinetic
Registered Member
Posts
15
Karma
0

Block Sparse

Fri May 01, 2009 3:31 pm
Hi. I have no idea if this can be done. The dense Matrices seem to support this.

Is is possible to build a large sparse matrix by defining sparse blocks separately?

For instance I need to construct a matrix

K = | C1 C2 |
| C3 C4 |

Where C1-C4 are all themselves sparse matrices. It would be convenient to be able to construct the C matrices independently as I need to use them to construct preconditioners for iterative solvers before building K.

Thanks.

Last edited by kinetic on Fri May 01, 2009 3:31 pm, edited 1 time in total.
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

RE: Block Sparse

Sun May 03, 2009 5:16 pm
hi,

indeed, currently this is not possible, but that's on the todo list. I can already say the API will be:

Code: Select all
K.resize(??,??);
K << C1, C2, C3, C4;


With K a SparseMatrix or DynamicSparseMatrix.

On the other hand, for obvious performance reasons, the following will be supported only by the DynamicSparseMatrix:
Code: Select all
K.block(0,0,C1.rows(),C1.cols()) = C1;
K.block(0,C1.cols(),C2.rows(),C2.cols()) = C2;
....

(perhaps this already works for DynamicSparseMatrix)

I'll update this thread when the comma initializer will be ready.
kinetic
Registered Member
Posts
15
Karma
0

RE: Block Sparse

Sun May 03, 2009 7:06 pm
Thanks! I was not sure if this was a reasonable feature to hope for. Once again this is a great library.


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Sogou [Bot]