quantax.optimizer.EnergyGrad#
- class quantax.optimizer.EnergyGrad#
Energy gradient source defining \(\bar \epsilon\) from the local energies of a Hamiltonian, used for ground-state search and time evolution.
- __init__(hamiltonian: Operator, clip: float | None = 5.0)#
- Parameters:
hamiltonian β The Hamiltonian for the evolution.
clip β
Clipping the local energies to \(\bar E \pm c \sigma\) to avoid divergence, default to 5.0. Clipping is disabled if set to None.
The clipping only enters \(\bar\epsilon\) (the gradient); the reported
energyandVarEremain the unclipped, unbiased estimators. For complex local energies, the real and imaginary parts are clipped independently with the shared scale \(\sigma = \sqrt{\mathrm{VarE}}\), as they enter the stacked SR equations as two equivalent real samples.Clipping is a biased operation, recommended for ground-state search but not for real-time evolution, where the bias is a systematic error in the dynamics instead of a stabilizer.
TimeEvoldisables it; passclip=Nonewhen usingSRwithimag_time=Falsedirectly.
- property energy: Array | ndarray | bool | number | bool | int | float | complex | None#
Energy of the current step.
- property VarE: Array | ndarray | bool | number | bool | int | float | complex | None#
Energy variance \(\left< (H - E)^2 \right>\) of the current step.
- ebar(state: Variational, samples: Samples | Array) Array#
Compute \(\bar \epsilon\) for given samples. The local energy is \(E_{loc, s} = \sum_{s'} \frac{\psi_{s'}}{\psi_s} \left< s|H|s' \right>\), and \(\bar \epsilon\) is defined as \(\bar \epsilon = \frac{1}{\sqrt{N_s}} (E_{loc, s} - \left<E_{loc, s}\right>)\).
Samples with non-finite local energy (e.g. from an overflowed or NaN wave function) are excluded from all estimators and contribute zero to \(\bar \epsilon\), so a single corrupted sample canβt poison the mean energy or the clipping threshold. A warning is emitted when such samples are detected.