What's the best way to get a lower-right quarter of sparse matrix in "coordinates format"? I need it for Schur complement.
Coordinates are indexed from 1 (I'm using MUMPS).
EXAMPLE:
int order_of_matrix = 4
int row_coords[] = {1,1,2,3,3,4};
int col_coords[] = {1,3,3,3,4,4};
int vals[] = {1,2,3,4,5,6};
So my matrix should look like this:
|1 0 2 0|
|0 0 3 0|
|0 0 4 5|
|0 0 0 6|
And now, I need to get values from the lower-right corner like this:
int schur_complement_size = 1
|6|
int schur_complement_size = 2
|4 5|
|0 6|
int schur_complement_size = 3
|0 3 0|
|0 4 5|
|0 0 6|
int schur_complement_size = 4
|1 0 2 0|
|0 0 3 0|
|0 0 4 5|
|0 0 0 6|
Is there any elegant way to achieve this without converting matrix to the dense format? The dense format is very problematic for me, because matrices in real usage of my program are going to be very large.