Skip to main content
`Ctrl`+`K`

# TaoTermIsGradientDefined

Whether a standalone gradient operation is defined for this `TaoTerm`

## Synopsis

    #include "petsctao.h"
    PetscErrorCode TaoTermIsGradientDefined(TaoTerm term, PetscBool *is_defined)

Not collective

## Input Parameter

- term - a `TaoTerm`

## Output Parameter

- is_defined - whether the gradient is defined

## Note

This function strictly checks whether a dedicated gradient operation is defined. It does not check whether the gradient could be computed via other operations (e.g., an objective-and-gradient callback or finite differences). `TaoTermComputeGradient()` may still succeed even if this function returns `PETSC_FALSE`, by falling back to `TaoTermComputeObjectiveAndGradient()` or finite-difference approximation.

## See Also

TaoTerm: composable objective function terms, `TaoTerm`, `TaoTermComputeGradient()`, `TaoTermShellSetGradient()`, `TaoTermIsObjectiveDefined()`, `TaoTermIsObjectiveAndGradientDefined()`, `TaoTermIsHessianDefined()`

## Level

developer

## Location

src/tao/term/interface/taoterm.c

## Implementations

TaoTermIsGradientDefined_Callbacks() in src/tao/term/impls/callbacks/taotermcallbacks.c

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