Skip to main content
`Ctrl`+`K`

# SNESComputeObjective

Computes the objective function that has been provided by `SNESSetObjective()`

## Synopsis

    #include "petscsnes.h"
    PetscErrorCode SNESComputeObjective(SNES snes, Vec X, PetscReal *ob)

Collective

## Input Parameters

- snes - the `SNES` context

- X - the state vector

## Output Parameter

- ob - the objective value

## Notes

`SNESComputeObjective()` is typically used within line-search routines, so users would not generally call this routine themselves.

When solving for \(F(x) = b\), this routine computes \(objective(x) - x^T b\) where \(objective(x)\) is the function provided with `SNESSetObjective()`

## See Also

SNES: Nonlinear Solvers, `SNESLineSearch`, `SNES`, `SNESSetObjective()`, `SNESGetSolution()`

## Level

developer

## Location

src/snes/interface/snesob.c

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