quantax.optimizer.SPRING#

class quantax.optimizer.SPRING#

Bases: SR

SPRING optimizer. This is a variant of SR with momentum. When using the default value of mu=0.9, the learning rate should be roughly 1/5 of the one in SR.

__init__(state: Variational, hamiltonian: Operator, imag_time: bool = True, solver: Callable | None = None, mu: float = 0.9, file: None | str | Path | BinaryIO = None)#

Initialize the SPRING optimizer.

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.

  • mu – The momentum factor.

  • file – File to load the optimizer internal quantities.

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

Solve the SPRING optimization step.

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

Save the optimizer internal quantities to a file.

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.

get_step(samples: Samples) Array#

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

property hamiltonian: Operator#

The Hamiltonian for the evolution.

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, see VS_TYPE.