[petsc-users] Mat indices

Barry Smith bsmith at mcs.anl.gov
Sun Sep 21 10:57:09 CDT 2014


  Mat indices always start with 0 in global indexing used by MatSetValues, MatSetValuesBlocked

  With “local orderings” on can chose to use whatever indexing makes sense for your local ordering, this is used with MatSetValuesLocal(), MatSetValuesBlockedLocal().

   Barry

On Sep 21, 2014, at 10:35 AM, Feng Shi <fshi at fit.edu> wrote:

> 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?
> 
> Thank you in advance!
> 
> Best regards,
> 
> Feng



More information about the petsc-users mailing list