how to combine several matrice into one matrix

Barry Smith bsmith at mcs.anl.gov
Fri Apr 18 21:12:00 CDT 2008


    For dense matrices only.

    You can call MatGetArray() on A and then do direct copies of the  
arrays.

   Barry

On Apr 18, 2008, at 8:40 PM, Yujie wrote:

> Hi, everyone
>
> Assuming there are A1(M*N) A2(M*N) A3(M*N), I want to get
>      A1
> A=A2
>      A3
>
> My method is
>
> MatGetArray(A1,&a1);
> MatSetValues(A,a1);
> MatGetArray(A2,&a2);
> MatSetValues(A,a2);
> MatGetArray(A3,&a3);
> MatSetValues(A,a3);
>
> Is there any better methods for it? The above codes are slow. thanks  
> a lot.
>
> Regards,
> Yujie
>
>




More information about the petsc-users mailing list