Skip to main content
`Ctrl`+`K`

# TAOTERMCALLBACKS

A `TaoTerm` implementation that accesses the callback functions that have been provided with in `TaoSetObjective()`, `TaoSetGradient()`, `TaoSetObjectiveAndGradient()`, and `TaoSetHessian()`.

## Notes

If you are interested in creating your own term, you should not use this. Use `TAOTERMSHELL` or create your own implementation of `TaoTerm` with `TaoTermRegister()`.

A `TAOTERMCALLBACKS` is always `TAOTERM_PARAMETERS_NONE`, so the `params` argument of `TaoTerm` evaluation routines should always be `NULL`.

A `TAOTERMCALLBACKS` cannot create Hessian matrices; the user needs to pass the Hessian matrices used in algorithms in `TaoSetHessian()`.

## Developer Notes

Internally each `Tao` has a `TaoTerm` of type `TAOTERMCALLBACKS` that is updated by the `Tao` callback routines (`TaoSetObjective()`, `TaoSetGradient()`, `TaoSetObjectiveAndGradient()`, and `TaoSetHessian()`).

The routines that get the user-defined `Tao` callback functions (`TaoGetObjective()`, `TaoGetObjectiveAndGradient()`, `TaoGetGradient()`, `TaoGetHessian()`) will always return those original callbacks, even if the objective function has been changed by `TaoAddTerm()`, so PETSc/TAO should not assume that those callbacks are valid in any library code.

A `TAOTERMCALLBACKS` has a weak-reference to the `Tao` that created it, which may not be the `Tao` currently using it because the term could have been shared using `TaoGetTerm()` and `TaoAddTerm()`.

## See Also

TaoTerm: composable objective function terms, `TaoTerm`, `TaoTermType`

## Level

developer

## Location

src/tao/term/impls/callbacks/taotermcallbacks.c

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