CircuitMatrix
QuICT.core.utils.get_gates_order_by_depth ¶
Order the gates of circuit by its depth layer
Returns:
-
list–List[List[BasicGate]]: The list of gates which at same layers in circuit.
Source code in QuICT/core/utils/circuit_matrix.py
QuICT.core.utils.circuit_matrix.MatrixGroup ¶
QuICT.core.utils.CircuitMatrix ¶
Generate Circuit's Matrix.
Parameters:
-
device(str, default:'CPU') –The device type, one of [CPU, GPU]. Defaults to "CPU".
-
precision(str, default:'double') –The precision for matrix, one of [single, double]. Defaults to "double".
Source code in QuICT/core/utils/circuit_matrix.py
get_unitary_matrix ¶
Parameters:
-
gates(List[BasicGate]) –The list of Quantum Gates in the Circuit.
-
qubits_num(int) –The number of qubits
Returns:
-
ndarray–np.ndarray: The unitary matrix of the Quantum Circuit.
Source code in QuICT/core/utils/circuit_matrix.py
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | |
get_unitary_matrix_non_expand ¶
Calculate the total unitary for gates in the gate list without expanding each gate to the system size of the total qubit number. Args: gates (List[BasicGate]): The list of Quantum Gates in the Circuit. qubits_num (int): The number of qubits
Returns:
-
ndarray–np.ndarray: The unitary matrix of the Quantum Circuit.
Source code in QuICT/core/utils/circuit_matrix.py
merge_gates ¶
Combined two Quantum Gate togather.
Parameters:
-
u1(ndarray) –The unitary matrix of Gate A.
-
u1_args(list) –The qubit indexes of Gate A.
-
u2(ndarray) –The unitary matrix of Gate B.
-
u2_args(list) –The qubit indexes of Gate B.
Returns:
-
Tuple((ndarray, list)) –The combined unitary matrix and its qubits indexes.