Skip to content

Commit

Permalink
create a new H everytime
Browse files Browse the repository at this point in the history
  • Loading branch information
BoxiLi committed Jul 7, 2021
1 parent 515a0ea commit 3ed593a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/qutip_qip/device/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -704,13 +704,13 @@ def run_analytically(self, init_state=None, qc=None):
coeffs = self.get_full_coeffs()

# Compute drift Hamiltonians
H = 0
H_drift = 0
for drift_ham in self.drift.drift_hamiltonians:
H += drift_ham.get_qobj(self.dims)
H_drift += drift_ham.get_qobj(self.dims)

# Compute control Hamiltonians
for n in range(len(tlist)-1):
H += sum(
H = H_drift + sum(
[coeffs[m, n] * self.ctrls[m]
for m in range(len(self.ctrls))])
dt = tlist[n + 1] - tlist[n]
Expand Down
2 changes: 1 addition & 1 deletion tests/test_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ def testDrift(self):
"""
processor = Processor(N=1)
processor.add_drift(sigmax() / 2, 0)
tlist = np.array([0., np.pi])
tlist = np.array([0., np.pi, 2*np.pi, 3*np.pi])
processor.add_pulse(Pulse(None, None, tlist, False))
ideal_qobjevo, _ = processor.get_qobjevo(noisy=True)
assert_equal(ideal_qobjevo.cte, sigmax() / 2)
Expand Down

0 comments on commit 3ed593a

Please sign in to comment.