static char help[] = "Tests matrix factorization. Note that most users should\n\ employ the KSP interface to the linear solvers instead of using the factorization\n\ routines directly.\n\n"; #include int main(int argc,char **args) { Mat C,LU; MatInfo info; PetscInt i,j,m,n,Ii,J; PetscScalar v,one = 1.0; IS perm,iperm; Vec x,u,b; PetscReal norm,fill; MatFactorInfo luinfo; PetscCall(PetscInitialize(&argc,&args,(char*)0,help)); PetscOptionsBegin(PETSC_COMM_WORLD,NULL,"Mat test ex7 options","Mat"); m = 3; n = 3; fill = 2.0; PetscCall(PetscOptionsInt("-m","Number of rows in grid",NULL,m,&m,NULL)); PetscCall(PetscOptionsInt("-n","Number of columns in grid",NULL,n,&n,NULL)); PetscCall(PetscOptionsReal("-fill","Expected fill ratio for factorization",NULL,fill,&fill,NULL)); PetscOptionsEnd(); /* Create the matrix for the five point stencil, YET AGAIN */ PetscCall(MatCreate(PETSC_COMM_SELF,&C)); PetscCall(MatSetSizes(C,PETSC_DECIDE,PETSC_DECIDE,m*n,m*n)); PetscCall(MatSetFromOptions(C)); PetscCall(MatSetUp(C)); for (i=0; i0) {J = Ii - n; PetscCall(MatSetValues(C,1,&Ii,1,&J,&v,INSERT_VALUES));} if (i0) {J = Ii - 1; PetscCall(MatSetValues(C,1,&Ii,1,&J,&v,INSERT_VALUES));} if (j