Basic Workflow: Writing & Submitting QCDL#
The two main steps of running quantum algorithms on dual-rail quantum computers are:
Formulate your algorithm as a QCDL program
QCDL is introduced in the Introduction to QCDL section and described in detail in the API Reference section.
Submit your QCDL program to a gate-model solver
You can then submit your QCDL program to a gate-model solver, for example a dual-rail simulator, as described in the Using the Gate-Model Simulator section.
Example#
The following example creates a Bell state circuit, producing a QCDL program that is passed to a gate-model simulator in the Leap service:
from dwave.gate.leap import LeapQCDLSimulator
from dwave.gate.qcdl import qcdl
from dwave.gate.qcdl.operations import cx, h, measure
@qcdl(num_qubits=2)
def qcdl_program(q0, q1):
h(q0) # Hadamard gate on q0
cx(q0, q1) # CNOT with q0 as control, q1 as target
measure(q0)
measure(q1)
# Submit to a gate-model simulator
simulator = LeapQCDLSimulator()
future = simulator.run(qcdl_program, shots=3)
result = future.result().result