:orphan: # TaoIsObjectiveAndGradientDefined Checks to see if the user has declared a joint objective/gradient routine. Useful for determining when it is appropriate to call `TaoComputeObjective()` or `TaoComputeObjectiveAndGradient()` ## Synopsis ``` #include "petsctao.h" PetscErrorCode TaoIsObjectiveAndGradientDefined(Tao tao, PetscBool *flg) ``` Not Collective ## Input Parameter - ***tao -*** the `Tao` context ## Output Parameter - ***flg -*** `PETSC_TRUE` if function routine is set by user, `PETSC_FALSE` otherwise ## See Also [](ch_tao), `TaoSetObjectiveAndGradient()`, `TaoIsObjectiveDefined()`, `TaoIsGradientDefined()` ## Level developer ## Location src/tao/interface/taosolver_fg.c --- [Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/tao/interface/taosolver_fg.c) [Index of all Tao routines](index.md) [Table of Contents for all manual pages](/manualpages/index.md) [Index of all manual pages](/manualpages/singleindex.md)