Dear Sir/Madam: Sorry to bother, but I didn't find any information I need to implement matrix-free functions for SNES after a long time search of the manual and sample codes.
Suppose I am solving nonlinear equation systems F(x) = 0, I have two choices: (1) MatCreateMFFD(snes, matJ): This calculate matJ * x with a finite difference scheme. I can create a function to calculate matJ * x, and link it to SNES by SNESSetJacobian. However, I do not prefer this feature because I am calculating the mat-vec product in another way. (2) MatCreateMF(snes, matJ): Here, matJ is not defined explicitly. It is some operations (like mat-vec product). must be linked to SNES, and must be linked to SNES through SNESSetJacobian. For KSP solvers, I know that a matshell type can be created and a mat-vec product can be assigned to matJ in this way: MatCreateShell( ....) MatShellSetOperation(....) KSPSetOperators(ksp, matJ, matJ) How to do the similar operations for SNES if matJ is already created via MatCreateMF? How to define the mat size and mat-vec product? What other operations are required in a customized function in order to link it to SNES via SNESSetJacobian? Thanks a for your help. Yongle Du
