-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvij_holoraumy_calc.py
291 lines (262 loc) · 8.71 KB
/
vij_holoraumy_calc.py
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
# ******************************************************************************
# Name: Calculate Vij matrices and Adinkra Gadget values
# Author: Vadim Korotkikh
# Email: [email protected]
# Date: November 2016
# Version: 1.3
#
# Description: Scripts for calculating Vij matrices for each one of 36864
# unique Adinkra tetrads and scripts for calculating the Gadget values from the
# Vij matrices
#
# ******************************************************************************
# ******************************************************************************
# Begin Imports
import math
import sys
import numpy as np
import numpy.matlib
import itertools
from numpy import array
from numpy.linalg import inv
import time
# import matrix_outerprod_calc
import alpha_beta_4x4
# ******************************************************************************
# Main() function.
def main():
# gen_signm(4)
pass
# ******************************************************************************
# Do the final Vij calculation
def calculate_vij_matrices(main_tetrad_list):
""" Remember that the main_tetrad_ark is a list of lists,
with each list containing four tuples, with tuples being
matrix number and the matrices itself. """
vij_possibilities = []
vij_possibilities = alpha_beta_4x4.illuminator_of_elfes()
vij_sixset = []
print(" ")
print("Calculating Vij matrices")
print(" ")
vij_alphas = []
vij_betas = []
calc_check = []
vij_matrices = []
anomaly_switch = 0
debug = 0
for ti, teti in enumerate(main_tetrad_list):
if debug:
print("# ********************************")
print(" ")
print("Tetrad i: ", ti)
# print(teti[0][1][0,:], teti[1][1][0,:], teti[2][1][0,:], teti[3][1][0,:])
# print(teti[0][1][1,:], teti[1][1][1,:], teti[2][1][1,:], teti[3][1][1,:])
# print(teti[0][1][2,:], teti[1][1][2,:], teti[2][1][2,:], teti[3][1][2,:])
# print(teti[0][1][3,:], teti[1][1][3,:], teti[2][1][3,:], teti[3][1][3,:])
print(" ")
temp_combos = []
alpha_temp = []
beta_temp = []
vij_tempset = []
""" Store 6 Vij matrices in temp_vijmat"""
temp_vijmat = []
""" This section does a double loop over the same tetrad to calculate
the set of 6 Vij matrices for the tetrad.
So for each matrix in the tetrad its checked against all the possible others,
bypassing the duplicate calculations
"""
for i, li in enumerate(teti):
# print(li[1])
bigli = li[1]
tr_bigli = np.transpose(bigli)
for j, lj in enumerate(teti):
biglj = lj[1]
ij_temp = [i, j]
ij_temp.sort()
ir = i + 1
jr = j + 1
ijstr = str(ir) + str(jr)
if ij_temp not in temp_combos and i != j:
# print("Vij matrix i-j vals:", ij_temp)
# print("Vij matrix i-j vals:", ijstr)
temp_combos.append(ij_temp)
tr_biglj = np.transpose(biglj)
# temp_mat = np.dot(tr_bigli, biglj) - np.dot(tr_biglj, bigli)
""" Vij eq from 1601.00 (3.2) """
# temp_mat = np.matmul(tr_biglj, bigli) - np.matmul(tr_bigli, biglj)
temp_mat = np.dot(tr_bigli, biglj) - np.dot(tr_biglj, bigli)
""" Compare against the 6 possible matrix solutions """
tf_bool = 0
for xi, ijx in enumerate(vij_possibilities):
ijx_neg = np.multiply(ijx, -1)
# print(xi)
if np.array_equal(temp_mat, ijx):
tf_bool = 1
temp_vijmat.append(temp_mat)
if debug:
print("*************$$$$$$$$$$$$$$$$$$ ")
print("l-solution found:")
print(ijx)
tmint = np.int(1)
if xi < 3:
tmp_str = "alpha" + str((xi + 1))
# print(tmp_str)
vij_tempset.append([tmp_str, ijstr, tmint])
alpha_temp.append([tmp_str, ijstr, tmint])
elif xi >= 3:
tmp_str = "beta" + str((xi - 2))
vij_tempset.append([tmp_str, ijstr, tmint])
beta_temp.append([tmp_str, ijstr, tmint])
elif np.array_equal(temp_mat, ijx_neg):
tf_bool = 1
temp_vijmat.append(temp_mat)
if debug:
print("*************$$$$$$$$$$$$$$$$$$ ")
print("l-solution found:")
print(ijx_neg)
# xint = (xi + 1) * ( -1)
tmint = np.int(-1)
if xi < 3:
tmp_str = "alpha" + str((xi + 1))
# print(tmp_str)
vij_tempset.append([tmp_str, ijstr, tmint])
alpha_temp.append([tmp_str, ijstr, tmint])
elif xi >= 3:
tmp_str = "beta" + str((xi - 2))
vij_tempset.append([tmp_str, ijstr, tmint])
beta_temp.append([tmp_str, ijstr, tmint])
else:
if i != j and tf_bool == 0 and xi >= 5:
if not(np.array_equal(temp_mat, ijx)) or not np.array_equal(temp_mat, ijx_neg):
print("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ")
print("Anomaly found:",i,j)
print(temp_mat)
anomaly_switch = 1
tf_bool = 0
vij_matrices.append(temp_vijmat)
calc_check.append(vij_tempset)
if alpha_temp:
vij_alphas.append(alpha_temp)
elif beta_temp:
vij_betas.append(beta_temp)
beta_temp = []
alpha_temp = []
print("*************$$$$$$$$$$$$$$$$$$ ")
print("Vij Matrix Coefficients Results:")
print("")
for mvals in calc_check:
if any(x for x in mvals if x[0].startswith('alpha')) and any(x for x in mvals if x[0].startswith('beta')):
print("MIXED ALPHA_BETA ERROR")
print(mvals)
else:
print(mvals)
print("Length Vij alphas tetrads:", len(vij_alphas))
print("length Vij beta tetrads:", len(vij_betas))
gadget_vals = []
one_count = 0
ptre_count = 0
ntre_count = 0
zero_count = 0
if not anomaly_switch:
for fi, ijf in enumerate(calc_check):
for xj, ijx in enumerate(calc_check):
# ind_temp = [fi, xj]
# ind_temp.sort()
# x = [val]
if ijf[0][0:2] == ijx[0][0:2] and ijf[1][0:2] == ijx[1][0:2] and ijf[2][0:2] == ijx[2][0:2]:
# als = ijf[0][3] * ijx[0][3]
gadget_sum = sum([(ijf[z][2] * ijx[z][2]) for z in range(0, len(ijf))])
if gadget_sum == 2:
ptre_count += 1
elif gadget_sum == -2:
ntre_count += 1
elif gadget_sum == 6:
one_count += 1
elif gadget_sum == 0:
zero_count += 1
else:
print(ijf)
print(ijx)
print("Gadget ERROR 1:",gadget_sum, "Tetrad#:",fi,xj)
div_const = gadget_sum / 6
# print("****** Gadget calculation ******")
# print("Calc #:", calc_count)
# print(div_const)
# print("G values:", gadget_vals)
if div_const not in gadget_vals:
gadget_vals.append(div_const)
elif ijf[0][0:2] == ijx[0][0:2] and ijf[1][0:2] != ijx[1][0:2]:
gadget_sum = sum([(ijf[z][2] * ijx[z][2]) for z in [0, 5]])
if gadget_sum == 2:
ptre_count += 1
elif gadget_sum == -2:
ntre_count += 1
elif gadget_sum == 6:
one_count += 1
elif gadget_sum == 0:
zero_count += 1
else:
print("Gadget ERROR 2:",gadget_sum, "Tetrad#:",fi,xj)
div_const = gadget_sum / 6
# print("Calc #:", calc_count)
if div_const not in gadget_vals:
gadget_vals.append(div_const)
elif ijf[0][0:2] != ijx[0][0:2] and ijf[1][0:2] == ijx[1][0:2]:
# print(ijf, ijx)
gadget_sum = sum([(ijf[z][2] * ijx[z][2]) for z in [1, 4]])
if gadget_sum == 2:
ptre_count += 1
elif gadget_sum == -2:
ntre_count += 1
elif gadget_sum == 6:
one_count += 1
elif gadget_sum == 0:
zero_count += 1
else:
print("Gadget ERROR 3:",gadget_sum, "Tetrad#:",fi,xj)
div_const = gadget_sum / 6
# print("Calc #:", calc_count)
if div_const not in gadget_vals:
gadget_vals.append(div_const)
elif ijf[0][0:2] != ijx[0][0:2] and ijf[2][0:2] == ijx[2][0:2]:
gadget_sum = sum([(ijf[z][2] * ijx[z][2]) for z in [2, 3]])
if gadget_sum == 2:
ptre_count += 1
elif gadget_sum == -2:
ntre_count += 1
elif gadget_sum == 6:
one_count += 1
elif gadget_sum == 0:
zero_count += 1
else:
print("Gadget ERROR 4:",gadget_sum, "Tetrad#:",fi,xj)
div_const = gadget_sum / 6
# print("Calc #:", calc_count)
if div_const not in gadget_vals:
gadget_vals.append(div_const)
elif ijf[0][0:2] != ijx[0][0:2] and ijf[1][0:2] != ijx[1][0:2] and ijf[2][0:2] != ijx[2][0:2]:
gadget_sum = 0
zero_count += 1
div_const = gadget_sum / 6
if div_const not in gadget_vals:
gadget_vals.append(div_const)
else:
print("ERROR**********")
print(ijf)
print(ijx)
print("zero count", zero_count)
print(" 1/3 count", ptre_count)
print("-1/3 count", ntre_count)
print(" 1 count", one_count)
print(gadget_vals)
else:
pass
print("################################################")
print(" Printing final Gadget values and counts ")
print(" ")
print("zero count", zero_count)
print(" 1/3 count", ptre_count)
print("-1/3 count", ntre_count)
print(" 1 count", one_count)
print(gadget_vals)