[petsc-users] Merge two MATMPIAIJ into one
Barry Smith
bsmith at mcs.anl.gov
Mon Jan 11 13:21:04 CST 2010
On Jan 11, 2010, at 12:38 PM, Vasia Kalavri wrote:
> Hello.
> I could use some help regarding the following issues:
>
> 1. I have created 2 structurally identical MATMPIJ matrices A1 and
> A2 with N rows and M columns. I want to merge them in order to
> create a matrix of the double size A3 with 2*N rows and M columns so
> that the first row of A2 will be the N+1-th row of the new matrix.
> Is there any function I could use to do this?
Since PETSc lays out the matrix rows across processors by having
the first set of rows on the first process, the next set of rows on
the next process etc. where is your "appended matrix" rows going to
live? Do you want the new matrix to have the A1 matrix on the first
half of the processors and the A2 matrix on the second half of the
processors?
PETSc doesn't have tools for "putting together" collections of
sparse parallel matrices, so there is some direct access to the sparse
matrix you need to do to get what you want.
>
> 2. Is there a way to split a matrix after its values have been set
> by 1 process? What I have done is to create a MATMPIJ and make that
> process send the data to the other processes in order to get the
> distributed matrix. But I hope there is a smarter way to do this!
In general one should create the entries to a PETSc matrix on the
same number of processors as where the matrix lives so one does not
need to "spread out" the matrix entries.
Again, there isn't code to spread around sparse matrix entries.
Barry
>
> Any idea is welcome,
> Vasia.
>
> Windows Live: Keep your friends up to date with what you do online.
More information about the petsc-users
mailing list