PhaseEstimationScale¶
- class PhaseEstimationScale(bound)[source]¶
Bases:
objectSet and use a bound on eigenvalues of a Hermitian operator in order to ensure phases are in the desired range and to convert measured phases into eigenvectors.
The
boundis set when constructing this class. Then the methodscaleis used to find the factor by which to scale the operator.If
boundis equal exactly to the largest eigenvalue, and the smallest eigenvalue is minus the largest, then these two eigenvalues will not be distinguished. For example, if the Hermitian operator is the Pauli Z operator with eigenvalues \(1\) and \(-1\), andboundis \(1\), then both eigenvalues will be mapped to \(1\). This can be avoided by makingbounda bit larger.Increasing
bounddecreases the part of the interval \([0, 1)\) that is used to map eigenvalues tophi. However, sometimes this results in a better determination of the eigenvalues, because 1) although there are fewer discrete phases in the useful range, it may shift one of the discrete phases closer to the actual phase. And, 2) If one of the discrete phases is close to, or exactly equal to the actual phase, then artifacts (probability) in neighboring phases will be reduced. This is important because the artifacts may be larger than the probability in a phase representing another eigenvalue of interest whose corresponding eigenstate has a relatively small weight in the input state.- Parameters:
bound (float) – an upper bound on the absolute value of the eigenvalues of a Hermitian operator. (The operator is not needed here.)
Attributes
- scale¶
Return the Hamiltonian scaling factor.
Return the scale factor by which a Hermitian operator must be multiplied so that the phase of the corresponding unitary is restricted to \([-\pi, \pi]\). This factor is computed from the bound on the absolute values of the eigenvalues of the operator. The methods
scale_phaseandscale_phasesare used recover the eigenvalues corresponding the original (unscaled) Hermitian operator.- Returns:
The scale factor.
Methods
- classmethod from_pauli_sum(pauli_sum)[source]¶
Create a PhaseEstimationScale from a SummedOp representing a sum of Pauli Operators.
It is assumed that the
pauli_sumis the sum ofPauliOpobjects. The bound on the absolute value of the eigenvalues of the sum is obtained as the sum of the absolute values of the coefficients of the terms. This is the best bound available in the generic case. APhaseEstimationScaleobject is instantiated using this bound.- Parameters:
pauli_sum (SparsePauliOp | Operator | BaseOperator) – A
SparsePauliOpor other suitable quantum infoOperator- Raises:
ValueError – if
pauli_sumis not a sum of Pauli operators.- Returns:
A
PhaseEstimationScaleobject- Return type:
- scale_phase(phi, id_coefficient=0.0)[source]¶
Convert a phase into an eigenvalue.
The input phase
phicorresponds to the eigenvalue of a unitary obtained by exponentiating a scaled Hermitian operator. Recall that the phase is obtained fromphias \(2\pi\phi\). Furthermore, the Hermitian operator was scaled so thatphiis restricted to \([-1/2, 1/2]\), corresponding to phases in \([-\pi, \pi]\). But the values of phi read from the phase-readout register are in \([0, 1)\). Any value ofphigreater than \(1/2\) corresponds to a raw phase of minus the complement with respect to 1. After this possible shift, the phase is scaled by the inverse of the factor by which the Hermitian operator was scaled to recover the eigenvalue of the Hermitian operator.
- scale_phases(phases, id_coefficient=0.0)[source]¶
Convert a list or dict of phases to eigenvalues.
The values in the list, or keys in the dict, are values of
phi` and are converted as described in the description of ``scale_phase. In casephasesis a dict, the values of the dict are passed unchanged.