Skip to content

Commit

Permalink
Add feature to show the direction of CX gate
Browse files Browse the repository at this point in the history
example : (1, ['cx_{q0, q1}'])
  • Loading branch information
minwook-shin committed Sep 29, 2023
1 parent e75a465 commit 8230ba2
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ def actual_convert_action(self):
for layer in dag.layers():
circuit = self.qiskit.converters.dag_to_circuit(layer['graph'])
matrix_list["gate"].append(self.qiskit.quantum_info.Operator(circuit).to_matrix())
matrix_list["name"].append((layer_index, [_inst[0].name for _inst in circuit.data]))
matrix_list["name"].append((layer_index, [_inst[0].name + "_{q" + str(_inst.qubits[0].index) + ", q" +
str(_inst.qubits[1].index) + "}"
if _inst[0].name == "cx"
else _inst[0].name for _inst in circuit.data]))
layer_index += 1
matrix_list["result"] = self.qiskit.quantum_info.Operator(self.input_value).to_matrix()
if self.option.get("print", False) == "raw":
Expand Down

0 comments on commit 8230ba2

Please sign in to comment.