API reference

Most code needs only the device name, qp.device("maestro.qubit", ...), which creates a MaestroQubitDevice. Its keyword arguments are the options below; the guide’s Options and simulation methods page explains them in more detail.

Device

class MaestroQubitDevice(wires=None, shots=None, simulator_type=None, simulation_type=None, max_bond_dimension=None, singular_value_threshold=None, precision=None, use_double_precision=None, disable_optimized_swapping=False, pp_coefficient_threshold=None, pp_max_pauli_weight=None, pp_gates_between_trims=None, pp_gates_between_deduplications=None, pp_pauli_weight_threshold=None, pp_steps_between_trims=None, enable_causal_cone_reduction=True, auto_reduce=True, enable_observable_clustering=True, max_cluster_qubits=None, gate_fusion=None, seed=None, adjoint_backend='auto', backend='local')

PennyLane device for the Maestro quantum simulator by Qoro Quantum.

Noise: PennyLane’s channel operations on one or two wires (and the ones qml.add_noise inserts) run on the local engine, with a qoro-maestro that has QuantumChannel. "DensityMatrix", "MatrixProductOperator" and "PauliPropagator" apply a channel exactly. "Statevector" and "MatrixProductState" sample it, one Kraus branch each time the circuit runs: a noisy circuit needs shots there, and each shot is its own run. The other simulation types take no channels.

Parameters:
  • wires (int or Iterable) – Number of wires, or explicit wire labels.

  • shots (int or None) – Default shot count. None → analytic mode.

  • simulator_type (str or None) –

    Backend engine (None, the default, is "QCSim" locally and leaves the choice to a Divi backend). Options:

    • "QCSim" — Qoro’s optimised CPU simulator (default)

    • "Gpu" — CUDA-accelerated GPU simulator

    • "CompositeQCSim" — Multi-node distributed CPU

    • "QiskitAer" — Integrated Qiskit Aer backend

    • "CompositeQiskitAer" — Distributed Qiskit Aer backend

    • "DistributedGpu" — State distributed across local GPUs

    • "DistributedMpiGpu" — State distributed across MPI ranks/GPUs

    • "QuestSim" — QuEST simulator

  • simulation_type (str or None) –

    Simulation algorithm (None, the default, is "Statevector" locally and leaves the choice to a Divi backend). Options:

    • "Statevector" — Full statevector (default)

    • "MatrixProductState" — MPS / tensor-train

    • "Stabilizer" — Clifford-only stabilizer

    • "TensorNetwork" — General tensor network

    • "PauliPropagator" — Pauli propagation

    • "ExtendedStabilizer" — Extended stabilizer

    • "DensityMatrix" — Density matrix for mixed states

    • "MatrixProductOperator" — MPO simulation

    • "PathIntegral" — Path integral simulation

  • max_bond_dimension (int or None) – MPS truncation (default: None).

  • singular_value_threshold (float or None) – MPS SVD cutoff.

  • precision (str or None) – Floating-point precision, "single" or "double", for the GPU and Qiskit Aer backends. None (default) keeps each backend’s default; QCSim always uses double.

  • use_double_precision (bool or None) – Legacy alias for precision: True → "double", False → "single".

  • disable_optimized_swapping (bool) – Disable MPS swap optimisation (default: False). Automatically enabled for native MCM circuits where the optimisation is incompatible with mid-circuit measure/reset.

  • pp_coefficient_threshold (float or None) – PauliPropagator — drop Pauli strings with smaller coefficients.

  • pp_max_pauli_weight (int or None) – PauliPropagator — drop Pauli strings acting on more qubits than this.

  • pp_gates_between_trims (int or None) – PauliPropagator — gates applied between truncation passes.

  • pp_gates_between_deduplications (int or None) – PauliPropagator — gates applied between merges of duplicate Pauli strings.

  • pp_pauli_weight_threshold – Deprecated alias for pp_max_pauli_weight.

  • pp_steps_between_trims – Deprecated alias for pp_gates_between_trims.

  • enable_causal_cone_reduction (bool) – Simulate only the causal cone of the measured observables (default: True).

  • auto_reduce (bool) – Detect invariant subspaces (e.g. from checks) and simulate the reduced register (default: True).

  • enable_observable_clustering (bool) – With causal-cone reduction, split multi-observable estimates into groups with disjoint lightcones, each simulated on its own register (default: True).

  • max_cluster_qubits (int or None) – With observable clustering, cap each group at this many lightcone qubits. None (default) keeps overlapping lightcones together.

  • gate_fusion (bool or None) – Fuse compatible gates. None (default) uses each backend’s default.

  • seed (int, np.random.Generator, or None) – Random seed for reproducible stochastic simulations (sampling, measurements, noise).

  • adjoint_backend (str) –

    How analytic derivatives are computed for diff_method="adjoint" (and "best") on the CPU statevector (simulator_type="QCSim", simulation_type="Statevector"):

    • "auto" (default) — "engine" when the installed qoro-maestro provides AdjointProgram, else "inner_product"

    • "engine" — Maestro’s batched adjoint sweep

    • "inner_product" — one maestro.inner_product per parameter and Pauli term

    Other configurations, and finite shots, use parameter-shift.

  • backend (str or divi.backends.CircuitRunner) –

    Where circuits run:

    • "local" (default) — the Maestro engine in this process

    • "qoro" — the Qoro cloud through Divi. The API key comes from QORO_API_KEY (environment or .env file) and the job target from the defaults saved by divi-config-helper; the Maestro options above that differ from Maestro’s defaults (and simulator_type / simulation_type whenever given) are layered over the saved ones, on simulator targets. simulator_type="Gpu" runs the jobs on the Qoro GPU cluster (qoro_gpu) instead of the saved target

    • a Divi CircuitRunner such as a configured divi.backends.QoroService — used as it is, with its own maestro_config

    Needs Divi 0.16+: pip install 'pennylane-maestro[cloud]'. Each batch of tapes becomes at most one expectation-value job and one sampling job. Adjoint derivatives (diff_method="adjoint" or "best") of analytic Pauli/Hamiltonian expectation values run as one submit_vjp job per register width when the backend differentiates on the CPU statevector; otherwise parameter-shift is used. qp.state() and other state-based measurements are not available, nor is incremental_evolve().

