Anders and Briegel in Python
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

16 lignes
376B

  1. from abp.graphstate 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)