API — Hessian Methods
Abstract type
Retro.AbstractHessianApproximation — Type
AbstractHessianApproximationSupertype for Hessian approximation strategies.
Every subtype must implement init_hessian!, update_hessian!, and apply_hessian!.
Concrete subtypes: BFGS, SR1, ExactHessian.
BFGS
Retro.BFGS — Type
BFGS <: AbstractHessianApproximationBFGS quasi-Newton Hessian approximation with full matrix storage. Maintains positive definiteness through careful update formula.
Fields
B0_scale::Real: Initial Hessian scaling factor (default: 1.0)skip_update::Bool: Whether to skip update if curvature condition failsdamped::Bool: Use damped BFGS update for robustness (default: true)
Symmetric Rank-1
Retro.SR1 — Type
SR1 <: AbstractHessianApproximationSymmetric Rank-1 quasi-Newton Hessian approximation. Does not maintain positive definiteness but can handle indefinite Hessians.
Fields
B0_scale::Real: Initial Hessian scaling factor (default: 1.0)skip_threshold::Real: Skip update if denominator is too small
Exact Hessian
Retro.ExactHessian — Type
ExactHessian{T} <: AbstractHessianApproximationExact Hessian computed via automatic differentiation (or user-supplied analytic Hessian). Adds a small diagonal regularization to improve conditioning.
Best for small-to-medium problems where the full Hessian is affordable.
Fields
regularization::T: Added to diagonal of H for numerical stability (default: 1e-8)
Retro.ExactHessianState — Type
ExactHessianState{T}Cached Hessian matrix and the point where it was last computed. Recomputes only when x changes.
Common interface
All Hessian approximations implement these methods:
Retro.init_hessian! — Function
init_hessian!(approx, cache) -> stateInitialise the Hessian approximation approx, writing the initial matrix into cache.B. Returns an opaque state object that tracks update history.
Retro.update_hessian! — Function
update_hessian!(approx, state, cache, obj, x)Update the Hessian approximation stored in cache.B using the latest iterate.
Retro.apply_hessian! — Function
apply_hessian!(Hv, approx, state, cache, v)Compute the Hessian-vector product Hv = B * v using the current approximation.