static char help[] = "Test MatAXPY and SUBSET_NONZERO_PATTERN [-different] [-skip]\n by default subset pattern is used \n\n"; /* A test contributed by Jose E. Roman, Oct. 2014 */ #include int main(int argc,char **args) { PetscErrorCode ierr; Mat A,B,C; PetscBool different=PETSC_FALSE,skip=PETSC_FALSE; PetscInt m0,m1,n=128,i; ierr = PetscInitialize(&argc,&args,(char*)0,help);if (ierr) return ierr; CHKERRQ(PetscOptionsGetBool(NULL,NULL,"-different",&different,NULL)); CHKERRQ(PetscOptionsGetBool(NULL,NULL,"-skip",&skip,NULL)); /* Create matrices A = tridiag(1,-2,1) and B = diag(7); */ CHKERRQ(MatCreate(PETSC_COMM_WORLD,&A)); CHKERRQ(MatCreate(PETSC_COMM_WORLD,&B)); CHKERRQ(MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,n,n)); CHKERRQ(MatSetSizes(B,PETSC_DECIDE,PETSC_DECIDE,n,n)); CHKERRQ(MatSetFromOptions(A)); CHKERRQ(MatSetFromOptions(B)); CHKERRQ(MatSetUp(A)); CHKERRQ(MatSetUp(B)); CHKERRQ(MatGetOwnershipRange(A,&m0,&m1)); for (i=m0;i0) CHKERRQ(MatSetValue(A,i,i-1,-1.0,INSERT_VALUES)); if (i ex172.tmp 2>&1 output_file: output/ex172.out test: suffix: mpibaij nsize: 4 args: -mat_type baij> ex172.tmp 2>&1 output_file: output/ex172.out test: suffix: mpisbaij nsize: 4 args: -mat_type sbaij> ex172.tmp 2>&1 output_file: output/ex172.out test: suffix: sbaij args: -mat_type sbaij> ex172.tmp 2>&1 output_file: output/ex172.out TEST*/