TaoGetTerm — PETSc 3.25.0 documentation

Skip to main content
`Ctrl`+`K`

# TaoGetTerm

Get the entire objective function of the `Tao` as a single `TaoTerm` in the form \(\alpha f(Ax; p)\), where \(\alpha\) is a scaling coefficient, \(f\) is a `TaoTerm`, \(A\) is an (optional) map and \(p\) are the parameters of \(f\).

## Synopsis

    #include "petsctao.h"
    PetscErrorCode TaoGetTerm(Tao tao, PetscReal *scale, TaoTerm *term, Vec *params, Mat *map)

Not collective

## Input Parameter

- tao - a `Tao` context

## Output Parameters

- scale - the scale of the term

- term - a `TaoTerm` for the real-valued function defining the objective

- params - the vector of parameters for `term`, or `NULL` if no parameters were specified for `term`

- map - a map from the solution space of `tao` to the solution space of `term`, if `NULL` then the map is the identity

## Notes

If the objective function was defined by providing function callbacks directly to `Tao` (for example, with `TaoSetObjectiveAndGradient()`), then `TaoGetTerm` will return a `TaoTerm` with the type `TAOTERMCALLBACKS` that encapsulates those functions.

If multiple `TaoTerms` were provided to `Tao` via, for example, `TaoAddTerm()`, or in combination with giving functions directly to `Tao`, then the type `TAOTERMSUM` is returned.

## See Also

TAO: Optimization Solvers, `Tao`, `TaoTerm`, `TAOTERMSUM`, `TaoAddTerm()`

## Level

intermediate

## Location

src/tao/interface/taosolver.c

## Examples

src/tao/unconstrained/tutorials/elastic_net_regularization.c

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