TaoLineSearchComputeObjectiveAndGradient — PETSc 3.25.4 documentation

Skip to main content
`Ctrl`+`K`

# TaoLineSearchComputeObjectiveAndGradient

Computes the objective function value at a given point

## Synopsis

    #include "petsctaolinesearch.h"
    PetscErrorCode TaoLineSearchComputeObjectiveAndGradient(TaoLineSearch ls, Vec x, PetscReal *f, Vec g)

Collective

## Input Parameters

- ls - the `TaoLineSearch` context

- x - input vector

## Output Parameters

- f - Objective value at `x`

- g - Gradient vector at `x`

## Note

`TaoLineSearchComputeObjectiveAndGradient()` is typically used within line searches so most users would not generally call this routine themselves.

## See Also

TAO: Optimization Solvers, `Tao`, `TaoLineSearch`, `TaoLineSearchComputeGradient()`, `TaoLineSearchSetObjectiveRoutine()`

## Level

developer

## Location

src/tao/linesearch/interface/taolinesearch.c

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