This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Splitting a vector

+1 vote

Hi everyone!
I have to solve a block-triangular system, so I want to do it with the block equivalent of backward substitution. In formulae,
$$ \begin{bmatrix}
A & \newline
B & C
\end{bmatrix}
\begin{pmatrix}
u_A \newline
u_B
\end{pmatrix} =
\begin{pmatrix}
b_A \newline
b_B
\end{pmatrix} $$

in which I first solve $$ A u_A = b_A $$ and then solve
$$ C u_B = b_B - B u_A. $$

I am in a PETScUserPreconditioner subclass [writing in C++, planning to run in parallel] so all I have are the PETScVectors $$ u, b. $$
I know how to build the single matrices, but I don't see how to split vectors $u$ and $b$ into $u_A,u_B,b_A,b_B$. I saw there are get and set methods, but I don't understand how to use them and what is a dolfin::la_index.

What's my best option? I would really like to avoid manual MPI communications, but I can do that if that's the only way.

Thanks for help!
Massimiliano

asked Oct 29, 2014 by Massimiliano Leoni FEniCS User (1,760 points)
edited Oct 29, 2014 by Massimiliano Leoni

1 Answer

0 votes

So far I only came up with a crappy workaround:
$$ \begin{bmatrix}
I_{n_A} & O_{n_A \times n_B}
\end{bmatrix}
\begin{pmatrix}
u_A \newline
u_B
\end{pmatrix} =
\begin{pmatrix}
u_A
\end{pmatrix} $$
but this way I pay the price of two matrix products for something that should be free

answered Oct 29, 2014 by Massimiliano Leoni FEniCS User (1,760 points)
...