# 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



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




## See Also
 `TaoLineSearchComputeGradient()`, `TaoLineSearchComputeObjectiveAndGradient()`, `TaoLineSearchSetObjectiveRoutine()`

## Level
developer

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/linesearch/interface/taolinesearch.c.html#TaoLineSearchComputeObjectiveAndGradient">src/tao/linesearch/interface/taolinesearch.c</A>


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


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