int MatShellSetOperation(Mat mat,MatOperation op, void *f)Collective on Mat
mat | - the shell matrix |
op | - the name of the operation |
f | - the function that provides the operation. |
extern int usermult(Mat,Vec,Vec);
ierr = MatCreateShell(comm,m,n,M,N,ctx,&A);
ierr = MatShellSetOperation(A,MATOP_MULT,(void*) usermult);
All user-provided functions should have the same calling sequence as the usual matrix interface routines, since they are intended to be accessed via the usual matrix interface routines, e.g.,
MatMult(Mat,Vec,Vec) -> usermult(Mat,Vec,Vec)
Within each user-defined routine, the user should call MatShellGetContext() to obtain the user-defined context that was set by MatCreateShell().
Level:advanced
Location:src/mat/impls/shell/shell.c
Matrix Index
Table of Contents