[petsc-users] mat function: A+A^T

Jed Brown jed at 59A2.org
Wed Jul 21 11:37:14 CDT 2010


On Wed, 21 Jul 2010 12:27:41 -0400, Verena Kuhlemann <vkuhlem at emory.edu> wrote:
> Is there a Mat function that computes A+A^T?
> I couldn't find one, but maybe I missed it.

  /* B = A + A^T */
  MatTranspose(A,MAT_INITIAL_MATRIX,&B);
  MatAXPY(B,1.0,A,DIFFERENT_NONZERO_PATTERN);

You can use SAME_NONZERO_PATTERN if the matrix is structurally
symmetric.

Jed


More information about the petsc-users mailing list