Advertisement
Guest User

Untitled

a guest
May 5th, 2023
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.47 KB | None | 0 0
  1. RecToList:=function(A); //Given the record that Subgroups or MaximalSubgroups returns, this returns a list of the subgroups, rather than all the stuff the record has.
  2. L:=[];
  3. for i:=1 to #A do
  4. L:=Append(L,A[i]`subgroup);
  5. end for;
  6. return L;
  7. end function;
  8.  
  9. ReadInFile:=function(s); //This lets me read in files easily.
  10. k:=Read(s);
  11. return eval k;
  12. end function;
  13.  
  14. conj:=function(h,g); //This just conjugates h by g and is shorthand for me.
  15. return g*h*g^-1;
  16. end function;
  17.  
  18. ListOfIdentities:=function(n) //Create a list with n 2x2 identity matrices in it. This will be useful in later functions.
  19. I:=IdentityMatrix(Integers(),2);
  20. N:=[];
  21. for i:=1 to n do
  22. N:=Append(N,I);
  23. end for;
  24. return N;
  25. end function;
  26.  
  27. TensorProductList:=function(N); //This does the tensor product of the matrices in the list N.
  28. T:=N[1];
  29. for k:=2 to #N do
  30. T:=TensorProduct(T,N[k]);
  31. end for;
  32. return T;
  33. end function;
  34.  
  35. sigma:=function(i,j,m); //This gives an m-fold tensor product with little sigma_i in its jth slot and a 2x2 identity in every other slot.
  36. if i eq 1 then
  37. s:=Matrix([[0,1],[1,0]]);
  38. else
  39. s:=Matrix([[1,0],[0,-1]]);
  40. end if;
  41. N:=ListOfIdentities(m);
  42. N[j]:=s;
  43. return ChangeRing(TensorProductList(N),Rationals());
  44. end function;
  45.  
  46. E:=function(m); //This gives the fundamental representation of the extraspecial 2-group of degree m by using the sigma function to compute each of the 2m generators.
  47. Gens:=[];
  48. for a:=1 to m do
  49. for b:=1 to m do
  50. Gens:=Append(Gens,sigma(1,a,m));
  51. Gens:=Append(Gens,sigma(2,b,m));
  52. end for;
  53. end for;
  54. return sub<GeneralLinearGroup(2^m,Rationals())|Gens>;
  55. end function;
  56.  
  57. g1:=function(m); //This computes the first new generator of BRW(m). It's a block diagonal matrix with an identity matrix, a zero, a zero, and (I x I x ... x sigma_1).
  58. if m eq 1 then
  59. return IdentityMatrix(Integers(),2);
  60. end if;
  61. I:=IdentityMatrix(Integers(),2^m div 2);
  62. Z:=ZeroMatrix(Integers(),2^m div 2);
  63. N:=ListOfIdentities(m-1);
  64. N[m-1]:=sigma(1,1,1);
  65. T:=TensorProductList(N);
  66. return BlockMatrix(2,2,[I,Z,Z,T]);
  67. end function;
  68.  
  69. g2:=function(m); // This computes the generator corresponding to the second new generator
  70. p:=[1..2^m]; //Initialize permutation to use to compute the generator
  71. for i:=1 to 2^(m-1) do //Creates the permutation on 2^m elements corresponding to the second generator of GL(m,2)'s action on R^(2^m), it is [1,3,5,...,2^(m-1),2,4,...,2^m]
  72. p[i]:=2*i-1;
  73. p[i+2^(m-1)]:=2*i;
  74. end for;
  75. return Transpose(PermutationMatrix(Rationals(),p)); //Returns the corresponding matrix representation of this permutation
  76. end function;
  77.  
  78. D:=function(m); //This gives a 2^m identity matrix, except each 4th entry is a -1.
  79. d:=IdentityMatrix(Integers(),2^m);
  80. for i:=1 to Floor(2^m/4) do
  81. d[4*i][4*i]:=-1;
  82. end for;
  83. return d;
  84. end function;
  85.  
  86. H:=function(m) //This creates the Hadamard matrix.
  87. Q<w>:=QuadraticField(2);
  88. h:=1/w*Matrix([[1,1],[1,-1]]);
  89. for i:=1 to m-1 do //Creates the Kronecker product of h with I m-1 times
  90. h:=KroneckerProduct(IdentityMatrix(Q,2),h);
  91. end for;
  92. return h;
  93. end function;
  94.  
  95. BRW:=function(m); //This creates the BRW group. It is generated by the gens of E(m); and g1, g2, and D, plus each of those conjugated by the Hadamard matrix.
  96. return sub<GeneralLinearGroup(2^m,Rationals())|Generators(E(m)),g1(m),g2(m),D(m),conj(g1(m),H(m)),conj(g2(m),H(m)),conj(D(m),H(m))>;
  97. end function;
  98.  
  99. CG:=function(m); //This creates the Clifford group. It is generated by the gens of BRW and the Hadamard matrix.
  100. return sub<GeneralLinearGroup(2^m,QuadraticField(2))|Generators(BRW(m)),H(m)>;
  101. end function;
  102.  
  103. vacuumsum:=function(M); //This computes the sum part of the formula for the vacuum anomaly of M.
  104. M:=Matrix(M);
  105. n:=Order(M);
  106. D:=0;
  107. if n ne 1 then
  108. D:=1;
  109. end if;
  110. S:=0;
  111. if D ne 0 then
  112. if n ne 2 then
  113. C:=CyclotomicPolynomial(n);
  114. F<p>:=SplittingField([C]);
  115. M:=ChangeRing(M,F);
  116. else
  117. p:=-1;
  118. end if;
  119. S:=0;
  120. for k:=1 to n-1 do
  121. S:=S+k*(n-k)*Dimension(Eigenspace(M,p^k));
  122. end for;
  123. end if;
  124. return S;
  125. end function;
  126.  
  127. vacuum:=function(M); //This computes the vacuum anomaly of M.
  128. M:=Matrix(M);
  129. S:=vacuumsum(M);
  130. n:=Order(M);
  131. return 1/(4*n^2) * vacuumsum(M);
  132. end function;
  133.  
  134. type:=function(M); //This computes the type of M.
  135. M:=Matrix(M);
  136. V:=vacuum(M);
  137. n:=Order(M);
  138. k:=n^2*V;
  139. if IsCoercible(Integers(),k) then
  140. l:=(Integers() ! k) mod n;
  141. else
  142. l:=-1;
  143. end if;
  144. return l;
  145. end function;
  146.  
  147. chi1:=function(g); //This is shorthand for the character of the fundamental representation.
  148. return Trace(Matrix(g));
  149. end function;
  150.  
  151. chi2:=function(g); //This computes the sum part of the inner product of the trivial character with the symmetric character.
  152. M:=Matrix(g);
  153. L:=M^2;
  154. a:=Trace(M);
  155. b:=Trace(M^2);
  156. c:=Trace(M)^2;
  157. return a+(b+c)/2;
  158. end function;
  159.  
  160. dimchi1:=function(H); //This computes the inner product of the fundamental character with the trivial character.
  161. C:=ConjugacyClasses(H);
  162. z:=0;
  163. for i:=1 to # C do
  164. a:=chi1(C[i][3]);
  165. z:=z+a*C[i][2];
  166. end for;
  167. return z/Order(H);
  168. end function;
  169.  
  170. dimchi2:=function(H); //This computes the inner product of the trivial character with the symmetric character.
  171. C:=ConjugacyClasses(H);
  172. z:=0;
  173. for k:=1 to # C do
  174. a:=chi2(C[k][3]);
  175. z:=z+a*C[k][2];
  176. end for;
  177. return z/Order(H);
  178. end function;
  179.  
  180. CheckConjugacyClasses:=function(H); //This checks to see if H, a group, has any elements with vacuum anomaly <= number. (I manually adjusted number as I needed it.)
  181. number:=1;
  182. for h in Generators(H) do //Check the relatively small number of generators first before generating all the conjugacy classes!
  183. if vacuum(h) le number then
  184. return false;
  185. end if;
  186. end for;
  187. C:=ConjugacyClasses(H);
  188. for i:=2 to # C do
  189. if vacuum(C[i][3]) le number then
  190. return false;
  191. end if;
  192. end for;
  193. return true;
  194. end function;
  195.  
  196. CheckDimensions:=function(H); //This checks to see if the inner products of the fundamental with the trivial and the symmetric with the trivial are 0 and 1, respectively.
  197. if dimchi1(H) ne 0 then
  198. return false;
  199. end if;
  200. if dimchi2(H) ne 1 then
  201. return false;
  202. end if;
  203. return true;
  204. end function;
  205.  
  206. MatrixToCycle:=function(M); //Elements of E(m) are signed permutation matrices and can hence be represented as permutations of 1 up to 2^(m+1). The first half represents the columns, and the second represents the minu of the columns.
  207. n:=NumberOfRows(M);
  208. Z:=ZeroMatrix(Integers(),n,1);
  209. N:=[];
  210. for i:=1 to NumberOfRows(Z) do
  211. k:=Z;
  212. k[i,1]:=1;
  213. N:=Append(N,k);
  214. end for;
  215. for i:=1 to NumberOfRows(Z) do
  216. k:=Z;
  217. k[i,1]:=-1;
  218. N:=Append(N,k);
  219. end for;
  220. A:=[];
  221. M:=ChangeRing(M,Integers());
  222. K:=[];
  223. for i:=1 to #N do
  224. k:=M*N[i];
  225. for j:=1 to #N do
  226. if k eq N[j] then
  227. K:=Append(K,j);
  228. end if;
  229. end for;
  230. end for;
  231. return SymmetricGroup(n*2) ! K;
  232. end function;
  233.  
  234. CycleToMatrix:=function(A); //This goes the other way if we ever need to.
  235. n:=Degree(Parent(A)) div 2;
  236. Z:=ZeroMatrix(Integers(),n,1);
  237. N:=[];
  238. for i:=1 to NumberOfRows(Z) do
  239. k:=Z;
  240. k[i,1]:=1;
  241. N:=Append(N,k);
  242. end for;
  243. for i:=1 to NumberOfRows(Z) do
  244. k:=Z;
  245. k[i,1]:=-1;
  246. N:=Append(N,k);
  247. end for;
  248. M:=[];
  249. for i:=1 to n do
  250. M:=Append(M,N[i ^ A]);
  251. end for;
  252. return Transpose(Matrix(M));
  253. end function;
  254.  
  255. PermE:=function(m); //Returns the permutation version of E(m). Calculations with this run about 2.5 times faster than with matrices.
  256. Gens:=[];
  257. for x in Generators(E(m)) do
  258. Gens:=Append(Gens,MatrixToCycle(x));
  259. end for;
  260. return sub<SymmetricGroup(2^m*2)|Gens>;
  261. end function;
  262.  
  263. MyE:=function(m); //This is for my convenience since I relabeled the function.
  264. return PermE(m);
  265. end function;
  266.  
  267. FindTrace:=function(A); //This finds the trace of a permutation.
  268. z:=0;
  269. n:=Degree(Parent(A)) div 2;
  270. for i:=1 to n do
  271. if i ^ A eq i then
  272. z:=z+1;
  273. end if;
  274. if i ^ A eq (i + n) then
  275. z:=z-1;
  276. end if;
  277. end for;
  278. return z;
  279. end function;
  280.  
  281. chi2perm:=function(g); //Computes the inner product of the symmetric with the trivial for the permutation realization.
  282. a:=FindTrace(g);
  283. b:=FindTrace(g^2);
  284. c:=FindTrace(g)^2;
  285. return a+(b+c)/2;
  286. end function;
  287.  
  288. dimchi1perm:=function(H); //Computes the inner product of the fundamental with the trivial for the permutation realization.
  289. C:=ConjugacyClasses(H);
  290. z:=0;
  291. for i:=1 to # C do
  292. a:=FindTrace(C[i][3]);
  293. z:=z+a*C[i][2];
  294. end for;
  295. return z/Order(H);
  296. end function;
  297.  
  298. dimchi2perm:=function(H); //Computes the inner product of the symmetric with the trivial for the permutation realization.
  299. C:=ConjugacyClasses(H);
  300. z:=0;
  301. for k:=1 to # C do
  302. a:=chi2perm(C[k][3]);
  303. z:=z+a*C[k][2];
  304. end for;
  305. return z/Order(H);
  306. end function;
  307.  
  308. TranslateSubgroupOfCycles:=function(H); //This takes a subgroup in the permutation realization to the corresponding subgroup in the matrix realization.
  309. m:=Integers() ! Log(2,Degree(Parent(Random(H))) div 2);
  310. L:=[];
  311. for c in Generators(H) do
  312. L:=Append(L,CycleToMatrix(c));
  313. end for;
  314. return sub<E(m)|L>;
  315. end function;
  316.  
  317. balanced:=function(m); //This returns the generator matrix for the Balanced Barnes-Wall lattice (as rows).
  318. Q<w>:=QuadraticField(2);
  319. M:=Matrix([[w,0],[1,1]]);
  320. T:=M;
  321. for i:=1 to m-1 do//
  322. T:=TensorProduct(T,M);
  323. end for;
  324. return T;
  325. end function;
  326.  
  327. Nebegen:=function(m); //This returns the generator matrix for Nebe et al's construction of the Barnes-Wall lattice.
  328. Q<w>:=QuadraticField(2);
  329. T:=balanced(m);
  330. B:=T;
  331. for i:=1 to 2^m do
  332. for j:=1 to 2^m do
  333. if Eltseq(T[i,j])[2] ne 0 then //Eltseq[2] tells me the sqrt(2) part.
  334. B[i,j]:=w * Eltseq(T[i,j])[2] * w; //Eltseq*w is the number. Then multiplying it by w again makes it rational.
  335. end if; //b/c apparently just multiplying it by w is enough to give the rational part.
  336. end for;
  337. end for;
  338. B:=ChangeRing(B, Integers());
  339. return B;
  340. end function;
  341.  
  342. Nebegram:=function(m); //The gram matrix
  343. G:=Nebegen(m);
  344. G:=G*Transpose(G);
  345. return G;
  346. end function;
  347.  
  348. Griessgen:=function(m); //Computes the generator matrix for Griess's constrction by rescaling Nebe et al's matrix.
  349. Q<w>:=QuadraticField(2);
  350. g:=Nebegen(m);
  351. g:=ChangeRing(g,QuadraticField(2));
  352. if IsEven(m) then
  353. c:=w ^ (-m div 2);
  354. end if;
  355. if IsOdd(m) then
  356. c:=w ^ ((-m-1) div 2);
  357. end if;
  358. for i:=1 to 2^m do
  359. for j:=1 to 2^m do
  360. g[i,j]:=c * g[i,j];
  361. end for;
  362. end for;
  363. return g;
  364. end function;
  365.  
  366. Griessgram:=function(m); //This one calculates the Gram matrix using the results of the previous function
  367. curlym:=Griessgen(m);
  368. curlym:=curlym*Transpose(curlym);
  369. curlym:=ChangeRing(curlym,Integers());
  370. return curlym;
  371. end function;
  372.  
  373. UnimodularBRW:=function(m); //This gives a unimodular representation of BRW by conjugating each generator of BRW by the generator matrix of the Barnes-Wall lattice.
  374. N:=ChangeRing(Nebegen(m),RationalField());
  375. L:=[];
  376. for A in Generators(BRW(m)) do
  377. B:=ChangeRing(A,RationalField());
  378. L:=Append(L,ChangeRing(N*B*N^(-1),Integers()));
  379. end for;
  380. return sub<GeneralLinearGroup(2^m,Integers())|L>;
  381. end function;
  382.  
  383. PrimeBRW:=function(m,p);
  384. M:=[];
  385. for x in Generators(UnimodularBRW(m)) do
  386. M:=Append(M,ChangeRing(x,FiniteField(p)));
  387. end for;
  388. return sub<GeneralLinearGroup(2^m,FiniteField(p)) | M>;
  389. end function;
  390.  
  391. Grassmannian:=function(d,n); //This computes the number of d-dimensional subspaces of an n-dimensional vector space over Z2.
  392. a:=2^n-1;
  393. b:=2^d-1;
  394. for i:=1 to d-1 do
  395. a:=a*(2^n-2^i);
  396. b:=b*(2^d-2^i);
  397. end for;
  398. return a/b;
  399. end function;
  400.  
  401. Centralizer2:=function(m); //This computes the centralizer of a non-identity element of order 2 element in E(m). They're all isomorphic so I just get one.
  402. G:=E(m);
  403. Two:=0;
  404. for x in G do
  405. if Order(x) eq 2 and not x in Center(G) then
  406. Two:=x;
  407. break;
  408. end if;
  409. end for;
  410. return Centralizer(G,Two);
  411. end function;
  412.  
  413. Centralizer4:=function(m); //Same as above, for order 4.
  414. G:=E(m);
  415. Four:=0;
  416. for x in G do
  417. if Order(x) eq 4 then
  418. Four:=x;
  419. break;
  420. end if;
  421. end for;
  422. return Centralizer(G,Four);
  423. end function;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement