[petsc-users] MatMult a MatNest and a Vec

Jed Brown jedbrown at mcs.anl.gov
Fri Sep 30 12:08:38 CDT 2011


On Fri, Sep 30, 2011 at 10:51, Hui Zhang <mike.hui.zhang at hotmail.com> wrote:

> Do you know what type of the resulting vector y by MatMult of a MatNest A
> and a Vec x, i.e. y = Ax?
>

MatMult does not change the types of vectors. This function works with any
types.

Note, however, that many Vec operations require all arguments to have the
same type, so you can't freely mix native Vec with VecNest. I don't
recommend using VecNest unless you have a very specific use case and can
explain to me why you should use it. (I do recommend using MatNest, but
generally with the MatGetLocalSubMatrix() so you don't depend on it---I
always try to avoid depending on implementations.)


> Because after that I want to modify a SubVec of the result y. If it is a
> VectNest, I think
> VecNestGetSubVec should be used but not VecGetSubVector.
>

This is why VecNest implements VecGetSubVector (see VecGetSubVector_Nest).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20110930/dabc9f48/attachment.htm>


More information about the petsc-users mailing list