Skip to content
Snippets Groups Projects
Commit 78838396 authored by Bernabeu Lou's avatar Bernabeu Lou
Browse files

implemented common plate matrices for quantum gates and actual plate

parent 45f3f783
No related branches found
No related tags found
No related merge requests found
import numpy as np import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import elements import elements
import graphics import graphics
......
import numpy as np
### Pauli matrices
X = np.array([[0, 1], [1, 0]], dtype="complex")
Y = np.array([[0, 0.-1j], [0+1j, 0]], dtype = "complex")
Z = np.array([[1, 0], [0, -1]], dtype = "complex")
### Other One-qubit matrices
H = np.array([[1, 1],[1, -1]], dtype='complex')
S = np.array([[1, 0], [0, 0+1j]], dtype='complex')
T = np.array([[1, 0], [0, np.exp(complex(0, np.pi/8))]], dtype="complex")
QUARTER_WAVE_RIGHT_CIRCULAR_RETARDER = (1/np.sqrt(2))*np.array([[1j, 1j],
[-1j, 1j]])
QUARTER_WAVE_LEFT_CIRCULAR_RETARDER = QUARTER_WAVE_RIGHT_CIRCULAR_RETARDER.T
HALF_WAVE_RIGHT_CIRCULAR_RETARDER = 1j*Y
HALF_WAVE_LEFT_CIRCULAR_RETARDER = 1j*Y.T
### Matrix functions
def PHASE(angle):
return np.array([[1, 0], [0, np.exp(complex(0, angle))]], dtype="complex")
def LINEAR_POLARIZER(theta):
return np.array([[np.cos(theta)*np.cos(theta), np.cos(theta)*np.sin(theta)],
[np.cos(theta)*np.sin(theta), np.sin(theta)*np.sin(theta)]])
def ELLIPTICAL_POLARIZER(epsilon, psi):
J11 = np.cos(psi)**2 + (epsilon*np.sin(psi))**2
J12 = 1j*epsilon + (epsilon**2 - 1)*np.cons(psi)*np.sin(psi)
J22 = (epsilon*np.cos(psi))**2 + np.sin(psi)**2
return (1/(1+epsilon**2))*np.array([[J11, J12],
[-J12, J22]])
def LINEAR_RETARDER(delta, theta): ### symmetric phase convention
L11 = np.exp(-1j*delta/2)*(np.cos(theta)**2) + np.exp(1j*delta/2)*(np.sin(theta)**2)
L12 =-1j*np.sin(delta/2)*np.sin(2*theta)
L22 = np.exp(1j*delta/2)*(np.cos(theta)**2) + np.exp(-1j*delta/2)*(np.sin(theta)**2)
return np.array([[L11, L12],
[L12, L22]])
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment