Hinton Plots

Hinton plots show matrix elements visually

Some states

[1]:
import numpy as np
from pyquil.gate_matrices import X, Y, Z
PROJ_ZERO = np.array([[1, 0], [0, 0]])
PROJ_ONE = np.array([[0, 0], [0, 1]])
ID = PROJ_ZERO + PROJ_ONE
PLUS = np.array([[1], [1]]) / np.sqrt(2)
PROJ_PLUS = PLUS @ PLUS.T.conj()
PROJ_MINUS = ID - PROJ_PLUS
Z_EFFECTS = [PROJ_ZERO, PROJ_ONE]
X_EFFECTS = [PROJ_PLUS, PROJ_MINUS]

# Two qubit defs
P00 = np.kron(PROJ_ZERO, PROJ_ZERO)
P01 = np.kron(PROJ_ZERO, PROJ_ONE)
P10 = np.kron(PROJ_ONE, PROJ_ZERO)
P11 = np.kron(PROJ_ONE, PROJ_ONE)
ID_2Q = P00 + P01 + P10 + P11
ZZ_EFFECTS = [P00, P01, P10, P11]
[2]:
from forest.benchmarking.plotting import hinton
from matplotlib import pyplot as plt
[3]:
hinton(PROJ_ZERO)
_ = plt.title(r'$\Pi_0$', fontsize=18)
../_images/examples_hinton_plots_4_0.png
[4]:
hinton(PROJ_ONE)
_ = plt.title(r'$\Pi_1$', fontsize=18)
../_images/examples_hinton_plots_5_0.png
[5]:
hinton(ID)
_ = plt.title(r'$I$', fontsize=18)
../_images/examples_hinton_plots_6_0.png
[6]:
hinton(PROJ_PLUS)
_ = plt.title(r'$\Pi_+$', fontsize=18)
../_images/examples_hinton_plots_7_0.png
[7]:
hinton(PROJ_MINUS)
_ = plt.title(r'$\Pi_-$', fontsize=18)
../_images/examples_hinton_plots_8_0.png
[8]:
hinton(X)
_ = plt.title(r'$X$', fontsize=18)
../_images/examples_hinton_plots_9_0.png
[9]:
hinton(Y) # this seems wrong
_ = plt.title(r'$Y$', fontsize=18)
../_images/examples_hinton_plots_10_0.png
[10]:
hinton(Z)
_ = plt.title(r'$Z$', fontsize=18)
../_images/examples_hinton_plots_11_0.png
[11]:
bell = 1/np.sqrt(2) * np.array([1, 0, 0, 1])
rho_bell = np.outer(bell, bell)
hinton(rho_bell)
_ = plt.title(r'$\rho_\mathrm{bell}$', fontsize=18)
../_images/examples_hinton_plots_12_0.png