#include "petsctao.h" PetscErrorCode TaoSetHessianRoutine(Tao tao, Mat H, Mat Hpre, PetscErrorCode (*func)(Tao, Vec, Mat*, Mat *, MatStructure *, void*), void *ctx)Logically collective on Tao
tao | - the Tao context | |
H | - Matrix used for the hessian | |
Hpre | - Matrix that will be used operated on by preconditioner, can be same as H | |
hess | - Hessian evaluation routine | |
ctx | - [optional] user-defined context for private data for the Hessian evaluation routine (may be NULL) |
hess (Tao tao,Vec x,Mat *H,Mat *Hpre,MatStructure *flag,void *ctx);
tao | - the Tao context | |
x | - input vector | |
H | - Hessian matrix | |
Hpre | - preconditioner matrix, usually the same as H | |
flag | - flag indicating information about the preconditioner matrix structure (see below) | |
ctx | - [optional] user-defined Hessian context |
The function hess() takes Mat * as the matrix arguments rather than Mat. This allows the Hessian evaluation routine to replace A and/or B with a completely new new matrix structure (not just different matrix elements) when appropriate, for instance, if the nonzero structure is changing throughout the global iterations.
The flag can be used to eliminate unnecessary work in the preconditioner during the repeated solution of linear systems of the same size. The available options are
SAME_PRECONDITIONER -
Hpre is identical during successive linear solves.
This option is intended for folks who are using
different Amat and Pmat matrices and want to reuse the
same preconditioner matrix. For example, this option
saves work by not recomputing incomplete factorization
for ILU/ICC preconditioners.
SAME_NONZERO_PATTERN -
Hpre has the same nonzero structure during
successive linear solves.
DIFFERENT_NONZERO_PATTERN -
Hpre does not have the same nonzero structure.
If in doubt about whether your preconditioner matrix has changed structure or not, use the flag DIFFERENT_NONZERO_PATTERN.
Level:beginner
Location:src/tao/interface/taosolver_hj.c
Index of all Tao routines
Table of Contents for all manual pages
Index of all manual pages