MPS execution for quimb

This commit is contained in:
Nitin Shivaraman
2023-10-05 15:13:49 +08:00
parent 6455825050
commit 3d359ebc1f
3 changed files with 19 additions and 10 deletions

View File

@@ -29,8 +29,9 @@ def time(func):
return time, res
@pytest.mark.parametrize("nqubits", [1, 2, 5, 10])
def test_eval(nqubits: int):
@pytest.mark.parametrize("nqubits, tolerance",
[(1, 1e-6), (2, 1e-6), (5, 1e-3), (10, 1e-3)])
def test_eval(nqubits: int, tolerance: float):
# hack quimb to use the correct number of processes
# TODO: remove completely, or at least delegate to the backend
# implementation
@@ -57,4 +58,5 @@ def test_eval(nqubits: int):
)
assert 1e-2 * qibo_time < quimb_time < 1e2 * qibo_time
assert np.allclose(result_sv, result_tn), "Resulting dense vectors do not match"
assert np.allclose(result_sv, result_tn,
atol=tolerance), "Resulting dense vectors do not match"