# TaoAppDefaultComputeHessianColor

Computes the Hessian using colored finite differences.

## Synopsis

    #include "tao.h"
    int TaoAppDefaultComputeHessianColor(TAO_APPLICATION taoapp, Vec V, Mat *HH,Mat *BB,
                                   MatStructure *flag,void *ctx)

Collective on TAO_APPLICATION

## Input Parameters

| tao | - the TAO_APPLICATION context
| V | - compute Hessian at this point
| ctx | - the TAO_APPLICATION structure, cast to (void*)

## Output Parameters

| H | - Hessian matrix (not altered in this routine)
| B | - newly computed Hessian matrix to use with preconditioner (generally the same as H)
| flag | - flag indicating whether the matrix sparsity structure has changed

## Options Database Keys

| -mat_fd_coloring_freq <freq> | - - -tao_view_hessian - view the hessian after each evaluation using PETSC_VIEWER_STDOUT_WORLD

## Note

The gradient evaluation must be set using the routine TaoSetPetscGradient().

.keywords: TAO_APPLICATION, finite differences, Hessian, coloring, sparse

## See Also

TaoAppSetHessianRoutine(), TaoAppDefaultComputeHessian(),SNESDefaultComputeJacobianColor(),
TaoAppSetGradientRoutine(), TaoAppSetColoring()

Level:intermediate
Location:src/petsctao/application/petscapp/fdiff.c
TAO Solver Index
Table of Contents

### Examples

src/unconstrained/examples/tutorials/minsurf2.c.html