quantax.optimizer.QNGD#
- class quantax.optimizer.QNGD#
Abstract class of quantum natural gradient descent.
The key function of the class is
get_step, which provides the update of parameters by solving the quantum natural gradient descent equation \(\bar O \dot \theta = \bar \epsilon\), in which \(\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>)\) and \(\bar \epsilon\) should be defined in the child class.- __init__(state: Variational, imag_time: bool = True, solver: Callable[[Array, Array], Array] | None = None)#
- Parameters:
state – Variational state to be optimized.
imag_time – Whether to use imaginary-time evolution.
solver – The numerical solver for the matrix inverse, default to
auto_pinv_eig.
- property state: Variational#
Variational state to be optimized.
- property holomorphic: bool#
Whether the state is holomorphic.
- property imag_time: bool#
Whether to use imaginary-time evolution.
- get_Ebar(samples: Samples) Array#
Method for computing \(\bar \epsilon\) in QNGD equaion, specified by the child class.
- 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.
- solve(Obar: Array, Ebar: Array) Array#
Solve the equation \(\bar O \dot \theta = \bar \epsilon\) for given \(\bar O\) and \(\bar \epsilon\).
- get_step(samples: Samples) Array#
Obtain the optimization step by solving the equation \(\bar O \dot \theta = \bar \epsilon\) for given samples.
- save(file: str | Path | BinaryIO) None#
Save the optimizer internal quantities to a file.