the performance about combining several matrices into one matrix

Yujie recrusader at gmail.com
Fri Jan 2 14:09:31 CST 2009


I am trying to combine several matrices into one matrix in parallel mode for
MPIDense.

Assuming combing A1, A2 into B

I would like to use

"MatGetArray() gets the local matrix of A1 and A2, MatSetValues() inserts
the local matrix into B"

I have checked the mail list, I got the following discussion

"We do not have such function.
You can create a new matrix C of size m x (n1 + n2),
and do a loop:
for each row:
 MatGetRow(A, row,...)
 MatSetValues(C,1,&row,...)
 MatGetRow(B, )
 MatSetValues(C,1,&row,...)

or
 create A and B with the size m x (n1 + n2),
and get B=A+B by calling MatAXPY(),

Hong
- Hide quoted text -

On Wed, 19 Sep 2007, Alejandro Garzon wrote:

>
> Hi, Is there a function to combine two matrices, sizes m x n1 and m x n2,
in a
> single matrix size m x (n1 + n2) or the analog case for rows? Thanks.
>
> Alejandro.
>
>

"

To the first method Hong proposed, MatGetRow() just get the local row of the
matrix, right? it should be slower than getting the local marix regarding
MatSetValues(), right? Do you have any comments about the above and any
better advice for matrix combination? thanks a lot.

Regards,

Yujie
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20090102/555db57e/attachment.htm>


More information about the petsc-users mailing list