loom.eka.channel

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.eka.channel.Channel(*args, **kwargs)[source]

Bases: object

Identifies information channels connecting the Circuit elements: examples are classical or quantum bit channels

Parameter

type: ChannelType

The type of the channel: QUANTUM or CLASSICAL, default is QUANTUM

label: str

The label of the channel, allowing it to be grouped in a user friendly way, E.g. can be “red”, “ancilla_qubit” or “my_favourite_qubit”

id: str

The unique identifier of the channel

id: str = FieldInfo(annotation=str, required=False, default_factory=<lambda>)
is_classical()[source]

Check if the channel is a classical channel. :returns: True if the channel is a classical channel, False otherwise. :rtype: bool

is_quantum()[source]

Check if the channel is a quantum channel.

Returns:

True if the channel is a quantum channel, False otherwise.

Return type:

bool

label: Optional[str] = None
classmethod set_default_label(v, info)[source]

Set the default label based on the type of the channel, according to the following scheme: ChannelType.QUANTUM: “data_qubit” ChannelType.CLASSICAL: “classical_bit”

Return type:

str

type: ChannelType = 'quantum'
class loom.eka.channel.ChannelType(*values)[source]

Bases: str, Enum

The type of the channel: QUANTUM or CLASSICAL More types should be added when we feel the need for it

CLASSICAL = 'classical'
QUANTUM = 'quantum'
loom.eka.channel.create_default_label(channel_type)[source]

Creates a default label for the channel.

Parameters:

channel_type (ChannelType) – The type of the channel: QUANTUM or CLASSICAL

Returns:

The default label for the channel

Return type:

str