petsc-3.4.2 2013-07-02

# SNESObjectiveComputeFunctionDefaultFD

Computes the gradient of a user provided objective

### Synopsis

    PetscErrorCode SNESObjectiveComputeFunctionDefaultFD(SNES snes,Vec X,Vec F,void *ctx)

Collective on SNES

### Input Parameter

| snes | - the SNES context
| X | - the state vector
| ctx | - the (ignored) function context

### Output Parameter

F -the function value

### Options Database Key

| -snes_fd_function_eps | - The differencing parameter
| -snes_fd_function | - Compute function from user provided objective with finite difference

### Notes

SNESObjectiveComputeFunctionDefaultFD is similar in character to SNESComputeJacobianDefault. Therefore, it should be used for debugging purposes only. Using it in conjunction with SNESComputeJacobianDefault is excessively costly and produces a Jacobian that is quite noisy. This is often necessary, but should be done with a grain of salt, even when debugging small problems.

Note that this uses quadratic interpolation of the objective to form each value in the function.

### Keywords

SNES, objective, debugging, finite differences, function

### See Also

SNESSetFunction(), SNESComputeObjective(), SNESComputeJacobianDefault()

Level:advanced
Location: src/snes/interface/snesob.c
Index of all SNES routines
Table of Contents for all manual pages
Index of all manual pages