[petsc-users] MatSetValues: reorder the values

2012-05-27 Thread Hui Zhang
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

[petsc-users] MatSetValues: reorder the values

2012-05-27 Thread Hui Zhang
Also, in the case that only a *subset* of v[] is used, the new function sounds easy to me. 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

[petsc-users] MatSetValues: reorder the values

2012-05-27 Thread Matthew Knepley
On Sun, May 27, 2012 at 9:01 AM, Hui Zhang mike.hui.zhang at hotmail.comwrote: 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

[petsc-users] MatSetValues: reorder the values

2012-05-27 Thread Dmitry Karpeev
Have you looked at MatSetValuesLocal() http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatSetValuesLocal.html? That routine might be close enough to what you need. Dmitry. On Sun, May 27, 2012 at 4:01 AM, Hui Zhang mike.hui.zhang at hotmail.comwrote: Also, in the case that only

[petsc-users] MatSetValues: reorder the values

2012-05-27 Thread Hui Zhang
Thanks for the hint! I should your advice. On May 27, 2012, at 2:12 PM, Dmitry Karpeev wrote: Have you looked at MatSetValuesLocal() http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatSetValuesLocal.html? That routine might be close enough to what you need. Dmitry. On

[petsc-users] MatSetValues: reorder the values

2012-05-27 Thread Hui Zhang
Since the values I want to take from v[] are not contiguous in v[], I found even with MatSetValuesLocal I can not avoid to make a copy of the values(that I want to take) in a new array vnew[]. On May 27, 2012, at 2:12 PM, Dmitry Karpeev wrote: Have you looked at MatSetValuesLocal()

[petsc-users] MatSetValues: reorder the values

2012-05-27 Thread Barry Smith
On May 27, 2012, at 10:06 AM, Hui Zhang wrote: Since the values I want to take from v[] are not contiguous in v[], I found even with MatSetValuesLocal I can not avoid to make a copy of the values(that I want to take) in a new array vnew[]. That extra copy is inexpensive compared to

[petsc-users] MatSetValues: reorder the values

2012-05-27 Thread Mohammad Mirzadeh
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? Why not use a single AO object to hold the mapping between PETSc mapping and your maping? Seems to me that the

[petsc-users] MatSetValues: reorder the values

2012-05-27 Thread Hui Zhang
On May 27, 2012, at 8:58 PM, Mohammad Mirzadeh wrote: 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? Why not use a single AO object to hold the