def test_switch_backend1(): c = Circuit().x[0].h[0] assert np.array_equal(c.run(), c.run(backend="numpy")) BlueqatGlobalSetting.set_default_backend("qasm_output") assert c.run() == c.to_qasm() # Different instance of QasmOutputBackend is used. # Lhs is owned by Circuit, rhs is passed as argument. But in this case same result. from blueqat.backends.qasm_output_backend import QasmOutputBackend assert c.run(output_prologue=False) == c.run(False, backend=QasmOutputBackend()) BlueqatGlobalSetting.set_default_backend("numpy") assert c.run(shots=5) == c.run_with_numpy(shots=5)
def test_circuit1(): c = Circuit().h[:].z[6] assert_almost_equal(c.run_with_numpy(), c.run_with_qulacs())
def test_circuit2(): c = Circuit().x[2].x[4] assert_almost_equal(c.run_with_numpy(), c.run_with_qulacs())