[petsc-users] ADDing a row to another one

Jed Brown jed at 59A2.org
Thu Dec 31 09:05:07 CST 2009


On Thu, 31 Dec 2009 13:05:37 +0000 (GMT), "Sr. Yo" <ventejuy at yahoo.es> wrote:
> Hi all,
> I'm trying to ADD(sum) a row into another on sparce matrix. I was looking for a function on PETSC documentation but no luck, so now a get the entire row to a PetscScalar and them ADD it to another row. It works but is slow, not elegant and no good for a sparce matrix. So, is there a smart way to do this?.

  MatGetRow(A,source_row,&ncols,&cols,&vals);
  MatSetValues(A,1,&dest_row,ncols,cols,vals,ADD_VALUES);
  MatRestoreRow(A,source_row,&ncols,&cols,&vals);

http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/Mat/MatGetRow.html

Jed


More information about the petsc-users mailing list