# TSSetRHSJacobian#

Sets the function to compute the Jacobian of G, where U_t = G(U,t), as well as the location to store the matrix.

## Synopsis#

```
#include "petscts.h"
PetscErrorCode TSSetRHSJacobian(TS ts, Mat Amat, Mat Pmat, TSRHSJacobianFn *f, void *ctx)
```

Logically Collective

## Input Parameters#

(approximate) location to store Jacobian matrix entries computed by**Amat -**`f`

matrix from which preconditioner is to be constructed (usually the same as**Pmat -**`Amat`

)the Jacobian evaluation routine**f -**[optional] user-defined context for private data for the Jacobian evaluation routine (may be**ctx -**`NULL`

)

## Notes#

You must set all the diagonal entries of the matrices, if they are zero you must still set them with a zero value

The `TS`

solver may modify the nonzero structure and the entries of the matrices `Amat`

and `Pmat`

between the calls to `f()`

You should not assume the values are the same in the next call to f() as you set them in the previous call.

## See Also#

TS: Scalable ODE and DAE Solvers, `TS`

, `TSRHSJacobianFn`

, `SNESComputeJacobianDefaultColor()`

,
`TSSetRHSFunction()`

, `TSRHSJacobianSetReuse()`

, `TSSetIJacobian()`

, `TSRHSFunctionFn`

, `TSIFunctionFn`

## Level#

beginner

## Location#

## Examples#

src/ts/tutorials/ex1.c

src/ts/tutorials/ex41.c

src/ts/tutorials/ex4.c

src/ts/tutorials/ex42.c

src/ts/tutorials/ex3.c

src/tao/unconstrained/tutorials/spectraladjointassimilation.c

src/ts/tutorials/ex21.c

src/tao/unconstrained/tutorials/burgers_spectral.c

src/ts/tutorials/extchemfield.c

src/ts/tutorials/ex5.c

Index of all TS routines

Table of Contents for all manual pages

Index of all manual pages