hybridlane.devices.preprocess

Functions

static_analyze_tape(tape[, fill_missing])

Circuit pass that validates a wire is only used as a qubit or a qumode

null_postprocessing(results)

Module Contents

hybridlane.devices.preprocess.static_analyze_tape(tape, fill_missing=None)[source]

Circuit pass that validates a wire is only used as a qubit or a qumode

This validates that once a wire is used in an operation as a qubit or a qumode, that its role remains the same in the rest of the circuit. This is physically motivated since a device cannot perform swap gates between qubits and qumodes (there would be truncation issues).

Example

# This would throw an error
def bad_circuit():
    qml.Displacement(alpha, 0, wires=[0])
    qml.X(1)
    qml.H(0) # error: wire 0 became a qumode earlier during Displacement
Parameters:
  • tape (QuantumScript) – The quantum circuit to check

  • fill_missing (str | None) – An optional string of ("qubits", "qumodes") specifying what default to provide for unidentified wires

Raises:
Return type:

tuple[pennylane.tape.QuantumScriptBatch, pennylane.typing.PostprocessingFn]

hybridlane.devices.preprocess.null_postprocessing(results)[source]