On Sun, May 27, 2012 at 9:01 AM, Hui Zhang <span dir="ltr"><<a href="mailto:mike.hui.zhang@hotmail.com" target="_blank">mike.hui.zhang@hotmail.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word">Also, in the case that only a *subset* of v[] is used, the new function sounds easy to me.</div></blockquote><div><br></div><div>The problem here is that this is one of the most used functions in PETSc. Thus we want to</div>
<div>keep it is simple and fast as possible. Another level of indirection slows it down, and having</div><div>a parameter most people do not use is confusing. I suggest you write this wapper for your</div><div>own code and see how it works out.</div>
<div><br></div><div>   Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><div class="h5"><div><blockquote type="cite">
<div style="word-wrap:break-word"><pre style="line-height:normal;text-indent:0px;letter-spacing:normal;text-align:-webkit-auto;font-variant:normal;text-transform:none;font-style:normal;font-weight:normal;word-spacing:0px">
Current MatSetValues is</pre><pre style="line-height:normal;text-indent:0px;letter-spacing:normal;text-align:-webkit-auto;font-variant:normal;text-transform:none;font-style:normal;font-weight:normal;word-spacing:0px">MatSetValues(Mat mat,PetscInt m,const PetscInt idxm[],PetscInt n,const PetscInt idxn[],const PetscScalar v[],InsertMode addv)</pre>
<pre style="line-height:normal;text-indent:0px;letter-spacing:normal;text-align:-webkit-auto;font-variant:normal;text-transform:none;font-style:normal;font-weight:normal;word-spacing:0px">I want something like</pre><pre style="line-height:normal;text-indent:0px;letter-spacing:normal;text-align:-webkit-auto;font-variant:normal;text-transform:none;font-style:normal;font-weight:normal;word-spacing:0px">
<span style="font-family:SimSun;white-space:normal"><pre style="line-height:normal;text-indent:0px;letter-spacing:normal;text-align:-webkit-auto;font-variant:normal;text-transform:none;font-style:normal;font-weight:normal;word-spacing:0px">
MatSetValues(Mat mat,PetscInt m,const PetscInt idxm[],PetscInt n,const PetscInt idxn[],const PetscScalar v[], const PetscInt idxv[], InsertMode addv)</pre></span><div>         -----------------------</div><div>         add a new parameter</div>
<div><br></div><div>such that the values v[0..m*n] are first reordered to v[idxv[0..m*n]] before set to the mat.</div><div>We may first do permutation on v before passing to current MatSetValues.  But won't the </div>
<div>new function be easier to use? </div><div><br></div><div><span style="font-family:SimSun;white-space:normal"><pre style="line-height:normal;text-indent:0px;letter-spacing:normal;text-align:-webkit-auto;font-variant:normal;text-transform:none;font-style:normal;font-weight:normal;word-spacing:0px">
<div>In the case that idxm[], idxn[] are obtained from a certain application ordering</div><div>but not the ordering of v[], I think I need the new function.</div></pre></span></div><div>Of course, this new function sounds unnecessary because reordering v is equivalent to reordering </div>
<div>idxm[] and idxn[].  But the second method seems not an easy task to me, is it?</div><div><br></div><div>Thanks!  </div><div><br></div></pre><pre style="line-height:normal;text-indent:0px;letter-spacing:normal;text-align:-webkit-auto;font-variant:normal;text-transform:none;font-style:normal;font-weight:normal;word-spacing:0px">
<br></pre><div><br></div></div></blockquote></div><br></div></div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>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<br>