quantax.optimizer.OverlapGrad#
- class quantax.optimizer.OverlapGrad#
Overlap gradient source defining \(\bar \epsilon\) from the amplitude ratios with a target state, used for supervised wave function optimization.
- __init__(target_state: State, clip: float | None = None)#
- Parameters:
target_state β The target state to be approximated.
clip β The clipping value of the centered amplitude ratios, default to no clipping.
- ebar(state: Variational, samples: Samples | Array) Array#
Compute \(\bar \epsilon\) from the normalized amplitude ratios \(\phi_s / \psi_s\) for given samples.
Samples with non-finite amplitude ratio (e.g. from an overflowed or NaN wave function) are excluded from the mean ratio and contribute zero to \(\bar \epsilon\), so a single corrupted sample canβt poison the whole gradient. A warning is emitted when such samples are detected.