← Atlas

Basic circuits · Oracle algorithm benchmark

Bernstein–Vazirani all-ones oracle · 16 qubits

A fixed all-ones Bernstein–Vazirani instance with the last qubit used as the phase-kickback ancilla.

Strong empiricalUpdated

View frozen graph

A small worked example, computed in your browser. It is not a result from this record's papers.

Bernstein-Vazirani recovers a secret string

4 input qubits, secret string 1011, recovered in a single query.

q0q1q2q3q4Step 1 of 6 · XXStep 2 of 6 · Hadamard layer(5)Hadamard layer(5)Step 3 of 6 · BV oracle(1011)BV oracle(1011)Step 4 of 6 · Hadamard layer(4)Hadamard layer(4)Step 5 of 6 · HHStep 6 of 6 · XX

Step 1 of 6 · X

Probability of each outcome after this step

  • 10000100%
  1. Sets the ancilla to |1⟩, so the next step can put it into |−⟩.

    The whole state moves from 00000 to 10000 — one certain outcome before, one certain outcome after, no superposition either side.

  2. Hadamards everything: the ancilla becomes |−⟩, and the four input qubits spread into an equal superposition.

    Probability spreads from 1 outcome to 32. All 32 are equally likely.

  3. CXs the input qubits where the secret has a 1 (positions 0, 1 and 3) onto the ancilla, kicking back a phase that encodes the secret.

    The outcome probabilities do not move at all. What this step changes is phase — 2 distinct relative phases across the state now — which no measurement can see until a later step turns it back into probability.

  4. A second Hadamard layer on the inputs turns that phase pattern directly into the secret string.

    Probability gathers from 32 outcomes onto 2. 01011 goes from 3.1% to 50.0%.

  5. Undoes the ancilla's Hadamard.

    Probability gathers from 2 outcomes onto 1. 11011 goes from 50.0% to 100.0%.

  6. Returns the ancilla to |0⟩, purely for a tidy final state.

    The whole state moves from 11011 to 01011 — one certain outcome before, one certain outcome after, no superposition either side.

Readout The four input qubits read 1011, the secret, recovered exactly, in one shot. The ancilla reads 0.

Open in Studio
  • Steps47
  • Wires16
  • Qubits16
  • Operations47
  • Framework exports7
  • Papers1
Native
benchmark-bernstein-vazirani-16q.py
from qiskit import QuantumCircuit

qc = QuantumCircuit(16)
qc.x(15)
qc.h(0)
qc.h(1)
qc.h(2)
qc.h(3)
qc.h(4)
qc.h(5)
qc.h(6)
qc.h(7)
qc.h(8)
qc.h(9)
qc.h(10)
qc.h(11)
qc.h(12)
qc.h(13)
qc.h(14)
qc.h(15)
qc.cx(0, 15)
qc.cx(1, 15)
qc.cx(2, 15)
qc.cx(3, 15)
qc.cx(4, 15)
qc.cx(5, 15)
qc.cx(6, 15)
qc.cx(7, 15)
qc.cx(8, 15)
qc.cx(9, 15)
qc.cx(10, 15)
qc.cx(11, 15)
qc.cx(12, 15)
qc.cx(13, 15)
qc.cx(14, 15)
qc.h(0)
qc.h(1)
qc.h(2)
qc.h(3)
qc.h(4)
qc.h(5)
qc.h(6)
qc.h(7)
qc.h(8)
qc.h(9)
qc.h(10)
qc.h(11)
qc.h(12)
qc.h(13)
qc.h(14)
qc.measure_all()

FINAL_CIRCUIT = qc

References

Strong empirical
  • Verified by construction
  • Peer-reviewed paper
Method
Deterministic portable-gate construction plus catalog schema validation
Result
Pass · 16 qubits and 47 pre-measurement operations emit non-empty Qiskit, PennyLane, Cirq, CUDA-Q, Amazon Braket, OpenQASM 3.0, and PyQuil source.
Caveat
This is a parameterized Leona Quantum benchmark scaffold informed by the cited suite, not an upstream benchmark file or a hardware result.
MQT Bench: Benchmarking Software and Design Automation Tools for Quantum Computing ↗
Kind
curated reference
Reviewed by
Leona Quantum curation pass
License
Citation metadata; Leona Quantum-authored scaffold
Bernstein–Vaziranioraclequery algorithm16 qubitsseven-framework export

Atlas stars stay in the public catalog. Saving this entry to your workspace starts an unstarred private copy.