Skip to main content

Module device

Module device 

Source
Expand description

PennyLane device backend for QuantRS2.

This module implements a JSON-protocol device that allows PennyLane to execute quantum circuits on QuantRS2’s state-vector simulator.

§Protocol

PennyLane sends a JSON payload to the device:

{
  "num_wires": 2,
  "operations": [
    {"name": "Hadamard", "wires": [0], "params": []},
    {"name": "CNOT",     "wires": [0, 1], "params": []}
  ],
  "observables": [
    {"name": "PauliZ", "wires": [0]}
  ]
}

The device responds with:

{
  "state": {"re": [...], "im": [...]},
  "probabilities": [...],
  "expval": [0.0]
}

Structs§

PennyLaneCircuit
The circuit payload sent from PennyLane to the device.
PennyLaneObservable
An observable for expectation-value computation.
PennyLaneOperation
A single gate operation in PennyLane’s JSON protocol.
PennyLaneResult
The result returned from the device to PennyLane.
QuantRS2Device
The QuantRS2 PennyLane device backend.

Enums§

DeviceError
Errors that can occur in the PennyLane device backend.