matrix building question
Jose E. Roman
jroman at dsic.upv.es
Wed Dec 16 01:33:24 CST 2009
On 16/12/2009, Matt Funk wrote:
> Sorry,
>
> i should have been more specific. Of course there cannot be 'holes':
> What i meant was this:
>
> could i, in theory, build a matrix that with the following layout:
> rows: 0-249 owned by proc0
> rows: 250-499 owned by proc1
> rows: 500-749 owned by proc0
> rows: 750-999 owned by proc1
>
> or does it have be like such:
> rows: 0-499 owned by proc0
> rows: 500-999 owned by proc1
>
>
> matt
This cannot be done with a PETSc Mat but can be simulated.
I sometimes have a matrix with block structure
[ A B ]
[ C D ]
where each block has to be stored separately as a Mat. What I do is represent the large matrix as a SHELL Mat that operates with the blocks (see SLEPc's ex9.c for an example). Then proc0 owns the first chunk corresponding to A,B and the first chunk of C,D, and so on, so the effect is what you wanted.
If you do not have independent blocks, then you can always use a renumbering scheme (permutation) that maps the rows you want to contiguous chunks in each processor.
Jose
More information about the petsc-users
mailing list