PetscErrorCode PETSCSNES_DLLEXPORT SNESLineSearchSetPostCheck(SNES snes,PetscErrorCode (*func)(SNES,Vec,Vec,Vec,void*,PetscTruth*,PetscTruth*),void *checkctx)
snes | - nonlinear context obtained from SNESCreate() | |
func | - pointer to function | |
checkctx | - optional user-defined context for use by step checking routine |
Collective on SNES
int func (SNES snes, Vec x,Vec y,Vec w,void *checkctx, PetscTruth *changed_y,PetscTruth *changed_w)where func returns an error code of 0 on success and a nonzero on failure.
snes | - nonlinear context | |
checkctx | - optional user-defined context for use by step checking routine | |
x | - previous iterate | |
y | - new search direction and length | |
w | - current candidate iterate |
y | - search direction (possibly changed) | |
w | - current iterate (possibly modified) | |
changed_y | - indicates search direction was changed by this routine | |
changed_w | - indicates current iterate was changed by this routine |
Notes: All line searches accept the new iterate computed by the line search checking routine.
Only one of changed_y and changed_w can be PETSC_TRUE
On input w = x + y
SNESLineSearchNo() and SNESLineSearchNoNorms() (1) compute a candidate iterate u_{i+1}, (2) pass control to the checking routine, and then (3) compute the corresponding nonlinear function f(u_{i+1}) with the (possibly altered) iterate u_{i+1}.
SNESLineSearchQuadratic() and SNESLineSearchCubic() (1) compute a candidate iterate u_{i+1} as well as a candidate nonlinear function f(u_{i+1}), (2) pass control to the checking routine, and then (3) force a re-evaluation of f(u_{i+1}) if any changes were made to the candidate iterate in the checking routine (as indicated by flag=PETSC_TRUE). The overhead of this extra function re-evaluation can be very costly, so use this feature with caution!
Level:advanced
Location:src/snes/impls/ls/ls.c
Index of all SNES routines
Table of Contents for all manual pages
Index of all manual pages