:orphan:
# TaoBRGNSetRegularizerObjectiveAndGradientRoutine
Sets the user-defined regularizer call-back function into the algorithm. 
## Synopsis
```
#include "petsctao.h" 
PetscErrorCode TaoBRGNSetRegularizerObjectiveAndGradientRoutine(Tao tao, PetscErrorCode (*func)(Tao, Vec, PetscReal *, Vec, void *), void *ctx)
```

## Input Parameters

- ***tao -*** the Tao context
- ***func -*** function pointer for the regularizer value and gradient evaluation
- ***ctx -*** user context for the regularizer



## Calling Sequence of `func`
```none
PetscErrorCode func(Tao tao, Vec u, PetscReal val, Vec g, void *ctx)
```

- ***tao -*** the `Tao` context
- ***u -*** the location at which to compute the objective and gradient
- ***val -*** location to store objective function value
- ***g -*** location to store gradient
- ***ctx -*** user context for the regularizer Hessian





## See Also
 `Tao`, `Mat`, `TAOBRGN`

## Level
advanced

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/leastsquares/impls/brgn/brgn.c.html#TaoBRGNSetRegularizerObjectiveAndGradientRoutine">src/tao/leastsquares/impls/brgn/brgn.c</A>

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/tao/leastsquares/tutorials/tomography.c.html">src/tao/leastsquares/tutorials/tomography.c</A><BR>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/tao/leastsquares/impls/brgn/brgn.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)  
