petsc-3.7.1 2016-05-15
Report Typos and Errors

MatCreateComposite

Creates a matrix as the sum of zero or more matrices

Synopsis

#include "petscmat.h" 
PetscErrorCode  MatCreateComposite(MPI_Comm comm,PetscInt nmat,const Mat *mats,Mat *mat)
Collective on MPI_Comm Many br

Input Parameters

comm - MPI communicator Many br
nmat - number of matrices to put in Many br
mats - the matrices Many br

Output Parameter

A -the matrix Many br

Many br

Notes

Alternative construction Many br
      MatCreate(comm,&mat);
      MatSetSizes(mat,m,n,M,N);
      MatSetType(mat,MATCOMPOSITE);
      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] Many br

See Also

MatDestroy(), MatMult(), MatCompositeAddMat(), MatCompositeMerge(), MatCompositeSetType(), MatCompositeType

Level:advanced
Location:
src/mat/impls/composite/mcomposite.c
Index of all Mat routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/mat/examples/tutorials/ex9.c.html