hybridlane.devices.preprocess

Functions

static_analyze_tape(tape)

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

null_postprocessing(results)

fill_wire_dims(tape[, wire_dims, default_qumode_dim])

Module Contents

hybridlane.devices.preprocess.static_analyze_tape(tape)[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():
    qp.Displacement(alpha, 0, wires=[0])
    qp.X(1)
    qp.H(0) # error: wire 0 became a qumode earlier during Displacement
Parameters:

tape (QuantumScript) – The quantum circuit to check

Raises:
  • StaticAnalysisError

  • if its type cannot be inferred and no default is provided.

Return type:

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

hybridlane.devices.preprocess.null_postprocessing(results)[source]
hybridlane.devices.preprocess.fill_wire_dims(tape, wire_dims=None, default_qumode_dim=None)[source]
Parameters:
Return type:

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