<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>Thanks for all your clarification!</span></div><div><span></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 Monday, November 4, 2013 11:21 AM, Barry Smith <bsmith@mcs.anl.gov> wrote:<br> </font> </div> <div class="y_msg_container"><br clear="none"> Normally one does not “generate” a single matrix entry at a time. For example with finite elements one generates an element stiffness which is a small dense block of values that need
to be added to the global stiffness matrix. With finite differences one generates a row of the matrix entries at the time. <br clear="none"><br clear="none"> One should then call MatSetValues() to set this collection of entries that have been computed together. Since you have all this collection it would be silly to call MatSetValue() on each.<br clear="none"><br clear="none"> If, for some nonstandard uncommon situation one truly generates one matrix entry at a time then it would be fine to call MatSetValue() with that one entry.<br clear="none"><br clear="none"> Barry<br clear="none"><div id="yqtfd98514" class="yqt2333780023"><br clear="none">On Nov 4, 2013, at 9:01 AM, 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>> wrote:<br clear="none"><br clear="none">> Hello,<br clear="none">> <br clear="none">> I need to set values of a
sparse matrix. Is setting coefficients row by row using MatSetValues more efficient than setting setting coefficient one by one using MatSetValue? Is MatSetValues implemented by looping over each entry of the input array calling MatSetValue?<br clear="none">> <br clear="none">> Thanks a lot for your help,<br clear="none">> Qin<br clear="none"></div><br><br></div> </div> </div> </div> </div></body></html>