primitive · G9
LCU block-encoding of H = c0·I + c1·X
Smallest-honest Linear-Combinations-of-Unitaries: one prep ancilla + one data qubit. PREP = Ry(2θ), SELECT = CX, UNPREP = Ry(-2θ). Post-selecting on prep = |0⟩ projects the data register onto (c0·I + c1·X)|ψ⟩ with c0 = cos²(θ), c1 = sin²(θ).
lcu_block_encoding_verified · worst |Δ P(prep=0)| = 0.0088 · worst |Δ P(d=1|prep=0)| = 0.0121
P(prep = 0) — post-selection success rate
P(data = 1 | prep = 0) — block-encoded output
Kernel snippet (θ = π/4, ψ = |0⟩)
open in Playpond ↗
from quantum.nadarasa_g9_lib import (
guppy, qubit, h, x, cx, rx, ry, rz, measure, result, angle,
)
@guppy
def program() -> None:
prep = qubit()
data = qubit()
# data starts in |0>
# PREP
ry(prep, angle(0.5))
# SELECT: controlled-X
cx(prep, data)
# UNPREP
ry(prep, angle(-0.5))
result("prep", measure(prep))
result("data", measure(data))