<div dir="ltr">Thanks, Patrick.<div>I think I got it now.</div><div><br></div><div>Cong Li</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Aug 5, 2015 at 3:45 PM, Patrick Sanan <span dir="ltr"><<a href="mailto:patrick.sanan@gmail.com" target="_blank">patrick.sanan@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><span class=""><div><br><br><br></div><div><br>Am 05.08.2015 um 08:23 schrieb Cong Li <<a href="mailto:solvercorleone@gmail.com" target="_blank">solvercorleone@gmail.com</a>>:<br><br></div><blockquote type="cite"><div><div dir="ltr">Hi,<div><br></div><div>I am wondering if it is necessary to call </div><div>MatAssemblyBegin() and MatAssemblyEnd() after MatDuplicate() with the option of MAT_DO_NOT_COPY_VALUES.</div><div>For example, if I have an assembled matrix A, and I call MatDuplicate() to create B, which is a duplication of A. </div><div>Do I need to call MatAssemblyBegin() and MatAssemblyEnd() for B.</div><div><br></div><div>And 2nd question is : </div><div>just after the MatCreateDense() call and before MatAssemblyBegin() and MatAssemblyEnd() calls, can I use MatGetArray() ?</div><div><br></div><div>The 3rd question is: </div><div>before the MatAssemblyBegin() and MatAssemblyEnd() calls, should I use INSERT_VALUES or <span style="font-family:Menlo;font-size:13px">ADD_VALUES for </span>MatSetValues call? And why ?</div><div>Actually I have read the manual, but I still feel confused about the means of INSERT_VALUES and <span style="font-size:13px;font-family:Menlo">ADD_VALUES.</span></div></div></div></blockquote></span>There are a couple of reasons that you need to make these MatAssemblyBegin/End calls:<div>- entries can be set which should be stored on a different process, so these need to be communicated</div><div>- for compressed formats like CSR (as used in MATAIJ and others) the entries need to be processed into their compressed form</div><div>In general, the entries of the matrix are not stored in their "usable" forms until you make the MatAssembleEnd call. Rather they are kept in some easy-to-insert-into intermediate storage. INSERT_VALUES means that old values that might be in the matrix are overwritten , and ADD_VALUES means that the new entries from intermediate storage are added to the old values.</div><div><br></div><div><br></div><div><blockquote type="cite"><div><div dir="ltr"><div><span style="font-size:13px;font-family:Menlo"><br></span></div><div><font face="Menlo">Thanks </font></div><div><font face="Menlo"><br></font></div><div><font face="Menlo">Cong Li</font></div></div>
</div></blockquote></div></div></blockquote></div><br></div>