[petsc-users] MatMult a MatNest and a Vec

Hui Zhang mike.hui.zhang at hotmail.com
Sat Oct 1 03:04:04 CDT 2011

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?  
And is there any function not supporting MatNest, for example, does LU decomposition 
supports MatNest? 
Does one sometimes need to convert MatNest to the usual type and how to do it? 
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.

Best wishes,

On Sep 30, 2011, at 7:08 PM, Jed Brown wrote:

> 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/20111001/d366a6e5/attachment.htm>

More information about the petsc-users mailing list