[petsc-users] Mat indices

Feng Shi fshi at fit.edu
Sun Sep 21 10:59:50 CDT 2014


Thank you all for your replies. 

All the best,,

On Sep 21, 2014, at 11:55 AM, "Jed Brown" <jed at jedbrown.org> wrote:

> 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.


More information about the petsc-users mailing list