MatShellSetOperation

Allows user to set a matrix operation for a shell matrix.

Synopsis

int MatShellSetOperation(Mat mat,MatOperation op, void *f)

Input Parameters

mat -the shell matrix
op -the name of the operation
f -the function that provides the operation.

Collective on Mat

Usage

     extern int usermult(Mat,Vec,Vec);
     ierr = MatCreateShell(comm,m,n,M,N,ctx,&A);
     ierr = MatShellSetOperation(A,MATOP_MULT,usermult);

Notes

See the file petsc/include/mat.h for a complete list of matrixoperations, which all have the form MATOP_<OPERATION>, where<OPERATION> is the name (in all capital letters) of theuser interface routine (e.g., MatMult() -> MATOP_MULT).

All user-provided functions should have the same callingsequence as the usual matrix interface routines, since theyare intended to be accessed via the usual matrix interfaceroutines, e.g.,

      MatMult(Mat,Vec,Vec) -> usermult(Mat,Vec,Vec)

Within each user-defined routine, the user should callMatShellGetContext() to obtain the user-defined context that wasset by MatCreateShell().

Keywords

matrix, shell, set, operation

See Also

MatCreateShell(), MatShellGetContext(), MatShellGetOperation()

Location: src/mat/impls/shell/shell.c
Matrix Index
Table of Contents