View source on GitHub |
A VPE estimator that works by fitting a set of known frequencies.
openfermion.measurements.PhaseFitEstimator(
evals: numpy.ndarray, ref_eval: float = 0
)
A Hamiltonian being fast-forwardable is equivalent to its spectral decomposition being known. This means that the only information to be obtained from QPE is the amplitudes. This estimator proceeds by a simple least-squares fit to obtain the amplitudes, and then outputs the expectation values.
Methods
get_amplitudes
get_amplitudes(
phase_function: numpy.ndarray
) -> numpy.ndarray
Fits the amplitudes in the phase function to the input signal data.
Arguments | |
---|---|
phase_function [numpy.ndarray] -- Phase function input |
Returns | |
---|---|
amplitudes [numpy.ndarray] -- Fitted estimates of the amplitudes of the given frequencies (in the same order as in self.energies) |
get_expectation_value
get_expectation_value(
phase_function: numpy.ndarray
) -> numpy.ndarray
Estates expectation values via amplitude fitting of known frequencies
Arguments | |
---|---|
phase_function [numpy.ndarray] -- The phase function obtained in experiment |
Returns | |
---|---|
expectation_value [float] -- the estimated expectation value |
get_simulation_points
get_simulation_points(
safe: bool = True
) -> numpy.ndarray
Generates time points for estimation
VPE requires estimating the phase function g(t) at multiple points t, and some care in choosing these points is needed to prevent aliasing. This should be taken care of in the estimator.
In this case, we fit len(self.energies) complex amplitudes to a complex valued signal, we need precisely this number of points in the signal.
However, it appears numerically that approximately twice as many points are needed to prevent aliasing, so we double this number here.
Then, to prevent aliasing, we need to make sure that the time step dt < 2*pi / (E_max-E_min). Here, we choose dt = pi / (E_max-E_min). (Importantly, for Pauli operators this reproduces the H test.)
Args | |
---|---|
safe [bool, default True] -- numerical testing shows that taking approximately twice as many points is better for the stability of the estimator; this |
Returns | |
---|---|
times
|
a set of times t that g(t) should be estimated at. |