<div dir="ltr"><div> </div><div>Thanks for the answer.</div><div> </div><div>Do you mean get each process's local data and save them in the C array locally, then let the program call MPI_Gather to combine the arrrays on one process?</div>
<div> </div><div>Actuall I am trying to implement block cg method for my research.</div><div>It is like this AX=B, X and B are mxk matrices, A is mxm large sparse marix.</div><div> </div><div>Given initial guess X0, R0=B-AX</div>
<div>P=R0</div><div>for i=1,2,...do</div><div> gamma(i)=inv(Pi(transpose)APi)Pi(transpose)Ri</div><div> X(i+1) = Xi +P(i) gamma(i)</div><div>.....</div><div>.....psi(i) = - inv(Pi(transpose)APi)PiA(transpose)R(i+1)</div>
<div>.....</div><div> </div><div>Since the program store Pi(transpose)APi in MATMPIAJI (beacase I am using MatPtAP call and A is MATMPIAIJ, I have to save the result in MATMPIAIJ for the compatibabilty concern), I need to convert Pi(transpose)APi to MATSEQDENSE to get its inverse.</div>
<div> </div><div>By the way, I also think elemental is a good choice, but I don't how to call its functions from PETSc, could you show me an example (data type conversion from MATMPIAIJ to elemental type, and how can I call elemental function in PETSc code) ?</div>
<div> </div><div>Thanks so much</div><div> </div><div>Cong</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Aug 18, 2013 at 10:12 PM, Jed Brown <span dir="ltr"><<a href="mailto:jedbrown@mcs.anl.gov" target="_blank">jedbrown@mcs.anl.gov</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">Cong Li <<a href="mailto:solvercorleone@gmail.com">solvercorleone@gmail.com</a>> writes:<br>
<br>
> Hi, all<br>
><br>
> Could someone tell me how I can convert a parallel MATDENSE (or MATMPIAIJ)<br>
> matrix to a MATSEQDENSE matrix?<br>
<br>
</div>Get the array and use MPI_Gather. With MATMPIAIJ, you almost certainly<br>
should not compute an explicit inverse.<br>
<div class="im"><br>
> I need this converted sequential matrix for direct solver to get its<br>
> inverse matrix.<br>
<br>
</div>You can do that with Elemental without needing to serialize the matrix<br>
inversion. Also, why do you need an explicit inverse?<br>
</blockquote></div><br></div>