QPSMonitorSet

Sets an ADDITIONAL function to be called at every iteration to monitor the residual/error etc.

Synopsis

PetscErrorCode  QPSMonitorSet(QPS qps,PetscErrorCode (*monitor)(QPS,PetscInt,PetscReal,void*),void *mctx,PetscErrorCode (*monitordestroy)(void**))
Logically Collective on QPS

Input Parameters

qps - iterative context obtained from QPSCreate()
monitor - pointer to function
mctx - [optional] context for private data for the monitor routine (use NULL if no context is desired)
monitordestroy - [optional] routine that frees monitor context (may be NULL)

Calling Sequence of monitor

    monitor (QPS qps, PetscInt it, PetscReal rnorm, void *mctx)

qps - iterative context obtained from QPSCreate()
it - iteration number
rnorm - 2-norm of the residual (more general, a vector whose norm determines convergence, such as a projected gradient for QPSMPGP)
mctx - optional monitoring context, as set by QPSMonitorSet()

Options Database Keys

-qps_monitor - sets QPSMonitorDefault()
-qps_monitor_cost - sets QPSMonitorCostFunction()
-qps_monitor_cancel - cancels all monitors that have been hardwired into a code by calls to QPSMonitorSet(), but does not cancel those set via the options database.

Notes

The default is to do nothing. To print the residual, use QPSMonitorDefault() as the monitoring routine, with a null monitoring context.

Several different monitoring routines may be set by calling QPSMonitorSet() multiple times; all will be called in the order in which they were set.

See Also

QPSMonitorDefault(), QPSMonitorCancel()

Level

beginner

Location

src/qps/interface/qps.c
Index of all QPS routines
Table of Contents for all manual pages
Index of all manual pages