Anders and Briegel in Python
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

test_get_state_vector.py 365B

123456789101112131415
  1. from abp import GraphState
  2. from abp import qi
  3. import numpy as np
  4. def test_single_qubit():
  5. """ Test some single-qubit stuff """
  6. g = GraphState()
  7. g.add_node(0)
  8. g.add_node(1)
  9. g.act_local_rotation_by_name(0, "hadamard")
  10. g.act_local_rotation_by_name(1, "hadamard")
  11. g.act_cz(0, 1)
  12. assert np.allclose(g.to_state_vector().state, qi.bond)