tlm_adjoint.cached_hessian

Module Contents

class tlm_adjoint.cached_hessian.CachedHessian(J, *, manager=None, cache_adjoint=True)

Represents a Hessian associated with a given forward. Uses a cached forward calculation.

Parameters:
Jvariable

Defines the functional.

managerEquationManager

The EquationManager used to record the forward. Must have recorded the forward calculation with ‘memory’ checkpointing, with automatic dropping of variable references disabled. manager() is used if not supplied.

cache_adjointbool

Whether to cache the first order adjoint.

action(M, dM, M0=None)

As described in Hessian.action(), using a cached forward calculation.

Warning

M defines the control, but does not define its value. The value of the control used is as for the recorded forward calculation. M0 is unused.

class tlm_adjoint.cached_hessian.CachedGaussNewton(X, R_inv_action, B_inv_action=None, *, manager=None)

Represents a Gauss-Newton approximation to a Hessian associated with a given forward. Uses a cached forward calculation.

Parameters:
Xvariable or Sequence[variable, …]

Defines the state.

R_inv_actioncallable

See GaussNewton.

B_inv_actioncallable

See GaussNewton.

managerEquationManager

The EquationManager used to record the forward. Must have recorded the forward calculation with ‘memory’ checkpointing, with automatic dropping of variable references disabled. manager() is used if not supplied.

action(M, dM, M0=None)

As described in GaussNewton.action(), using a cached forward calculation.

Warning

M defines the control, but does not define its value. The value of the control used is as for the recorded forward calculation. M0 is unused.