petsc-3.15.0 2021-04-05
Report Typos and Errors


indicates that SNES should use matrix free finite difference matrix vector products internally to apply the Jacobian.


#include "petscsnes.h"  
PetscErrorCode  SNESSetUseMatrixFree(SNES snes,PetscBool mf_operator,PetscBool mf)
Collective on SNES

Input Parameters

snes - SNES context
mf_operator - use matrix-free only for the Amat used by SNESSetJacobian(), this means the user provided Pmat will continue to be used
mf - use matrix-free for both the Amat and Pmat used by SNESSetJacobian(), both the Amat and Pmat set in SNESSetJacobian() will be ignored

Options Database

-snes_mf - use matrix free for both the mat and pmat operator
-snes_mf_operator - use matrix free only for the mat operator
-snes_fd_color - compute the Jacobian via coloring and finite differences.
-snes_fd - compute the Jacobian via finite differences (slow)


SNES supports three approaches for computing (approximate) Jacobians: user provided via SNESSetJacobian(), matrix free, and computing explictly with finite differences and coloring using MatFDColoring. It is also possible to use automatic differentiation and the MatFDColoring object.

See Also

SNESGetUseMatrixFree(), MatCreateSNESMF(), SNESComputeJacobianDefaultColor()




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