Skip to content

Commit

Permalink
Use the simulator to compute unitary
Browse files Browse the repository at this point in the history
Provide qeye as the input states.
  • Loading branch information
BoxiLi committed Dec 10, 2023
1 parent e50feed commit d9a2341
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/qutip_qip/circuit/circuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@
Measurement,
expand_operator,
GATE_CLASS_MAP,
gate_sequence_product,
)
from .circuitsimulator import (
CircuitSimulator,
CircuitResult,
)
from qutip import basis, Qobj
from qutip import Qobj, qeye


try:
Expand Down Expand Up @@ -939,8 +938,9 @@ def compute_unitary(self):
circuit_unitary : :class:`qutip.Qobj`
Product of all gate arrays in the quantum circuit.
"""
gate_list = self.propagators()
circuit_unitary = gate_sequence_product(gate_list)
sim = CircuitSimulator(self)
result = sim.run(qeye(self.dims))
circuit_unitary = result.get_final_states()[0]
return circuit_unitary

def latex_code(self):
Expand Down

0 comments on commit d9a2341

Please sign in to comment.