remove __main__

This commit is contained in:
tankya2
2023-07-24 18:06:19 +08:00
parent ac712d241e
commit 6a22db07ad

View File

@@ -19,19 +19,3 @@ def eval_mps(qibo_circ, gate_algo, datatype):
sv_mps = mps_helper.contract_state_vector(
myconvertor.mps_tensors, myconvertor.options)
return sv_mps
if __name__ == "__main__":
num_qubits = 25
swaps = True
circ_qibo = QFT(num_qubits, swaps)
exact_gate_algorithm = {'qr_method': False,
'svd_method': {'partition': 'UV', 'abs_cutoff': 1e-12}}
dtype = "complex128"
sv_mps = eval_mps(circ_qibo, exact_gate_algorithm, dtype)
sv_reference = eval(circ_qibo, dtype)
state_vec = np.array(circ_qibo())
print(f"State vector difference: {abs(sv_mps-sv_reference).max():0.3e}")
assert cp.allclose(sv_mps, sv_reference)
assert cp.allclose(sv_mps.flatten(), state_vec)