Hello!<br>I am trying to solve A*X = B where A and B are matrices, and then find trace of the resulting matrix X. My approach has been to partition matrix B in column vectors bi and then solve each system A*xi = bi. Then, for all vectors xi I would extract i-th element xi(i) and sum those elements in order to get Trace(X).<br>
Pseudo-code:<br>1) load matrices A and B<br>2) transpose matrix B (so that each right-hand side bi is in the row, as operation MatGetColumnVector is slow)<br>3) set up KSPSolve<br>4) create vector diagonal (in which xi(i) elements will be stored)<br>
5) for each row i of matrix B owned by current process:<br>          - create vector bi by extracting row i from matrix B<br>          - apply KSPsolve to get xi<br>          - insert value xi(i) in diagonal vector (only the process which         <br>
            holds the ith value of vector x(i) should do so)<br>6) sum vector diagonal to get the trace.<br>However, my code (attached, along with the test case) runs fine on one process, but hangs if started on multiple processes. Could you please help me figure out what am I doing wrong?<br>
Also, could you please tell me is it possible to use Cholesky factorization when running on multiple processes (I see that I cannot use it when I set the format of matrix A to MPIAIJ)?<br><br>