<div dir="ltr"><div>Add two rows 2 ,4, and each row has three nonzeros at column 3, 7, 9</div><div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><font face="monospace">m=2;</font></div><div><font face="monospace">n=3;</font></div><div><font face="monospace">idxm[] = {2, 4};</font></div><div><font face="monospace">idxn[] = {3, 7, 9};</font></div><div><font face="monospace">v[6] = {0.1, 0.2, ....};</font></div><div><font face="monospace">MatSetValues(mat, m, idxm, n, idxn,v, INSERT_VALUES);</font></div></blockquote></div><br clear="all"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">--Junchao Zhang</div></div></div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Apr 13, 2020 at 9:59 AM Bin Liu <<a href="mailto:lbllm2018@hotmail.com">lbllm2018@hotmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div lang="EN-SG">
<div>
<p class="MsoNormal"><span lang="EN-US">Hi all,<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">I know how to insert values in one row into the matrix via routine “MatSetValues”. I understand I logically should be able to insert multiple rows into the matrix with one call of “MatSetValues”. However, I am not sure
how to do it. I searched in the PETSc mail list and did not find a relevant question answered before. Could anyone help me and give me a simple example code?<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">Regards<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">B. <u></u><u></u></span></p>
</div>
</div>
</blockquote></div>