pyqonvert.routing.Layout

class pyqonvert.routing.Layout(number_qubits)

Helper to keep track of current layout of logical qubits on physical qubits.

Used internally to keep track of current layout during routing

__init__()

Methods

__init__()

is_trivial()

Return true when Layout is trivial i:i.

logical_to_physical()

Return the logical_to_physical dictionary of the Layout.

physical_to_logical()

Return the physical_to_logical dictionary of the Layout.

swap_physical(control, target)

Update Layout for a SWAP of two physical qubits.

is_trivial()

Return true when Layout is trivial i:i.

Returns:

whether the Layout is trivial or not.

Return type:

bool

logical_to_physical()

Return the logical_to_physical dictionary of the Layout.

Returns:

The dictionary of {qubit: qubit} elements.

Return type:

dict[int, int]

physical_to_logical()

Return the physical_to_logical dictionary of the Layout.

Returns:

The dictionary of {qubit: qubit} elements.

Return type:

dict[int, int]

swap_physical(control, target)

Update Layout for a SWAP of two physical qubits.

Parameters:
  • control (int) -- The control qubit.

  • target (int) -- The target qubit.