quantax.optimizer.SR#

class quantax.optimizer.SR#

Bases: QNGD

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.

  • solver – The numerical solver for the matrix inverse, default to auto_pinv_eig.

property hamiltonian: Operator#

The Hamiltonian for the evolution.

property energy: float | None#

Energy of the current step.

property VarE: float | None#

Energy variance \(\left< (H - E)^2 \right>\) 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.

get_step(samples: Samples) Array#

Obtain the optimization step by solving the equation \(\bar O \dot \theta = \bar \epsilon\) for given samples.

property holomorphic: bool#

Whether the state is holomorphic.

property imag_time: bool#

Whether to use imaginary-time evolution.

save(file: str | Path | BinaryIO) None#

Save the optimizer internal quantities to a file.

solve(Obar: Array, Ebar: Array) Array#

Solve the equation \(\bar O \dot \theta = \bar \epsilon\) for given \(\bar O\) and \(\bar \epsilon\).

property state: Variational#

Variational state to be optimized.

property vs_type: int#

The vs_type of the state, see VS_TYPE.