SNESLineSearchPostCheck — PETSc 3.21.4 documentation

Skip to main content
`Ctrl`+`K`

# SNESLineSearchPostCheck

Hook to modify step direction or updated solution after a successful linesearch

## Synopsis

    #include "petscsnes.h"
    PetscErrorCode SNESLineSearchPostCheck(SNESLineSearch linesearch, Vec X, Vec Y, Vec W, PetscBool *changed_Y, PetscBool *changed_W)

Logically Collective

## Input Parameters

- linesearch - The line search context

- X - The last solution

- Y - The step direction

- W - The updated solution, `W = X - lambda * Y` for some lambda

## Output Parameters

- changed_Y - Indicator if the direction `Y` has been changed.

- changed_W - Indicator if the new candidate solution `W` has been changed.

## Note

This calls any function provided with `SNESLineSearchSetPostCheck()` and is called automatically inside the line search routines

## Developer Note

The use of `PetscObjectGetState()` would eliminate the need for the `changed_Y` and `changed_W` arguments to be provided

## See Also

SNES: Nonlinear Solvers, `SNES`, `SNESGetLineSearch()`, `SNESLineSearchPreCheck()`, `SNESLineSearchSetPostCheck()`, `SNESLineSearchGetPostCheck()`, `SNESLineSearchSetPrecheck()`, `SNESLineSearchGetPrecheck()`

## Level

developer

## Location

src/snes/linesearch/interface/linesearch.c

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