static char help[] = "Testing MatCreateSeqBAIJWithArrays() and MatCreateSeqSBAIJWithArrays().\n\n"; #include int main(int argc,char **argv) { Mat A,B,As; const PetscInt *ai,*aj; PetscInt i,j,k,nz,n,asi[]={0,2,3,4,6,7}; PetscInt asj[]={0,4,1,2,3,4,4}; PetscScalar asa[7],*aa; PetscRandom rctx; PetscMPIInt size; PetscBool flg; PetscCall(PetscInitialize(&argc,&argv,(char*)0,help)); PetscCallMPI(MPI_Comm_size(PETSC_COMM_WORLD,&size)); PetscCheck(size == 1,PETSC_COMM_WORLD,PETSC_ERR_WRONG_MPI_SIZE,"This is a uniprocessor example only!"); /* Create a aij matrix for checking */ PetscCall(MatCreateSeqAIJ(PETSC_COMM_SELF,5,5,2,NULL,&A)); PetscCall(PetscRandomCreate(PETSC_COMM_WORLD,&rctx)); PetscCall(PetscRandomSetFromOptions(rctx)); k = 0; for (i=0; i<5; i++) { nz = asi[i+1] - asi[i]; /* length of i_th row of A */ for (j=0; j