Anders and Briegel in Python
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
1.7KB

  1. cphase (vertex a, vertex b):
  2. if ngbh a\{b} =/= {}:
  3. remove VOP (a, b)
  4. end if
  5. if ngbh b\{a} =/= {}:
  6. remove VOP (b, a)
  7. end if
  8. [It may happen that the condition in line 2 has not been fulfilled then, but is now due to the effect of line 5. So we check again:]
  9. if ngbh a\{b} =/= {}:
  10. remove VOP (a, b)
  11. end if
  12. [Now we can be sure that the the condition (ngbh c\{a, b} = {} or VOP[c] ∈ Z) is fulfilled for c = a, b and we may use the lookup table (cf. Eq. (9)).]
  13. if {a, b} ∈ E :
  14. edge ← true
  15. else:
  16. edge ← false
  17. end if
  18. (edge, VOP[a], VOP[b]) ← cphase_table[edge, VOP[a], VOP[b]]
  19. remove_VOP (vertex a, vertex b):
  20. [This reduces VOP[a] to I, avoiding (if possible) to use b as swapping partner.]
  21. [First, we choose a swapping partner c.]
  22. if ngbh a\{b} = {}:
  23. c ← any element of ngbh a\{b}
  24. else:
  25. c←b
  26. end if
  27. d ← decomposition lookup table [a]
  28. [c contains now a decomposition such as Eq. (7)]
  29. for v from last factor of d to first factor of d
  30. if v = −iX:
  31. local complementation (a)
  32. else: ( this means that v = iZ)
  33. local complementation (b)
  34. end if
  35. [Now, VOP[a] = I.]
  36. local complementation (vertex a)
  37. [performs the operation specified in Definition 4]
  38. nv ← ngbh v
  39. for i ∈ nv :
  40. for j ∈ nv :
  41. if i < j:
  42. if (i, j) ∈ E:
  43. remove edge (i, j)
  44. else:
  45. add edge (i, j)
  46. end if
  47. end if
  48. end for
  49. VOP[i] ← VOP[i]sqrt(−iZ)
  50. VOP[v] ← VOP[v]sqrt(iX)
  51. end for