static char help[] = "Creates a matrix, inserts some values, and tests MatCreateSubMatrices() and MatZeroEntries().\n\n"; #include int main(int argc,char **argv) { Mat mat,submat,submat1,*submatrices; PetscInt m = 10,n = 10,i = 4,tmp,rstart,rend; IS irow,icol; PetscScalar value = 1.0; PetscViewer sviewer; PetscBool allA = PETSC_FALSE; PetscCall(PetscInitialize(&argc,&argv,(char*)0,help)); PetscCall(PetscViewerPushFormat(PETSC_VIEWER_STDOUT_WORLD,PETSC_VIEWER_ASCII_COMMON)); PetscCall(PetscViewerPushFormat(PETSC_VIEWER_STDOUT_SELF,PETSC_VIEWER_ASCII_COMMON)); PetscCall(MatCreate(PETSC_COMM_WORLD,&mat)); PetscCall(MatSetSizes(mat,PETSC_DECIDE,PETSC_DECIDE,m,n)); PetscCall(MatSetFromOptions(mat)); PetscCall(MatSetUp(mat)); PetscCall(MatGetOwnershipRange(mat,&rstart,&rend)); for (i=rstart; i