Skip to content

Commit

Permalink
Revert solver changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Ericgig committed Oct 27, 2023
1 parent 1f73849 commit 4e223b8
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions qutip_benchmark/benchmarks/bench_solvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ def jc_setup(size):

# Hamiltonian
Ia = qutip.qeye(2)
Ic = qutip.qeye(size, dtype="csr")
Ic = qutip.qeye(size)

a = qutip.destroy(size, dtype="csr")
a_dag = qutip.create(size, dtype="csr")
a = qutip.destroy(size)
a_dag = qutip.create(size)
n = a_dag * a

sm = qutip.sigmam()
Expand Down Expand Up @@ -146,7 +146,8 @@ def bench_mesolve(benchmark, model_solve, size):
elif model_solve == "Qubit Spin Chain":
H, psi0, c_ops, e_ops = qubit_setup(size)

benchmark(mesolve, H, psi0, tlist, c_ops, e_ops)
result = benchmark(mesolve, H, psi0, tlist, c_ops, e_ops)
return result


def bench_mcsolve(benchmark, model_solve, size):
Expand All @@ -159,20 +160,21 @@ def bench_mcsolve(benchmark, model_solve, size):
elif model_solve == "Qubit Spin Chain":
H, psi0, c_ops, e_ops = qubit_setup(size)

benchmark(mcsolve, H, psi0, tlist, c_ops, e_ops, ntraj=1)
result = benchmark(mcsolve, H, psi0, tlist, c_ops, e_ops, ntraj=1)
return result


@pytest.mark.nightly
def bench_steadystate(benchmark, model_steady, size):
benchmark.group = "solvers:steadystate"

if model_steady == "Cavity":
if size >= 128:
pytest.skip("Slow test")
H, _, c_ops, _ = cavity_setup(size)
# Steadystate is bad with Dia.
H = H.to("csr")
c_ops = [c_ops[0].to("csr")]

elif model_steady == "Jaynes-Cummings":
H, _, c_ops, _ = jc_setup(size)

benchmark(steadystate, H, c_ops)
result = benchmark(steadystate, H, c_ops)
return result

0 comments on commit 4e223b8

Please sign in to comment.