[petsc-users] MatMult a MatNest and a Vec

Jed Brown jedbrown at mcs.anl.gov
Sat Oct 1 08:06:26 CDT 2011


On Sat, Oct 1, 2011 at 03:04, Hui Zhang <mike.hui.zhang at hotmail.com> wrote:

> Thank you, Jed!  I have more questions:
>
> if I do C=A*B with A(or B) of MatNest type and B(or A, resp.) of usual
> type,
> what type will C be of?
>

MatMatMult() is not currently supported for any type combination involving
MatNest.


> And is there any function not supporting MatNest, for example, does LU
> decomposition
> supports MatNest?
>

No, and the only practical way to do so would be to convert it to an AIJ
format.


> Does one sometimes need to convert MatNest to the usual type and how to do
> it?
>

MatConvert() except that case is not written so it won't work yet. I will
write it, it's not difficult, but it hasn't been needed yet.


> The MatNest is useful to me because my matrix is in the form [K1*K2
>  K3*K4].
> I think to construct it as MatNest is easier than setting up Aij.
>

The difficulty to construct them should be about the same. In particular,
you should be able to use identical code to assemble into either format by
building [K1, K3] and [K2; K4]. You can create these matrices (set
dimensions and types, but no values), call MatGetLocalSubMatrix() to address
the "blocks", and call the assembly routines for each block. Then do the
MatMatMult. The assembly part will work for any format, the MatMatMult()
will currently require AIJ (not Nest), but will work as soon as
MatMatMult_Nest() is implemented.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20111001/5653a741/attachment.htm>


More information about the petsc-users mailing list