[petsc-users] Mat indices

Jed Brown jed at jedbrown.org
Sun Sep 21 10:55:02 CDT 2014


Feng  Shi <fshi at fit.edu> writes:

> Hi all,
>
> When setting the Mat indices, like the example: src/ts/examples/tutorials/ex10, I noticed that on line
>
> 508:     col[0] = i-1;
> 509:     col[1] = i;
> 510:     col[2] = i+1<info.mx ? i+1 : -1;
> 511:     MatSetValuesBlocked<http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatSetValuesBlocked.html#MatSetValuesBlocked>(B,1,&i,3,col,&K[0][0],INSERT_VALUES<http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Sys/INSERT_VALUES.html#INSERT_VALUES>);
>
> How about the case that when i=0, then col[0]=-1 and i=info.mx then col[2]=-1?
> My question is, is the Mat default indices starting from -1?

No, matrix insertion ignores negative indices.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20140921/6c99500c/attachment.pgp>


More information about the petsc-users mailing list