Simulator#
The QPU Simulator section provides an introduction to the simulator in the Leap service and the Submitting Programs shows its use.
Classes#
- class LeapQCDLSimulator(**config)[source]#
Bases:
objectSubmits QCDL programs to the dual-rail simulator in the Leap service.
Examples
Construct a simple QCDL program:
from dwave.gate.qcdl import qcdl from dwave.gate.qcdl.operations import cx, h, measure @qcdl(num_qubits=2) def main(q0, q1): h(q0) # Hadamard gate on q0 cx(q0, q1) # CNOT with q0 as control, q1 as target measure(q0) measure(q1) qcdl_program = main()
Submit it to the QCDL simulator:
from dwave.gate.leap import LeapQCDLSimulator simulator = LeapQCDLSimulator() future = simulator.run(qcdl_program, shots=100) result = future.result().result
Access measurements and sample counts by calling
measurementsproperty orget_counts()method respectively.- class RunResult(result: Result, info: 'dwave.system.samplers.ResultInfoDict')[source]#
Bases:
NamedTuplerun()method future result.
- close() None[source]#
Close the underlying cloud client to release system resources such as threads.
The method blocks for all the currently scheduled work (sampling requests) to finish.
See also
- property default_solver: dict[str, str][source]#
Features used to select the latest accessible QCDL simulator.
- property parameters: dict[str, list[str]][source]#
Supported parameters.
Keys of the returned dict are keyword parameters as returned by a SAPI query.
Solver parameters are dependent on the selected solver and subject to change; for example, new features may add parameters.
- property properties: dict[str, Any][source]#
Solver properties as returned by a SAPI query.
Solver properties are dependent on the selected solver and subject to change; for example, new features may add properties.
- run(qcdl: QCDLProgram | Mapping[str, Any], **params) Future[RunResult][source]#
Run the QCDL program using the selected simulator in the Leap service.
Returns the
Resultclass, with SAPI job metadata, both wrapped in aRunResultclass and returned in aFuture.- Parameters:
qcdl – QCDL circuit to upload and simulate.
**params – Job parameters accepted by the simulator (solver).
- Returns:
Simulation results.