[petsc-users] MatSetValues: reorder the values

Matthew Knepley knepley at gmail.com
Sun May 27 06:55:45 CDT 2012


On Sun, May 27, 2012 at 9:01 AM, Hui Zhang <mike.hui.zhang at hotmail.com>wrote:

> Also, in the case that only a *subset* of v[] is used, the new function
> sounds easy to me.
>

The problem here is that this is one of the most used functions in PETSc.
Thus we want to
keep it is simple and fast as possible. Another level of indirection slows
it down, and having
a parameter most people do not use is confusing. I suggest you write this
wapper for your
own code and see how it works out.

   Matt


> Current MatSetValues is
>
> MatSetValues(Mat mat,PetscInt m,const PetscInt idxm[],PetscInt n,const PetscInt idxn[],const PetscScalar v[],InsertMode addv)
>
> I want something like
>
> MatSetValues(Mat mat,PetscInt m,const PetscInt idxm[],PetscInt n,const PetscInt idxn[],const PetscScalar v[], const PetscInt idxv[], InsertMode addv)
>
> -----------------------
> add a new parameter
>
> such that the values v[0..m*n] are first reordered to v[idxv[0..m*n]]
> before set to the mat.
> We may first do permutation on v before passing to current MatSetValues.
> But won't the
> new function be easier to use?
>
> In the case that idxm[], idxn[] are obtained from a certain application ordering
> but not the ordering of v[], I think I need the new function.
>
> Of course, this new function sounds unnecessary because reordering v is
> equivalent to reordering
> idxm[] and idxn[]. But the second method seems not an easy task to me, is
> it?
>
> Thanks!
>
>
>
>
>


-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120527/2ee00d08/attachment.html>


More information about the petsc-users mailing list