how to extract a subvector?

Yujie recrusader at
Fri Jan 2 13:59:38 CST 2009

thank you very much, Barry. I made a misunderstanding about the parameters
"ix" and "iy".

Further question is after finishing scatter, the subvector will be
redistributed? I mean like matrix, because I get a submatrix, the rows in
some processes will become zero, is the subvector the same with the matrix?


On Fri, Jan 2, 2009 at 11:46 AM, Barry Smith <bsmith at> wrote:

>   VecScatter is for this purpose.
>   Rational: extracting subparts of vectors for ghost points etc takes place
> many times in a simulation; maybe millions.
> Thus separating it into a set-up followed by many uses is a  worthwhile
> optimization. Extracting submatrices occur
> much less often in a simulation, maybe tens, hundreds or thousands of times
> so it is not worth the extra complexity
> of having separate set-up followed by many uses. One could argue that
> uniformity of design means we should have
> handled matrices with a MatScatter concept to parallel the Vec approach,
> but it is too late now :-).
>   Barry
> On Jan 2, 2009, at 1:41 PM, Yujie wrote:
>  Like MatGetSubMatrix(), whether is there a function to get a subvector in
>> parallel mode? I have checked some scatter functios, they don't likely work.
>> thanks a lot.
>> Regards,
>> Yujie
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the petsc-users mailing list