Skip to content

Instantly share code, notes, and snippets.

@goerz
Created September 12, 2016 19:59
Show Gist options
  • Save goerz/b8c3314d1f6f3beec1d4d748f758c57b to your computer and use it in GitHub Desktop.
Save goerz/b8c3314d1f6f3beec1d4d748f758c57b to your computer and use it in GitHub Desktop.
Plot of the Local Invariants of Two-Qubit gates
import matplotlib.pylab as plt
import QDYN
import numpy as np
def plot_gspace():
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
g1_s = []
g2_s = []
g3_s = []
c_s = []
c1_s = np.linspace(0, 1, 50)
c2_s = np.linspace(0, 0.5, 25)
c3_s = np.linspace(0, 0.5, 25)
colors = {'W0': 'green', 'PE': 'red', 'W0*': 'cyan', 'W1': 'blue'}
for c1 in c1_s:
for c2 in c2_s:
for c3 in c3_s:
try:
region = QDYN.weyl.get_region(c1, c2, c3)
color = colors[region]
g1, g2, g3 = QDYN.weyl.g1g2g3_from_c1c2c3(c1, c2, c3)
g1_s.append(g1)
g2_s.append(g2)
g3_s.append(g3)
c_s.append(color)
except ValueError:
pass
ax.scatter(g1_s, g2_s, g3_s, c=c_s)
ax.set_xlabel('g1')
ax.set_ylabel('g2')
ax.set_zlabel('g3')
ax.set_xlim(-3,3)
ax.set_ylim(-3,3)
ax.set_zlim(-3,3)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment