Quantum Phase Estimation¶

The phase estimation function estimates the phase of an eigenvector of a unitary function. More precisely, given a unitary function $$F$$ and an input containing a quantum register with a state $$|\psi\rangle$$ such that $$F(|\psi\rangle)=e^{2\pi\i\nu}|\psi\rangle$$, the phase estimation function outputs an estimation of $$\nu$$ as a fixed-point binary number.

Phase estimation is frequently used as a subroutine in other quantum algorithms, such as Shor's algorithm and quantum algorithms for solving linear systems of equations.

Theoretical details are provided in Ref. [1].

Syntax¶

Function: PhaseEstimation

Parameters:

• size: int
• unitary: str
• unitary_params: FunctionParams

The size argument provides the number of digits in the fixed-point representation of the phase. The unitary_params argument provides the function parameters of the unitary function $$F$$. The unitary may be omitted when using the SDK and should otherwise contain the name of the function $$F$$.

Example¶

The following example shows how to perform a simple phase estimation. First we initialize the state "10" over 2 qubits by using XGate on the first qubit. Then we apply a phase estimation on the matrix

$\begin{pmatrix} 0 & 0 & 0 & 0 \\ 0 & \tfrac{1}{4} & 0 & 0 \\ 0 & 0 & \tfrac{1}{2} & 0 \\ 0 & 0 & 0 & \tfrac{3}{4} \\ \end{pmatrix}$

The output register would be in the state "10" corresponding to the number 0.10 which is $$\frac{1}{2}$$ in binary implying that $$\nu=\frac{1}{2}$$ as expected for input state "10".

{
"logic_flow": [
{
"function": "XGate",
"function_params": {},
"outputs": {
"TARGET": "x_qpe"
}
},
{
"function": "PhaseEstimation",
"function_params": {
"size": 2,
"unitary": "Exponentiation",
"unitary_params": {
"pauli_operator": {
"pauli_list": [
["ZI", -0.125],
["IZ", -0.25],
["II", 0.375]
]
},
"evolution_coefficient": -6.283185307179586
}
},
"inputs": {
"IN[0]": "x_qpe"
}
}
],
"preferences": {
"draw_at_level": -1
}
}

from math import pi
from classiq.interface.chemistry.operator import PauliOperator
from classiq.interface.generator.exponentiation import Exponentiation
from classiq.interface.generator.qpe import PhaseEstimation
from classiq.interface.generator.standard_gates.standard_gates import XGate
from classiq.model_designer import ModelDesigner

model_designer = ModelDesigner()
model_designer.preferences.draw_image = True

x_qpe = model_designer.XGate(params=XGate())
qpe_out = model_designer.PhaseEstimation(
params=PhaseEstimation(
size=2,
unitary_params=Exponentiation(
pauli_operator=PauliOperator(
pauli_list=[
("ZI", -0.125),
("IZ", -0.25),
("II", 0.375),
]
),
evolution_coefficient=-2 * pi,
),
),
in_wires={"IN[0]": x_qpe["TARGET"]},
)
model_designer.preferences.draw_at_level = -1
circuit = model_designer.synthesize()
circuit.show_interactive()


References¶

[1] A. Yu. Kitaev Barenco et al, Quantum measurements and the Abelian Stabilizer Problem, arXiv:quant-ph/9511026 (1995). https://doi.org/10.48550/arXiv.quant-ph/9511026