-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMUBs.py
More file actions
125 lines (80 loc) · 3.67 KB
/
MUBs.py
File metadata and controls
125 lines (80 loc) · 3.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
import numpy as np
import time
import sys
import math
from Classic_algebra import *
from Classic_generators import *
import csv
np.set_printoptions(threshold=sys.maxsize)
def all_set_A(N):
# En entrée : S = ensemble des matrices symétriques de taille n
# On veut construire tous les ensembles de matrices {A_1,...,A_(2^N)} tels que pour 1<=i<j<=N, det(A_i-A_j)!=0
All_sets_A = [] # liste des ensembles de matrices {A_1,...,A_(2^N)}
def set_A_rec(built_A, next_A):
new_S = []
A_i = built_A[-1]
for A_j in next_A :
if np.linalg.det(A_i-A_j)!=0:
new_S.append(A_j)
for A_j in new_S :
new_next_A = list(new_S)
new_built_A = built_A+[A_j]
if len(new_built_A) == 2**N:
All_sets_A.append(new_built_A)
else :
new_next_A = remove_array_from_list_array(new_next_A, A_j)
set_A_rec(new_built_A,new_next_A)
S = Symetrique(N)
for A_1 in S:
next_A = list(S)
next_A = remove_array_from_list_array(next_A, A_1)
set_A_rec([A_1],next_A)
return All_sets_A
def multiple_MUB(N):
MUBs = []
all_sets_A = all_set_A(N)
I = np.eye(N,dtype=int)
zero = np.zeros((N,N),dtype=int)
start = time.time()
for set_A in all_sets_A :
# On a {A_1,...,A_(2^N)} tels que pour 1<=i<j<=N, det(A_i-A_j)!=0
computing_time = time.time()-start
if computing_time < 180 :
for i in range(0,2*N):
# MUB_i = {T^i([1|A_1]),...,T^i([1|A_(2^N)])}
MUB_i = []
MUB_i.append(translation_operator(np.concatenate((zero,I),axis=1), i))
for A in set_A :
MUB_i.append(translation_operator(np.concatenate((I,A),axis=1), i))
#on ne la rajoute à la liste que si on n'a pas déjà réalisé cette répartition
already_counted = False
for MUB in MUBs :
same_repartition = True
for commutative_subgrp_MUB_i in MUB_i:
is_in_MUB = False
for commutative_subgrp_MUB in MUB :
if are_equivalent(commutative_subgrp_MUB_i, commutative_subgrp_MUB):
is_in_MUB = True
break
if is_in_MUB == False :
same_repartition = False
break
if same_repartition :
already_counted = True
break
if not already_counted :
MUBs.append(MUB_i)
return MUBs
def multiple_MUB_toprint(N):
fichier = open("MUB_Pauli_order_"+str(N)+".csv", "wt")
MUBCSV = csv.writer(fichier,delimiter=";")
MUBCSV.writerow(["index "+ str(i+1) for i in range(2**N+1)])
MUBs= multiple_MUB(N)
for MUB in MUBs:
csvline = []
for commutative_subgroups in MUB:
X = commutative_subgroups[:,:N]
Z = commutative_subgroups[:,N:]
csvline.append(sub_pauli(X,Z))
MUBCSV.writerow(csvline)
fichier.close()