[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
@@ -9,6 +9,7 @@ from qibo.symbols import X, Z
|
||||
|
||||
ABS_TOL = 1e-7
|
||||
|
||||
|
||||
def qibo_qft(nqubits, swaps):
|
||||
circ_qibo = QFT(nqubits, swaps)
|
||||
state_vec = circ_qibo().state(numpy=True)
|
||||
@@ -166,7 +167,9 @@ def test_expectation(nqubits: int, dtype="complex128"):
|
||||
}
|
||||
backend.configure_tn_simulation(computation_settings_1)
|
||||
result_tn = backend.execute_circuit(circuit=qibo_circ)
|
||||
assert math.isclose(exact_expval.item(), result_tn.real.get().item(), abs_tol=ABS_TOL)
|
||||
assert math.isclose(
|
||||
exact_expval.item(), result_tn.real.get().item(), abs_tol=ABS_TOL
|
||||
)
|
||||
|
||||
# Test with user defined hamiltonian using "hamiltonians.SymbolicHamiltonian" object.
|
||||
computation_settings_2 = {
|
||||
@@ -177,7 +180,9 @@ def test_expectation(nqubits: int, dtype="complex128"):
|
||||
}
|
||||
backend.configure_tn_simulation(computation_settings_2)
|
||||
result_tn = backend.execute_circuit(circuit=qibo_circ)
|
||||
assert math.isclose(exact_expval.item(), result_tn.real.get().item(), abs_tol=ABS_TOL)
|
||||
assert math.isclose(
|
||||
exact_expval.item(), result_tn.real.get().item(), abs_tol=ABS_TOL
|
||||
)
|
||||
|
||||
# Test with user defined hamiltonian using Dictionary object form of hamiltonian.
|
||||
ham_dict = build_observable_dict(nqubits)
|
||||
@@ -189,4 +194,6 @@ def test_expectation(nqubits: int, dtype="complex128"):
|
||||
}
|
||||
backend.configure_tn_simulation(computation_settings_3)
|
||||
result_tn = backend.execute_circuit(circuit=qibo_circ)
|
||||
assert math.isclose(exact_expval.item(), result_tn.real.get().item(), abs_tol=ABS_TOL)
|
||||
assert math.isclose(
|
||||
exact_expval.item(), result_tn.real.get().item(), abs_tol=ABS_TOL
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user