quantax.optimizer.TimeEvol#

class quantax.optimizer.TimeEvol#

Bases: SR

Time evolution optimizer, equivalent to real-time SR. This optimizer assumes the number of samples is more than the number of parameters, and is more memory-efficient than SR when this is the case.

__init__(state: Variational, hamiltonian: Operator, solver: Callable | None = None)#
Parameters:
  • state – Variational state to be evolved.

  • hamiltonian – Hamiltonian operator for time evolution.

  • solver – The numerical solver for \(Sx = F\), default to pseudo-inverse.

get_SF(samples: Samples) Tuple[Array, Array]#

Compute \(S = \bar O^\dagger \bar O\) and \(F = \bar O^\dagger \bar \epsilon\) with the given samples. When the number of samples is large, this function will automatically switch to a more memory-efficient implementation.

get_step(samples: Samples) Array#

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

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 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.

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

Save the optimizer internal quantities to a file.

property state: Variational#

Variational state to be optimized.

property vs_type: int#

The vs_type of the state, see VS_TYPE.