TaoTermComputeObjectiveAndGradient — PETSc 3.25.1 documentation

Skip to main content
`Ctrl`+`K`

# TaoTermComputeObjectiveAndGradient

Evaluate both the value and gradient of a `TaoTerm` for a given set of solution vector and parameter vector

## Synopsis

    #include "petsctao.h"
    PetscErrorCode TaoTermComputeObjectiveAndGradient(TaoTerm term, Vec x, Vec params, PetscReal *value, Vec g)

Collective

## Input Parameters

- term - a `TaoTerm` representing a parametric function \(f(x; p)\)

- x - the solution variable \(x\) in \(f(x; p)\)

- params - the parameters \(p\) in \(f(x; p)\) (may be NULL if the term is not parametric)

## Output Parameters

- value - the value of \(f(x; p)\)

- g - the value of \(\nabla_x f(x; p)\)

## See Also

TaoTerm: composable objective function terms, `TaoTerm`, `TaoTermComputeObjective()`, `TaoTermComputeGradient()`, `TaoTermComputeHessian()`, `TaoTermShellSetObjectiveAndGradient()`

## Level

developer

## Location

src/tao/term/interface/taoterm.c

## Implementations

TaoTermComputeObjectiveAndGradient_Callbacks() in src/tao/term/impls/callbacks/taotermcallbacks.c
TaoTermComputeObjectiveAndGradient_Halfl2squared() in src/tao/term/impls/halfl2squared/taotermhalfl2squared.c
TaoTermComputeObjectiveAndGradient_L1() in src/tao/term/impls/l1/taoterml1.c
TaoTermComputeObjectiveAndGradient_Quadratic() in src/tao/term/impls/quadratic/taotermquadratic.c
TaoTermComputeObjectiveAndGradient_Test() in src/tao/term/impls/shell/tests/ex1.c
TaoTermComputeObjectiveAndGradient_Sum() in src/tao/term/impls/sum/taotermsum.c

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