Circuit
The phase sequence is W(theta) → S(π/4) → W(theta) → S(−π/4) → W(theta), where:- W(theta) is the signal operator:
Rx(−2·theta), a rotation about the X axis - S(phi) is the phase operator:
U(0, 0, −2·phi), a Z-axis phase rotation
Quantum Signal Processing
Expected results
Withtheta = pi/6, the signal value is x = cos(π/6) = √3/2. The polynomial evaluates to:
P(x) = 2·(√3/2)³ − √3/2 = √3/4 ≈ 0.433013
After running, you should see two quantum states:
The probability of |0⟩ is P(x)² = (√3/4)² = 3/16 ≈ 0.1875. The amplitude itself is P(x) ≈ 0.433013, which is what QSP encodes — the polynomial value appears as the real amplitude of the |0⟩ component.
How the circuit works
1
Define signal and phase operators
W(theta) applies Rx(−2·theta), a rotation by −2·theta around the X axis. S(phi) applies U(0, 0, −2·phi), a phase rotation around the Z axis. These are the two primitive QSP building blocks.2
Build the alternating sequence
The 5-gate sequence W → S(π/4) → W → S(−π/4) → W alternates signal and phase operators. The specific phase angles (π/4, −π/4) determine the polynomial being implemented — different phase sequences yield different polynomials.
3
Run and read the |0⟩ amplitude
The real part of the |0⟩ amplitude encodes P(x) = 2x³ − x evaluated at x = cos(theta). Change
theta to evaluate the polynomial at a different point.Changing the input
To evaluate the polynomial at a different point, change thetheta constant:
Modified theta