# TSSetRHSJacobianP
Sets the function that computes the Jacobian of G w.r.t. the parameters P where U_t = G(U,P,t), as well as the location to store the matrix. 
## Synopsis
```
#include "petscts.h"  
PetscErrorCode TSSetRHSJacobianP(TS ts, Mat Amat, PetscErrorCode (*func)(TS, PetscReal, Vec, Mat, void *), void *ctx)
```
Logically Collective on ts


## Input Parameters

- ***ts -*** `TS` context obtained from `TSCreate()`
- ***Amat -*** JacobianP matrix
- ***func -*** function
- ***ctx -*** [optional] user-defined function context



## Calling sequence of func
```none
func (TS ts,PetscReal t,Vec y,Mat A,void *ctx);
```

- ***t -*** current timestep
- ***U -*** input vector (current ODE solution)
- ***A -*** output matrix
- ***ctx -*** [optional] user-defined function context





## Note
Amat has the same number of rows and the same row parallel layout as u, Amat has the same number of columns and parallel layout as p


## See Also
 [](chapter_ts), `TS`, `TSGetRHSJacobianP()`

## Level
intermediate

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

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/tutorials/ex16fwd.c.html">src/ts/tutorials/ex16fwd.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/tutorials/ex20adj.c.html">src/ts/tutorials/ex20adj.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/tutorials/ex20fwd.c.html">src/ts/tutorials/ex20fwd.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/tutorials/ex20opt_p.c.html">src/ts/tutorials/ex20opt_p.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/tutorials/ex20td.c.html">src/ts/tutorials/ex20td.c.html</A><BR>


---
[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)  
