1 2 static char help[] = "Tests MatConvert() from SeqDense to SeqAIJ \n\n"; 3 4 #include <petscmat.h> 5 6 int main(int argc,char **args) 7 { 8 Mat A,C; 9 PetscInt n = 10; 10 11 PetscFunctionBeginUser; 12 PetscCall(PetscInitialize(&argc,&args,(char*)0,help)); 13 PetscCall(MatCreateSeqDense(PETSC_COMM_WORLD,n,n,NULL,&A)); 14 PetscCall(MatConvert(A,MATSEQDENSE,MAT_INITIAL_MATRIX,&C)); 15 PetscCall(MatView(C,NULL)); 16 PetscCall(MatDestroy(&A)); 17 PetscCall(MatDestroy(&C)); 18 PetscCall(PetscFinalize()); 19 return 0; 20 } 21 22 /*TEST 23 24 test: 25 26 TEST*/ 27