MatCompositeSetMergeType — PETSc 3.21.4 documentation

Skip to main content
`Ctrl`+`K`

# MatCompositeSetMergeType

Sets order of `MatCompositeMerge()`.

## Synopsis

    #include "petscmat.h"
    PetscErrorCode MatCompositeSetMergeType(Mat mat, MatCompositeMergeType type)

Logically Collective

## Input Parameters

- mat - the composite matrix

- type - `MAT_COMPOSITE_MERGE RIGHT` (default) to start merge from right with the first added matrix (mat[0]), `MAT_COMPOSITE_MERGE_LEFT` to start merge from left with the last added matrix (mat[nmat-1])

## Note

The resulting matrix is the same regardless of the `MatCompositeMergeType`. Only the order of operation is changed. If set to `MAT_COMPOSITE_MERGE_RIGHT` the order of the merge is mat[nmat-1](mat[nmat-2](…*(mat[1]*mat[0]))) otherwise the order is (((mat[nmat-1]*mat[nmat-2])mat[nmat-3])…)*mat[0].

## See Also

Matrices, `Mat`, `MatCreateComposite()`, `MatCompositeMerge()`, `MATCOMPOSITE`

## Level

advanced

## Location

src/mat/impls/composite/mcomposite.c

## Examples

src/mat/tutorials/ex9.c

## Implementations

MatCompositeSetMergeType_Composite() in src/mat/impls/composite/mcomposite.c

Index of all Mat routines
Table of Contents for all manual pages
Index of all manual pages