<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:12pt"><div><span>Jed,</span></div><div><span></span> </div><div><span>What about MatCreateSeqAIJWithArrays? Is it also implemented by looping over<br clear="none">the rows calling MatSetValues?</span></div><div><span></span> </div><div><span>My CRS matrix is constructed in the master processor when using a parallel solver. Do I have to manually partition it (using metis, for instance) and distribute it to all processors using MPI, or PETSc has any subroutines to do this job?</span></div><div><span></span> </div><div><span>Thanks,</span></div><div><span>Qin</span></div><div style="display: block;" class="yahoo_quoted"> <br> <br> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 12pt;"> <div style="font-family: HelveticaNeue,
Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 12pt;"> <div dir="ltr"> <font size="2" face="Arial"> On Thursday, October 31, 2013 3:50 PM, Jed Brown <jedbrown@mcs.anl.gov> wrote:<br> </font> </div> <div class="y_msg_container">Qin Lu <<a href="mailto:lu_qin_2000@yahoo.com" shape="rect" ymailto="mailto:lu_qin_2000@yahoo.com">lu_qin_2000@yahoo.com</a>> writes:<div id="yqtfd66247" class="yqt7565185694"><br clear="none"><br clear="none">> Jed, Thanks a lot for your nice suggestions. The CRS matrix has<br clear="none">> already been created by the program and I don't want to change that,<br clear="none">> do you mean I should read the arrays (i, j, a) and set coefficients<br clear="none">> row by row using MatSetValues? Will it be much slower than passing the<br clear="none">> arrays directly to MatCreateSeqAIJWithArrays or<br clear="none">> MatCreateMPIAIJWithArrays, especially when
the matrix is big?</div><br clear="none"><br clear="none">Are your *parallel* matrices already assembled in that form (which is<br clear="none">not suitable to compute with)?<br clear="none"><br clear="none">In any case, MatCreateMPIAIJWithArrays is *implemented* by looping over<br clear="none">the rows calling MatSetValues. The best is to generate the matrix by<br clear="none">row or element and insert at that time, but that is mostly for memory<br clear="none">reasons. Copying the entries by row is not that expensive.<br><br></div> </div> </div> </div> </div></body></html>