[petsc-users] ADDing a row to another one

Bentejui Medina ventejuy at yahoo.es
Sun Jan 3 15:19:17 CST 2010


Thanks. Really faster now.



----- Mensaje original ----
De: Jed Brown <jed at 59A2.org>
Para: Sr. Yo <ventejuy at yahoo.es>; PETSc users list <petsc-users at mcs.anl.gov>; petsc-users at mcs.anl.gov
Enviado: jue,31 diciembre, 2009 15:05
Asunto: Re: [petsc-users] ADDing a row to another one

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