Remove unused imports, format it using black
This commit is contained in:
@@ -1,5 +1,3 @@
|
|||||||
import copy
|
|
||||||
import os
|
|
||||||
from timeit import default_timer as timer
|
from timeit import default_timer as timer
|
||||||
|
|
||||||
import config
|
import config
|
||||||
@@ -22,18 +20,22 @@ def time(func):
|
|||||||
time = end - start
|
time = end - start
|
||||||
return time, res
|
return time, res
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.gpu
|
@pytest.mark.gpu
|
||||||
@pytest.mark.parametrize("nqubits", [1, 2, 5, 10])
|
@pytest.mark.parametrize("nqubits", [1, 2, 5, 10])
|
||||||
def test_eval(nqubits: int):
|
def test_eval(nqubits: int):
|
||||||
import qibotn.cutn
|
import qibotn.cutn
|
||||||
|
|
||||||
# Test qibo
|
# Test qibo
|
||||||
qibo.set_backend(backend=config.qibo.backend, platform=config.qibo.platform)
|
qibo.set_backend(backend=config.qibo.backend,
|
||||||
qibo_time, (qibo_circ, result_sv) = time(lambda: qibo_qft(nqubits, swaps=True))
|
platform=config.qibo.platform)
|
||||||
|
qibo_time, (qibo_circ, result_sv) = time(
|
||||||
|
lambda: qibo_qft(nqubits, swaps=True))
|
||||||
|
|
||||||
# Test Cuquantum
|
# Test Cuquantum
|
||||||
data_type = "complex128"
|
data_type = "complex128"
|
||||||
cutn_time, result_tn = time(lambda: qibotn.cutn.eval(qibo_circ,data_type))
|
cutn_time, result_tn = time(lambda: qibotn.cutn.eval(qibo_circ, data_type))
|
||||||
|
|
||||||
assert 1e-2 * qibo_time < cutn_time < 1e2 * qibo_time
|
assert 1e-2 * qibo_time < cutn_time < 1e2 * qibo_time
|
||||||
assert np.allclose(result_sv, result_tn), "Resulting dense vectors do not match"
|
assert np.allclose(
|
||||||
|
result_sv, result_tn), "Resulting dense vectors do not match"
|
||||||
|
|||||||
Reference in New Issue
Block a user