Usage examples:

# CPU statevector (default)
dev = qp.device("maestro.qubit", wires=20)

# GPU statevector
dev = qp.device("maestro.qubit", wires=20, simulator_type="Gpu")

# GPU with double precision
dev = qp.device("maestro.qubit", wires=20,
                simulator_type="Gpu", precision="double")

# MPS for large qubit counts
dev = qp.device("maestro.qubit", wires=100,
                simulation_type="MatrixProductState",
                max_bond_dimension=256)

# Stabilizer for Clifford circuits
dev = qp.device("maestro.qubit", wires=1000,
                simulation_type="Stabilizer")

# Reproducible random sampling with seed
dev = qp.device("maestro.qubit", wires=5, shots=1000, seed=42)

# The Qoro cloud through Divi
dev = qp.device("maestro.qubit", wires=20, backend="qoro")
property seed: int | None

Return the random seed configured on the device.

property backend

The Divi CircuitRunner circuits run on, or None when they run on the local Maestro engine.

incremental_evolve(init, trotter_step, measure_at_steps, observables)

Perform persistent incremental time evolution using Maestro’s incremental_evolve.

Executes init once, then applies trotter_step incrementally, evaluating expectation values for observables at each step in measure_at_steps without re-simulating from scratch.

Parameters:
  • init (callable, list[Operator], or QuantumCircuit) – Initial state preparation.

  • trotter_step (callable, list[Operator], or QuantumCircuit) – Single Trotter step.

  • measure_at_steps (Sequence[int]) – Step indices at which to measure.

  • observables (list[Operator] or list[str]) – Observables to evaluate.

Returns:

The expectation values and timings, with keys:
  • "expectation_values": NumPy array of shape (len(measure_at_steps), len(observables))

  • "steps": list of measured step indices

  • "time_taken": total elapsed seconds

  • "time_per_step": seconds per step interval

  • "dynamic_bond_dims": bond dimensions per step (for MPS)

  • "max_bond_dim_reached": max bond dimension reached

Return type:

dict

Functions

incremental_evolve(dev, init, trotter_step, measure_at_steps, observables)

Same as dev.incremental_evolve(init, trotter_step, measure_at_steps, observables).

See MaestroQubitDevice.incremental_evolve() for the arguments and result.