[petsc-users] question on extracting a column from a matrix

Hong Zhang hzhang at mcs.anl.gov
Tue May 31 14:41:55 CDT 2011

This is virtually SCHUR complement. You may take a look at
petsc-dev/src/ksp/ksp/examples/tests/ex11.c and
petsc-dev/src/ksp/ksp/examples/tests/makefile: runex11


On Tue, May 31, 2011 at 8:29 AM, RenZhengYong <renzhengyong at gmail.com> wrote:
> I have a linear system of equation like
>  [A  B]  [E]= [C]
>  [F  G]  [S]= [D],
> where size of matrix A is NxN, B is NxNs, F is Ns_N, G is Ns_Ns; size of
> vector E is N, S is Ns, C is N and D is N.
> Instead of solving them together, I prefer to solve it by:
> (1) AX=B, AY=C;
> (2) QS=P, Q= G-FX, P=D-FY,
> due to the dense property of G.
> In step (1), I need to extract a new "vec" Bi from "mat" B, according to the
> way of PETSc telling me. My question is that could I do it as follows,
> for a given sparse matrix B, first get transpose of B by "MatTranspose(B,
> MatReuse, B_t); then, form a new "vec" Bi by "MatGetRow(...)"?
> If answer is yes, is it expensive?
> --
> Zhengyong Ren
> AUG Group, Institute of Geophysics
> Department of Geosciences, ETH Zurich
> NO H 47 Sonneggstrasse 5
> CH-8092, Zürich, Switzerland
> Tel: +41 44 633 37561
> e-mail: zhengyong.ren at aug.ig.erdw.ethz.ch
> Gmail: renzhengyong at gmail.com

More information about the petsc-users mailing list