# SNESComputeObjective
Computes the objective function that has been provided by `SNESSetObjective()` 
## Synopsis
```
PetscErrorCode SNESComputeObjective(SNES snes, Vec X, PetscReal *ob)
```
Collective on snes


## Input Parameters

- ***snes -*** the `SNES` context
- ***X    -*** the state vector



## Output Parameter

- ***ob   -*** the objective value





## See Also
 `SNESLineSearch`, `SNES`, `SNESSetObjective()`, `SNESGetSolution()`

## Level
developer

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/interface/snesob.c.html#SNESComputeObjective">src/snes/interface/snesob.c</A>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/snes/interface/snesob.c)


[Index of all SNES routines](index.md)  
[Table of Contents for all manual pages](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
