Skip to main content
`Ctrl`+`K`

# 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

TS: Scalable ODE and DAE Solvers, `TS`, `MatFDColoring`, `TSComputeIJacobianDefaultColor()`, `MatEliminateZeros()`, `MatFDColoringCreate()`, `MatFDColoringSetFunction()`

## Level

intermediate

## Location

src/ts/interface/ts.c

Index of all TS routines
Table of Contents for all manual pages
Index of all manual pages