Skip to content

laboneq_applications.tasks.multi_qubit_logic

This module defines tasks handling multi-qubit logic and manipulations.

extract_edges_from_qubit_pairs(qpu, qubit_pair_uids, *, tag)

Extracts all edges of type tag in the QPU with the qubit pair passed.

Parameters:

Name Type Description Default
qpu QPU

The QPU where the topology is stored.

required
qubit_pair_uids list[list[str]]

The pairs of UIDs for the qubits that will be used as source and target node from the edge, respectively.

required
tag str

The edge tag to be searched.

required

Returns:

Type Description
list[TopologyEdge]

The list of extracted edges.

extract_nodes_from_edges(edges, node_type='all')

Extract the nodes of a list of edges.

Parameters:

Name Type Description Default
edges list[TopologyEdge]

A list of TopologyEdge instances from which to extract the nodes.

required
node_type str

The type of nodes to extract: "all": both the source and the target nodes are returned; "source": only the source nodes are returned; "target": only the target nodes are returned.

'all'

Returns:

Type Description
list[QuantumElement] | tuple[list[QuantumElement], list[QuantumElement]]

The list of extracted nodes. If "all" is selected as a node_type, we return a tuple of lists: the first element is the list of source nodes, and the second element is the list of target nodes.

Raises:

Type Description
TypeError

If edges has an invalid type.

ValueError

If the node_type is not "all", "source", or "target".