Layout
QuICT.core.layout.LayoutType ¶
Bases: Enum
QuICT.core.layout.LayoutEdge ¶
Implement a physical connection between physical qubits
Attributes:
-
u(int)–Node u of edge
-
v(int)–Node v of edge
-
directional(bool)–Whether the layout is directional
-
error_rate(float)–Error_rate between u and v, default 1.0
Source code in QuICT/core/layout/layout.py
QuICT.core.layout.Layout ¶
Layout(qubit_number: int, name: str = 'unknown', layout_type: LayoutType = LayoutType.normal, unreachable_nodes: list = None, layout_width: int = -1)
Implement a topology in a physical device
Parameters:
-
qubit_number(int)–the number of qubits
-
name(string)–the name of the topology
Source code in QuICT/core/layout/layout.py
directionalized
property
¶
Return a copy of current layout with all undirected edges replaced with 2 reversed directional edges.
add_edge ¶
add an edge in the layout
Parameters:
-
u(int)–Edge endpoint u
-
v(int)–Edge endpoint v
-
directional(bool)–Whether the edge is directional
-
error_rate(float)–Error rate, default 1.0
Source code in QuICT/core/layout/layout.py
build_layout_by_double_gate_fidelity ¶
build layout by double_gate_fidelity form virtual quantum machine.
Source code in QuICT/core/layout/layout.py
check_edge ¶
Check whether layout contain u->v
Parameters:
-
u(int)–the edge endpoint u
-
v(int)–the edge endpoint v
Return: bool: whether layout contain u->v
Source code in QuICT/core/layout/layout.py
draw ¶
Visualization of the topology structure.
Parameters:
-
mode(str, default:None) –The mode of topology, should be one of [random, grid, linear, circuit, rhombus]; default to be grid.
Source code in QuICT/core/layout/layout.py
get_sublayout_edges ¶
Get list of edges with target qubits from current Layout.
Parameters:
-
qubits(list) –The target qubits
Returns:
-
list(List[LayoutEdge]) –The list of LayoutEdge
Source code in QuICT/core/layout/layout.py
grid_layout
staticmethod
¶
grid_layout(qubit_number: int, width: int = None, unreachable_nodes: list = [], directional: bool = DIRECTIONAL_DEFAULT, error_rate: list = None)
Get Grid Structure Topology.
Parameters:
-
qubit_number(int)–the number of qubits
-
width(int, default:None) –The width of grid layout. Defaults to None.
-
unreachable_nodes(list, default:[]) –The nodes which are not work. Defaults to [].
-
directional(bool, default:DIRECTIONAL_DEFAULT) –Whether the edge is directional. Defaults to DIRECTIONAL_DEFAULT.
-
error_rate(list, default:None) –Error rate for each edge, default 1.0. Defaults to []. WARNING: The error rate is for each valid edges from top to bottom, left to right. Please make sure you know exactly every edges' position and rate.
Returns:
-
Layout–The layout with grid topology
Source code in QuICT/core/layout/layout.py
linear_layout
staticmethod
¶
Return the layout with linearly topology.
Parameters:
-
qubit_number(int)–the number of qubits
-
directional(_type_, default:DIRECTIONAL_DEFAULT) –Whether the edge is directional. Defaults to DIRECTIONAL_DEFAULT.
-
error_rate(list, default:None) –Error rate for each edges, default 1.0. Defaults to [].
Returns:
-
Layout–The layout with linearly topology
Source code in QuICT/core/layout/layout.py
load_file
classmethod
¶
Load layout from file. Args: file_path(str): Path of layout file. Return: Layout: Layout parsed from file.
Source code in QuICT/core/layout/layout.py
out_edges ¶
edges begin from begin_point
Parameters:
-
begin_point(int)–the index of begin node
Return
list
Source code in QuICT/core/layout/layout.py
remove_edge ¶
remove an edge in the layout
Parameters:
-
u(int)–Edge endpoint u
-
v(int)–Edge endpoint v
-
directional(bool)–Whether the edge is directional
Source code in QuICT/core/layout/layout.py
rhombus_layout
staticmethod
¶
rhombus_layout(qubit_number: int, width: int = None, unreachable_nodes: list = [], directional: bool = DIRECTIONAL_DEFAULT, error_rate: list = None, shape: int = 0)
Get Rhombus Structure Topology.
Parameters:
-
qubit_number(int)–the number of qubits
-
width(int, default:None) –The width of grid layout. Defaults to None.
-
unreachable_nodes(list, default:[]) –The nodes which are not work. Defaults to [].
-
directional(bool, default:DIRECTIONAL_DEFAULT) –Whether the edge is directional. Defaults to DIRECTIONAL_DEFAULT.
-
error_rate(list, default:None) –Error rate for each edge, default 1.0. Defaults to []. WARNING: The error rate is arranged in order of valid edges, from top to bottom, left to right. Please make sure you know exactly every edges' position and rate.
-
shape(int, default:0) –The shape of rhombus; if 0, it will be close shape first; otherwise it will be open shape. default to close shape.
Returns:
-
Layout–The layout with rhombus topology
Source code in QuICT/core/layout/layout.py
set_double_gate_fidelity ¶
Set the coupling strength between qubits
Parameters:
-
double_gate_fidelity(List[Tuple(idx, idx, float)]) –The strength of the interaction between two qubits in a quantum computing system.
Source code in QuICT/core/layout/layout.py
sub_layout ¶
Get partial layout. Only working for undirected layout.
Parameters:
-
qubits_number(list) –The qubit indexes for sub-layout
Returns:
-
Layout(Layout) –The sub-layout
Source code in QuICT/core/layout/layout.py
to_json ¶
Serialize current layout into json string.
Source code in QuICT/core/layout/layout.py
valid_circuit ¶
Validate the given Circuit/CompositeGate is valid with current Layout.
Parameters:
-
circuit(Union[Circuit, CompositeGate]) –The given Circuit/CompositeGate
Returns:
-
bool(bool) –Whether is valid for current layout.
Source code in QuICT/core/layout/layout.py
write_file ¶
Write layout into file.
Parameters:
-
directory(str)–Directory to store layout file in, default "./"