Anders and Briegel in Python
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

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)