From d647c80fac8dd63efa8e89809b8d58bb7a668755 Mon Sep 17 00:00:00 2001 From: Lou Bernabeu <lou.bernabeu@student-cs.fr> Date: Thu, 7 Jan 2021 00:32:37 +0100 Subject: [PATCH] udpated some stuff --- __main__.py | 4 ++-- matrices.py | 20 +++++++++++--------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/__main__.py b/__main__.py index 3df1aa6..5f4eb69 100644 --- a/__main__.py +++ b/__main__.py @@ -11,7 +11,7 @@ print("Hi World!") source = elements.Source(initial_vector = np.array([1.+0j, 0.])) -BS1 = elements.BeamSplitter(previous = {"left": (source, "left"), "right": None}, matrix=matrices.HALF_MIRROR_LEFT_ACTIVE) +BS1 = elements.BeamSplitter(previous = {"left": (source, "left"), "right": None}, matrix=matrices.HALF_MIRROR_LEFT_INACTIVE) X_left_1 = elements.Plate(previous = (BS1, "left"), jones_matrix=matrices.X) Z_left_2 = elements.Plate(previous = (X_left_1, "left"), jones_matrix = matrices.Z) @@ -20,7 +20,7 @@ Z_left_2 = elements.Plate(previous = (X_left_1, "left"), jones_matrix = matrices Z_right_1 = elements.Plate(previous = (BS1, "right"), jones_matrix = matrices.Z) X_right_2 = elements.Plate(previous = (Z_right_1, "left"), jones_matrix = matrices.X) -BS2 = elements.BeamSplitter(previous = {"left": (Z_left_2, "left"), "right": (X_right_2, "left")}, matrix = matrices.HALF_MIRROR_RIGHT_ACTIVE) +BS2 = elements.BeamSplitter(previous = {"left": (Z_left_2, "left"), "right": (X_right_2, "left")}, matrix = matrices.HALF_MIRROR_RIGHT_INACTIVE) screen_right = elements.Screen(previous = (BS2, "right")) screen_left = elements.Screen(previous = (BS2, "left")) diff --git a/matrices.py b/matrices.py index b21ae68..bbd6474 100644 --- a/matrices.py +++ b/matrices.py @@ -8,8 +8,10 @@ Z = np.array([[1, 0], [0, -1]], dtype = "complex") ### Other One-qubit matrices -H = (1/np.sqrt(2))*np.array([[1, 1],[1, -1]], dtype='complex') -H_REV = (1/np.sqrt(2))*np.array([[-1, 1], [1, 1]], dtype='complex') +H = (1/np.sqrt(2))*np.array([[1, 1], + [1, -1]], dtype='complex') +H_REV = (1/np.sqrt(2))*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") @@ -57,10 +59,10 @@ SYM_BS_INACTIVE = np.kron(SYM_BS_AMPLITUDE_MATRIX, np.eye(2)) HALF_MIRROR_LEFT_INACTIVE = np.kron(HALF_MIRROR_LEFT_PLATE_AMPLITUDE_MATRIX, np.eye(2)) HALF_MIRROR_RIGHT_INACTIVE = np.kron(HALF_MIRROR_RIGHT_PLATE_AMPLITUDE_MATRIX, np.eye(2)) -SYM_BS_INACTIVE = (1/np.sqrt(2))*np.array([[1j, 0, 1, 0], - [0, -1j, 0, 1], - [1, 0, 1j, 0], - [0, 1, 0, -1j]], dtype='complex') +SYM_BS_INACTIVE = (1/np.sqrt(2))*np.array([[1j, 0, 1, 0], + [0, -1j, 0, 1], + [1, 0, 1j, 0], + [0, 1, 0, -1j]], dtype='complex') HALF_MIRROR_LEFT_ACTIVE = (1/np.sqrt(2))*np.array([[-1, 0, 1, 0], [0, 1, 0, 1], @@ -68,6 +70,6 @@ HALF_MIRROR_LEFT_ACTIVE = (1/np.sqrt(2))*np.array([[-1, 0, 1, 0], [0, 1, 0, -1]], dtype='complex') HALF_MIRROR_RIGHT_ACTIVE = (1/np.sqrt(2))*np.array([[1, 0, 1, 0], - [0, -1, 0, 1], - [1, 0, -1, 0], - [0, 1, 0, 1]], dtype='complex') + [0, -1, 0, 1], + [1, 0, -1, 0], + [0, 1, 0, 1]], dtype='complex') -- GitLab