Skip to content

Commit

Permalink
Merge 7ebec1a into 22c0ebf
Browse files Browse the repository at this point in the history
  • Loading branch information
BoxiLi committed Sep 8, 2022
2 parents 22c0ebf + 7ebec1a commit e6832fd
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/qutip_qip/transpiler/chain.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from copy import deepcopy
from ..circuit import QubitCircuit


Expand Down Expand Up @@ -27,7 +28,8 @@ def to_chain_structure(qc, setup="linear"):
# FIXME This huge block has been here for a long time.
# It could be moved to the new compiler section and carefully
# splitted into smaller peaces.
qc_t = QubitCircuit(qc.N, qc.reverse_states)
qc_t = deepcopy(qc)
qc_t.gates = []
swap_gates = [
"SWAP",
"ISWAP",
Expand Down Expand Up @@ -265,12 +267,8 @@ def to_chain_structure(qc, setup="linear"):
j = j + 1

else:
qc_t.add_gate(
gate.name,
gate.targets,
gate.controls,
gate.arg_value,
gate.arg_label,
)
# This gate can be general quantum operations
# such as measurement or global phase.
qc_t.add_gate(gate)

return qc_t

0 comments on commit e6832fd

Please sign in to comment.