[petsc-users] MatCreateComposite

Matthew Knepley knepley at gmail.com
Wed Oct 24 18:38:19 CDT 2012


On Wed, Oct 24, 2012 at 7:32 PM, Nachiket Gokhale <gokhalen at gmail.com>wrote:

> I have matrices K and M  and I am trying to create the matrix
>
> D = K -  (w^2) M    where w is a scalar.
>
> I am trying to do this using matscale of M and then using MatComposite
> and MatCompositeMerge.  However,  I am not clear about the
> documentation of MatCreateComposite.
>
>
> http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatCreateComposite.html
>
> It says the output parameter is A, however I don't see A in the call.
> Perhaps the output is Mat?  Also, the documentation says that nmat is
> the number of matrices to put in, but I see only one argument - does
> this function take variable number of arguments? I haven't seen Petsc
> functions like this in the past ...
>

The argument mats in an array. That is why you need nmat. You put both K
and M in
the array.

   Matt


>
> Also, the call in the example seems ex9.c is
>
>  67:     MatCreateComposite(PETSC_COMM_WORLD,3,A,&B);
>
> So, there are three matrices to put in but only one (A) is put in.  I
> don't quite understand this either.
>
> Any help would be appreciated,
>
> Thanks,
>
> -Nachiket
>



-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20121024/a5c550d9/attachment-0001.html>


More information about the petsc-users mailing list