loom.executor.op_signature

Copyright 2024 Entropica Labs Pte Ltd

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

class loom.executor.op_signature.OpSignature(*args, **kwargs)[source]

Bases: object

A class to represent a channel signature for quantum operations.

Parameters:
  • name (str) – The name of the channel signature.

  • quantum_input (int) – The number of quantum inputs required by the operation.

  • classical_input (int) – The number of classical inputs required by the operation.

  • description (str, optional) – A description of the channel signature. Default is an empty string.

classical_input: int = 0
description: str = ''
is_clifford: bool = True
classmethod measurement_op_signature(name)[source]

Create a measurement operation signature.

Return type:

OpSignature

name: str
op_type: OpType
quantum_input: int = 0
classmethod reset_op_signature(name)[source]

Create a reset operation signature.

Return type:

OpSignature

classmethod single_qubit_op_signature(name, is_clifford=True)[source]

Create a single qubit operation signature.

Return type:

OpSignature

classmethod two_qubit_op_signature(name)[source]

Create a two qubit operation signature.

Return type:

OpSignature

classmethod validate_positive_inputs(v)[source]

Validate that quantum_input and classical_input are non-negative.

class loom.executor.op_signature.OpType(*values)[source]

Bases: Enum

Enum for operation types.

BOOL_LOGIC = 'bool_logic'
CONTROL_FLOW = 'control_flow'
CUSTOM = 'custom'
MEASUREMENT = 'measurement'
RESET = 'reset'
SINGLE_QUBIT = 'single_qubit'
SUBCIRCUIT = 'subcircuit'
TWO_QUBIT = 'two_qubit'
UTILS = 'utils'