From 2034bd7fb186b0ff7f8f0d05022942eb7f721a63 Mon Sep 17 00:00:00 2001 From: William L <=> Date: Sun, 9 Jun 2024 11:46:47 -0400 Subject: [PATCH 1/8] added F matrix to model --- src/Model.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/Model.py b/src/Model.py index 4b859f3..260b88c 100644 --- a/src/Model.py +++ b/src/Model.py @@ -1,6 +1,7 @@ # Standard Library from enum import Enum - +import cmath +import numpy as np class AnyonModel(Enum): Ising = 1 @@ -13,6 +14,7 @@ def __init__(self, model_type: AnyonModel, num_fusion_channels=5) -> None: """ Requires: 'model_type' representing the type of model being used + The Ising model is """ if model_type == AnyonModel.Ising: self._r_mtx = [] @@ -20,6 +22,16 @@ def __init__(self, model_type: AnyonModel, num_fusion_channels=5) -> None: self._rules = [] elif model_type == AnyonModel.Fibonacci: self._r_mtx = [] - self._f_mtx = [] + self._f_mtx = np.zeros((2,2,2,2,2,2)) + + for i in range(2): + for j in range(2): + for k in range(2): + for l in range(2): + self._r_mtx[i][j][k][l] = np.identity(2) + + golden = (1 + 5 ** 0.5) / 2 + goldenInv = 1/golden + self._r_mtx[1][1][1][1] = np.array([[goldenInv, np.sqrt(goldenInv)],[np.sqrt(goldenInv), -goldenInv]]) self._rules = [] - self._num_fusion_channels = num_fusion_channels + self._num_fusion_channels = num_fusion_channels \ No newline at end of file From 109bd271aa5503ab08641019bd573c8a67ce82cf Mon Sep 17 00:00:00 2001 From: William L <=> Date: Sun, 9 Jun 2024 12:01:03 -0400 Subject: [PATCH 2/8] corrected F matrix for fibonacci --- src/Model.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Model.py b/src/Model.py index 260b88c..19e720b 100644 --- a/src/Model.py +++ b/src/Model.py @@ -23,12 +23,12 @@ def __init__(self, model_type: AnyonModel, num_fusion_channels=5) -> None: elif model_type == AnyonModel.Fibonacci: self._r_mtx = [] self._f_mtx = np.zeros((2,2,2,2,2,2)) - - for i in range(2): - for j in range(2): - for k in range(2): - for l in range(2): - self._r_mtx[i][j][k][l] = np.identity(2) + + self._r_mtx[1,1,0,1,1,1] = 1 + self._r_mtx[0,1,1,1,1,1] = 1 + self._r_mtx[1,1,1,0,1,1] = 1 + self._r_mtx[1,0,1,1,1,1] = 1 + self._r_mtx[0,0,0,0,0,0] = 1 golden = (1 + 5 ** 0.5) / 2 goldenInv = 1/golden From 29e7e7a292644ea93b88514f3f53c03417e7fa31 Mon Sep 17 00:00:00 2001 From: William L <=> Date: Sun, 9 Jun 2024 12:02:12 -0400 Subject: [PATCH 3/8] corrected f matrix for fibonacci --- src/Model.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Model.py b/src/Model.py index 19e720b..314d511 100644 --- a/src/Model.py +++ b/src/Model.py @@ -24,14 +24,14 @@ def __init__(self, model_type: AnyonModel, num_fusion_channels=5) -> None: self._r_mtx = [] self._f_mtx = np.zeros((2,2,2,2,2,2)) - self._r_mtx[1,1,0,1,1,1] = 1 - self._r_mtx[0,1,1,1,1,1] = 1 - self._r_mtx[1,1,1,0,1,1] = 1 - self._r_mtx[1,0,1,1,1,1] = 1 - self._r_mtx[0,0,0,0,0,0] = 1 + self._f_mtx[1,1,0,1,1,1] = 1 + self._f_mtx[0,1,1,1,1,1] = 1 + self._f_mtx[1,1,1,0,1,1] = 1 + self._f_mtx[1,0,1,1,1,1] = 1 + self._f_mtx[0,0,0,0,0,0] = 1 golden = (1 + 5 ** 0.5) / 2 goldenInv = 1/golden - self._r_mtx[1][1][1][1] = np.array([[goldenInv, np.sqrt(goldenInv)],[np.sqrt(goldenInv), -goldenInv]]) + self._f_mtx[1][1][1][1] = np.array([[goldenInv, np.sqrt(goldenInv)],[np.sqrt(goldenInv), -goldenInv]]) self._rules = [] self._num_fusion_channels = num_fusion_channels \ No newline at end of file From 33ac4843dd51605ae7173d9c691a1f3d0a903ff9 Mon Sep 17 00:00:00 2001 From: William L <=> Date: Sun, 9 Jun 2024 12:41:27 -0400 Subject: [PATCH 4/8] added R matrix for fibonacci --- src/Model.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Model.py b/src/Model.py index 314d511..74a90b6 100644 --- a/src/Model.py +++ b/src/Model.py @@ -21,7 +21,7 @@ def __init__(self, model_type: AnyonModel, num_fusion_channels=5) -> None: self._f_mtx = [] self._rules = [] elif model_type == AnyonModel.Fibonacci: - self._r_mtx = [] + self._r_mtx = [[cmath.exp(4*np.pi*1j/5), 0],[0, -1*cmath.exp(2*np.pi*1j/5)]] self._f_mtx = np.zeros((2,2,2,2,2,2)) self._f_mtx[1,1,0,1,1,1] = 1 From 7c8fd7e28c3601ba13408e9696f857a49f5abf47 Mon Sep 17 00:00:00 2001 From: William L <=> Date: Mon, 10 Jun 2024 22:22:48 -0400 Subject: [PATCH 5/8] implemented R and F matrices for Ising Model --- src/Model.py | 47 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/src/Model.py b/src/Model.py index 74a90b6..ab4dc15 100644 --- a/src/Model.py +++ b/src/Model.py @@ -14,24 +14,41 @@ def __init__(self, model_type: AnyonModel, num_fusion_channels=5) -> None: """ Requires: 'model_type' representing the type of model being used - The Ising model is + The Ising, Fibonacci, and Custom models correspond to 1, 2, an 3 respectively + + The R matrix is implemented as a 6 dimensional array, with the + first 3 indexes corresponding to the 3 lower indices of the R matrix + (which physically correspond to the anyons being fused) and the + 4th index corresponding to the upper index of the R matrix + (which physically corresponds to the anyon resulting from fusion) + + Indices correspond to anyon types as follows: + 0 = vacuum state/ trivial anyon + 1 = sigma + 2 = psi + + For details on notation, c.f.r. On classification of modular tensor + categories by Rowell, Stong, and Wang """ if model_type == AnyonModel.Ising: - self._r_mtx = [] - self._f_mtx = [] + self._r_mtx = cmath.exp(-1j*np.pi/8)*np.array([[1,0],[0,1j]]) + + self._f_mtx = np.zeroes(3,3,3,3,2,2) + + for i in range(3): + for j in range(3): + for k in range(3): + for l in range(3): + self._f_mtx[i][j][k][l] = np.identity(2) + + for i in range(3): + self._f_mtx[1][1][1][i] = 1/np.sqrt(2)*np.array([[1,1],[1,-1]]) + self._f_mtx[2][1][1][i] = self._f_mtx[1][2][1][i] = self._f_mtx[1][1][2][i] = -1*np.identity(2) + self._f_mtx[1][2][2][i] = self._f_mtx[2][1][2][i] = self._f_mtx[2][2][1][i] = -1*np.identity(2) + self._rules = [] elif model_type == AnyonModel.Fibonacci: - self._r_mtx = [[cmath.exp(4*np.pi*1j/5), 0],[0, -1*cmath.exp(2*np.pi*1j/5)]] - self._f_mtx = np.zeros((2,2,2,2,2,2)) - - self._f_mtx[1,1,0,1,1,1] = 1 - self._f_mtx[0,1,1,1,1,1] = 1 - self._f_mtx[1,1,1,0,1,1] = 1 - self._f_mtx[1,0,1,1,1,1] = 1 - self._f_mtx[0,0,0,0,0,0] = 1 - - golden = (1 + 5 ** 0.5) / 2 - goldenInv = 1/golden - self._f_mtx[1][1][1][1] = np.array([[goldenInv, np.sqrt(goldenInv)],[np.sqrt(goldenInv), -goldenInv]]) + self._r_mtx = np.array([[cmath.exp(4*np.pi*1j/5), 0],[0, -1*cmath.exp(2*np.pi*1j/5)]]) + self._f_mtx = [] self._rules = [] self._num_fusion_channels = num_fusion_channels \ No newline at end of file From 7ddfcd0a6270c19d8af835c52e6bd459f0e30f5a Mon Sep 17 00:00:00 2001 From: William L <=> Date: Mon, 10 Jun 2024 23:17:49 -0400 Subject: [PATCH 6/8] Closes #10 --- src/Model.py | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 62 insertions(+), 2 deletions(-) diff --git a/src/Model.py b/src/Model.py index ab4dc15..7cbf06a 100644 --- a/src/Model.py +++ b/src/Model.py @@ -30,10 +30,12 @@ def __init__(self, model_type: AnyonModel, num_fusion_channels=5) -> None: For details on notation, c.f.r. On classification of modular tensor categories by Rowell, Stong, and Wang """ + self.model_type = model_type + if model_type == AnyonModel.Ising: self._r_mtx = cmath.exp(-1j*np.pi/8)*np.array([[1,0],[0,1j]]) - self._f_mtx = np.zeroes(3,3,3,3,2,2) + self._f_mtx = np.zeros((3,3,3,3,2,2)) for i in range(3): for j in range(3): @@ -47,8 +49,66 @@ def __init__(self, model_type: AnyonModel, num_fusion_channels=5) -> None: self._f_mtx[1][2][2][i] = self._f_mtx[2][1][2][i] = self._f_mtx[2][2][1][i] = -1*np.identity(2) self._rules = [] + elif model_type == AnyonModel.Fibonacci: self._r_mtx = np.array([[cmath.exp(4*np.pi*1j/5), 0],[0, -1*cmath.exp(2*np.pi*1j/5)]]) self._f_mtx = [] self._rules = [] - self._num_fusion_channels = num_fusion_channels \ No newline at end of file + elif model_type == AnyonModel.Custom: + + raise NotImplementedError("Custom Models not yet implemented") + + else: + raise ValueError("Model type not recognized") + + self._num_fusion_channels = num_fusion_channels + + def getFMatrix(self, a: str, b: str, c: str, d: str) -> np.ndarray: + + ''' + Parameters + ---------- + a : str + name of anyon corresponding to first lower index + b : str + name of anyon corresponding to second lower index + c : str + name of anyon corresponding to third lower index + d : str + name of anyon corresponding to upper index + + Only the following strings are accepted as parameters: + vacuum, sigma, psi + + Requires that all anyons used as parameters are contained with the + given model + + Returns + ------- + the F-matrix corresponding to the set of indices in the model + ''' + + if self.model_type == AnyonModel.Ising: + anyondict = { + "vacuum": 0, + "sigma": 1, + "psi": 2} + + elif self.model_type == AnyonModel.Fibonacci: + anyondict = { + "vacuum": 0, + "sigma": 1,} + + elif self.model_type == AnyonModel.Custom: + raise NotImplementedError("Custom Models not yet implemented") + + else: + raise ValueError("Model type not recognized") + + inputs = {a,b,c,d} + + for i in inputs: + if i not in anyondict: + raise ValueError("invalid anyon name") + + return self._f_mtx[anyondict[a], anyondict[b], anyondict[c], anyondict[d]] \ No newline at end of file From 32253123287c4855264db722690551883d2ec80b Mon Sep 17 00:00:00 2001 From: William L <=> Date: Mon, 10 Jun 2024 23:20:36 -0400 Subject: [PATCH 7/8] closes #10 --- src/Model.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Model.py b/src/Model.py index 7cbf06a..5fff40d 100644 --- a/src/Model.py +++ b/src/Model.py @@ -29,6 +29,7 @@ def __init__(self, model_type: AnyonModel, num_fusion_channels=5) -> None: For details on notation, c.f.r. On classification of modular tensor categories by Rowell, Stong, and Wang + https://www.arxiv.org/abs/0712.1377 """ self.model_type = model_type @@ -83,6 +84,10 @@ def getFMatrix(self, a: str, b: str, c: str, d: str) -> np.ndarray: Requires that all anyons used as parameters are contained with the given model + For details on notation, c.f.r. On classification of modular tensor + categories by Rowell, Stong, and Wang + https://www.arxiv.org/abs/0712.1377 + Returns ------- the F-matrix corresponding to the set of indices in the model From eeb2ee7467199e23f7e7363b294d40dc63fcfbd6 Mon Sep 17 00:00:00 2001 From: William L <=> Date: Mon, 10 Jun 2024 23:28:55 -0400 Subject: [PATCH 8/8] error in documentation corrected --- src/Model.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Model.py b/src/Model.py index 5fff40d..28ff58f 100644 --- a/src/Model.py +++ b/src/Model.py @@ -16,10 +16,10 @@ def __init__(self, model_type: AnyonModel, num_fusion_channels=5) -> None: The Ising, Fibonacci, and Custom models correspond to 1, 2, an 3 respectively - The R matrix is implemented as a 6 dimensional array, with the - first 3 indexes corresponding to the 3 lower indices of the R matrix + The F matrix is implemented as a 6 dimensional array, with the + first 3 indexes corresponding to the 3 lower indices of the F matrix (which physically correspond to the anyons being fused) and the - 4th index corresponding to the upper index of the R matrix + 4th index corresponding to the upper index of the F matrix (which physically corresponds to the anyon resulting from fusion) Indices correspond to anyon types as follows: