Skip to content

Commit

Permalink
fix some bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Kotani-UT committed Aug 9, 2024
1 parent 4a104bf commit d211250
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions qdd/qdd_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ def merge_circuit(self, circ:QiskitCircuit, gc_freq=20):
matrix = _qiskit_gates_2q_0param[qiskit_gate_type]()
elif qiskit_gate_type in _qiskit_gates_2q_1param:
matrix = _qiskit_gates_2q_1param[qiskit_gate_type](i.params[0])
gate = pyQDD.makeTwoQubitGate(n_qubit, matrix, self.get_qID(qargs[-2]), self.get_qID(qargs[-1]), controls)
gate = pyQDD.makeTwoQubitGate(n_qubit, matrix, self.get_qID(qargs[-1]), self.get_qID(qargs[-2]), controls)
current = pyQDD.mm_multiply(gate, current)
elif qiskit_gate_type in _qiskit_gates_large:
matrix = i.to_matrix()
Expand Down Expand Up @@ -624,7 +624,7 @@ def _evaluate_circuit(self, circ: QiskitCircuit, circ_prop: CircuitProperty, opt
matrix = _qiskit_gates_2q_0param[qiskit_gate_type]()
elif qiskit_gate_type in _qiskit_gates_2q_1param:
matrix = _qiskit_gates_2q_1param[qiskit_gate_type](i.params[0])
gate = pyQDD.makeTwoQubitGate(n_qubit, matrix, map_after_swap[self.get_qID(qargs[-2])], map_after_swap[self.get_qID(qargs[-1])], controls)
gate = pyQDD.makeTwoQubitGate(n_qubit, matrix, map_after_swap[self.get_qID(qargs[-1])], map_after_swap[self.get_qID(qargs[-2])], controls)
current = pyQDD.mv_multiply(gate, current) if use_mpi ==False else pyQDD.mv_multiply_MPI(gate, current, n_qubit, max([map_after_swap[self.get_qID(i)] for i in qargs])) if use_bcast==False else pyQDD.mv_multiply_MPI_bcast(gate, current, n_qubit, max([map_after_swap[self.get_qID(i)] for i in qargs]))
elif qiskit_gate_type in _qiskit_gates_unitary:
matrix = i.to_matrix()
Expand Down
2 changes: 1 addition & 1 deletion src/dd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ mEdge makeLargeGate(const ComplexMatrix &g){
mEdge makeLargeGate(const ComplexMatrix &g, const Qubit level, const std::size_t rowStart, const std::size_t rowEnd, const std::size_t colStart, const std::size_t colEnd){
if (level == 0){
assert (rowEnd - rowStart == 2 && colEnd - colStart == 2);
return makeMEdge(2, {mEdge{{g[rowStart][colStart].real(), g[rowStart][colStart].imag()}, mNode::terminal},
return makeMEdge(0, {mEdge{{g[rowStart][colStart].real(), g[rowStart][colStart].imag()}, mNode::terminal},
mEdge{{g[rowStart][colStart+1].real(), g[rowStart][colStart+1].imag()}, mNode::terminal},
mEdge{{g[rowStart+1][colStart].real(), g[rowStart+1][colStart].imag()}, mNode::terminal},
mEdge{{g[rowStart+1][colStart+1].real(), g[rowStart+1][colStart+1].imag()}, mNode::terminal}});
Expand Down

0 comments on commit d211250

Please sign in to comment.