PetscErrorCode MatCreateProd(MPI_Comm comm,PetscInt nmat,const Mat *mats,Mat *mat)Collective on MPI_Comm
| comm | - MPI communicator | |
| nmat | - number of matrices to put in | |
| mats | - the matrices |
| A | - the matrix |
MatCreate(comm,&mat);
MatSetType(mat,MATPROD);
MatCompositeAddMat(mat,mats[0]);
....
MatCompositeAddMat(mat,mats[nmat-1]);
MatAssemblyBegin(mat,MAT_FINAL_ASSEMBLY);
MatAssemblyEnd(mat,MAT_FINAL_ASSEMBLY);
For the multiplicative form the product is mat[nmat-1]*mat[nmat-2]*....*mat[0]