SNESSetGradient

Sets the gradient evaluation routine and gradient vector for use by the SNES routines.

Synopsis

int SNESSetGradient(SNES snes,Vec r,int (*func)(SNES,Vec,Vec,void*),void *ctx)
Collective on SNES

Input Parameters

snes - the SNES context
func - function evaluation routine
ctx - optional user-defined context for private data for the gradient evaluation routine (may be PETSC_NULL)
r - vector to store gradient value

Calling sequence of func

    func (SNES, Vec x, Vec g, void *ctx);

x - input vector
g - gradient vector
ctx - optional user-defined gradient context

Notes

SNESSetMinimizationFunction() is valid for SNES_UNCONSTRAINED_MINIMIZATIONmethods only. An analogous routine for SNES_NONLINEAR_EQUATIONS methods isSNESSetFunction().

Keywords

SNES, nonlinear, set, function

See Also

SNESGetGradient(), SNESComputeGradient(), SNESSetHessian(),
SNESSetMinimizationFunction(),

Location: src/snes/interface/snes.c
SNES Index
Table of Contents