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

RenZhengYong renzhengyong at gmail.com
Tue May 31 08:29:06 CDT 2011

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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20110531/fda0a0ae/attachment.htm>

More information about the petsc-users mailing list