<div dir="ltr"><div dir="ltr"><div>Add Matt mentioned, with ADD_VALUES, the values will be added. But with INSERT_VALUES, if it is a sequential vector (VECSEQ), it will overwrite with the last value; but if it is an MPI parallel vector (VECMPI), it is undetermined, as you could not even define "which is the last" (assuming duplicate indices over processes)</div><div><br></div></div><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Tue, Jan 14, 2025 at 8:32 AM Matthew Knepley <<a href="mailto:knepley@gmail.com">knepley@gmail.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 dir="ltr"><div dir="ltr">On Tue, Jan 14, 2025 at 9:06 AM Mark Adams <<a href="mailto:mfadams@lbl.gov" target="_blank">mfadams@lbl.gov</a>> wrote:</div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">INSERT_VALUES is clearly an error, but we can't check that easily so you will probably just get the last value, and ADD_VALUES should work.</div></blockquote><div><br></div><div>For INSERT_VALUES, it will overwrite with the last value. For ADD_VALUES, it will add.</div><div><br></div><div> Thanks,</div><div><br></div><div> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Mark</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jan 14, 2025 at 8:20 AM Venkata Narayana Sarma Dhavala <<a href="mailto:dhavala@udel.edu" target="_blank">dhavala@udel.edu</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 dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><p>Dear PETSc Development Team,</p><p>I hope this message finds you well. I am currently working with the VecSetValues() function in PETSc, and I have a question regarding its behavior when there are duplicate indices in the input array.</p><p>PetscErrorCode VecSetValues(Vec x, PetscInt ni, const PetscInt ix[], const PetscScalar y[], InsertMode iora)</p><p>Specifically, what is the expected behavior if the ix[] array passed to VecSetValues() contains duplicate indices? Does the function overwrite the value at those indices, or does it handle duplicates differently depending on the insert mode (INSERT_VALUES or ADD_VALUES)?</p><p>I would greatly appreciate any clarification on this matter, as it will help me better understand how to manage values when working with potentially repeated indices in the input.</p><p>Thank you for your time and assistance.</p><p>Best regards,</p><p>Narayana Dhavala.</p></div></div></div></div>
</blockquote></div>
</blockquote></div><div><br clear="all"></div><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div><div><br></div><div><a href="https://urldefense.us/v3/__http://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!ZrWqm3ouVJY_jjPcpNhmzIsTmWA-OY60MzKAlKcDJ5o_jUPAhxhaQ3iueKObVE-ZlFN2Au1qH1z2PiuXkG3q$" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>
</blockquote></div></div>