Selene · Primitive · Frontier08 / 13
← Frontier index
PrimitiveVerified

Block-encoding via LCU

Two prep ancillas + select-oracle. The substrate every QSP/QSVT demo needs.

Results · real Selene shots

lcu_block_encoding_verified

Smallest-honest LCU shipped: 1 prep ancilla + 1 data qubit block-encoding H = cos²(θ)·I + sin²(θ)·X via PREP=Ry(2θ), SELECT=CX, UNPREP=Ry(-2θ). Across an 8-row (θ × ψ) grid, both P(prep=0) and P(data=1|prep=0) sit within ~1.2% of the closed-form prediction.

worst |Δ| vs classical prediction0.0121
JSONsrc/data/demos/nadarasa_g9.json

Why this matters

QSP only does interesting work when the block-encoded matrix is interesting. Linear-Combinations-of-Unitaries (LCU) is the workhorse construction: prepare a coefficient register, controlled-apply each Pauli term, un-prepare. Once it lands on Selene the QSP cards stop being toys and become composable primitives.

What the repo already has

Nothing — SWAP test is the closest thing structurally.

What's missing

A `lcu_block_encode(prep, paulis, data)` Guppy primitive. Cleanly factored from the QSP layer above.

Smallest experiment

Build it or kill it

Qubits

2 prep ancillas + 2 data

Ancilla pattern

Prep + select + unprep; ancillas measured at the end.

Shots

4096 shots × 4 input states.

Predicted outcome

When prep ancillas measure |00>, the data register's state matches H|ψ>/‖H|ψ>‖ for the encoded 4×4 Hermitian H. Verified against numpy.linalg.eig on H.

Refutation criterion

If post-selected state diverges from the classical prediction by trace distance > 0.05, the select-oracle is buggy.

Kernel sketch

Untested — sketch only
@guppy
def lcu_select(a0: qubit, a1: qubit, d0: qubit, d1: qubit) -> None:
    # apply P_{2*a1 + a0} on (d0, d1) — Pauli term indexed by classical ancilla bits
    # implemented as four controlled Paulis with appropriate negative controls
    ...

@guppy
def lcu_block_encode(coeffs: array[float, 4]) -> None:
    a0, a1 = qubit(), qubit()
    d0, d1 = qubit(), qubit()
    prep_coeffs(a0, a1, coeffs)
    lcu_select(a0, a1, d0, d1)
    unprep_coeffs(a0, a1, coeffs)
    result("a0", measure(a0)); result("a1", measure(a1))
    result("d0", measure(d0)); result("d1", measure(d1))

Host pipeline

Post-select on (a0, a1) = (0, 0); reconstruct data state; compare to classical H|ψ>/‖H|ψ>‖.

Related

Files in this repo

  • · quantum/nadarasa_g9.py
  • · quantum/nadarasa_g9_lib.py
  • · src/data/demos/nadarasa_g9.json
  • · src/routes/nadarasa.g9.tsx

More in Primitive

3 cards