[petsc-users] create a sparse symmetric matrix
Yifei Li
yifli82 at gmail.com
Thu Aug 9 17:20:00 CDT 2012
Hi all,
I only filled the entries in the upper triangular part of the matrix,
however, I got 0 when I tried to get the value of some entry in the lower
triangular part.
Here's how I do it:
MatCreate(PETSC_COMM_WORLD, &A);
MatSetSizes(A, PETSC_DECIDE, PETSC_DECIDE, n, n);
MatSetType(A, MATSEQSBAIJ);
MatSetUp(A);
// I set the value for the entry at (0, 2)
int i = 2, j = 0;
MatGetValues(A,1,&i,1,&j,values);
Any help is highly appreicated.
Yifei
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120809/cd7f169d/attachment.html>
More information about the petsc-users
mailing list