Skip to main content
`Ctrl`+`K`

# SNESLineSearchSetFunction

Sets the function evaluation used by the `SNES` line search `

## Synopsis

    #include "petscsnes.h"
    PetscErrorCode SNESLineSearchSetFunction(SNESLineSearch linesearch, PetscErrorCode (*func)(SNES snes, Vec x, Vec f))

## Input Parameters

- linesearch - the `SNESLineSearch` context

- func - function evaluation routine, this is usually the function provided with `SNESSetFunction()`

## Calling sequence of `func`

- snes - the `SNES` with which the `SNESLineSearch` context is associated with

- x - the input vector

- f - the computed value of the function

## Note

By default the `SNESLineSearch` uses the function provided by `SNESSetFunction()` so this is rarely needed

## See Also

SNES: Nonlinear Solvers, `SNES`, `SNESLineSearch`, `SNESGetLineSearch()`, `SNESSetFunction()`

## 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