quairkit.ansatz.layer
The source file of the class for quantum circuit templates.
-
class quairkit.ansatz.layer.Layer(qubits_idx, num_qubits, depth=
1
)
Base class for Layers.
- Parameters:
- qubits_idx : Iterable[int] | str
Indices of the qubits on which this layer is applied.
- num_qubits : int
Total number of qubits.
- depth : int
Number of layers.
Note
A Circuit instance needs to extend this Layer instance to be used in a circuit.
-
property gate_history
list of gates information of this layer
- Returns:
history of quantum gates
-
class quairkit.ansatz.layer.SuperpositionLayer(qubits_idx=
None
, num_qubits=None
)
Layers of Hadamard gates.
- Parameters:
- qubits_idx : Iterable[int] | str
Indices of the qubits on which the layer is applied.
Defaults to None
i.e. applied on all qubits.
- num_qubits : int
Total number of qubits. Defaults to None
.
-
class quairkit.ansatz.layer.LinearEntangledLayer(qubits_idx=
None
, num_qubits=None
, depth=1
)
Linear entangled layers consisting of Ry gates, Rz gates, and CNOT gates.
- Parameters:
- qubits_idx : Iterable[int] | str
Indices of the qubits on which the layer is applied.
Defaults to None
i.e. applied on all qubits.
- num_qubits : int
Total number of qubits. Defaults to None
.
- depth : int
Number of layers. Defaults to 1
.
-
class quairkit.ansatz.layer.RealEntangledLayer(qubits_idx=
None
, num_qubits=None
, depth=1
)
Strongly entangled layers consisting of Ry gates and CNOT gates.
- Parameters:
- qubits_idx : Iterable[int] | str
Indices of the qubits on which the layer is applied.
Defaults to None
i.e. applied on all qubits.
- num_qubits : int
Total number of qubits. Defaults to None
.
- depth : int
Number of layers. Defaults to 1
.
-
class quairkit.ansatz.layer.ComplexEntangledLayer(qubits_idx=
None
, num_qubits=None
, depth=1
)
Strongly entangled layers consisting of single-qubit rotation gates and CNOT gates.
Note
The mathematical representation of this layer of quantum gates is a complex unitary matrix.
This ansatz is from the following paper: https://arxiv.org/abs/1804.00633.
- Parameters:
- qubits_idx : Iterable[int] | str
Indices of the qubits on which the layer is applied.
Defaults to None
i.e. applied on all qubits.
- num_qubits : int
Total number of qubits. Defaults to None
.
- depth : int
Number of layers. Defaults to 1
.
-
class quairkit.ansatz.layer.WeakSuperpositionLayer(qubits_idx=
None
, num_qubits=None
)
Layers of Ry gates with a rotation angle \(\pi/4\).
- Parameters:
- qubits_idx : Iterable[int] | str
Indices of the qubits on which the layer is applied.
Defaults to None
i.e. applied on all qubits.
- num_qubits : int
Total number of qubits. Defaults to None
.
-
class quairkit.ansatz.layer.ComplexBlockLayer(qubits_idx=
None
, num_qubits=None
, depth=1
)
Weakly entangled layers consisting of single-qubit rotation gates and CNOT gates.
Note
The mathematical representation of this layer of quantum gates is a complex unitary matrix.
- Parameters:
- qubits_idx : Iterable[int] | str
Indices of the qubits on which the layer is applied.
Defaults to None
i.e. applied on all qubits.
- num_qubits : int
Total number of qubits. Defaults to None
.
- depth : int
Number of layers. Defaults to 1
.
-
class quairkit.ansatz.layer.RealBlockLayer(qubits_idx=
None
, num_qubits=None
, depth=1
)
Weakly entangled layers consisting of Ry gates and CNOT gates.
Note
The mathematical representation of this layer of quantum gates is a real unitary matrix.
- Parameters:
- qubits_idx : Iterable[int] | str
Indices of the qubits on which the layer is applied.
Defaults to None
i.e. applied on all qubits.
- num_qubits : int
Total number of qubits. Defaults to None
.
- depth : int
Number of layers. Defaults to 1
.
-
class quairkit.ansatz.layer.QAOALayer(edges, nodes, depth=
1
)
QAOA driving layers
Note
this layer only works for MAXCUT problem
- Parameters:
- edges : Iterable
edges of the graph
- nodes : Iterable
nodes of the graph
- depth : int
depth of layer
-
class quairkit.ansatz.layer.QAOALayerWeighted(edges, nodes, depth=
1
)
QAOA driving layers with weights
- Parameters:
- edges : Dict[Tuple[int, int], float]
edges of the graph with weights
- nodes : Dict[int, float]
nodes of the graph with weights
- depth : int
depth of layer