quantax.optimizer.MinSR#
- class quantax.optimizer.MinSR#
Bases:
TDVP
MinSR optimization, specifically designed for
Sequential
networks. The optimization utilizes gradient checkpointing method and structured derivatives to reduce the memory cost. See MinSR paper for details.- __init__(state: Variational, hamiltonian: Operator, solver: Callable | None = None)#
- Parameters:
state – Variational state to be optimized.
hamiltonian – The Hamiltonian for the evolution.
solver – The numerical solver for the matrix inverse, default to
minsr_pinv_eig
.
…warning:
The model must be `~quantax.nn.Sequential`, otherwise one should use `~quantax.optimizer.TDVP`. The vs_type of the variational state should be ``real_or_holomorphic`` or ``real_to_complex``. In the latter case, the complex neurons are only allowed in the last few unparametrized layers.
- Ohvp(samples: Samples, vec: Array) Array #
Compute \(\bar O^† v\). vec @ jac is used instead of vjp for better precision.
- solve(samples: Samples, Tmat: Array, Ebar: Array) Array #
Solve the equation \(\bar O \dot \theta = \bar \epsilon\) for given \(\bar O\) and \(\bar \epsilon\).
- property VarE: float | None#
Energy variance \(\left< (H - E)^2 \right>\) of the current step.
- property energy: float | None#
Energy of the current step.
- get_Ebar(samples: Samples) 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>)\).
- get_Obar(samples: Samples) Array #
Calculate \(\bar O = \frac{1}{\sqrt{N_s}}(\frac{1}{\psi} \frac{\partial \psi}{\partial \theta} - \left< \frac{1}{\psi} \frac{\partial \psi}{\partial \theta} \right>)\) for given samples.
- property holomorphic: bool#
Whether the state is holomorphic.
- property imag_time: bool#
Whether to use imaginary-time evolution.
- property state: Variational#
Variational state to be optimized.
- property vs_type: int#
The vs_type of the state.