# TSGetCostHessianProducts
Returns the gradients from the `TSAdjointSolve()` 
## Synopsis
```
#include "petscts.h"  
PetscErrorCode TSGetCostHessianProducts(TS ts, PetscInt *numcost, Vec **lambda2, Vec **mu2, Vec *dir)
```
Not Collective, but vectors returned are parallel if `TS` is parallel


## Input Parameter

- ***ts -*** the `TS` context obtained from `TSCreate()`



## Output Parameters

- ***numcost -*** number of cost functions
- ***lambda2 -*** Hessian-vector product with respect to the initial condition variables, the dimension and parallel layout of these vectors is the same as the ODE solution vector
- ***mu2 -*** Hessian-vector product with respect to the parameters, the number of entries in these vectors is the same as the number of parameters
- ***dir -*** the direction vector that are multiplied with the Hessian of the cost functions





## See Also
 [](chapter_ts), `TSAdjointSolve()`, `TSSetCostHessianProducts()`

## Level
intermediate

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/interface/sensitivity/tssen.c.html#TSGetCostHessianProducts">src/ts/interface/sensitivity/tssen.c</A>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/ts/interface/sensitivity/tssen.c)


[Index of all Sensitivity routines](index.md)  
[Table of Contents for all manual pages](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
