:orphan:
# TSPruneIJacobianColor
Remove nondiagonal zeros in the Jacobian matrix and update the `MatMFFD` coloring information. 
## Synopsis
```
#include "petscts.h"  
PetscErrorCode TSPruneIJacobianColor(TS ts, Mat J, Mat B)
```
Collective


## Input Parameters

- ***ts -*** the `TS` context
- ***J -*** Jacobian matrix (not altered in this routine)
- ***B -*** newly computed Jacobian matrix to use with preconditioner





## Notes
This function improves the `MatFDColoring` performance when the Jacobian matrix was over-allocated or contains
many constant zeros entries, which is typically the case when the matrix is generated by a `DM`
and multiple fields are involved.

Users need to make sure that the Jacobian matrix is properly filled to reflect the sparsity
structure. For `MatFDColoring`, the values of nonzero entries are not important. So one can
usually call `TSComputeIJacobian()` with randomized input vectors to generate a dummy Jacobian.
`TSComputeIJacobian()` should be called before `TSSolve()` but after `TSSetUp()`.


## See Also
 [](ch_ts), `TS`, `MatFDColoring`, `TSComputeIJacobianDefaultColor()`, `MatEliminateZeros()`, `MatFDColoringCreate()`, `MatFDColoringSetFunction()`

## Level
intermediate

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


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


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