Browse Source

Starting to compute the CZ table

master
Pete Shadbolt 8 years ago
parent
commit
ae05a679ef
3 changed files with 25 additions and 0 deletions
  1. +20
    -0
      cz_table.py
  2. +4
    -0
      qi.py
  3. +1
    -0
      server.py

+ 20
- 0
cz_table.py View File

@@ -0,0 +1,20 @@
import qi
import numpy as np
import tables
import tqdm

# TODO: ensure that Constraint 1 is met. i.e.
# if C1 is in Z, choose C1' such that it is in Z

bond = qi.cz * np.kron(qi.plus, qi.plus)
no_bond = np.kron(qi.plus, qi.plus)

for u in tables.unitaries:
psi = qi.cz*np.kron(u, qi.ha)*bond

for bb in bond, no_bond:
for a in tables.unitaries:
for b in tables.unitaries:
if np.allclose(np.kron(a, b)*bb, psi):
print "match"


+ 4
- 0
qi.py View File

@@ -14,6 +14,10 @@ py = np.matrix([[0, -1j], [1j, 0]], dtype=complex)
pz = np.matrix([[1, 0], [0, -1]], dtype=complex)
ha = np.matrix([[1, 1], [1, -1]], dtype=complex) / np.sqrt(2)
ph = np.matrix([[1, 0], [0, 1j]], dtype=complex)
cz = np.matrix(np.eye(4), dtype=complex)
cz[3,3]=-1

plus = np.matrix([[1],[1]], dtype=complex) / np.sqrt(2)

sqy = sqrtm(1j * py)
msqy = sqrtm(-1j * py)


+ 1
- 0
server.py View File

@@ -0,0 +1 @@
#TODO: this will serve an in-memory state for visualization etc in the browser

Loading…
Cancel
Save