quantax.optimizer.SR#
- class quantax.optimizer.SR(state: Variational, hamiltonian: Operator, imag_time: bool = True, solver: Callable | None = None)#
Stochastic reconfiguration (SR). This optimizer automatically chooses between SR and MinSR based on the the number of samples and parameters.
- __init__(state: Variational, hamiltonian: Operator, imag_time: bool = True, solver: Callable | None = None)#
- Parameters:
state – Variational state to be optimized.
hamiltonian – The Hamiltonian for the evolution.
imag_time – Whether to use imaginary-time evolution, default to True.
solver – The numerical solver for the matrix inverse, default to
auto_pinv_eig
.
Methods
__init__
(state, hamiltonian[, imag_time, solver])get_Ebar
(samples)Compute \(\bar \epsilon\) for given samples.
get_Obar
(samples)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.
get_step
(samples)Obtain the optimization step by solving the equation \(\bar O \dot \theta = \bar \epsilon\) for given samples.
solve
(Obar, Ebar)Solve the equation \(\bar O \dot \theta = \bar \epsilon\) for given \(\bar O\) and \(\bar \epsilon\).
Attributes
VarE
Energy variance \(\left< (H - E)^2 \right>\) of the current step.
energy
Energy of the current step.
hamiltonian
The Hamiltonian for the evolution.
holomorphic
Whether the state is holomorphic.
imag_time
Whether to use imaginary-time evolution.
state
Variational state to be optimized.
vs_type
The vs_type of the state.