1 | //////////////////////////////////////////////////////////////////// |
---|
2 | // |
---|
3 | version = "(v0.2, 2015-10-01)"; |
---|
4 | category = "Algebraic Geometry"; |
---|
5 | info = " |
---|
6 | LIBRARY: gitfan.lib Compute GIT-fans. |
---|
7 | |
---|
8 | AUTHORS: Janko Boehm, boehm at mathematik.uni-kl.de @* |
---|
9 | Simon Keicher, keicher at mail.mathematik.uni-tuebingen.de @* |
---|
10 | Yue Ren, ren at mathematik.uni-kl.de @* |
---|
11 | |
---|
12 | OVERVIEW: |
---|
13 | This library allows you to calculate GIT-fans, torus orbits and GKZ-fans. |
---|
14 | |
---|
15 | In provides features to make use of symmetries of the torus action under consideration. |
---|
16 | |
---|
17 | The main procedure is GITfan which can be directly applied to an ideal and a grading matrix encoding the torus action, and returns a fan, the associated GIT-fan. We also provide various procedures implementing substeps of the algorithm to deal with large computations. |
---|
18 | |
---|
19 | The library uses the package 'gfanlib' by Anders N. Jensen. |
---|
20 | |
---|
21 | For notation, background, and algorithms see [BKR16]. |
---|
22 | |
---|
23 | Functions produce debug output if printlevel is positive. |
---|
24 | |
---|
25 | Elements of the symmetric group Sn of type permutation can be created by the function permutationFromIntvec. The images of 1,...,n can be obtained by permutationToIntvec. Composition of permutations can be done by the *-Operator, also powers can be computed in the usual way. |
---|
26 | |
---|
27 | |
---|
28 | REFERENCES: |
---|
29 | |
---|
30 | [BKR16] J. Boehm, S. Keicher, Y. Ren: Computing GIT-Fans with Symmetry and the Mori Chamber Decomposition of M06bar, https://arxiv.org/abs/1603.09241 |
---|
31 | |
---|
32 | TYPES: |
---|
33 | permutation; Permutation in map representation. |
---|
34 | |
---|
35 | PROCEDURES (not using group action): |
---|
36 | isAface(ideal, intvec); Checks whether the given face is an a-face. |
---|
37 | afaces(ideal); Returns a list of intvecs that correspond to the set of all a-faces, optionally for given list of simplex faces. |
---|
38 | fullDimImages(list, intmat); Finds the afaces which have a full-dimensional projection. |
---|
39 | minimalAfaces(list); compute the minimal a-faces among the a-faces with full dimensional projection. |
---|
40 | orbitCones(list, intmat); Returns the list of all orbit cones. |
---|
41 | GITcone(list, bigintmat); Returns the GIT-cone containing the given weight vector. |
---|
42 | GITfan(ideal, intmat); Compute GIT-fan. |
---|
43 | GITfanFromOrbitCones(list, intmat, cone); Compute GIT-fan from orbit cones. |
---|
44 | GITfanParallel(list, intmat, cone); Compute GIT-fan in parallel from orbit cones. |
---|
45 | GKZfan(intmat); Returns the GKZ-fan of the matrix Q. |
---|
46 | movingCone(intmat); Compute the moving cone. |
---|
47 | |
---|
48 | PROCEDURES (using group action): |
---|
49 | computeAfaceOrbits(list, list); Compute orbits of a-faces under a permutation group action. |
---|
50 | minimalAfaceOrbits(list); Find the minimal a-face orbits. |
---|
51 | orbitConeOrbits(list, intmat); Project the a-face orbits to orbit cone orbits. |
---|
52 | minimalOrbitConeOrbits(list); Find the minimal orbit cone orbits. |
---|
53 | intersectOrbitsWithMovingCone(list, cone); Intersect orbit cone orbits with moving cone. |
---|
54 | groupActionOnQImage(list, intmat); Determine the induced group action in the target of the grading matrix. |
---|
55 | groupActionOnHashes(list, list); Determine the induced group action on the set of orbit cones. |
---|
56 | storeActionOnOrbitConeIndices(list, string); Write the group action on the set of orbit cones to a file. |
---|
57 | permutationFromIntvec(intvec); Create a permutation from an intvec of images. |
---|
58 | permutationToIntvec(permutation); Return the intvec of images. |
---|
59 | evaluateProduct(list,list); Evaluate a list of products of group elements in terms of a given representation of the elements as permutations. |
---|
60 | GITfanSymmetric(list, intmat, cone, list); Compute GIT-fan from orbit cones by determining a minimal representing set for the orbits of maximal dimensional GIT-cones. |
---|
61 | GITfanParallelSymmetric(list, intmat, cone, list); Compute GIT-fan in parallel from orbit cones by determining a minimal representing set for the orbits of maximal dimensional GIT-cones. |
---|
62 | bigintToBinary(bigint, int); Convert bigint into a sparse binary represenation specifying the indices of the one-entries |
---|
63 | binaryToBigint(intvec); Convert sparse binary represenation specifying the indices of the one-entries to bigint |
---|
64 | applyPermutationToIntvec(intvec, permutation); Apply permutation to a set of integers represented as an intvec |
---|
65 | hashToCone(bigint, list); Convert a bigint hash to a GIT-cone |
---|
66 | hashesToFan(list hashes, list OC) |
---|
67 | |
---|
68 | KEYWORDS: library, gitfan, GIT, geometric invariant theory, quotients |
---|
69 | "; |
---|
70 | |
---|
71 | |
---|
72 | LIB "customstd.lib"; |
---|
73 | LIB "linalg.lib"; |
---|
74 | LIB "multigrading.lib"; |
---|
75 | LIB "parallel.lib"; |
---|
76 | |
---|
77 | proc mod_init() |
---|
78 | { |
---|
79 | LIB "~ren/murrumesh/gfanlib.so"; |
---|
80 | LIB "~ren/murrumesh/gitfan.so"; |
---|
81 | newstruct("permutation","intvec image"); |
---|
82 | system("install","permutation","*",composePermutations,2); |
---|
83 | system("install","permutation","^",permutationPower,2); |
---|
84 | system("install","permutation","print",printPermutation,1); |
---|
85 | } |
---|
86 | |
---|
87 | static proc emptyString(int n) |
---|
88 | { |
---|
89 | string st; |
---|
90 | for (int i = 1; i<=n;i++){ |
---|
91 | st=st+" "; |
---|
92 | } |
---|
93 | return(st);} |
---|
94 | |
---|
95 | proc printPermutation(permutation sigma) |
---|
96 | { |
---|
97 | intvec v = permutationToIntvec(sigma); |
---|
98 | string vsrc,vimg; |
---|
99 | for (int i = 1; i<=size(v);i++){ |
---|
100 | vsrc=vsrc+emptyString(1+size(string(size(v)))-size(string(i)))+string(i); |
---|
101 | } |
---|
102 | for (i = 1; i<=size(v);i++){ |
---|
103 | vimg=vimg+emptyString(1+size(string(size(v)))-size(string(v[i])))+string(v[i]); |
---|
104 | } |
---|
105 | print("|"+vsrc+"|"); |
---|
106 | print("|"+vimg+"|"); |
---|
107 | } |
---|
108 | |
---|
109 | |
---|
110 | //////////////////////////////////////////////////// |
---|
111 | // converts e.g. n=5 to its binary representation, i.e. 0,1,0,1 |
---|
112 | // if r = 3. |
---|
113 | // and stores it in an intvec. |
---|
114 | // r gives the bound for n <= 2^r: |
---|
115 | static proc int2face(int n, int r) |
---|
116 | { |
---|
117 | int k = r-1; |
---|
118 | intvec v; |
---|
119 | int n0 = n; |
---|
120 | |
---|
121 | while(n0 > 0){ |
---|
122 | while(2^k > n0){ |
---|
123 | k--; |
---|
124 | //v[size(v)+1] = 0; |
---|
125 | } |
---|
126 | |
---|
127 | v = k+1,v; |
---|
128 | n0 = n0 - 2^k; |
---|
129 | k--; |
---|
130 | } |
---|
131 | v = v[1..size(v)-1]; |
---|
132 | return(v); |
---|
133 | } |
---|
134 | example |
---|
135 | { |
---|
136 | echo = 2; |
---|
137 | int n = 5; |
---|
138 | int r = 4; |
---|
139 | int2face(n, r); |
---|
140 | |
---|
141 | n = 1; |
---|
142 | r = 1; |
---|
143 | int2face(n,r); |
---|
144 | } |
---|
145 | |
---|
146 | //////// |
---|
147 | |
---|
148 | |
---|
149 | |
---|
150 | //////////////////////////////////////////////////// |
---|
151 | |
---|
152 | proc afaces(ideal a, list #) |
---|
153 | "USAGE: afaces(a [,L]); a: ideal, L: list of intvecs |
---|
154 | PURPOSE: Returns a list of all a-faces (considered as intvecs of 0 and 1, where the i-th entry is 1 if the cone has the i-th unit basis vector as a generator), if L is specified only the faces of the simplex listed in L are considered (e.g. representatives with respect to a group action). |
---|
155 | RETURN: a list of intvecs |
---|
156 | EXAMPLE: example afaces; shows an example |
---|
157 | " |
---|
158 | { |
---|
159 | list AF; |
---|
160 | if ((size(#)>0) and (typeof(#[1])=="intvec")){ |
---|
161 | list L = #; |
---|
162 | for(int i = 1; i<=size(L); i++ ){ |
---|
163 | dbprint("representative "+string(i)+" of "+string(size(L))); |
---|
164 | if (isAface(a,L[i])){ |
---|
165 | AF[size(AF) + 1] = L[i]; |
---|
166 | } |
---|
167 | } |
---|
168 | return(AF); |
---|
169 | } |
---|
170 | |
---|
171 | intvec gam0; |
---|
172 | int r = nvars(basering); |
---|
173 | |
---|
174 | // check if 0 is an a-face: |
---|
175 | int bd; |
---|
176 | if (size(#)>0){bd=#[1];} |
---|
177 | gam0 = 0; |
---|
178 | if (size(gam0)>=bd){ |
---|
179 | if (isAface(a,gam0)){ |
---|
180 | AF[size(AF) + 1] = gam0; |
---|
181 | } |
---|
182 | } |
---|
183 | // check for other a-faces: |
---|
184 | for(int i = 1; i < 2^r; i++ ){ |
---|
185 | gam0 = int2face(i,r); |
---|
186 | if (size(gam0)>=bd){ |
---|
187 | if (isAface(a,gam0)){ |
---|
188 | AF[size(AF) + 1] = gam0; |
---|
189 | } |
---|
190 | } |
---|
191 | } |
---|
192 | |
---|
193 | //"done checking a-faces!"; |
---|
194 | return(AF); |
---|
195 | } |
---|
196 | example |
---|
197 | { |
---|
198 | |
---|
199 | echo = 2; |
---|
200 | ring R = 0,T(1..3),dp; |
---|
201 | ideal a = T(1)+T(2)+T(3); |
---|
202 | |
---|
203 | list F = afaces(a); |
---|
204 | print(F); |
---|
205 | print(size(F)); |
---|
206 | |
---|
207 | // 2nd ex // |
---|
208 | ring R2 = 0,T(1..3),dp; |
---|
209 | ideal a2 = T(2)^2*T(3)^2+T(1)*T(3); |
---|
210 | |
---|
211 | list F2 = afaces(a2); |
---|
212 | print(F2); |
---|
213 | print(size(F2)); |
---|
214 | |
---|
215 | // 3rd ex // |
---|
216 | ring R3 = 0,T(1..3),dp; |
---|
217 | ideal a3 = 0; |
---|
218 | |
---|
219 | list F3 = afaces(a3); |
---|
220 | print(F3); |
---|
221 | print(size(F3)); |
---|
222 | |
---|
223 | |
---|
224 | // 4th ex // |
---|
225 | ring R = 0,T(1..10),wp(1,1,1,1,1,1,1,1,1,1); |
---|
226 | ideal J = |
---|
227 | T(5)*T(10)-T(6)*T(9)+T(7)*T(8), |
---|
228 | T(1)*T(9)-T(2)*T(7)+T(4)*T(5), |
---|
229 | T(1)*T(8)-T(2)*T(6)+T(3)*T(5), |
---|
230 | T(1)*T(10)-T(3)*T(7)+T(4)*T(6), |
---|
231 | T(2)*T(10)-T(3)*T(9)+T(4)*T(8); |
---|
232 | list F4 = afaces(J); |
---|
233 | print(size(F4)); |
---|
234 | } |
---|
235 | |
---|
236 | |
---|
237 | |
---|
238 | static proc saturateWithRespectToVariable(ideal I, int k) |
---|
239 | { |
---|
240 | // "saturating with respect to variable "+string(k); |
---|
241 | ASSUME(1,k>=1); |
---|
242 | ASSUME(1,k<=nvars(basering)); |
---|
243 | |
---|
244 | def origin = basering; |
---|
245 | int n = nvars(basering); |
---|
246 | intvec weightVector = ringlist(origin)[3][1][2]; |
---|
247 | |
---|
248 | string newVars; |
---|
249 | intvec newWeightVector; |
---|
250 | for (int i=1; i<k; i++) |
---|
251 | { |
---|
252 | newVars = newVars+string(var(i))+","; |
---|
253 | newWeightVector[i]=weightVector[i]; |
---|
254 | } |
---|
255 | for (i=k+1; i<=n; i++) |
---|
256 | { |
---|
257 | newVars = newVars+string(var(i))+","; |
---|
258 | newWeightVector[i-1]=weightVector[i]; |
---|
259 | } |
---|
260 | newVars = newVars+string(var(k)); |
---|
261 | newWeightVector[n]=weightVector[k]; |
---|
262 | execute("ring ringForSaturation = ("+charstr(origin)+"),("+newVars+"),(wp(newWeightVector));"); |
---|
263 | |
---|
264 | ideal I = satstd(imap(origin,I)); |
---|
265 | I = simplify(I,2+4+32); |
---|
266 | |
---|
267 | // "finished saturating with respect to variable "+string(k); |
---|
268 | setring origin; |
---|
269 | return (imap(ringForSaturation,I)); |
---|
270 | } |
---|
271 | |
---|
272 | static proc stepwiseSaturation(ideal I) |
---|
273 | { |
---|
274 | if (I!=1) |
---|
275 | { |
---|
276 | list variablesToBeSaturated; |
---|
277 | int l = nvars(basering); |
---|
278 | for (int i=1; i<=l; i++) |
---|
279 | { variablesToBeSaturated[i]=l-i+1; } |
---|
280 | |
---|
281 | while (size(variablesToBeSaturated)>0) |
---|
282 | { |
---|
283 | I = saturateWithRespectToVariable(I,variablesToBeSaturated[1]); |
---|
284 | variablesToBeSaturated = delete(variablesToBeSaturated,1); |
---|
285 | if ((I==1) || (I==-1)) |
---|
286 | { |
---|
287 | break; |
---|
288 | } |
---|
289 | } |
---|
290 | } |
---|
291 | |
---|
292 | return (I); |
---|
293 | } |
---|
294 | |
---|
295 | |
---|
296 | |
---|
297 | |
---|
298 | |
---|
299 | |
---|
300 | proc isAface(ideal a, intvec gam0) |
---|
301 | "USAGE: isAface(a,gam0); a: ideal, gam0:intvec |
---|
302 | PURPOSE: Checks whether gam0 is an a-face w.r.t. the ideal a. |
---|
303 | RETURN: int |
---|
304 | EXAMPLE: example isaface; shows an example |
---|
305 | " |
---|
306 | { |
---|
307 | // special case: gam0 is the zero-cone: |
---|
308 | if (size(gam0) == 1 and gam0[1] == 0){ |
---|
309 | poly pz; |
---|
310 | ideal G; |
---|
311 | int i; |
---|
312 | for (int k = 1; k <= size(a); k++) { |
---|
313 | pz = subst(a[k], var(1), 0); |
---|
314 | for (i = 2; i <= nvars(basering); i++) { |
---|
315 | pz = subst(pz, var(i), 0); |
---|
316 | } |
---|
317 | G = G, pz; |
---|
318 | } |
---|
319 | G = std(G); |
---|
320 | // monomial inside?: |
---|
321 | if(G == 1){ |
---|
322 | return(0); |
---|
323 | } |
---|
324 | return(1); |
---|
325 | } |
---|
326 | |
---|
327 | string initNewRing = "ring Rgam0 = 0,("; |
---|
328 | |
---|
329 | intvec w = ringlist(basering)[3][1][2]; |
---|
330 | intvec w0; |
---|
331 | for (int i=1; i<size(gam0); i++) |
---|
332 | { |
---|
333 | // take only entries i of w0 with i in gam0 |
---|
334 | initNewRing = initNewRing + string(var(gam0[i])) + ","; |
---|
335 | w0[i] = w[gam0[i]]; |
---|
336 | } |
---|
337 | w0[size(gam0)] = w[gam0[size(gam0)]]; |
---|
338 | |
---|
339 | initNewRing = initNewRing + string(var(gam0[size(gam0)])) + "),wp(w0);"; |
---|
340 | def R = basering; |
---|
341 | execute(initNewRing); |
---|
342 | |
---|
343 | ideal agam0 = imap(R,a); |
---|
344 | |
---|
345 | ideal G = stepwiseSaturation(agam0); |
---|
346 | |
---|
347 | if(G == 1) |
---|
348 | { |
---|
349 | return(0); // true |
---|
350 | } |
---|
351 | return(1); // false |
---|
352 | } |
---|
353 | example |
---|
354 | { |
---|
355 | echo = 2; |
---|
356 | |
---|
357 | ring R = 0,(T(1..4)),dp; |
---|
358 | ideal I = T(1)*T(2)-T(4); |
---|
359 | |
---|
360 | intvec w = 1,4; |
---|
361 | intvec v = 1,2,4; |
---|
362 | |
---|
363 | isAface(I,w); // should be 0 |
---|
364 | "-----------"; |
---|
365 | isAface(I,v); // should be 1 |
---|
366 | } |
---|
367 | |
---|
368 | |
---|
369 | proc applyPermutationToIntvec(intvec v, permutation g) |
---|
370 | "USAGE: applyPermutationToIntvec(v,g); v: intvec, g:permutation |
---|
371 | PURPOSE: Apply g to the set of entries of v. The result is a sorted intvec. We assume that the entries of v are valid arguments of g. We do not require that the input is sorted. |
---|
372 | RETURN: intvec. |
---|
373 | EXAMPLE: example applyPermutationToIntvec; shows an example |
---|
374 | " |
---|
375 | { |
---|
376 | intvec gv = composeIntvecs(permutationToIntvec(g),v); |
---|
377 | //for (int i=1;i<=size(v);i++){ |
---|
378 | // gv[i]=g[v[i]]; |
---|
379 | //} |
---|
380 | return(sort(gv)[1]); |
---|
381 | } |
---|
382 | example |
---|
383 | { |
---|
384 | permutation g = permutationFromIntvec(intvec(10, 9, 7, 4, 8, 6, 3, 5, 2, 1)); |
---|
385 | applyPermutationToIntvec(intvec(1, 3, 4, 6, 8),g); |
---|
386 | } |
---|
387 | |
---|
388 | static proc isContained(intvec v, list orbit){ |
---|
389 | for (int i=1;i<=size(orbit);i++){ |
---|
390 | if (v==orbit[i]){return(1);} |
---|
391 | } |
---|
392 | return(0); |
---|
393 | } |
---|
394 | |
---|
395 | |
---|
396 | static proc computeSimplexOrbit(intvec v, list G){ |
---|
397 | list orbit; |
---|
398 | intvec gv; |
---|
399 | for (int i=1;i<=size(G);i++){ |
---|
400 | gv=applyPermutationToIntvec(v,G[i]); |
---|
401 | if (isContained(gv,orbit)==0){orbit[size(orbit)+1]=gv;} |
---|
402 | } |
---|
403 | return(orbit); |
---|
404 | } |
---|
405 | |
---|
406 | |
---|
407 | proc computeAfaceOrbits(list AF, list G) |
---|
408 | "USAGE: computeAfaceOrbits(AF,G); AF list of intvecs, G: list of permutations |
---|
409 | PURPOSE: Computes the orbits of the afaces in the list AF under the group action in G, where G is a list of permutations. We assume that the elements of G form a group and the first entry corresponds to the neutral element. |
---|
410 | RETURN: a list of lists of intvecs |
---|
411 | EXAMPLE: example computeAfaceOrbits; shows an example |
---|
412 | " |
---|
413 | { |
---|
414 | list listorbits; |
---|
415 | for (int i=1;i<=size(AF);i++){ |
---|
416 | dbprint(i); |
---|
417 | listorbits[i]=computeSimplexOrbit(AF[i],G); |
---|
418 | } |
---|
419 | return(listorbits);} |
---|
420 | example |
---|
421 | { |
---|
422 | echo = 2; |
---|
423 | // Note that simplexOrbitRepresentatives and simplexSymmetryGroup are subsets of the actual sets for G25. For the full example see the examples in the source code documentation. |
---|
424 | ring R = 0,T(1..10),wp(1,1,1,1,1,1,1,1,1,1); |
---|
425 | ideal J = |
---|
426 | T(5)*T(10)-T(6)*T(9)+T(7)*T(8), |
---|
427 | T(1)*T(9)-T(2)*T(7)+T(4)*T(5), |
---|
428 | T(1)*T(8)-T(2)*T(6)+T(3)*T(5), |
---|
429 | T(1)*T(10)-T(3)*T(7)+T(4)*T(6), |
---|
430 | T(2)*T(10)-T(3)*T(9)+T(4)*T(8); |
---|
431 | intmat Q[5][10] = |
---|
432 | 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, |
---|
433 | 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, |
---|
434 | 0, 1, 1, 0, 0, 0, -1, 1, 0, 0, |
---|
435 | 0, 1, 0, 1, 0, -1, 0, 0, 1, 0, |
---|
436 | 0, 0, 1, 1, -1, 0, 0, 0, 0, 1; |
---|
437 | list simplexOrbitRepresentatives = intvec( 1, 2, 3, 4, 5 ), |
---|
438 | intvec( 1, 2, 3, 5, 6 ), |
---|
439 | intvec( 1, 2, 3, 5, 7 ), |
---|
440 | intvec( 1, 2, 3, 5, 10 ), |
---|
441 | intvec( 1, 2, 3, 7, 9 ), |
---|
442 | intvec( 1, 2, 3, 4, 5, 6, 9, 10 ), |
---|
443 | intvec( 1, 2, 3, 4, 5, 6, 7, 8, 9 ), |
---|
444 | intvec( 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ); |
---|
445 | list afaceOrbitRepresentatives=afaces(J,simplexOrbitRepresentatives); |
---|
446 | list simplexSymmetryGroup = permutationFromIntvec(intvec( 1 .. 10 )), |
---|
447 | permutationFromIntvec(intvec( 1, 2, 4, 3, 5, 7, 6, 9, 8, 10 )), |
---|
448 | permutationFromIntvec(intvec( 1, 3, 2, 4, 6, 5, 7, 8, 10, 9 )), |
---|
449 | permutationFromIntvec(intvec( 1, 3, 4, 2, 6, 7, 5, 10, 8, 9 )), |
---|
450 | permutationFromIntvec(intvec( 1, 4, 2, 3, 7, 5, 6, 9, 10, 8 )), |
---|
451 | permutationFromIntvec(intvec( 1, 4, 3, 2, 7, 6, 5, 10, 9, 8 )); |
---|
452 | list fulldimAfaceOrbitRepresentatives=fullDimImages(afaceOrbitRepresentatives,Q); |
---|
453 | list afaceOrbits=computeAfaceOrbits(fulldimAfaceOrbitRepresentatives,simplexSymmetryGroup); |
---|
454 | apply(afaceOrbits,size); |
---|
455 | } |
---|
456 | |
---|
457 | |
---|
458 | |
---|
459 | |
---|
460 | static proc isSubset(intvec v, intvec w) |
---|
461 | { |
---|
462 | int i,j; |
---|
463 | int jStart=1; |
---|
464 | for (i=1; i<=size(v); i++) |
---|
465 | { |
---|
466 | for (j=jStart; j<=size(w); j++) |
---|
467 | { |
---|
468 | if (v[i]==w[j]) |
---|
469 | { |
---|
470 | break; |
---|
471 | } |
---|
472 | } |
---|
473 | if (j<=size(w)) |
---|
474 | { |
---|
475 | jStart = j+1; |
---|
476 | } |
---|
477 | else |
---|
478 | { |
---|
479 | return (0); |
---|
480 | } |
---|
481 | } |
---|
482 | return (1); |
---|
483 | } |
---|
484 | |
---|
485 | |
---|
486 | |
---|
487 | static proc containsOrbitd(list A, list B) |
---|
488 | { |
---|
489 | intvec a = A[1]; |
---|
490 | for (int i=1; i<=size(B); i++) |
---|
491 | { |
---|
492 | if (isSubset(a,B[i])) |
---|
493 | { |
---|
494 | return (1); |
---|
495 | } |
---|
496 | } |
---|
497 | return (0); |
---|
498 | } |
---|
499 | |
---|
500 | |
---|
501 | proc minimalAfaceOrbits(list listOfOrbits) |
---|
502 | "USAGE: minimalAfaceOrbits(afaceOrbits); afaceOrbits: list |
---|
503 | PURPOSE: Returns a list of all minimal a-face orbits. |
---|
504 | RETURN: a list of intvecs |
---|
505 | EXAMPLE: example minimalAfaceOrbits; shows an example |
---|
506 | " |
---|
507 | { |
---|
508 | int i,j; |
---|
509 | list L = listOfOrbits; |
---|
510 | for (i=1; i<=size(L); i++) |
---|
511 | { |
---|
512 | dbprint(string(i)+" of "+string(size(L))); |
---|
513 | for (j=1; j<=size(L); j++) |
---|
514 | { |
---|
515 | if (i!=j) |
---|
516 | { |
---|
517 | if (containsOrbitd(L[i],L[j])) |
---|
518 | { |
---|
519 | dbprint("werfe raus (Laenge): " + string(size(L[j]))); |
---|
520 | L = delete(L,j); |
---|
521 | if (j<i) |
---|
522 | { |
---|
523 | i = i-1; |
---|
524 | } |
---|
525 | j = j-1; |
---|
526 | } |
---|
527 | } |
---|
528 | } |
---|
529 | } |
---|
530 | return(L); |
---|
531 | } |
---|
532 | example |
---|
533 | { |
---|
534 | echo = 2; |
---|
535 | // Note that simplexOrbitRepresentatives and simplexSymmetryGroup are subsets of the actual sets for G25. For the full example see the examples in the documentation |
---|
536 | ring R = 0,T(1..10),wp(1,1,1,1,1,1,1,1,1,1); |
---|
537 | ideal J = |
---|
538 | T(5)*T(10)-T(6)*T(9)+T(7)*T(8), |
---|
539 | T(1)*T(9)-T(2)*T(7)+T(4)*T(5), |
---|
540 | T(1)*T(8)-T(2)*T(6)+T(3)*T(5), |
---|
541 | T(1)*T(10)-T(3)*T(7)+T(4)*T(6), |
---|
542 | T(2)*T(10)-T(3)*T(9)+T(4)*T(8); |
---|
543 | intmat Q[5][10] = |
---|
544 | 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, |
---|
545 | 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, |
---|
546 | 0, 1, 1, 0, 0, 0, -1, 1, 0, 0, |
---|
547 | 0, 1, 0, 1, 0, -1, 0, 0, 1, 0, |
---|
548 | 0, 0, 1, 1, -1, 0, 0, 0, 0, 1; |
---|
549 | list simplexOrbitRepresentatives = intvec( 1, 2, 3, 4, 5 ), |
---|
550 | intvec( 1, 2, 3, 5, 6 ), |
---|
551 | intvec( 1, 2, 3, 5, 7 ), |
---|
552 | intvec( 1, 2, 3, 5, 10 ), |
---|
553 | intvec( 1, 2, 3, 7, 9 ), |
---|
554 | intvec( 1, 2, 3, 4, 5, 6, 9, 10 ), |
---|
555 | intvec( 1, 2, 3, 4, 5, 6, 7, 8, 9 ), |
---|
556 | intvec( 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ); |
---|
557 | list afaceOrbitRepresentatives=afaces(J,simplexOrbitRepresentatives); |
---|
558 | list simplexSymmetryGroup = permutationFromIntvec(intvec( 1 .. 10 )), |
---|
559 | permutationFromIntvec(intvec( 1, 2, 4, 3, 5, 7, 6, 9, 8, 10 )), |
---|
560 | permutationFromIntvec(intvec( 1, 3, 2, 4, 6, 5, 7, 8, 10, 9 )), |
---|
561 | permutationFromIntvec(intvec( 1, 3, 4, 2, 6, 7, 5, 10, 8, 9 )), |
---|
562 | permutationFromIntvec(intvec( 1, 4, 2, 3, 7, 5, 6, 9, 10, 8 )), |
---|
563 | permutationFromIntvec(intvec( 1, 4, 3, 2, 7, 6, 5, 10, 9, 8 )); |
---|
564 | list fulldimAfaceOrbitRepresentatives=fullDimImages(afaceOrbitRepresentatives,Q); |
---|
565 | list afaceOrbits=computeAfaceOrbits(fulldimAfaceOrbitRepresentatives,simplexSymmetryGroup); |
---|
566 | apply(afaceOrbits,size); |
---|
567 | list minAfaceOrbits = minimalAfaceOrbits(afaceOrbits); |
---|
568 | apply(minAfaceOrbits,size); |
---|
569 | } |
---|
570 | |
---|
571 | |
---|
572 | static proc list2string(list L){ |
---|
573 | string s = ""; |
---|
574 | |
---|
575 | for(int i = 1; i <=size(L); i++){ |
---|
576 | s = s + string(size(L[i])) + ", "; |
---|
577 | } |
---|
578 | |
---|
579 | return(s); |
---|
580 | } |
---|
581 | |
---|
582 | |
---|
583 | |
---|
584 | proc fullDimImages(list afaces,intmat Q) |
---|
585 | "USAGE: fullDimImages(afaces, Q); afaces: list, Q: intmat |
---|
586 | PURPOSE: Determines the a-faces (represented as intvecs) from the list afaces which have a full-dimensional projection with respect to Q. |
---|
587 | RETURN: a list of intvecs |
---|
588 | EXAMPLE: example fullDimImages; shows an example |
---|
589 | " |
---|
590 | { |
---|
591 | list L; |
---|
592 | for (int i=1; i<=size(afaces); i++) |
---|
593 | { |
---|
594 | intvec gam0 = afaces[i]; |
---|
595 | intmat Qgam0[nrows(Q)][size(gam0)] = Q[intvec(1..nrows(Q)),gam0]; |
---|
596 | //cone c = coneViaPoints(Qgam0); |
---|
597 | if(rank(Qgam0) == nrows(Q)){ |
---|
598 | L[size(L)+1]=afaces[i]; |
---|
599 | } |
---|
600 | kill gam0,Qgam0; |
---|
601 | } |
---|
602 | return(L); |
---|
603 | } |
---|
604 | example |
---|
605 | { |
---|
606 | echo=2; |
---|
607 | ring R = 0,T(1..10),wp(1,1,1,1,1,1,1,1,1,1); |
---|
608 | ideal J = |
---|
609 | T(5)*T(10)-T(6)*T(9)+T(7)*T(8), |
---|
610 | T(1)*T(9)-T(2)*T(7)+T(4)*T(5), |
---|
611 | T(1)*T(8)-T(2)*T(6)+T(3)*T(5), |
---|
612 | T(1)*T(10)-T(3)*T(7)+T(4)*T(6), |
---|
613 | T(2)*T(10)-T(3)*T(9)+T(4)*T(8); |
---|
614 | intmat Q[5][10] = |
---|
615 | 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, |
---|
616 | 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, |
---|
617 | 0, 1, 1, 0, 0, 0, -1, 1, 0, 0, |
---|
618 | 0, 1, 0, 1, 0, -1, 0, 0, 1, 0, |
---|
619 | 0, 0, 1, 1, -1, 0, 0, 0, 0, 1; |
---|
620 | |
---|
621 | list AF= afaces(J,nrows(Q)); |
---|
622 | size(AF); |
---|
623 | size(fullDimImages(AF,Q)); |
---|
624 | } |
---|
625 | |
---|
626 | |
---|
627 | |
---|
628 | |
---|
629 | proc orbitConeOrbits(list F, intmat Q) |
---|
630 | "USAGE: orbitConeOrbits(F, Q); F: list, Q: intmat |
---|
631 | PURPOSE: Projects a list F of a-face orbits to the orbit cones with respect to Q. The function checks whether the projections are of full dimension and returns an error otherwise. |
---|
632 | RETURN: a list of lists of cones |
---|
633 | EXAMPLE: example orbitConeOrbits; shows an example |
---|
634 | " |
---|
635 | { |
---|
636 | list OC; |
---|
637 | int j; |
---|
638 | intmat Qt = transpose(Q); |
---|
639 | for(int i = 1; i <= size(F); i++){ |
---|
640 | list Orbit = F[i]; |
---|
641 | list U; |
---|
642 | for(j = 1; j <= size(Orbit); j++){ |
---|
643 | intvec aface = Orbit[j]; |
---|
644 | intmat Qgam0[size(aface)][ncols(Qt)] = Qt[aface,intvec(1..ncols(Qt))]; |
---|
645 | cone c = coneViaPoints(Qgam0); |
---|
646 | if (dimension(c)!=ncols(Qt)){ERROR("cone should have full dimension");} |
---|
647 | // insert it even if it is already inside (mincones will take care of this) |
---|
648 | U[size(U)+1] = c; |
---|
649 | kill aface; |
---|
650 | kill Qgam0; |
---|
651 | kill c; |
---|
652 | } |
---|
653 | OC[size(OC)+1] = U; |
---|
654 | dbprint("current size of OC:"); |
---|
655 | dbprint(size(OC)); |
---|
656 | kill U; |
---|
657 | kill Orbit; |
---|
658 | } |
---|
659 | return(OC); |
---|
660 | } |
---|
661 | example |
---|
662 | { |
---|
663 | echo = 2; |
---|
664 | // Note that simplexOrbitRepresentatives and simplexSymmetryGroup are subsets of the actual sets for G25. For the full example see the examples in the documentation |
---|
665 | ring R = 0,T(1..10),wp(1,1,1,1,1,1,1,1,1,1); |
---|
666 | ideal J = |
---|
667 | T(5)*T(10)-T(6)*T(9)+T(7)*T(8), |
---|
668 | T(1)*T(9)-T(2)*T(7)+T(4)*T(5), |
---|
669 | T(1)*T(8)-T(2)*T(6)+T(3)*T(5), |
---|
670 | T(1)*T(10)-T(3)*T(7)+T(4)*T(6), |
---|
671 | T(2)*T(10)-T(3)*T(9)+T(4)*T(8); |
---|
672 | intmat Q[5][10] = |
---|
673 | 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, |
---|
674 | 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, |
---|
675 | 0, 1, 1, 0, 0, 0, -1, 1, 0, 0, |
---|
676 | 0, 1, 0, 1, 0, -1, 0, 0, 1, 0, |
---|
677 | 0, 0, 1, 1, -1, 0, 0, 0, 0, 1; |
---|
678 | list simplexOrbitRepresentatives = intvec( 1, 2, 3, 4, 5 ), |
---|
679 | intvec( 1, 2, 3, 5, 6 ), |
---|
680 | intvec( 1, 2, 3, 5, 7 ), |
---|
681 | intvec( 1, 2, 3, 5, 10 ), |
---|
682 | intvec( 1, 2, 3, 7, 9 ), |
---|
683 | intvec( 1, 2, 3, 4, 5, 6, 9, 10 ), |
---|
684 | intvec( 1, 2, 3, 4, 5, 6, 7, 8, 9 ), |
---|
685 | intvec( 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ); |
---|
686 | list afaceOrbitRepresentatives=afaces(J,simplexOrbitRepresentatives); |
---|
687 | list simplexSymmetryGroup = permutationFromIntvec(intvec( 1 .. 10 )), |
---|
688 | permutationFromIntvec(intvec( 1, 2, 4, 3, 5, 7, 6, 9, 8, 10 )), |
---|
689 | permutationFromIntvec(intvec( 1, 3, 2, 4, 6, 5, 7, 8, 10, 9 )), |
---|
690 | permutationFromIntvec(intvec( 1, 3, 4, 2, 6, 7, 5, 10, 8, 9 )), |
---|
691 | permutationFromIntvec(intvec( 1, 4, 2, 3, 7, 5, 6, 9, 10, 8 )), |
---|
692 | permutationFromIntvec(intvec( 1, 4, 3, 2, 7, 6, 5, 10, 9, 8 )); |
---|
693 | list fulldimAfaceOrbitRepresentatives=fullDimImages(afaceOrbitRepresentatives,Q); |
---|
694 | list afaceOrbits=computeAfaceOrbits(fulldimAfaceOrbitRepresentatives,simplexSymmetryGroup); |
---|
695 | apply(afaceOrbits,size); |
---|
696 | list minAfaceOrbits = minimalAfaceOrbits(afaceOrbits); |
---|
697 | apply(minAfaceOrbits,size); |
---|
698 | list listOfOrbitConeOrbits = orbitConeOrbits(minAfaceOrbits,Q); |
---|
699 | } |
---|
700 | |
---|
701 | |
---|
702 | proc minimalOrbitConeOrbits(list listOfOrbits) |
---|
703 | "USAGE: minimalOrbitConeOrbits(listOfOrbits); listOfOrbits: list of lists of cones |
---|
704 | PURPOSE: Minimizes a list of orbit cone orbits. |
---|
705 | RETURN: a list of lists of cones |
---|
706 | EXAMPLE: example minimalOrbitConeOrbits; shows an example |
---|
707 | " |
---|
708 | { |
---|
709 | int i,j; |
---|
710 | list L = listOfOrbits; |
---|
711 | |
---|
712 | |
---|
713 | for (i=1; i<=size(L); i++) |
---|
714 | { |
---|
715 | dbprint("::::: " + string(i)+" of "+string(size(L))); |
---|
716 | |
---|
717 | for (j=1; j<=size(L); j++) |
---|
718 | { |
---|
719 | dbprint("outer: "+string(i)+" inner: " + string(j)); |
---|
720 | if (i!=j) |
---|
721 | { |
---|
722 | if (containsOrbitdCone(L[i],L[j])) |
---|
723 | { |
---|
724 | dbprint("werfe raus, i="+string(i)+", j="+string(j)+" (Laenge): " + string(size(L[j]))); |
---|
725 | L = delete(L,j); |
---|
726 | if (j<i) |
---|
727 | { |
---|
728 | i = i-1; |
---|
729 | } |
---|
730 | j = j-1; |
---|
731 | } |
---|
732 | } |
---|
733 | } |
---|
734 | } |
---|
735 | return(L); |
---|
736 | } |
---|
737 | example |
---|
738 | { |
---|
739 | echo = 2; |
---|
740 | // Note that simplexOrbitRepresentatives and simplexSymmetryGroup are subsets of the actual sets for G25. For the full example see the examples in the documentation |
---|
741 | ring R = 0,T(1..10),wp(1,1,1,1,1,1,1,1,1,1); |
---|
742 | ideal J = |
---|
743 | T(5)*T(10)-T(6)*T(9)+T(7)*T(8), |
---|
744 | T(1)*T(9)-T(2)*T(7)+T(4)*T(5), |
---|
745 | T(1)*T(8)-T(2)*T(6)+T(3)*T(5), |
---|
746 | T(1)*T(10)-T(3)*T(7)+T(4)*T(6), |
---|
747 | T(2)*T(10)-T(3)*T(9)+T(4)*T(8); |
---|
748 | intmat Q[5][10] = |
---|
749 | 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, |
---|
750 | 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, |
---|
751 | 0, 1, 1, 0, 0, 0, -1, 1, 0, 0, |
---|
752 | 0, 1, 0, 1, 0, -1, 0, 0, 1, 0, |
---|
753 | 0, 0, 1, 1, -1, 0, 0, 0, 0, 1; |
---|
754 | list simplexOrbitRepresentatives = intvec( 1, 2, 3, 4, 5 ), |
---|
755 | intvec( 1, 2, 3, 5, 6 ), |
---|
756 | intvec( 1, 2, 3, 5, 7 ), |
---|
757 | intvec( 1, 2, 3, 5, 10 ), |
---|
758 | intvec( 1, 2, 3, 7, 9 ), |
---|
759 | intvec( 1, 2, 3, 4, 5, 6, 9, 10 ), |
---|
760 | intvec( 1, 2, 3, 4, 5, 6, 7, 8, 9 ), |
---|
761 | intvec( 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ); |
---|
762 | list afaceOrbitRepresentatives=afaces(J,simplexOrbitRepresentatives); |
---|
763 | list simplexSymmetryGroup = permutationFromIntvec(intvec( 1 .. 10 )), |
---|
764 | permutationFromIntvec(intvec( 1, 2, 4, 3, 5, 7, 6, 9, 8, 10 )), |
---|
765 | permutationFromIntvec(intvec( 1, 3, 2, 4, 6, 5, 7, 8, 10, 9 )), |
---|
766 | permutationFromIntvec(intvec( 1, 3, 4, 2, 6, 7, 5, 10, 8, 9 )), |
---|
767 | permutationFromIntvec(intvec( 1, 4, 2, 3, 7, 5, 6, 9, 10, 8 )), |
---|
768 | permutationFromIntvec(intvec( 1, 4, 3, 2, 7, 6, 5, 10, 9, 8 )); |
---|
769 | list fulldimAfaceOrbitRepresentatives=fullDimImages(afaceOrbitRepresentatives,Q); |
---|
770 | list afaceOrbits=computeAfaceOrbits(fulldimAfaceOrbitRepresentatives,simplexSymmetryGroup); |
---|
771 | apply(afaceOrbits,size); |
---|
772 | list minAfaceOrbits = minimalAfaceOrbits(afaceOrbits); |
---|
773 | apply(minAfaceOrbits,size); |
---|
774 | list listOfOrbitConeOrbits = orbitConeOrbits(minAfaceOrbits,Q); |
---|
775 | list listOfMinimalOrbitConeOrbits = minimalOrbitConeOrbits(listOfOrbitConeOrbits); |
---|
776 | size(listOfMinimalOrbitConeOrbits); |
---|
777 | } |
---|
778 | |
---|
779 | |
---|
780 | static proc containsOrbitdCone(list A, list B) |
---|
781 | { |
---|
782 | cone a = A[1]; |
---|
783 | for (int i=1; i<=size(B); i++) |
---|
784 | { |
---|
785 | if (isSubcone(a,B[i])) |
---|
786 | { |
---|
787 | dbprint("found subcone i="+string(i)); |
---|
788 | return (1); |
---|
789 | } |
---|
790 | } |
---|
791 | return (0); |
---|
792 | } |
---|
793 | |
---|
794 | static proc isSubcone(cone c1, cone c2) |
---|
795 | { |
---|
796 | return(containsInSupport(c2, c1)); |
---|
797 | } |
---|
798 | |
---|
799 | |
---|
800 | |
---|
801 | |
---|
802 | |
---|
803 | |
---|
804 | proc intersectOrbitsWithMovingCone(list OCmin,cone mov) |
---|
805 | "USAGE: intersectOrbitsWithMovingCone(OCmin, mov); OCmin: list of lists of cones, mov: cone |
---|
806 | PURPOSE: Intersects all cones in the orbits in OCmin with mov discarting all orbits of cones which are not of full dimension. The resulting orbits are duplicate free. |
---|
807 | RETURN: a list of lists of cones |
---|
808 | EXAMPLE: example intersectOrbitsWithMovingCone; shows an example |
---|
809 | " |
---|
810 | { |
---|
811 | list OCmov; |
---|
812 | cone ocmov; |
---|
813 | int i,j; |
---|
814 | int fulldim=dimension(mov); |
---|
815 | for (i=1; i<=size(OCmin); i++) |
---|
816 | { |
---|
817 | dbprint("intersecting orbit "+string(i)+" with moving cone"); |
---|
818 | ocmov = convexIntersection(OCmin[i][1],mov); |
---|
819 | if (dimension(ocmov)==fulldim) |
---|
820 | { |
---|
821 | list currentOrbit; |
---|
822 | for (j=1; j<=size(OCmin[i]); j++) |
---|
823 | { |
---|
824 | dbprint("checking cone "+string(j)+" of "+string(size(OCmin[i]))); |
---|
825 | ocmov = convexIntersection(OCmin[i][j],mov); |
---|
826 | ocmov = canonicalizeCone(ocmov); |
---|
827 | if (!listContainsCone(currentOrbit,ocmov)) |
---|
828 | { |
---|
829 | dbprint("inserting cone"); |
---|
830 | currentOrbit[size(currentOrbit)+1] = ocmov; |
---|
831 | } |
---|
832 | } |
---|
833 | OCmov[size(OCmov)+1] = currentOrbit; |
---|
834 | kill currentOrbit; |
---|
835 | } |
---|
836 | else |
---|
837 | { |
---|
838 | dbprint("intersection with moving cone lower-dimensional, abandoning orbit"); |
---|
839 | } |
---|
840 | } |
---|
841 | return(OCmov); |
---|
842 | } |
---|
843 | example { |
---|
844 | echo=2; |
---|
845 | ring R = 0,T(1..10),wp(1,1,1,1,1,1,1,1,1,1); |
---|
846 | ideal J = |
---|
847 | T(5)*T(10)-T(6)*T(9)+T(7)*T(8), |
---|
848 | T(1)*T(9)-T(2)*T(7)+T(4)*T(5), |
---|
849 | T(1)*T(8)-T(2)*T(6)+T(3)*T(5), |
---|
850 | T(1)*T(10)-T(3)*T(7)+T(4)*T(6), |
---|
851 | T(2)*T(10)-T(3)*T(9)+T(4)*T(8); |
---|
852 | intmat Q[5][10] = |
---|
853 | 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, |
---|
854 | 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, |
---|
855 | 0, 1, 1, 0, 0, 0, -1, 1, 0, 0, |
---|
856 | 0, 1, 0, 1, 0, -1, 0, 0, 1, 0, |
---|
857 | 0, 0, 1, 1, -1, 0, 0, 0, 0, 1; |
---|
858 | list simplexOrbitRepresentatives = intvec( 1, 2, 3, 4, 5 ), |
---|
859 | intvec( 1, 2, 3, 5, 6 ), |
---|
860 | intvec( 1, 2, 3, 5, 7 ), |
---|
861 | intvec( 1, 2, 3, 5, 10 ), |
---|
862 | intvec( 1, 2, 3, 7, 9 ), |
---|
863 | intvec( 1, 2, 3, 4, 5, 6, 9, 10 ), |
---|
864 | intvec( 1, 2, 3, 4, 5, 6, 7, 8, 9 ), |
---|
865 | intvec( 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ); |
---|
866 | list afaceOrbitRepresentatives=afaces(J,simplexOrbitRepresentatives); |
---|
867 | list simplexSymmetryGroup = permutationFromIntvec(intvec( 1 .. 10 )), |
---|
868 | permutationFromIntvec(intvec( 1, 2, 4, 3, 5, 7, 6, 9, 8, 10 )), |
---|
869 | permutationFromIntvec(intvec( 1, 3, 2, 4, 6, 5, 7, 8, 10, 9 )), |
---|
870 | permutationFromIntvec(intvec( 1, 3, 4, 2, 6, 7, 5, 10, 8, 9 )), |
---|
871 | permutationFromIntvec(intvec( 1, 4, 2, 3, 7, 5, 6, 9, 10, 8 )), |
---|
872 | permutationFromIntvec(intvec( 1, 4, 3, 2, 7, 6, 5, 10, 9, 8 )); |
---|
873 | list fulldimAfaceOrbitRepresentatives=fullDimImages(afaceOrbitRepresentatives,Q); |
---|
874 | list afaceOrbits=computeAfaceOrbits(fulldimAfaceOrbitRepresentatives,simplexSymmetryGroup); |
---|
875 | apply(afaceOrbits,size); |
---|
876 | list minAfaceOrbits = minimalAfaceOrbits(afaceOrbits); |
---|
877 | apply(minAfaceOrbits,size); |
---|
878 | list listOfOrbitConeOrbits = orbitConeOrbits(minAfaceOrbits,Q); |
---|
879 | cone mov = movingCone(Q); |
---|
880 | intersectOrbitsWithMovingCone(listOfOrbitConeOrbits,mov); |
---|
881 | } |
---|
882 | |
---|
883 | |
---|
884 | static proc coneToString(cone C){ |
---|
885 | bigintmat F = facets(C); |
---|
886 | ring R=0,(x),dp; |
---|
887 | matrix FF[nrows(F)][ncols(F)]; |
---|
888 | int i,j; |
---|
889 | for (i=1; i<=nrows(F);i++){ |
---|
890 | for (j=1; j<=ncols(F);j++){ |
---|
891 | FF[i,j]=number(F[i,j]); |
---|
892 | } |
---|
893 | } |
---|
894 | return("bigintmat F["+string(nrows(F))+"]["+string(ncols(F))+"]="+string(FF)+";cone C=canonicalizeCone(coneViaInequalities(F));"); |
---|
895 | } |
---|
896 | |
---|
897 | proc storeOrbitConeOrbits(list OC, string fn) |
---|
898 | "USAGE: storeOrbitConeOrbits(OC, fn); OC: list of lists of cones, fn: string |
---|
899 | PURPOSE: Writes OC to file fn in Singular readable format. Can be importet using <. |
---|
900 | RETURN: nothing |
---|
901 | " |
---|
902 | { |
---|
903 | int i,j; |
---|
904 | write(":w "+fn,"list OC;"); |
---|
905 | for (i=1;i<=size(OC);i++){ |
---|
906 | write(":a "+fn,"list OCj;"); |
---|
907 | for (j=1;j<=size(OC[i]);j++){ |
---|
908 | write(":a "+fn,coneToString(OC[i][j])); |
---|
909 | write(":a "+fn,"OCj[size(OCj)+1]=C;"); |
---|
910 | write(":a "+fn,"kill C;kill F;"); |
---|
911 | } |
---|
912 | write(":a "+fn,"OC[size(OC)+1]=OCj;"); |
---|
913 | write(":a "+fn,"kill OCj;"); |
---|
914 | } |
---|
915 | } |
---|
916 | |
---|
917 | static proc storeCone(cone C,string fn){ |
---|
918 | intmat H = intmat(inequalities(C)); |
---|
919 | write(":w "+fn,"bigintmat H["+string(nrows(H))+"]["+string(ncols(H))+"] ="); |
---|
920 | write(":w "+fn,string(H)+";"); |
---|
921 | write(":a "+fn,"cone C= coneViaInequalities(H); kill H;"); |
---|
922 | } |
---|
923 | |
---|
924 | static proc listToIntvec(list L){ |
---|
925 | intvec v; |
---|
926 | for (int i = 1;i<=size(L);i++){ |
---|
927 | v[i]=L[i];} |
---|
928 | return(v); |
---|
929 | } |
---|
930 | |
---|
931 | static proc intvecToList(intvec L){ |
---|
932 | list v; |
---|
933 | for (int i = 1;i<=size(L);i++){ |
---|
934 | v[i]=L[i];} |
---|
935 | return(v); |
---|
936 | } |
---|
937 | |
---|
938 | static proc stackMatrices(bigintmat M, bigintmat N){ |
---|
939 | if (ncols(M)!=ncols(N)){ERROR("matrices should have the same number of columns");} |
---|
940 | bigintmat MN[nrows(M)+nrows(N)][ncols(N)]; |
---|
941 | MN[1..nrows(M),1..ncols(M)]=M[1..nrows(M),1..ncols(M)]; |
---|
942 | MN[(nrows(M)+1)..(nrows(M)+nrows(N)),1..ncols(M)]=N[1..nrows(N),1..ncols(N)]; |
---|
943 | return(MN); |
---|
944 | } |
---|
945 | |
---|
946 | |
---|
947 | proc movingCone(intmat Q) |
---|
948 | "USAGE: movingCone(Q); Q: intmat |
---|
949 | PURPOSE: Computes the moving cone from the grading matrix, with the degrees in the columns of Q. |
---|
950 | RETURN: a cone |
---|
951 | EXAMPLE: example movingCone; shows an example |
---|
952 | " |
---|
953 | { |
---|
954 | cone Qgammadual = coneViaInequalities(transpose(Q)); |
---|
955 | bigintmat R = facets(Qgammadual); |
---|
956 | list idx1=intvecToList(intvec(1..nrows(R))); |
---|
957 | intvec idx2=1..ncols(R); |
---|
958 | intvec idx1iv; |
---|
959 | bigintmat Ri[nrows(R)-1][ncols(R)]; |
---|
960 | list C; |
---|
961 | for (int i = 1; i<=nrows(R);i++){ |
---|
962 | idx1iv = listToIntvec(delete(idx1,i)); |
---|
963 | Ri=R[idx1iv,idx2]; |
---|
964 | C[i]=coneViaPoints(Ri); |
---|
965 | dbprint(string(i)+" "+string(nrows(facets(C[i])))); |
---|
966 | } |
---|
967 | cone mov = convexIntersection(C); |
---|
968 | return(mov); |
---|
969 | } |
---|
970 | example |
---|
971 | { |
---|
972 | echo=2; |
---|
973 | intmat Q[5][10] = |
---|
974 | 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, |
---|
975 | 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, |
---|
976 | 0, 1, 1, 0, 0, 0, -1, 1, 0, 0, |
---|
977 | 0, 1, 0, 1, 0, -1, 0, 0, 1, 0, |
---|
978 | 0, 0, 1, 1, -1, 0, 0, 0, 0, 1; |
---|
979 | cone mov = movingCone(Q); |
---|
980 | mov; |
---|
981 | rays(mov); |
---|
982 | } |
---|
983 | |
---|
984 | |
---|
985 | static proc pivotIndices(matrix H) |
---|
986 | { |
---|
987 | intvec p; |
---|
988 | int pp; |
---|
989 | int i,j; |
---|
990 | int l=1; |
---|
991 | for (i=1; i<=ncols(H); i++) |
---|
992 | { |
---|
993 | for (j=nrows(H); j>=0; j--) |
---|
994 | { |
---|
995 | if (H[j,i]!=0) |
---|
996 | { |
---|
997 | if (j>pp) |
---|
998 | { |
---|
999 | p[l] = i; |
---|
1000 | l++; |
---|
1001 | pp = j; |
---|
1002 | } |
---|
1003 | break; |
---|
1004 | } |
---|
1005 | } |
---|
1006 | } |
---|
1007 | return (p); |
---|
1008 | } |
---|
1009 | |
---|
1010 | |
---|
1011 | |
---|
1012 | proc groupActionOnQImage(list G,intmat Q) |
---|
1013 | "USAGE: groupActionOnQImage(G,Q); G: list of permutations, Q: intmat |
---|
1014 | PURPOSE: Given the group G of permutations acting on the simplex on ncols(Q) objects, computes the corresponding group action on the image of Q. We assume that the basering has characteristic 0. |
---|
1015 | RETURN: list of matrices |
---|
1016 | EXAMPLE: example groupActionOnQImage; shows an example |
---|
1017 | " |
---|
1018 | { |
---|
1019 | matrix Qmat = transpose(matrix(Q)); |
---|
1020 | matrix H = gauss_nf(Qmat); |
---|
1021 | intvec indices = pivotIndices(H); |
---|
1022 | intmat Qbasis[nrows(Q)][size(indices)]=Q[1..nrows(Q),indices]; |
---|
1023 | matrix QbasisInv = inverse(Qbasis); |
---|
1024 | list L; |
---|
1025 | intmat Qt = transpose(Q); |
---|
1026 | for(int i = 1; i <= size(G); i++){ |
---|
1027 | i; |
---|
1028 | intvec sig = permutationToIntvec(G[i]); |
---|
1029 | intmat Bsig = perm2mat(sig, indices,Qt); |
---|
1030 | matrix Asig = Bsig * QbasisInv; |
---|
1031 | L[size(L)+1] = matrixToIntmat(Asig); |
---|
1032 | kill sig; |
---|
1033 | kill Bsig; |
---|
1034 | kill Asig; |
---|
1035 | } |
---|
1036 | return(L); |
---|
1037 | } |
---|
1038 | example { |
---|
1039 | echo=2; |
---|
1040 | ring R = 0,(x),dp; |
---|
1041 | intmat Q[5][10] = |
---|
1042 | 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, |
---|
1043 | 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, |
---|
1044 | 0, 1, 1, 0, 0, 0, -1, 1, 0, 0, |
---|
1045 | 0, 1, 0, 1, 0, -1, 0, 0, 1, 0, |
---|
1046 | 0, 0, 1, 1, -1, 0, 0, 0, 0, 1; |
---|
1047 | list generatorsG = permutationFromIntvec(intvec( 1, 3, 2, 4, 6, 5, 7, 8, 10, 9 )), |
---|
1048 | permutationFromIntvec(intvec( 5, 7, 1, 6, 9, 2, 8, 4, 10, 3 )); |
---|
1049 | groupActionOnQImage(generatorsG,Q); |
---|
1050 | } |
---|
1051 | |
---|
1052 | |
---|
1053 | |
---|
1054 | static proc perm2mat(intvec sig, intvec indices, intmat Q){ |
---|
1055 | intvec sigind = 1:size(indices); |
---|
1056 | for(int i = 1; i <= size(indices); i++){ |
---|
1057 | if(indices[i] > size(sig)){ |
---|
1058 | sigind[i] = indices[i]; |
---|
1059 | } else { |
---|
1060 | sigind[i] = sig[indices[i]]; |
---|
1061 | } |
---|
1062 | } |
---|
1063 | intmat Asig[size(indices)][ncols(Q)]; |
---|
1064 | for(i = 1; i <= size(sigind); i++){ |
---|
1065 | Asig[i,1..ncols(Q)] = Q[sigind[i], 1..ncols(Q)]; |
---|
1066 | } |
---|
1067 | // the new basis must be in the cols: |
---|
1068 | return(transpose(Asig)); |
---|
1069 | } |
---|
1070 | |
---|
1071 | /////// |
---|
1072 | |
---|
1073 | |
---|
1074 | |
---|
1075 | |
---|
1076 | static proc imageCone(cone c, intmat A){ |
---|
1077 | bigintmat ineqs = inequalities(c); |
---|
1078 | cone cc = coneViaInequalities (ineqs * A); |
---|
1079 | return(cc); |
---|
1080 | } |
---|
1081 | |
---|
1082 | |
---|
1083 | static proc matrixToIntmat(matrix A){ |
---|
1084 | int i,j; |
---|
1085 | intmat Aint[nrows(A)][ncols(A)]; |
---|
1086 | for(i = 1; i<=nrows(A); i++){ |
---|
1087 | for(j = 1; j<=ncols(A); j++){ |
---|
1088 | if (deg(A[i,j])>0){ERROR("entries should be constants");} |
---|
1089 | if (denominator(number(A[i,j]))!=1){ERROR("entries should be integers");} |
---|
1090 | Aint[i,j]=int(number(A[i,j])); |
---|
1091 | } |
---|
1092 | } |
---|
1093 | return(Aint); |
---|
1094 | } |
---|
1095 | |
---|
1096 | |
---|
1097 | proc groupActionOnHashes(list Asigma, list OCmov) |
---|
1098 | "USAGE: groupActionOnHashes(Asigma,OCmov); Asigma: list, OCmov: list of list of cones |
---|
1099 | PURPOSE: From the list of orbits of orbitcones, and the symmetry group represenation given by the matrices in Asigma, compute the corresponding permutation representation of the symmetry group on the orbit cones. The permutations are specified in a map representation of length the sum of the size of the orbits of OCmov. |
---|
1100 | RETURN: list of permutations |
---|
1101 | EXAMPLE: example groupActionOnHashes; shows an example |
---|
1102 | " |
---|
1103 | { |
---|
1104 | // for each A in S6: |
---|
1105 | // for each c in OC90: |
---|
1106 | // store index of A*c |
---|
1107 | // --> intvec v_A |
---|
1108 | // store this in the list Ind |
---|
1109 | list Ind; |
---|
1110 | int i,j,b,k,sizepreviousorbits; |
---|
1111 | list remaining; |
---|
1112 | intmat A; |
---|
1113 | cone c,Ac; |
---|
1114 | for(i = 1; i<=size(Asigma); i++){ |
---|
1115 | intvec vA; |
---|
1116 | A = intmat(Asigma[i]); |
---|
1117 | dbprint("element "+string(i)+" of symmetry group"); |
---|
1118 | sizepreviousorbits=0; |
---|
1119 | for(b = 1; b <= size(OCmov); b++){ |
---|
1120 | remaining = intvecToList(intvec(1..size(OCmov[b]))); |
---|
1121 | for(j = 1; j <= size(OCmov[b]); j++){ |
---|
1122 | Ac = imageCone(OCmov[b][j], A); |
---|
1123 | |
---|
1124 | // find out index: |
---|
1125 | for(k= 1; k <= size(remaining); k++){ |
---|
1126 | if(OCmov[b][remaining[k]] == Ac){ |
---|
1127 | vA[j+sizepreviousorbits] = remaining[k]+sizepreviousorbits; |
---|
1128 | remaining = delete(remaining,k); |
---|
1129 | break; |
---|
1130 | } |
---|
1131 | } |
---|
1132 | } |
---|
1133 | |
---|
1134 | sizepreviousorbits=size(vA); |
---|
1135 | } |
---|
1136 | Ind[size(Ind)+1] = permutationFromIntvec(vA); |
---|
1137 | dbprint("vA: "+string(vA)); |
---|
1138 | kill vA; |
---|
1139 | } |
---|
1140 | return(Ind); |
---|
1141 | } |
---|
1142 | example |
---|
1143 | { |
---|
1144 | ring R = 0,T(1..10),wp(1,1,1,1,1,1,1,1,1,1); |
---|
1145 | ideal J = |
---|
1146 | T(5)*T(10)-T(6)*T(9)+T(7)*T(8), |
---|
1147 | T(1)*T(9)-T(2)*T(7)+T(4)*T(5), |
---|
1148 | T(1)*T(8)-T(2)*T(6)+T(3)*T(5), |
---|
1149 | T(1)*T(10)-T(3)*T(7)+T(4)*T(6), |
---|
1150 | T(2)*T(10)-T(3)*T(9)+T(4)*T(8); |
---|
1151 | intmat Q[5][10] = |
---|
1152 | 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, |
---|
1153 | 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, |
---|
1154 | 0, 1, 1, 0, 0, 0, -1, 1, 0, 0, |
---|
1155 | 0, 1, 0, 1, 0, -1, 0, 0, 1, 0, |
---|
1156 | 0, 0, 1, 1, -1, 0, 0, 0, 0, 1; |
---|
1157 | list AF= afaces(J); |
---|
1158 | list OC = orbitCones(AF,Q); |
---|
1159 | list generatorsG = permutationFromIntvec(intvec( 1, 3, 2, 4, 6, 5, 7, 8, 10, 9 )), |
---|
1160 | permutationFromIntvec(intvec( 5, 7, 1, 6, 9, 2, 8, 4, 10, 3 )); |
---|
1161 | list Asigmagens = groupActionOnQImage(generatorsG,Q); |
---|
1162 | groupActionOnHashes(Asigmagens,OC); |
---|
1163 | } |
---|
1164 | |
---|
1165 | |
---|
1166 | |
---|
1167 | |
---|
1168 | |
---|
1169 | |
---|
1170 | static proc composePermutationsGAP(permutation sigma, permutation tau){ |
---|
1171 | intvec sigmaTauImage; |
---|
1172 | |
---|
1173 | for (int i=1;i<=size(sigma.image);i++){ |
---|
1174 | sigmaTauImage[i]=tau.image[sigma.image[i]]; |
---|
1175 | } |
---|
1176 | |
---|
1177 | permutation sigmaTau; |
---|
1178 | sigmaTau.image = sigmaTauImage; |
---|
1179 | return(sigmaTau); |
---|
1180 | } |
---|
1181 | |
---|
1182 | static proc composePermutations(permutation sigma, permutation tau){ |
---|
1183 | intvec sigmaTauImage; |
---|
1184 | |
---|
1185 | for (int i=1;i<=size(sigma.image);i++){ |
---|
1186 | sigmaTauImage[i]=sigma.image[tau.image[i]]; |
---|
1187 | } |
---|
1188 | |
---|
1189 | permutation sigmaTau; |
---|
1190 | sigmaTau.image = sigmaTauImage; |
---|
1191 | return(sigmaTau); |
---|
1192 | } |
---|
1193 | |
---|
1194 | |
---|
1195 | static proc permutationPower(permutation sigma, int k){ |
---|
1196 | int i; |
---|
1197 | if (k==0) |
---|
1198 | { |
---|
1199 | permutation identity; |
---|
1200 | identity.image = intvec(1..size(sigma.image)); |
---|
1201 | return (identity); |
---|
1202 | } |
---|
1203 | if (k<0) |
---|
1204 | { |
---|
1205 | // if k<0 invert sigma and replace k with -k |
---|
1206 | intvec sigmaImage = sigma.image; |
---|
1207 | for (i=1; i<=size(sigmaImage); i++) |
---|
1208 | { |
---|
1209 | sigma.image[sigmaImage[i]] = i; |
---|
1210 | } |
---|
1211 | k = -k; |
---|
1212 | } |
---|
1213 | permutation sigmaToPowerK = sigma; |
---|
1214 | for (i=2; i<=k; i++) |
---|
1215 | { |
---|
1216 | sigmaToPowerK = composePermutations(sigmaToPowerK, sigma); |
---|
1217 | } |
---|
1218 | return (sigmaToPowerK); |
---|
1219 | } |
---|
1220 | |
---|
1221 | proc permutationFromIntvec(intvec sigmaImage) |
---|
1222 | "USAGE: permutationFromIntvec(sigmaImage); sigmaImage: intvec |
---|
1223 | PURPOSE: Create a permutation from an intvec of images. |
---|
1224 | RETURN: permutation |
---|
1225 | EXAMPLE: example permutationFromIntvec; shows an example |
---|
1226 | " |
---|
1227 | { |
---|
1228 | permutation sigma; |
---|
1229 | sigma.image = sigmaImage; |
---|
1230 | return (sigma); |
---|
1231 | } |
---|
1232 | |
---|
1233 | |
---|
1234 | proc evaluateProduct(list generatorsGperm, string st) |
---|
1235 | "USAGE: evaluateProduct(generatorsGperm,st); generatorsGperm: list, st: string |
---|
1236 | PURPOSE: Evaluates a formal product of variables xi in st, where xi corresponds to the permutation generatorsGperm[i]. |
---|
1237 | RETURN: permutation |
---|
1238 | EXAMPLE: example evaluateProduct; shows an example |
---|
1239 | " |
---|
1240 | { |
---|
1241 | for (int i=1;i<=size(generatorsGperm);i++){ |
---|
1242 | execute("permutation x"+string(i)+"= generatorsGperm[i];"); |
---|
1243 | } |
---|
1244 | if (st==""){ |
---|
1245 | st="x1^0"; |
---|
1246 | } |
---|
1247 | execute("permutation sigma = "+st); |
---|
1248 | return(sigma);} |
---|
1249 | example |
---|
1250 | { |
---|
1251 | ring R = 0,T(1..10),wp(1,1,1,1,1,1,1,1,1,1); |
---|
1252 | ideal J = |
---|
1253 | T(5)*T(10)-T(6)*T(9)+T(7)*T(8), |
---|
1254 | T(1)*T(9)-T(2)*T(7)+T(4)*T(5), |
---|
1255 | T(1)*T(8)-T(2)*T(6)+T(3)*T(5), |
---|
1256 | T(1)*T(10)-T(3)*T(7)+T(4)*T(6), |
---|
1257 | T(2)*T(10)-T(3)*T(9)+T(4)*T(8); |
---|
1258 | intmat Q[5][10] = |
---|
1259 | 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, |
---|
1260 | 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, |
---|
1261 | 0, 1, 1, 0, 0, 0, -1, 1, 0, 0, |
---|
1262 | 0, 1, 0, 1, 0, -1, 0, 0, 1, 0, |
---|
1263 | 0, 0, 1, 1, -1, 0, 0, 0, 0, 1; |
---|
1264 | list AF= afaces(J); |
---|
1265 | list OC = orbitCones(AF,Q); |
---|
1266 | list generatorsG = permutationFromIntvec(intvec( 1, 3, 2, 4, 6, 5, 7, 8, 10, 9 )), |
---|
1267 | permutationFromIntvec(intvec( 5, 7, 1, 6, 9, 2, 8, 4, 10, 3 )); |
---|
1268 | list Asigmagens = groupActionOnQImage(generatorsG,Q); |
---|
1269 | list actionOnOrbitconeIndicesForGenerators = groupActionOnHashes(Asigmagens,OC); |
---|
1270 | string elementInTermsOfGenerators = |
---|
1271 | "(x2^-1*x1^-1)^3*x1^-1"; |
---|
1272 | evaluateProduct(actionOnOrbitconeIndicesForGenerators, elementInTermsOfGenerators); |
---|
1273 | } |
---|
1274 | |
---|
1275 | |
---|
1276 | proc permutationToIntvec(permutation sigma) |
---|
1277 | "USAGE: permutationToIntvec(sigma); sigma: permutation |
---|
1278 | PURPOSE: Convert a permutation to an intvec of images. |
---|
1279 | RETURN: intvec |
---|
1280 | EXAMPLE: example permutationToIntvec; shows an example |
---|
1281 | " |
---|
1282 | {return(sigma.image);} |
---|
1283 | example |
---|
1284 | { |
---|
1285 | ///// todo |
---|
1286 | } |
---|
1287 | |
---|
1288 | |
---|
1289 | |
---|
1290 | |
---|
1291 | |
---|
1292 | |
---|
1293 | |
---|
1294 | |
---|
1295 | |
---|
1296 | |
---|
1297 | |
---|
1298 | |
---|
1299 | proc storeActionOnOrbitConeIndices(list Ind,string fn) |
---|
1300 | "USAGE: storeActionOnOrbitConeIndices(generatorsGperm,st); generatorsGperm: list, fn: string |
---|
1301 | PURPOSE: Write the action on the set of orbit cones to the file fn in Singular readable format. |
---|
1302 | RETURN: nothing |
---|
1303 | " |
---|
1304 | { |
---|
1305 | string s = "list actionOnOrbitconeIndices;"; |
---|
1306 | for(int i =1; i <= size(Ind); i++){ |
---|
1307 | s = s + "intvec v = " + string(Ind[i]) + ";" + newline; |
---|
1308 | s = s + "actionOnOrbitconeIndices[size(actionOnOrbitconeIndices)+1] = permutationFromIntvec(v);" + newline + "kill v;" + newline; |
---|
1309 | } |
---|
1310 | write(":w "+fn, s); |
---|
1311 | } |
---|
1312 | |
---|
1313 | |
---|
1314 | |
---|
1315 | |
---|
1316 | |
---|
1317 | static proc getNeighborHash(list OC, bigintmat w, bigintmat v, int mu) |
---|
1318 | { |
---|
1319 | int success = 0; |
---|
1320 | int zz; |
---|
1321 | intvec Jtmp; |
---|
1322 | bigintmat wtmp; |
---|
1323 | |
---|
1324 | while(!success) |
---|
1325 | { |
---|
1326 | mu = mu*2; |
---|
1327 | wtmp = mu*w - v; |
---|
1328 | success = 1; |
---|
1329 | for(zz = 1; zz <= size(OC); zz++) |
---|
1330 | { |
---|
1331 | if(containsInSupport(OC[zz], wtmp)) |
---|
1332 | { |
---|
1333 | if(!containsInSupport(OC[zz], w)) |
---|
1334 | { |
---|
1335 | success = 0; |
---|
1336 | Jtmp = 0; |
---|
1337 | break; |
---|
1338 | } |
---|
1339 | // insert index zz: |
---|
1340 | if(size(Jtmp) ==1 && Jtmp[1] == 0) |
---|
1341 | { |
---|
1342 | Jtmp[1] = zz; |
---|
1343 | } |
---|
1344 | else |
---|
1345 | { |
---|
1346 | Jtmp[size(Jtmp)+1] = zz; |
---|
1347 | } |
---|
1348 | } |
---|
1349 | } |
---|
1350 | } |
---|
1351 | |
---|
1352 | return(Jtmp); |
---|
1353 | } |
---|
1354 | |
---|
1355 | |
---|
1356 | |
---|
1357 | |
---|
1358 | /////////////////////////////////////// |
---|
1359 | |
---|
1360 | proc GITfanSymmetric(list OC, bigintmat Q, cone Qgamma, list actiononorbitcones, list #) |
---|
1361 | "USAGE: GITfanSymmetric(OC, Q, Qgamma, actiononorbitcones [, file1, file2]); OC:list, Q:bigintmat, Qgamma:cone, actiononorbitcones: list of intvec, file1:string, file2:string |
---|
1362 | PURPOSE: Returns the common refinement of the cones given in |
---|
1363 | the list OC which is supposed to contain the orbit cones intersected with Qgamma. The list actiononorbitcones is supposed to contain the symmetry group acting as permutations of on the list of orbit cones in OC. The optional argument can be used to specify one or two strings with file names, where the first file will contain the hashes of the GIT-cones and the second argument the actual cones in their H-representation. |
---|
1364 | To obtain the whole GIT-fan Qgamma has to be take the cone generated by the columns of Q. |
---|
1365 | RETURN: a list containing the bigint hashes of the GIT cones. |
---|
1366 | EXAMPLE: example GITfanSymmetric; shows an example |
---|
1367 | " |
---|
1368 | { |
---|
1369 | actiononorbitcones=apply(actiononorbitcones,permutationToIntvec); |
---|
1370 | /** |
---|
1371 | * stores the hashes of all maximal GIT cones computed |
---|
1372 | */ |
---|
1373 | list hashesOfCones; |
---|
1374 | /** |
---|
1375 | * stores to the corresponding maximal GIT cone in hashesOfCones |
---|
1376 | * - 0, if guaranteed that all adjacent GIT cones are known |
---|
1377 | * or are to be computed in the next iteration (*) |
---|
1378 | * - hash as intvec, otherwise |
---|
1379 | */ |
---|
1380 | list workingList; |
---|
1381 | |
---|
1382 | |
---|
1383 | /** |
---|
1384 | * compute starting cone |
---|
1385 | */ |
---|
1386 | bigintmat w,v; |
---|
1387 | cone lambda; |
---|
1388 | intvec lambdaHash; |
---|
1389 | while(dimension(lambda) <> nrows(Q)){ |
---|
1390 | w = randConeEl(transpose(Q),100); |
---|
1391 | dbprint("testing "+string(w)); |
---|
1392 | if (containsRelatively(Qgamma,w)) { |
---|
1393 | lambda,lambdaHash = GITcone(OC,w); |
---|
1394 | dbprint("computed cone of dimension "+string(dimension(lambda))); |
---|
1395 | } |
---|
1396 | } |
---|
1397 | int nCones = 1; // essentially size(hashesOfCones) |
---|
1398 | int nConesOpen = 1; // essentially size(workingList)+1, see (*) above |
---|
1399 | |
---|
1400 | |
---|
1401 | /** |
---|
1402 | * initialize lists |
---|
1403 | */ |
---|
1404 | int posToInsert = 1; |
---|
1405 | bigint hashToInsert = binaryToBigint(lambdaHash); |
---|
1406 | intvec sigLambdaHash; |
---|
1407 | for(int i = 2; i <= size(actiononorbitcones); i++){ |
---|
1408 | sigLambdaHash = composeIntvecs(actiononorbitcones[i],lambdaHash); |
---|
1409 | hashToInsert = min(hashToInsert,binaryToBigint(sigLambdaHash)); |
---|
1410 | } |
---|
1411 | hashesOfCones[1] = hashToInsert; |
---|
1412 | workingList[1] = int(0); |
---|
1413 | if (size(#)>0) {write(":w "+#[1],string(hashesOfCones[1]) + ",");} |
---|
1414 | if (size(#)>1) {write(":w "+#[2],"");writeGitconeToFile(lambda,#[2]);} |
---|
1415 | |
---|
1416 | |
---|
1417 | /** |
---|
1418 | * traverse fan |
---|
1419 | */ |
---|
1420 | int t,tt; |
---|
1421 | list FL; |
---|
1422 | intvec neighbourHash; |
---|
1423 | int mu = 1024; |
---|
1424 | while (lambdaHash>0) |
---|
1425 | { |
---|
1426 | tt=timer; |
---|
1427 | |
---|
1428 | /** |
---|
1429 | * compute all facets of lambda |
---|
1430 | */ |
---|
1431 | t = timer; |
---|
1432 | FL = listOfFacetsAndInteriorVectors(lambda, Qgamma); |
---|
1433 | dbprint("time for facets: "+string(timer - t)); |
---|
1434 | |
---|
1435 | /** |
---|
1436 | * compute all neighbours of lambda |
---|
1437 | */ |
---|
1438 | for (i=size(FL[1]); i>0; i--) |
---|
1439 | { |
---|
1440 | v = FL[1][i][1]; // interior facet normal |
---|
1441 | w = FL[1][i][2]; // interior facet point |
---|
1442 | neighbourHash = getNeighborHash(OC,w,v,mu); |
---|
1443 | posToInsert,hashToInsert = findPosToInsertSymmetric(hashesOfCones,neighbourHash,actiononorbitcones); |
---|
1444 | if(posToInsert > 0) |
---|
1445 | { |
---|
1446 | if (size(#)>0){write(":a "+#[1],string(binaryToBigint(neighbourHash)) + ",");} |
---|
1447 | hashesOfCones = insertToList(hashesOfCones,hashToInsert,posToInsert); |
---|
1448 | workingList = insertToList(workingList,neighbourHash,posToInsert); |
---|
1449 | nConesOpen++; |
---|
1450 | nCones++; |
---|
1451 | } |
---|
1452 | } |
---|
1453 | |
---|
1454 | /** |
---|
1455 | * pick lambdaHash and lambda for next iteration, |
---|
1456 | * set respective entry in workingList to 0 |
---|
1457 | */ |
---|
1458 | lambdaHash = 0; |
---|
1459 | for (i=size(workingList); i>0; i--) |
---|
1460 | { |
---|
1461 | if (typeof(workingList[i])=="intvec") |
---|
1462 | { |
---|
1463 | lambdaHash = workingList[i]; |
---|
1464 | lambda = gitConeFromHash(OC,lambdaHash); |
---|
1465 | if (size(#)>1) {writeGitconeToFile(lambda,#[2]);} |
---|
1466 | workingList[i] = int(0); |
---|
1467 | break; |
---|
1468 | } |
---|
1469 | } |
---|
1470 | nConesOpen--; |
---|
1471 | |
---|
1472 | dbprint("overall: "+string(nCones)+" open: "+string(nConesOpen)+" time for loop: "+string(timer-tt)); |
---|
1473 | } |
---|
1474 | return(hashesOfCones); |
---|
1475 | } |
---|
1476 | example |
---|
1477 | { |
---|
1478 | ///// todo |
---|
1479 | } |
---|
1480 | |
---|
1481 | |
---|
1482 | proc GITfanParallelSymmetric(list OC, bigintmat Q, cone Qgamma, list actiononorbitcones, list #) |
---|
1483 | "USAGE: GITfanParallelSymmetric(OC, Q, Qgamma, actiononorbitcones [, file1]); OC:list, Q:bigintmat, Qgamma:cone, actiononorbitcones: list of intvec, file1:string |
---|
1484 | PURPOSE: Returns the common refinement of the cones given in |
---|
1485 | the list OC which is supposed to contain the orbit cones intersected with Qgamma. The list actiononorbitcones is supposed to contain the symmetry group acting as permutations of on the list of orbit cones in OC. The optional argument can be used to specify a name for a file which will contain the hashes of the GIT-cones. |
---|
1486 | To obtain the whole GIT-fan Qgamma has to be take the cone generated by the columns of Q. |
---|
1487 | RETURN: a list containing the bigint hashes of the GIT cones. |
---|
1488 | NOTE: The proceduce uses parallel computation for the construction of the GIT-cones. |
---|
1489 | EXAMPLE: example GITfanParallelSymmetric; shows an example |
---|
1490 | " |
---|
1491 | { |
---|
1492 | actiononorbitcones=apply(actiononorbitcones,permutationToIntvec); |
---|
1493 | /** |
---|
1494 | * stores the hashes of all maximal GIT cones computed |
---|
1495 | */ |
---|
1496 | list hashesOfCones; |
---|
1497 | /** |
---|
1498 | * stores to the corresponding maximal GIT cone in hashesOfCones |
---|
1499 | * - 0, if guaranteed that all adjacent GIT cones are known |
---|
1500 | * or are to be computed in the next iteration (*) |
---|
1501 | * - hash as intvec, otherwise |
---|
1502 | */ |
---|
1503 | list workingList; |
---|
1504 | |
---|
1505 | |
---|
1506 | /** |
---|
1507 | * compute starting cone |
---|
1508 | */ |
---|
1509 | bigintmat w,v; |
---|
1510 | cone lambda; |
---|
1511 | intvec lambdaHash; |
---|
1512 | while(dimension(lambda) <> nrows(Q)){ |
---|
1513 | w = randConeEl(transpose(Q),100); |
---|
1514 | dbprint("testing "+string(w)); |
---|
1515 | if (containsRelatively(Qgamma,w)) { |
---|
1516 | lambda,lambdaHash = GITcone(OC,w); |
---|
1517 | dbprint("computed cone of dimension "+string(dimension(lambda))); |
---|
1518 | } |
---|
1519 | } |
---|
1520 | int nCones = 1; // essentially size(hashesOfCones) |
---|
1521 | int nConesOpen = 1; // essentially size(workingList)+1, see (*) above |
---|
1522 | |
---|
1523 | |
---|
1524 | /** |
---|
1525 | * initialize lists |
---|
1526 | */ |
---|
1527 | bigint hashToInsert = binaryToBigint(lambdaHash); |
---|
1528 | int posToInsert = 1; |
---|
1529 | intvec sigLambdaHash; |
---|
1530 | for(int i = 2; i <= size(actiononorbitcones); i++){ |
---|
1531 | sigLambdaHash = composeIntvecs(actiononorbitcones[i],lambdaHash); |
---|
1532 | hashToInsert = min(hashToInsert,binaryToBigint(sigLambdaHash)); |
---|
1533 | } |
---|
1534 | hashesOfCones[1] = hashToInsert; |
---|
1535 | workingList[1] = int(0); |
---|
1536 | if (size(#)>0) {write(":w "+#[1],string(binaryToBigint(lambdaHash)) + ",");} |
---|
1537 | //if (size(#)>1) {write(":w "+#[2],"list listOfMaximalCones;");writeGitconeToFile(lambda,#[2]);} |
---|
1538 | |
---|
1539 | |
---|
1540 | list iterationArgs = list(list(lambdaHash,OC,Qgamma,actiononorbitcones)); |
---|
1541 | list iterationRes; |
---|
1542 | |
---|
1543 | /** |
---|
1544 | * traverse fan |
---|
1545 | */ |
---|
1546 | int j,t,tloop; |
---|
1547 | list FL; |
---|
1548 | list neighbourHashes; |
---|
1549 | intvec neighbourHash; |
---|
1550 | while (size(iterationArgs)>0) |
---|
1551 | { |
---|
1552 | tloop=rtimer; |
---|
1553 | |
---|
1554 | /** |
---|
1555 | * compute all neighbours of lambda |
---|
1556 | */ |
---|
1557 | t = rtimer; |
---|
1558 | iterationRes = parallelWaitAll("computeNeighbourMinimalHashes",iterationArgs); |
---|
1559 | dbprint("time neighbours: "+string(rtimer - t)); |
---|
1560 | |
---|
1561 | /** |
---|
1562 | * central book keeping |
---|
1563 | */ |
---|
1564 | t = rtimer; |
---|
1565 | for (i=1; i<=size(iterationRes); i++) |
---|
1566 | { |
---|
1567 | neighbourHashes = iterationRes[i]; |
---|
1568 | for (j=1; j<=size(neighbourHashes); j++) |
---|
1569 | { |
---|
1570 | neighbourHash = neighbourHashes[j]; |
---|
1571 | hashToInsert = binaryToBigint(neighbourHash); |
---|
1572 | posToInsert = findPlaceToInsert(hashesOfCones,hashToInsert); |
---|
1573 | if(posToInsert > 0) |
---|
1574 | { |
---|
1575 | if (size(#)>0){write(":a "+#[1],string(binaryToBigint(neighbourHash)) + ",");} |
---|
1576 | hashesOfCones = insertToList(hashesOfCones,hashToInsert,posToInsert); |
---|
1577 | workingList = insertToList(workingList,neighbourHash,posToInsert); |
---|
1578 | nConesOpen++; |
---|
1579 | nCones++; |
---|
1580 | } |
---|
1581 | } |
---|
1582 | } |
---|
1583 | nConesOpen = nConesOpen - size(iterationArgs); |
---|
1584 | dbprint("time bookkeeping: "+string(rtimer - t)); |
---|
1585 | |
---|
1586 | /** |
---|
1587 | * pick arguments for next iteration, |
---|
1588 | * set respective entry in workingList to 0 |
---|
1589 | */ |
---|
1590 | t = rtimer; |
---|
1591 | iterationArgs = list(); |
---|
1592 | for (i=size(workingList); i>0; i--) |
---|
1593 | { |
---|
1594 | if (typeof(workingList[i])=="intvec") |
---|
1595 | { |
---|
1596 | iterationArgs[size(iterationArgs)+1] = list(workingList[i],OC,Qgamma,actiononorbitcones); |
---|
1597 | workingList[i] = int(0); |
---|
1598 | if (size(iterationArgs) >= getcores()) |
---|
1599 | { |
---|
1600 | break; |
---|
1601 | } |
---|
1602 | } |
---|
1603 | } |
---|
1604 | dbprint("time preparation: "+string(rtimer - t)); |
---|
1605 | |
---|
1606 | dbprint("overall: "+string(nCones)+" open: "+string(nConesOpen)+" time loop: "+string(rtimer-tloop)); |
---|
1607 | } |
---|
1608 | return(hashesOfCones); |
---|
1609 | } |
---|
1610 | example |
---|
1611 | { |
---|
1612 | ///// todo |
---|
1613 | } |
---|
1614 | |
---|
1615 | |
---|
1616 | // not static to be used in parallel.lib |
---|
1617 | proc computeNeighbourMinimalHashes(intvec lambdaHash, list OC, cone Qgamma, list actiononorbitcones) |
---|
1618 | { |
---|
1619 | /** |
---|
1620 | * compute all facets of lambda |
---|
1621 | */ |
---|
1622 | cone lambda = gitConeFromHash(OC,lambdaHash); |
---|
1623 | list FL = listOfFacetsAndInteriorVectors(lambda, Qgamma); |
---|
1624 | |
---|
1625 | /** |
---|
1626 | * compute all minimal hashes of neighbours of lambda |
---|
1627 | */ |
---|
1628 | int i,j; |
---|
1629 | bigintmat v,w; |
---|
1630 | intvec neighbourHash; |
---|
1631 | intvec neighbourHashPerm; |
---|
1632 | bigint nPerm; |
---|
1633 | intvec neighbourHashMin; |
---|
1634 | bigint nMin; |
---|
1635 | list neighbourHashes; |
---|
1636 | for (i=size(FL[1]); i>0; i--) |
---|
1637 | { |
---|
1638 | v = FL[1][i][1]; // interior facet normal |
---|
1639 | w = FL[1][i][2]; // interior facet point |
---|
1640 | neighbourHash = getNeighborHash(OC,w,v,1024); |
---|
1641 | neighbourHashMin = neighbourHash; |
---|
1642 | nMin = binaryToBigint(neighbourHash); |
---|
1643 | for (j=size(actiononorbitcones); j>1; j--) |
---|
1644 | { |
---|
1645 | neighbourHashPerm = composeIntvecs(actiononorbitcones[j],neighbourHash); |
---|
1646 | nPerm = binaryToBigint(neighbourHashPerm); |
---|
1647 | if (nPerm < nMin) |
---|
1648 | { |
---|
1649 | nMin = nPerm; |
---|
1650 | neighbourHashMin = neighbourHashPerm; |
---|
1651 | } |
---|
1652 | } |
---|
1653 | neighbourHashes[i] = neighbourHashMin; |
---|
1654 | } |
---|
1655 | |
---|
1656 | return (neighbourHashes); |
---|
1657 | } |
---|
1658 | |
---|
1659 | |
---|
1660 | |
---|
1661 | static proc writeGitconeToFile(cone lambda,string fn) |
---|
1662 | { |
---|
1663 | bigintmat H = facets(lambda); |
---|
1664 | |
---|
1665 | int rows = nrows(H); |
---|
1666 | int cols = ncols(H); |
---|
1667 | string toBeWritten = "bigintmat H["+string(rows)+"]["+string(cols)+"]="; |
---|
1668 | int i,j; |
---|
1669 | for (i=1; i<=rows; i++) |
---|
1670 | { |
---|
1671 | for (j=1; j<=cols; j++) |
---|
1672 | { |
---|
1673 | toBeWritten = toBeWritten + string(H[i,j]) + ","; |
---|
1674 | } |
---|
1675 | } |
---|
1676 | toBeWritten = toBeWritten[1..size(toBeWritten)-1]; |
---|
1677 | toBeWritten = toBeWritten + ";"; |
---|
1678 | write(":a "+fn,toBeWritten); |
---|
1679 | |
---|
1680 | toBeWritten = "listOfMaximalCones[size(listOfMaximalCones)+1] = coneViaInequalities(V);"; |
---|
1681 | write(":a "+fn,toBeWritten); |
---|
1682 | |
---|
1683 | toBeWritten = "kill V;"; |
---|
1684 | write(":a "+fn,toBeWritten); |
---|
1685 | |
---|
1686 | toBeWritten = ""; |
---|
1687 | write(":a "+fn,toBeWritten); |
---|
1688 | } |
---|
1689 | |
---|
1690 | |
---|
1691 | |
---|
1692 | static proc listOfFacetsAndInteriorVectors(cone lambda, cone Qgamma, list #){ |
---|
1693 | list FL; |
---|
1694 | int numboundary; |
---|
1695 | |
---|
1696 | bigintmat FL0 = facets(lambda); |
---|
1697 | bigintmat H[1][ncols(FL0)]; |
---|
1698 | bigintmat FL1[nrows(FL0)-1][ncols(FL0)]; // delete row of H from FL0 |
---|
1699 | |
---|
1700 | bigintmat w; |
---|
1701 | cone facetCone; |
---|
1702 | for(int i = 1; i <= nrows(FL0); i++){ |
---|
1703 | H = FL0[i,1..ncols(FL0)]; |
---|
1704 | |
---|
1705 | if(i > 1 and i < nrows(FL0)){ |
---|
1706 | FL1 = FL0[1..i-1, 1..ncols(FL0)], FL0[i+1..nrows(FL0), 1..ncols(FL0)]; |
---|
1707 | } else { |
---|
1708 | if(i == nrows(FL0)){ |
---|
1709 | FL1 = FL0[1..i-1, 1..ncols(FL0)]; |
---|
1710 | } else { // i = 1: |
---|
1711 | FL1 = FL0[2..nrows(FL0), 1..ncols(FL0)]; |
---|
1712 | } |
---|
1713 | } |
---|
1714 | |
---|
1715 | facetCone = coneViaInequalities(FL1, H); |
---|
1716 | |
---|
1717 | if (size(#)>0) |
---|
1718 | { |
---|
1719 | if (containsInSupport(facetCone,#[1])) |
---|
1720 | { |
---|
1721 | i++; |
---|
1722 | continue; |
---|
1723 | } |
---|
1724 | } |
---|
1725 | |
---|
1726 | w = relativeInteriorPoint(facetCone); |
---|
1727 | |
---|
1728 | if(containsRelatively(Qgamma,w)){ |
---|
1729 | FL[size(FL) + 1] = list(H,w); |
---|
1730 | } else { |
---|
1731 | numboundary=numboundary+1; |
---|
1732 | } |
---|
1733 | } |
---|
1734 | |
---|
1735 | return(list(FL,numboundary)); |
---|
1736 | } |
---|
1737 | |
---|
1738 | |
---|
1739 | |
---|
1740 | |
---|
1741 | |
---|
1742 | //////////////////////////////// |
---|
1743 | |
---|
1744 | // CAREFUL: we assume that actiononorbitcones[1] = id. |
---|
1745 | static proc findPosToInsertSymmetric(list hashesOfCones, intvec J, list actiononorbitcones){ |
---|
1746 | |
---|
1747 | // 1.: compute minimal hash sigJ |
---|
1748 | bigint n = binaryToBigint(J); |
---|
1749 | intvec sigJ; |
---|
1750 | for(int i = 2; i <= size(actiononorbitcones); i++){ |
---|
1751 | sigJ = composeIntvecs(actiononorbitcones[i],J); |
---|
1752 | n = min(n,binaryToBigint(sigJ)); |
---|
1753 | } |
---|
1754 | |
---|
1755 | // 2.:check if minimal hash is already in list |
---|
1756 | return(findPlaceToInsert(hashesOfCones,n),n); |
---|
1757 | } |
---|
1758 | |
---|
1759 | ////////////////////// |
---|
1760 | |
---|
1761 | // insert n at position pos and move bigger elements by one index |
---|
1762 | proc insertToList(list L, def elementToInsert, int posToInsert){ |
---|
1763 | if(posToInsert == 1){ |
---|
1764 | return(list(elementToInsert)+L); |
---|
1765 | } |
---|
1766 | if(posToInsert == size(L)+1){ |
---|
1767 | return(L+list(elementToInsert)); |
---|
1768 | } |
---|
1769 | return(list(L[1..(posToInsert-1)],elementToInsert,L[posToInsert..size(L)])); |
---|
1770 | } |
---|
1771 | |
---|
1772 | proc GITcone(list OCcones, bigintmat w) |
---|
1773 | "USAGE: GITcone(OCcones, w); OCcones: list of orbit cones, w: bigintmat with one row |
---|
1774 | PURPOSE: Returns the intersection of all orbit cones containing w. |
---|
1775 | RETURN: cone,intvec with the GIT cone containing w, and the hash of this cone (the indices of the orbit cones contributing to the intersection) |
---|
1776 | EXAMPLE: example GITcone; shows an example |
---|
1777 | " |
---|
1778 | { |
---|
1779 | list OCrelcones; |
---|
1780 | intvec Hash; |
---|
1781 | for(int i = 1; i <= size(OCcones); i++){ |
---|
1782 | if(containsInSupport(OCcones[i], w)){ |
---|
1783 | OCrelcones[size(OCrelcones)+1]=OCcones[i]; |
---|
1784 | Hash[size(Hash)+1] = i; |
---|
1785 | } |
---|
1786 | } |
---|
1787 | Hash = intvec(Hash[2..size(Hash)]); |
---|
1788 | return(convexIntersection(OCrelcones),Hash); |
---|
1789 | } |
---|
1790 | example { |
---|
1791 | echo=2; |
---|
1792 | ring R = 0,T(1..10),wp(1,1,1,1,1,1,1,1,1,1); |
---|
1793 | ideal J = |
---|
1794 | T(5)*T(10)-T(6)*T(9)+T(7)*T(8), |
---|
1795 | T(1)*T(9)-T(2)*T(7)+T(4)*T(5), |
---|
1796 | T(1)*T(8)-T(2)*T(6)+T(3)*T(5), |
---|
1797 | T(1)*T(10)-T(3)*T(7)+T(4)*T(6), |
---|
1798 | T(2)*T(10)-T(3)*T(9)+T(4)*T(8); |
---|
1799 | intmat Q[5][10] = |
---|
1800 | 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, |
---|
1801 | 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, |
---|
1802 | 0, 1, 1, 0, 0, 0, -1, 1, 0, 0, |
---|
1803 | 0, 1, 0, 1, 0, -1, 0, 0, 1, 0, |
---|
1804 | 0, 0, 1, 1, -1, 0, 0, 0, 0, 1; |
---|
1805 | |
---|
1806 | list AF= afaces(J,nrows(Q)); |
---|
1807 | AF=fullDimImages(AF,Q); |
---|
1808 | AF = minimalAfaces(AF); |
---|
1809 | list OC = orbitCones(AF,Q); |
---|
1810 | bigintmat w[1][nrows(Q)]; |
---|
1811 | for(int i = 1; i <= nrows(Q); i++){ |
---|
1812 | w = w + Q[1..nrows(Q),i]; |
---|
1813 | } |
---|
1814 | GITcone(OC,w); |
---|
1815 | } |
---|
1816 | |
---|
1817 | |
---|
1818 | static proc gitConeFromHash(list OC, intvec Hash) |
---|
1819 | { |
---|
1820 | list OCtoIntersect = OC[Hash]; |
---|
1821 | return (convexIntersection(OCtoIntersect)); |
---|
1822 | } |
---|
1823 | |
---|
1824 | |
---|
1825 | |
---|
1826 | |
---|
1827 | |
---|
1828 | static proc randConeEl(bigintmat Q, int bound){ |
---|
1829 | bigintmat w[1][ncols(Q)]; |
---|
1830 | |
---|
1831 | for(int i = 1; i <= nrows(Q); i++){ |
---|
1832 | bigintmat v[1][ncols(Q)] = Q[i,1..ncols(Q)]; |
---|
1833 | |
---|
1834 | w = w + random(1,bound) * v; |
---|
1835 | |
---|
1836 | kill v; |
---|
1837 | } |
---|
1838 | |
---|
1839 | return(w); |
---|
1840 | } |
---|
1841 | |
---|
1842 | |
---|
1843 | |
---|
1844 | proc subdividelist(list OC,int ncores){ |
---|
1845 | if (ncores>size(OC)){ncores=size(OC);} |
---|
1846 | int percore = size(OC) div (ncores); |
---|
1847 | int lastcore = size(OC) mod (ncores); |
---|
1848 | list OCLL; |
---|
1849 | int j=1; |
---|
1850 | int starti=1; |
---|
1851 | int endi; |
---|
1852 | for (int i=1;i<=ncores;i++){ |
---|
1853 | endi = starti+percore-1; |
---|
1854 | if (i<=lastcore) {endi=endi+1;} |
---|
1855 | list OCLLi=OC[starti..endi]; |
---|
1856 | starti=endi+1; |
---|
1857 | OCLL[i]=OCLLi; |
---|
1858 | kill OCLLi; |
---|
1859 | } |
---|
1860 | return(OCLL); |
---|
1861 | } |
---|
1862 | //list OC = 1,2,3,4,5,6,7,8,9,10,11,12; |
---|
1863 | //subdividelist(OC,4); |
---|
1864 | |
---|
1865 | |
---|
1866 | |
---|
1867 | |
---|
1868 | |
---|
1869 | |
---|
1870 | |
---|
1871 | |
---|
1872 | |
---|
1873 | |
---|
1874 | |
---|
1875 | |
---|
1876 | proc orbitCones(list AF, intmat Q, list #) |
---|
1877 | "USAGE: orbitCones(AF, Q[, d]); AF: list of intvecs, Q: intmat, d: int |
---|
1878 | PURPOSE: Returns the list consisting of all cones Q(gam0) where gam0 in AF. If the optional argument d is given then the function returns only the orbit cones of dimension at least d |
---|
1879 | RETURN: a list of cones |
---|
1880 | EXAMPLE: example orbitCones; shows an example |
---|
1881 | " |
---|
1882 | { |
---|
1883 | list OC; |
---|
1884 | intvec gam0; |
---|
1885 | int j; |
---|
1886 | cone c; |
---|
1887 | int d = 0; |
---|
1888 | if (size(#)>0) { |
---|
1889 | d = #[1]; |
---|
1890 | } |
---|
1891 | |
---|
1892 | for(int i = 1; i <= size(AF); i++){ |
---|
1893 | gam0 = AF[i]; |
---|
1894 | |
---|
1895 | if(gam0 == 0){ |
---|
1896 | bigintmat M[1][nrows(Q)]; |
---|
1897 | } else { |
---|
1898 | bigintmat M[size(gam0)][nrows(Q)]; |
---|
1899 | |
---|
1900 | for (j = 1; j <= size(gam0); j++){ |
---|
1901 | M[j,1..ncols(M)] = Q[1..nrows(Q),gam0[j]]; |
---|
1902 | } |
---|
1903 | } |
---|
1904 | |
---|
1905 | c = coneViaPoints(M); |
---|
1906 | |
---|
1907 | if(listContainsCone(OC, c) == 0 && dimension(c)>=d){ |
---|
1908 | OC[size(OC)+1] = c; |
---|
1909 | } |
---|
1910 | |
---|
1911 | kill M; |
---|
1912 | } |
---|
1913 | |
---|
1914 | return(OC); |
---|
1915 | } |
---|
1916 | example |
---|
1917 | { |
---|
1918 | echo=2; |
---|
1919 | ring R = 0,T(1..10),wp(1,1,1,1,1,1,1,1,1,1); |
---|
1920 | ideal J = |
---|
1921 | T(5)*T(10)-T(6)*T(9)+T(7)*T(8), |
---|
1922 | T(1)*T(9)-T(2)*T(7)+T(4)*T(5), |
---|
1923 | T(1)*T(8)-T(2)*T(6)+T(3)*T(5), |
---|
1924 | T(1)*T(10)-T(3)*T(7)+T(4)*T(6), |
---|
1925 | T(2)*T(10)-T(3)*T(9)+T(4)*T(8); |
---|
1926 | intmat Q[5][10] = |
---|
1927 | 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, |
---|
1928 | 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, |
---|
1929 | 0, 1, 1, 0, 0, 0, -1, 1, 0, 0, |
---|
1930 | 0, 1, 0, 1, 0, -1, 0, 0, 1, 0, |
---|
1931 | 0, 0, 1, 1, -1, 0, 0, 0, 0, 1; |
---|
1932 | |
---|
1933 | list AF= afaces(J); |
---|
1934 | print(size(AF)); |
---|
1935 | list OC = orbitCones(AF,Q); |
---|
1936 | size(OC); |
---|
1937 | } |
---|
1938 | |
---|
1939 | |
---|
1940 | |
---|
1941 | /////////////////////////////////////// |
---|
1942 | |
---|
1943 | proc GITfanFromOrbitCones(list OC, bigintmat Q, cone Qgamma, list #) |
---|
1944 | "USAGE: GITfanFromOrbitCones(OC, Q, Qgamma [, file1, file2]); OC:list, Q:bigintmat, Qgamma:cone, file1:string, file2:string |
---|
1945 | PURPOSE: Returns the common refinement of the cones given in |
---|
1946 | the list OC which is supposed to contain the orbit cones intersected with Qgamma. The optional argument can be used |
---|
1947 | to specify one or two strings with file names, where the first file will contain the hashes of the |
---|
1948 | GIT-cones and the second argument the actual cones in their H-representation. |
---|
1949 | To obtain the whole GIT-fan Qgamma has to be take the cone generated by the columns of Q. |
---|
1950 | RETURN: a list containing the bigint hashes of the GIT cones. |
---|
1951 | EXAMPLE: example GITfanFromOrbitCones; shows an example |
---|
1952 | " |
---|
1953 | { |
---|
1954 | /** |
---|
1955 | * stores the hashes of all maximal GIT cones computed |
---|
1956 | */ |
---|
1957 | list hashesOfCones; |
---|
1958 | /** |
---|
1959 | * stores to the corresponding maximal GIT cone in hashesOfCones |
---|
1960 | * - 0, if guaranteed that all adjacent GIT cones are known |
---|
1961 | * or are to be computed in the next iteration (*) |
---|
1962 | * - hash as intvec, otherwise |
---|
1963 | */ |
---|
1964 | list workingList; |
---|
1965 | |
---|
1966 | |
---|
1967 | /** |
---|
1968 | * compute starting cone |
---|
1969 | */ |
---|
1970 | bigintmat w,v; |
---|
1971 | cone lambda; |
---|
1972 | intvec lambdaHash; |
---|
1973 | while(dimension(lambda) <> nrows(Q)){ |
---|
1974 | w = randConeEl(transpose(Q),100); |
---|
1975 | dbprint("testing "+string(w)); |
---|
1976 | if (containsRelatively(Qgamma,w)) { |
---|
1977 | lambda,lambdaHash = GITcone(OC,w); |
---|
1978 | dbprint("computed cone of dimension "+string(dimension(lambda))); |
---|
1979 | } |
---|
1980 | } |
---|
1981 | int nCones = 1; // essentially size(hashesOfCones) |
---|
1982 | int nConesOpen = 1; // essentially size(workingList)+1, see (*) above |
---|
1983 | |
---|
1984 | |
---|
1985 | /** |
---|
1986 | * initialize lists |
---|
1987 | */ |
---|
1988 | int posToInsert = 1; |
---|
1989 | bigint hashToInsert = binaryToBigint(lambdaHash); |
---|
1990 | hashesOfCones[1] = hashToInsert; |
---|
1991 | workingList[1] = int(0); |
---|
1992 | if (size(#)>0) {write(":w "+#[1],string(hashesOfCones[1]) + ",");} |
---|
1993 | if (size(#)>1) {write(":w "+#[2],"list listOfMaximalCones;");writeGitconeToFile(lambda,#[2]);} |
---|
1994 | |
---|
1995 | |
---|
1996 | /** |
---|
1997 | * traverse fan |
---|
1998 | */ |
---|
1999 | int i,t,tt; |
---|
2000 | list FL; |
---|
2001 | intvec neighbourHash; |
---|
2002 | int mu = 1024; |
---|
2003 | while (lambdaHash>0) |
---|
2004 | { |
---|
2005 | tt=timer; |
---|
2006 | |
---|
2007 | /** |
---|
2008 | * compute all facets of lambda |
---|
2009 | */ |
---|
2010 | t = timer; |
---|
2011 | FL = listOfFacetsAndInteriorVectors(lambda, Qgamma); |
---|
2012 | dbprint("time for facets: "+string(timer - t)); |
---|
2013 | |
---|
2014 | /** |
---|
2015 | * compute all neighbours of lambda |
---|
2016 | */ |
---|
2017 | for (i=size(FL[1]); i>0; i--) |
---|
2018 | { |
---|
2019 | v = FL[1][i][1]; // interior facet normal |
---|
2020 | w = FL[1][i][2]; // interior facet point |
---|
2021 | neighbourHash = getNeighborHash(OC,w,v,mu); |
---|
2022 | hashToInsert = binaryToBigint(neighbourHash); |
---|
2023 | posToInsert = findPlaceToInsert(hashesOfCones,hashToInsert); |
---|
2024 | |
---|
2025 | if(posToInsert > 0) |
---|
2026 | { |
---|
2027 | if (size(#)>0){write(":a "+#[1],string(binaryToBigint(neighbourHash)) + ",");} |
---|
2028 | hashesOfCones = insertToList(hashesOfCones,hashToInsert,posToInsert); |
---|
2029 | workingList = insertToList(workingList,neighbourHash,posToInsert); |
---|
2030 | nConesOpen++; |
---|
2031 | nCones++; |
---|
2032 | } |
---|
2033 | } |
---|
2034 | |
---|
2035 | /** |
---|
2036 | * pick lambdaHash and lambda for next iteration, |
---|
2037 | * set respective entry in workingList to 0 |
---|
2038 | */ |
---|
2039 | lambdaHash = 0; |
---|
2040 | for (i=size(workingList); i>0; i--) |
---|
2041 | { |
---|
2042 | if (typeof(workingList[i])=="intvec") |
---|
2043 | { |
---|
2044 | lambdaHash = workingList[i]; |
---|
2045 | lambda = gitConeFromHash(OC,lambdaHash); |
---|
2046 | if (size(#)>1) {writeGitconeToFile(lambda,#[2]);} |
---|
2047 | workingList[i] = int(0); |
---|
2048 | break; |
---|
2049 | } |
---|
2050 | } |
---|
2051 | nConesOpen--; |
---|
2052 | |
---|
2053 | dbprint("overall: "+string(nCones)+" open: "+string(nConesOpen)+" time for loop: "+string(timer-tt)); |
---|
2054 | } |
---|
2055 | return(hashesOfCones); |
---|
2056 | } |
---|
2057 | example |
---|
2058 | { |
---|
2059 | echo=2; |
---|
2060 | ring R = 0,T(1..10),wp(1,1,1,1,1,1,1,1,1,1); |
---|
2061 | ideal J = |
---|
2062 | T(5)*T(10)-T(6)*T(9)+T(7)*T(8), |
---|
2063 | T(1)*T(9)-T(2)*T(7)+T(4)*T(5), |
---|
2064 | T(1)*T(8)-T(2)*T(6)+T(3)*T(5), |
---|
2065 | T(1)*T(10)-T(3)*T(7)+T(4)*T(6), |
---|
2066 | T(2)*T(10)-T(3)*T(9)+T(4)*T(8); |
---|
2067 | intmat Q[5][10] = |
---|
2068 | 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, |
---|
2069 | 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, |
---|
2070 | 0, 1, 1, 0, 0, 0, -1, 1, 0, 0, |
---|
2071 | 0, 1, 0, 1, 0, -1, 0, 0, 1, 0, |
---|
2072 | 0, 0, 1, 1, -1, 0, 0, 0, 0, 1; |
---|
2073 | |
---|
2074 | list AF= afaces(J,nrows(Q)); |
---|
2075 | AF=fullDimImages(AF,Q); |
---|
2076 | AF = minimalAfaces(AF); |
---|
2077 | list OC = orbitCones(AF,Q); |
---|
2078 | cone Qgamma = coneViaPoints(transpose(Q)); |
---|
2079 | list GIT = GITfanFromOrbitCones(OC,Q,Qgamma); |
---|
2080 | size(GIT); |
---|
2081 | } |
---|
2082 | |
---|
2083 | |
---|
2084 | |
---|
2085 | |
---|
2086 | |
---|
2087 | proc GITfanParallel(list OC, intmat Q, cone Qgamma, list #) |
---|
2088 | "USAGE: GITfanParallel(OC, Q, Qgamma [, file1]); OC:list, Q:intmat, Qgamma:cone, file1:string |
---|
2089 | PURPOSE: Returns the common refinement of the cones given in |
---|
2090 | the list OC which is supposed to contain the orbit cones intersected with Qgamma. The optional argument can be used to specify a name for a file which will contain the hashes of the GIT-cones. |
---|
2091 | To obtain the whole GIT-fan Qgamma has to be take the cone generated by the columns of Q. |
---|
2092 | RETURN: a list containing the bigint hashes of the GIT cones. |
---|
2093 | NOTE: The proceduce uses parallel computation for the construction of the GIT-cones. |
---|
2094 | EXAMPLE: example GITfanParallel; shows an example |
---|
2095 | " |
---|
2096 | { |
---|
2097 | /** |
---|
2098 | * stores the hashes of all maximal GIT cones computed |
---|
2099 | */ |
---|
2100 | list hashesOfCones; |
---|
2101 | /** |
---|
2102 | * stores to the corresponding maximal GIT cone in hashesOfCones |
---|
2103 | * - 0, if guaranteed that all adjacent GIT cones are known |
---|
2104 | * or are to be computed in the next iteration (*) |
---|
2105 | * - hash as intvec, otherwise |
---|
2106 | */ |
---|
2107 | list workingList; |
---|
2108 | |
---|
2109 | |
---|
2110 | /** |
---|
2111 | * compute starting cone |
---|
2112 | */ |
---|
2113 | bigintmat w,v; |
---|
2114 | cone lambda; |
---|
2115 | intvec lambdaHash; |
---|
2116 | while(dimension(lambda) <> nrows(Q)){ |
---|
2117 | w = randConeEl(transpose(Q),100); |
---|
2118 | dbprint("testing "+string(w)); |
---|
2119 | if (containsRelatively(Qgamma,w)) { |
---|
2120 | lambda,lambdaHash = GITcone(OC,w); |
---|
2121 | dbprint("computed cone of dimension "+string(dimension(lambda))); |
---|
2122 | } |
---|
2123 | } |
---|
2124 | int nCones = 1; // essentially size(hashesOfCones) |
---|
2125 | int nConesOpen = 1; // essentially size(workingList)+1, see (*) above |
---|
2126 | |
---|
2127 | |
---|
2128 | /** |
---|
2129 | * initialize lists |
---|
2130 | */ |
---|
2131 | bigint hashToInsert = binaryToBigint(lambdaHash); |
---|
2132 | int posToInsert = 1; |
---|
2133 | hashesOfCones[1] = hashToInsert; |
---|
2134 | workingList[1] = int(0); |
---|
2135 | if (size(#)>0) {write(":w "+#[1],string(binaryToBigint(lambdaHash)) + ",");} |
---|
2136 | //if (size(#)>1) {write(":w "+#[2],"list listOfMaximalCones;");writeGitconeToFile(lambda,#[2]);} |
---|
2137 | |
---|
2138 | |
---|
2139 | list iterationArgs = list(list(lambdaHash,OC,Qgamma)); |
---|
2140 | list iterationRes; |
---|
2141 | |
---|
2142 | /** |
---|
2143 | * traverse fan |
---|
2144 | */ |
---|
2145 | int i,j,t,tloop; |
---|
2146 | list FL; |
---|
2147 | list neighbourHashes; |
---|
2148 | intvec neighbourHash; |
---|
2149 | while (size(iterationArgs)>0) |
---|
2150 | { |
---|
2151 | tloop=rtimer; |
---|
2152 | |
---|
2153 | /** |
---|
2154 | * compute all neighbours of lambda |
---|
2155 | */ |
---|
2156 | t = rtimer; |
---|
2157 | iterationRes = parallelWaitAll("computeNeighbourHashes",iterationArgs); |
---|
2158 | dbprint("time neighbours: "+string(rtimer - t)); |
---|
2159 | |
---|
2160 | /** |
---|
2161 | * central book keeping |
---|
2162 | */ |
---|
2163 | t = rtimer; |
---|
2164 | for (i=1; i<=size(iterationRes); i++) |
---|
2165 | { |
---|
2166 | neighbourHashes = iterationRes[i]; |
---|
2167 | for (j=1; j<=size(neighbourHashes); j++) |
---|
2168 | { |
---|
2169 | neighbourHash = neighbourHashes[j]; |
---|
2170 | hashToInsert = binaryToBigint(neighbourHash); |
---|
2171 | posToInsert = findPlaceToInsert(hashesOfCones,hashToInsert); |
---|
2172 | if(posToInsert > 0) |
---|
2173 | { |
---|
2174 | if (size(#)>0){write(":a "+#[1],string(binaryToBigint(neighbourHash)) + ",");} |
---|
2175 | hashesOfCones = insertToList(hashesOfCones,hashToInsert,posToInsert); |
---|
2176 | workingList = insertToList(workingList,neighbourHash,posToInsert); |
---|
2177 | nConesOpen++; |
---|
2178 | nCones++; |
---|
2179 | } |
---|
2180 | } |
---|
2181 | } |
---|
2182 | nConesOpen = nConesOpen - size(iterationArgs); |
---|
2183 | dbprint("time bookkeeping: "+string(rtimer - t)); |
---|
2184 | |
---|
2185 | /** |
---|
2186 | * pick arguments for next iteration, |
---|
2187 | * set respective entry in workingList to 0 |
---|
2188 | */ |
---|
2189 | t = rtimer; |
---|
2190 | iterationArgs = list(); |
---|
2191 | for (i=size(workingList); i>0; i--) |
---|
2192 | { |
---|
2193 | if (typeof(workingList[i])=="intvec") |
---|
2194 | { |
---|
2195 | iterationArgs[size(iterationArgs)+1] = list(workingList[i],OC,Qgamma); |
---|
2196 | workingList[i] = int(0); |
---|
2197 | if (size(iterationArgs) >= getcores()) |
---|
2198 | { |
---|
2199 | break; |
---|
2200 | } |
---|
2201 | } |
---|
2202 | } |
---|
2203 | dbprint("time preparation: "+string(rtimer - t)); |
---|
2204 | |
---|
2205 | dbprint("overall: "+string(nCones)+" open: "+string(nConesOpen)+" time loop: "+string(rtimer-tloop)); |
---|
2206 | } |
---|
2207 | |
---|
2208 | if (size(#)==0) |
---|
2209 | { |
---|
2210 | return(hashesOfCones); |
---|
2211 | } |
---|
2212 | } |
---|
2213 | example |
---|
2214 | { |
---|
2215 | echo=2; |
---|
2216 | setcores(4); |
---|
2217 | ring R = 0,T(1..10),wp(1,1,1,1,1,1,1,1,1,1); |
---|
2218 | ideal J = |
---|
2219 | T(5)*T(10)-T(6)*T(9)+T(7)*T(8), |
---|
2220 | T(1)*T(9)-T(2)*T(7)+T(4)*T(5), |
---|
2221 | T(1)*T(8)-T(2)*T(6)+T(3)*T(5), |
---|
2222 | T(1)*T(10)-T(3)*T(7)+T(4)*T(6), |
---|
2223 | T(2)*T(10)-T(3)*T(9)+T(4)*T(8); |
---|
2224 | intmat Q[5][10] = |
---|
2225 | 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, |
---|
2226 | 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, |
---|
2227 | 0, 1, 1, 0, 0, 0, -1, 1, 0, 0, |
---|
2228 | 0, 1, 0, 1, 0, -1, 0, 0, 1, 0, |
---|
2229 | 0, 0, 1, 1, -1, 0, 0, 0, 0, 1; |
---|
2230 | |
---|
2231 | list AF= afaces(J); |
---|
2232 | print(size(AF)); |
---|
2233 | list OC = orbitCones(AF,Q); |
---|
2234 | cone Qgamma = coneViaPoints(transpose(Q)); |
---|
2235 | list GIT = GITfanParallel(OC,Q,Qgamma); |
---|
2236 | size(GIT); |
---|
2237 | } |
---|
2238 | |
---|
2239 | // not static to be used in parallel.lib |
---|
2240 | proc computeNeighbourHashes(intvec lambdaHash, list OC, cone Qgamma) |
---|
2241 | { |
---|
2242 | /** |
---|
2243 | * compute all facets of lambda |
---|
2244 | */ |
---|
2245 | cone lambda = gitConeFromHash(OC,lambdaHash); |
---|
2246 | list FL = listOfFacetsAndInteriorVectors(lambda, Qgamma); |
---|
2247 | |
---|
2248 | /** |
---|
2249 | * compute all minimal hashes of neighbours of lambda |
---|
2250 | */ |
---|
2251 | bigintmat v,w; |
---|
2252 | intvec neighbourHash; |
---|
2253 | list neighbourHashes; |
---|
2254 | for (int i=size(FL[1]); i>0; i--) |
---|
2255 | { |
---|
2256 | v = FL[1][i][1]; // interior facet normal |
---|
2257 | w = FL[1][i][2]; // interior facet point |
---|
2258 | neighbourHash = getNeighborHash(OC,w,v,1024); |
---|
2259 | neighbourHashes[i] = neighbourHash; |
---|
2260 | } |
---|
2261 | |
---|
2262 | return (neighbourHashes); |
---|
2263 | } |
---|
2264 | |
---|
2265 | |
---|
2266 | |
---|
2267 | proc minimalAfaces(list listOfAfaces) |
---|
2268 | "USAGE: minimalAfaces(listOfAfaces); listOfAfaces: list |
---|
2269 | PURPOSE: Returns a list of all minimal a-faces. Note that listOfAfaces must only contain |
---|
2270 | afaces which project to full dimension. |
---|
2271 | RETURN: a list of intvecs |
---|
2272 | EXAMPLE: example minimalAfaces; shows an example |
---|
2273 | " |
---|
2274 | { |
---|
2275 | int i,j; |
---|
2276 | for (i=1; i<=size(listOfAfaces); i++) |
---|
2277 | { |
---|
2278 | for (j=1; j<=size(listOfAfaces); j++) |
---|
2279 | { |
---|
2280 | if (i!=j) |
---|
2281 | { |
---|
2282 | if (isSubset(listOfAfaces[i],listOfAfaces[j])) |
---|
2283 | { |
---|
2284 | listOfAfaces = delete(listOfAfaces,j); |
---|
2285 | if (j<i) |
---|
2286 | { |
---|
2287 | i = i-1; |
---|
2288 | } |
---|
2289 | j = j-1; |
---|
2290 | } |
---|
2291 | } |
---|
2292 | } |
---|
2293 | } |
---|
2294 | return(listOfAfaces); |
---|
2295 | } |
---|
2296 | example |
---|
2297 | { |
---|
2298 | echo=2; |
---|
2299 | setcores(4); |
---|
2300 | ring R = 0,T(1..10),wp(1,1,1,1,1,1,1,1,1,1); |
---|
2301 | ideal J = |
---|
2302 | T(5)*T(10)-T(6)*T(9)+T(7)*T(8), |
---|
2303 | T(1)*T(9)-T(2)*T(7)+T(4)*T(5), |
---|
2304 | T(1)*T(8)-T(2)*T(6)+T(3)*T(5), |
---|
2305 | T(1)*T(10)-T(3)*T(7)+T(4)*T(6), |
---|
2306 | T(2)*T(10)-T(3)*T(9)+T(4)*T(8); |
---|
2307 | intmat Q[5][10] = |
---|
2308 | 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, |
---|
2309 | 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, |
---|
2310 | 0, 1, 1, 0, 0, 0, -1, 1, 0, 0, |
---|
2311 | 0, 1, 0, 1, 0, -1, 0, 0, 1, 0, |
---|
2312 | 0, 0, 1, 1, -1, 0, 0, 0, 0, 1; |
---|
2313 | list AF= afaces(J,nrows(Q)); |
---|
2314 | size(AF); |
---|
2315 | AF=fullDimImages(AF,Q); |
---|
2316 | size(AF); |
---|
2317 | AF=minimalAfaces(AF); |
---|
2318 | size(AF); |
---|
2319 | } |
---|
2320 | |
---|
2321 | |
---|
2322 | |
---|
2323 | proc GITfan(ideal J, intmat Q) |
---|
2324 | "USAGE: GITfan(J,Q); J:ideal, Q:intmat |
---|
2325 | PURPOSE: Computes the GIT fan associated to J and Q. |
---|
2326 | RETURN: a fan, the GIT fan. |
---|
2327 | NOTE: The proceduce uses parallel computation for the construction of the GIT-cones. The a-faces are not computed in parallel. This can be done by calling the aface procedure specifying a list of simplex faces. |
---|
2328 | EXAMPLE: example GITfan; shows an example |
---|
2329 | " |
---|
2330 | { |
---|
2331 | list AF= afaces(J,nrows(Q)); |
---|
2332 | AF=fullDimImages(AF,Q); |
---|
2333 | AF = minimalAfaces(AF); |
---|
2334 | list OC = orbitCones(AF,Q); |
---|
2335 | cone Qgamma = coneViaPoints(transpose(Q)); |
---|
2336 | list GIT = GITfanParallel(OC,Q,Qgamma); |
---|
2337 | fan Sigma = hashesToFan(GIT,OC); |
---|
2338 | return(Sigma); |
---|
2339 | } |
---|
2340 | example |
---|
2341 | { |
---|
2342 | echo=2; |
---|
2343 | setcores(4); |
---|
2344 | ring R = 0,T(1..10),wp(1,1,1,1,1,1,1,1,1,1); |
---|
2345 | ideal J = |
---|
2346 | T(5)*T(10)-T(6)*T(9)+T(7)*T(8), |
---|
2347 | T(1)*T(9)-T(2)*T(7)+T(4)*T(5), |
---|
2348 | T(1)*T(8)-T(2)*T(6)+T(3)*T(5), |
---|
2349 | T(1)*T(10)-T(3)*T(7)+T(4)*T(6), |
---|
2350 | T(2)*T(10)-T(3)*T(9)+T(4)*T(8); |
---|
2351 | intmat Q[5][10] = |
---|
2352 | 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, |
---|
2353 | 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, |
---|
2354 | 0, 1, 1, 0, 0, 0, -1, 1, 0, 0, |
---|
2355 | 0, 1, 0, 1, 0, -1, 0, 0, 1, 0, |
---|
2356 | 0, 0, 1, 1, -1, 0, 0, 0, 0, 1; |
---|
2357 | fan GIT = GITfan(J,Q); |
---|
2358 | } |
---|
2359 | |
---|
2360 | |
---|
2361 | proc hashToCone(bigint v, list OC) |
---|
2362 | "USAGE: hashToCone(v, OC): v bigint, OC list of cones. |
---|
2363 | ASSUME: the elements of OC are the orbit cones used in the hash representation of the GIT cones. |
---|
2364 | RETURN: a cone, the intersection of the cones in OC according to the binary representation of the hash v. |
---|
2365 | EXAMPLE: example hashToCone; shows an example |
---|
2366 | " |
---|
2367 | { |
---|
2368 | intvec J = bigintToBinary(v, size(OC)); |
---|
2369 | return(convexIntersection(list(OC[J]))); |
---|
2370 | } |
---|
2371 | example |
---|
2372 | { |
---|
2373 | echo = 2; |
---|
2374 | setcores(4); |
---|
2375 | ring R = 0,T(1..10),wp(1,1,1,1,1,1,1,1,1,1); |
---|
2376 | ideal J = |
---|
2377 | T(5)*T(10)-T(6)*T(9)+T(7)*T(8), |
---|
2378 | T(1)*T(9)-T(2)*T(7)+T(4)*T(5), |
---|
2379 | T(1)*T(8)-T(2)*T(6)+T(3)*T(5), |
---|
2380 | T(1)*T(10)-T(3)*T(7)+T(4)*T(6), |
---|
2381 | T(2)*T(10)-T(3)*T(9)+T(4)*T(8); |
---|
2382 | intmat Q[5][10] = |
---|
2383 | 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, |
---|
2384 | 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, |
---|
2385 | 0, 1, 1, 0, 0, 0, -1, 1, 0, 0, |
---|
2386 | 0, 1, 0, 1, 0, -1, 0, 0, 1, 0, |
---|
2387 | 0, 0, 1, 1, -1, 0, 0, 0, 0, 1; |
---|
2388 | list AF= afaces(J,nrows(Q)); |
---|
2389 | AF=fullDimImages(AF,Q); |
---|
2390 | AF = minimalAfaces(AF); |
---|
2391 | list OC = orbitCones(AF,Q); |
---|
2392 | bigint v = 21300544; |
---|
2393 | hashToCone(v, OC); |
---|
2394 | } |
---|
2395 | |
---|
2396 | |
---|
2397 | proc bigintToBinary(bigint n, int r) |
---|
2398 | " |
---|
2399 | USAGE: bigintToBinary(n, r): n bigint, r int. |
---|
2400 | ASSUME: n is smaller then 2^r. |
---|
2401 | RETURN: an intvec, with entries the positions of 1 in the binary representation of n with r bits. |
---|
2402 | EXAMPLE: example bigintToBinary; shows an example |
---|
2403 | " |
---|
2404 | { |
---|
2405 | int k = r-1; |
---|
2406 | |
---|
2407 | intvec v; |
---|
2408 | bigint n0 = n; |
---|
2409 | |
---|
2410 | while(n0 > 0){ |
---|
2411 | bigint tmp = bigint(2)^k; |
---|
2412 | |
---|
2413 | while(tmp > n0){ |
---|
2414 | k--; |
---|
2415 | tmp = bigint(2)^k; |
---|
2416 | } |
---|
2417 | |
---|
2418 | v = k+1,v; |
---|
2419 | n0 = n0 - tmp; |
---|
2420 | k--; |
---|
2421 | |
---|
2422 | kill tmp; |
---|
2423 | } |
---|
2424 | |
---|
2425 | v = v[1..size(v)-1]; |
---|
2426 | return(v); |
---|
2427 | } |
---|
2428 | example |
---|
2429 | { |
---|
2430 | echo = 2; |
---|
2431 | bigintToBinary(bigint(2)^90-1, 90); |
---|
2432 | } |
---|
2433 | |
---|
2434 | |
---|
2435 | |
---|
2436 | |
---|
2437 | proc hashesToFan(list hashes, list OC) |
---|
2438 | "USAGE: hashesToFan(hashes, OC): hashes list of bigint, OC list of cones. |
---|
2439 | ASSUME: the elements of OC are the orbit cones used in the hash representation of the GIT cones. |
---|
2440 | RETURN: a fan, with maximal cones the intersections of the cones in OC according to the binary representation of the hashes. |
---|
2441 | EXAMPLE: example hashesToFan; shows an example |
---|
2442 | " |
---|
2443 | { |
---|
2444 | fan Sigma = emptyFan(ambientDimension(OC[1])); |
---|
2445 | for (int i=1;i<=size(hashes);i++){ |
---|
2446 | insertCone(Sigma,hashToCone(hashes[i],OC),0); |
---|
2447 | } |
---|
2448 | return(Sigma); |
---|
2449 | } |
---|
2450 | example |
---|
2451 | { |
---|
2452 | echo = 2; |
---|
2453 | setcores(4); |
---|
2454 | ring R = 0,T(1..10),wp(1,1,1,1,1,1,1,1,1,1); |
---|
2455 | ideal J = |
---|
2456 | T(5)*T(10)-T(6)*T(9)+T(7)*T(8), |
---|
2457 | T(1)*T(9)-T(2)*T(7)+T(4)*T(5), |
---|
2458 | T(1)*T(8)-T(2)*T(6)+T(3)*T(5), |
---|
2459 | T(1)*T(10)-T(3)*T(7)+T(4)*T(6), |
---|
2460 | T(2)*T(10)-T(3)*T(9)+T(4)*T(8); |
---|
2461 | intmat Q[5][10] = |
---|
2462 | 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, |
---|
2463 | 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, |
---|
2464 | 0, 1, 1, 0, 0, 0, -1, 1, 0, 0, |
---|
2465 | 0, 1, 0, 1, 0, -1, 0, 0, 1, 0, |
---|
2466 | 0, 0, 1, 1, -1, 0, 0, 0, 0, 1; |
---|
2467 | list AF= afaces(J,nrows(Q)); |
---|
2468 | AF=fullDimImages(AF,Q); |
---|
2469 | AF = minimalAfaces(AF); |
---|
2470 | list OC = orbitCones(AF,Q); |
---|
2471 | cone Qgamma = coneViaPoints(transpose(Q)); |
---|
2472 | list GIT = GITfanParallel(OC,Q,Qgamma); |
---|
2473 | fan Sigma = hashesToFan(GIT,OC); |
---|
2474 | } |
---|
2475 | |
---|
2476 | |
---|
2477 | |
---|
2478 | |
---|
2479 | ///////////////////////////////////// |
---|
2480 | |
---|
2481 | proc gkzFan(intmat Q) |
---|
2482 | "USAGE: gkzFan(Q); a: ideal, Q:intmat |
---|
2483 | PURPOSE: Returns the GKZ-fan of the matrix Q. |
---|
2484 | RETURN: a fan. |
---|
2485 | EXAMPLE: example gkzFan; shows an example |
---|
2486 | " |
---|
2487 | { |
---|
2488 | // only difference to gitFan: |
---|
2489 | // it suffices to consider all faces |
---|
2490 | // that are simplicial: |
---|
2491 | list OC = simplicialToricOrbitCones(Q); |
---|
2492 | print(size(OC)); |
---|
2493 | cone Qgamma = coneViaPoints(transpose(Q)); |
---|
2494 | list GIT = GITfanParallel(OC,Q,Qgamma); |
---|
2495 | fan Sigma = hashesToFan(GIT,OC); |
---|
2496 | return(Sigma); |
---|
2497 | } |
---|
2498 | example |
---|
2499 | { |
---|
2500 | echo=2; |
---|
2501 | intmat Q[3][4] = |
---|
2502 | 1,0,1,0, |
---|
2503 | 0,1,0,1, |
---|
2504 | 0,0,1,1; |
---|
2505 | |
---|
2506 | gkzFan(Q); |
---|
2507 | } |
---|
2508 | |
---|
2509 | |
---|
2510 | |
---|
2511 | ///////////////////////////////////// |
---|
2512 | |
---|
2513 | // Computes all simplicial orbit cones |
---|
2514 | // w.r.t. the 0-ideal: |
---|
2515 | static proc simplicialToricOrbitCones(bigintmat Q){ |
---|
2516 | intvec gam0; |
---|
2517 | list OC; |
---|
2518 | cone c; |
---|
2519 | int r = ncols(Q); |
---|
2520 | int j; |
---|
2521 | |
---|
2522 | for(int i = 1; i < 2^r; i++ ){ |
---|
2523 | gam0 = int2face(i,r); |
---|
2524 | |
---|
2525 | // each simplicial cone is generated by |
---|
2526 | // exactly nrows(Q) many columns of Q: |
---|
2527 | if(size(gam0) == nrows(Q)){ |
---|
2528 | bigintmat M[size(gam0)][nrows(Q)]; |
---|
2529 | |
---|
2530 | for(j = 1; j <= size(gam0); j++){ |
---|
2531 | M[j,1..ncols(M)] = Q[1..nrows(Q),gam0[j]]; |
---|
2532 | } |
---|
2533 | |
---|
2534 | c = coneViaPoints(M); |
---|
2535 | |
---|
2536 | if((dimension(c) == nrows(Q)) and (!(listContainsCone(OC, c)))){ |
---|
2537 | OC[size(OC)+1] = c; |
---|
2538 | } |
---|
2539 | |
---|
2540 | kill M; |
---|
2541 | } |
---|
2542 | } |
---|
2543 | |
---|
2544 | return(OC); |
---|
2545 | } |
---|
2546 | example |
---|
2547 | { |
---|
2548 | echo = 2; |
---|
2549 | bigintmat Q[3][4] = |
---|
2550 | 1,0,1,0, |
---|
2551 | 0,1,0,1, |
---|
2552 | 0,0,1,1; |
---|
2553 | |
---|
2554 | list OC = simplicialToricOrbitCones(Q); |
---|
2555 | print(OC); |
---|
2556 | |
---|
2557 | bigintmat Q[5][15] = |
---|
2558 | 1,0,0,0,0,1,1,1,1,0,0,0,0,0,0, |
---|
2559 | 0,1,0,0,0,1,0,0,0,1,1,1,0,0,0, |
---|
2560 | 0,0,1,0,0,0,1,0,0,1,0,0,1,1,0, |
---|
2561 | 0,0,0,1,0,0,0,1,0,0,1,0,1,0,1, |
---|
2562 | 0,0,0,0,1,0,0,0,1,0,0,1,0,1,1; |
---|
2563 | |
---|
2564 | list OC = simplicialToricOrbitCones(Q); |
---|
2565 | print(size(OC)); |
---|
2566 | } |
---|
2567 | |
---|
2568 | |
---|
2569 | proc G25Action() |
---|
2570 | "USAGE: G25Action(Q); |
---|
2571 | PURPOSE: Returns a representation of S5 as a subgroup of S10 with the action on the Grassmannian G25. |
---|
2572 | RETURN: list of with elements of type permutation. |
---|
2573 | EXAMPLE: example G25Action; shows an example |
---|
2574 | " |
---|
2575 | { |
---|
2576 | list simplexSymmetryGroup = permutationFromIntvec(intvec( 1 .. 10 )), |
---|
2577 | permutationFromIntvec(intvec( 1, 2, 4, 3, 5, 7, 6, 9, 8, 10 )), |
---|
2578 | permutationFromIntvec(intvec( 1, 3, 2, 4, 6, 5, 7, 8, 10, 9 )), |
---|
2579 | permutationFromIntvec(intvec( 1, 3, 4, 2, 6, 7, 5, 10, 8, 9 )), |
---|
2580 | permutationFromIntvec(intvec( 1, 4, 2, 3, 7, 5, 6, 9, 10, 8 )), |
---|
2581 | permutationFromIntvec(intvec( 1, 4, 3, 2, 7, 6, 5, 10, 9, 8 )), |
---|
2582 | permutationFromIntvec(intvec( 1, 5, 6, 7, 2, 3, 4, 8, 9, 10 )), |
---|
2583 | permutationFromIntvec(intvec( 1, 5, 7, 6, 2, 4, 3, 9, 8, 10 )), |
---|
2584 | permutationFromIntvec(intvec( 1, 6, 5, 7, 3, 2, 4, 8, 10, 9 )), |
---|
2585 | permutationFromIntvec(intvec( 1, 6, 7, 5, 3, 4, 2, 10, 8, 9 )), |
---|
2586 | permutationFromIntvec(intvec( 1, 7, 5, 6, 4, 2, 3, 9, 10, 8 )), |
---|
2587 | permutationFromIntvec(intvec( 1, 7, 6, 5, 4, 3, 2, 10, 9, 8 )), |
---|
2588 | permutationFromIntvec(intvec( 2, 1, 3, 4, 5, 8, 9, 6, 7, 10 )), |
---|
2589 | permutationFromIntvec(intvec( 2, 1, 4, 3, 5, 9, 8, 7, 6, 10 )), |
---|
2590 | permutationFromIntvec(intvec( 2, 3, 1, 4, 8, 5, 9, 6, 10, 7 )), |
---|
2591 | permutationFromIntvec(intvec( 2, 3, 4, 1, 8, 9, 5, 10, 6, 7 )), |
---|
2592 | permutationFromIntvec(intvec( 2, 4, 1, 3, 9, 5, 8, 7, 10, 6 )), |
---|
2593 | permutationFromIntvec(intvec( 2, 4, 3, 1, 9, 8, 5, 10, 7, 6 )), |
---|
2594 | permutationFromIntvec(intvec( 2, 5, 8, 9, 1, 3, 4, 6, 7, 10 )), |
---|
2595 | permutationFromIntvec(intvec( 2, 5, 9, 8, 1, 4, 3, 7, 6, 10 )), |
---|
2596 | permutationFromIntvec(intvec( 2, 8, 5, 9, 3, 1, 4, 6, 10, 7 )), |
---|
2597 | permutationFromIntvec(intvec( 2, 8, 9, 5, 3, 4, 1, 10, 6, 7 )), |
---|
2598 | permutationFromIntvec(intvec( 2, 9, 5, 8, 4, 1, 3, 7, 10, 6 )), |
---|
2599 | permutationFromIntvec(intvec( 2, 9, 8, 5, 4, 3, 1, 10, 7, 6 )), |
---|
2600 | permutationFromIntvec(intvec( 3, 1, 2, 4, 6, 8, 10, 5, 7, 9 )), |
---|
2601 | permutationFromIntvec(intvec( 3, 1, 4, 2, 6, 10, 8, 7, 5, 9 )), |
---|
2602 | permutationFromIntvec(intvec( 3, 2, 1, 4, 8, 6, 10, 5, 9, 7 )), |
---|
2603 | permutationFromIntvec(intvec( 3, 2, 4, 1, 8, 10, 6, 9, 5, 7 )), |
---|
2604 | permutationFromIntvec(intvec( 3, 4, 1, 2, 10, 6, 8, 7, 9, 5 )), |
---|
2605 | permutationFromIntvec(intvec( 3, 4, 2, 1, 10, 8, 6, 9, 7, 5 )), |
---|
2606 | permutationFromIntvec(intvec( 3, 6, 8, 10, 1, 2, 4, 5, 7, 9 )), |
---|
2607 | permutationFromIntvec(intvec( 3, 6, 10, 8, 1, 4, 2, 7, 5, 9 )), |
---|
2608 | permutationFromIntvec(intvec( 3, 8, 6, 10, 2, 1, 4, 5, 9, 7 )), |
---|
2609 | permutationFromIntvec(intvec( 3, 8, 10, 6, 2, 4, 1, 9, 5, 7 )), |
---|
2610 | permutationFromIntvec(intvec( 3, 10, 6, 8, 4, 1, 2, 7, 9, 5 )), |
---|
2611 | permutationFromIntvec(intvec( 3, 10, 8, 6, 4, 2, 1, 9, 7, 5 )), |
---|
2612 | permutationFromIntvec(intvec( 4, 1, 2, 3, 7, 9, 10, 5, 6, 8 )), |
---|
2613 | permutationFromIntvec(intvec( 4, 1, 3, 2, 7, 10, 9, 6, 5, 8 )), |
---|
2614 | permutationFromIntvec(intvec( 4, 2, 1, 3, 9, 7, 10, 5, 8, 6 )), |
---|
2615 | permutationFromIntvec(intvec( 4, 2, 3, 1, 9, 10, 7, 8, 5, 6 )), |
---|
2616 | permutationFromIntvec(intvec( 4, 3, 1, 2, 10, 7, 9, 6, 8, 5 )), |
---|
2617 | permutationFromIntvec(intvec( 4, 3, 2, 1, 10, 9, 7, 8, 6, 5 )), |
---|
2618 | permutationFromIntvec(intvec( 4, 7, 9, 10, 1, 2, 3, 5, 6, 8 )), |
---|
2619 | permutationFromIntvec(intvec( 4, 7, 10, 9, 1, 3, 2, 6, 5, 8 )), |
---|
2620 | permutationFromIntvec(intvec( 4, 9, 7, 10, 2, 1, 3, 5, 8, 6 )), |
---|
2621 | permutationFromIntvec(intvec( 4, 9, 10, 7, 2, 3, 1, 8, 5, 6 )), |
---|
2622 | permutationFromIntvec(intvec( 4, 10, 7, 9, 3, 1, 2, 6, 8, 5 )), |
---|
2623 | permutationFromIntvec(intvec( 4, 10, 9, 7, 3, 2, 1, 8, 6, 5 )), |
---|
2624 | permutationFromIntvec(intvec( 5, 1, 6, 7, 2, 8, 9, 3, 4, 10 )), |
---|
2625 | permutationFromIntvec(intvec( 5, 1, 7, 6, 2, 9, 8, 4, 3, 10 )), |
---|
2626 | permutationFromIntvec(intvec( 5, 2, 8, 9, 1, 6, 7, 3, 4, 10 )), |
---|
2627 | permutationFromIntvec(intvec( 5, 2, 9, 8, 1, 7, 6, 4, 3, 10 )), |
---|
2628 | permutationFromIntvec(intvec( 5, 6, 1, 7, 8, 2, 9, 3, 10, 4 )), |
---|
2629 | permutationFromIntvec(intvec( 5, 6, 7, 1, 8, 9, 2, 10, 3, 4 )), |
---|
2630 | permutationFromIntvec(intvec( 5, 7, 1, 6, 9, 2, 8, 4, 10, 3 )), |
---|
2631 | permutationFromIntvec(intvec( 5, 7, 6, 1, 9, 8, 2, 10, 4, 3 )), |
---|
2632 | permutationFromIntvec(intvec( 5, 8, 2, 9, 6, 1, 7, 3, 10, 4 )), |
---|
2633 | permutationFromIntvec(intvec( 5, 8, 9, 2, 6, 7, 1, 10, 3, 4 )), |
---|
2634 | permutationFromIntvec(intvec( 5, 9, 2, 8, 7, 1, 6, 4, 10, 3 )), |
---|
2635 | permutationFromIntvec(intvec( 5, 9, 8, 2, 7, 6, 1, 10, 4, 3 )), |
---|
2636 | permutationFromIntvec(intvec( 6, 1, 5, 7, 3, 8, 10, 2, 4, 9 )), |
---|
2637 | permutationFromIntvec(intvec( 6, 1, 7, 5, 3, 10, 8, 4, 2, 9 )), |
---|
2638 | permutationFromIntvec(intvec( 6, 3, 8, 10, 1, 5, 7, 2, 4, 9 )), |
---|
2639 | permutationFromIntvec(intvec( 6, 3, 10, 8, 1, 7, 5, 4, 2, 9 )), |
---|
2640 | permutationFromIntvec(intvec( 6, 5, 1, 7, 8, 3, 10, 2, 9, 4 )), |
---|
2641 | permutationFromIntvec(intvec( 6, 5, 7, 1, 8, 10, 3, 9, 2, 4 )), |
---|
2642 | permutationFromIntvec(intvec( 6, 7, 1, 5, 10, 3, 8, 4, 9, 2 )), |
---|
2643 | permutationFromIntvec(intvec( 6, 7, 5, 1, 10, 8, 3, 9, 4, 2 )), |
---|
2644 | permutationFromIntvec(intvec( 6, 8, 3, 10, 5, 1, 7, 2, 9, 4 )), |
---|
2645 | permutationFromIntvec(intvec( 6, 8, 10, 3, 5, 7, 1, 9, 2, 4 )), |
---|
2646 | permutationFromIntvec(intvec( 6, 10, 3, 8, 7, 1, 5, 4, 9, 2 )), |
---|
2647 | permutationFromIntvec(intvec( 6, 10, 8, 3, 7, 5, 1, 9, 4, 2 )), |
---|
2648 | permutationFromIntvec(intvec( 7, 1, 5, 6, 4, 9, 10, 2, 3, 8 )), |
---|
2649 | permutationFromIntvec(intvec( 7, 1, 6, 5, 4, 10, 9, 3, 2, 8 )), |
---|
2650 | permutationFromIntvec(intvec( 7, 4, 9, 10, 1, 5, 6, 2, 3, 8 )), |
---|
2651 | permutationFromIntvec(intvec( 7, 4, 10, 9, 1, 6, 5, 3, 2, 8 )), |
---|
2652 | permutationFromIntvec(intvec( 7, 5, 1, 6, 9, 4, 10, 2, 8, 3 )), |
---|
2653 | permutationFromIntvec(intvec( 7, 5, 6, 1, 9, 10, 4, 8, 2, 3 )), |
---|
2654 | permutationFromIntvec(intvec( 7, 6, 1, 5, 10, 4, 9, 3, 8, 2 )), |
---|
2655 | permutationFromIntvec(intvec( 7, 6, 5, 1, 10, 9, 4, 8, 3, 2 )), |
---|
2656 | permutationFromIntvec(intvec( 7, 9, 4, 10, 5, 1, 6, 2, 8, 3 )), |
---|
2657 | permutationFromIntvec(intvec( 7, 9, 10, 4, 5, 6, 1, 8, 2, 3 )), |
---|
2658 | permutationFromIntvec(intvec( 7, 10, 4, 9, 6, 1, 5, 3, 8, 2 )), |
---|
2659 | permutationFromIntvec(intvec( 7, 10, 9, 4, 6, 5, 1, 8, 3, 2 )), |
---|
2660 | permutationFromIntvec(intvec( 8, 2, 5, 9, 3, 6, 10, 1, 4, 7 )), |
---|
2661 | permutationFromIntvec(intvec( 8, 2, 9, 5, 3, 10, 6, 4, 1, 7 )), |
---|
2662 | permutationFromIntvec(intvec( 8, 3, 6, 10, 2, 5, 9, 1, 4, 7 )), |
---|
2663 | permutationFromIntvec(intvec( 8, 3, 10, 6, 2, 9, 5, 4, 1, 7 )), |
---|
2664 | permutationFromIntvec(intvec( 8, 5, 2, 9, 6, 3, 10, 1, 7, 4 )), |
---|
2665 | permutationFromIntvec(intvec( 8, 5, 9, 2, 6, 10, 3, 7, 1, 4 )), |
---|
2666 | permutationFromIntvec(intvec( 8, 6, 3, 10, 5, 2, 9, 1, 7, 4 )), |
---|
2667 | permutationFromIntvec(intvec( 8, 6, 10, 3, 5, 9, 2, 7, 1, 4 )), |
---|
2668 | permutationFromIntvec(intvec( 8, 9, 2, 5, 10, 3, 6, 4, 7, 1 )), |
---|
2669 | permutationFromIntvec(intvec( 8, 9, 5, 2, 10, 6, 3, 7, 4, 1 )), |
---|
2670 | permutationFromIntvec(intvec( 8, 10, 3, 6, 9, 2, 5, 4, 7, 1 )), |
---|
2671 | permutationFromIntvec(intvec( 8, 10, 6, 3, 9, 5, 2, 7, 4, 1 )), |
---|
2672 | permutationFromIntvec(intvec( 9, 2, 5, 8, 4, 7, 10, 1, 3, 6 )), |
---|
2673 | permutationFromIntvec(intvec( 9, 2, 8, 5, 4, 10, 7, 3, 1, 6 )), |
---|
2674 | permutationFromIntvec(intvec( 9, 4, 7, 10, 2, 5, 8, 1, 3, 6 )), |
---|
2675 | permutationFromIntvec(intvec( 9, 4, 10, 7, 2, 8, 5, 3, 1, 6 )), |
---|
2676 | permutationFromIntvec(intvec( 9, 5, 2, 8, 7, 4, 10, 1, 6, 3 )), |
---|
2677 | permutationFromIntvec(intvec( 9, 5, 8, 2, 7, 10, 4, 6, 1, 3 )), |
---|
2678 | permutationFromIntvec(intvec( 9, 7, 4, 10, 5, 2, 8, 1, 6, 3 )), |
---|
2679 | permutationFromIntvec(intvec( 9, 7, 10, 4, 5, 8, 2, 6, 1, 3 )), |
---|
2680 | permutationFromIntvec(intvec( 9, 8, 2, 5, 10, 4, 7, 3, 6, 1 )), |
---|
2681 | permutationFromIntvec(intvec( 9, 8, 5, 2, 10, 7, 4, 6, 3, 1 )), |
---|
2682 | permutationFromIntvec(intvec( 9, 10, 4, 7, 8, 2, 5, 3, 6, 1 )), |
---|
2683 | permutationFromIntvec(intvec( 9, 10, 7, 4, 8, 5, 2, 6, 3, 1 )), |
---|
2684 | permutationFromIntvec(intvec( 10, 3, 6, 8, 4, 7, 9, 1, 2, 5 )), |
---|
2685 | permutationFromIntvec(intvec( 10, 3, 8, 6, 4, 9, 7, 2, 1, 5 )), |
---|
2686 | permutationFromIntvec(intvec( 10, 4, 7, 9, 3, 6, 8, 1, 2, 5 )), |
---|
2687 | permutationFromIntvec(intvec( 10, 4, 9, 7, 3, 8, 6, 2, 1, 5 )), |
---|
2688 | permutationFromIntvec(intvec( 10, 6, 3, 8, 7, 4, 9, 1, 5, 2 )), |
---|
2689 | permutationFromIntvec(intvec( 10, 6, 8, 3, 7, 9, 4, 5, 1, 2 )), |
---|
2690 | permutationFromIntvec(intvec( 10, 7, 4, 9, 6, 3, 8, 1, 5, 2 )), |
---|
2691 | permutationFromIntvec(intvec( 10, 7, 9, 4, 6, 8, 3, 5, 1, 2 )), |
---|
2692 | permutationFromIntvec(intvec( 10, 8, 3, 6, 9, 4, 7, 2, 5, 1 )), |
---|
2693 | permutationFromIntvec(intvec( 10, 8, 6, 3, 9, 7, 4, 5, 2, 1 )), |
---|
2694 | permutationFromIntvec(intvec( 10, 9, 4, 7, 8, 3, 6, 2, 5, 1 )), |
---|
2695 | permutationFromIntvec(intvec( 10, 9, 7, 4, 8, 6, 3, 5, 2, 1 )); |
---|
2696 | return(simplexSymmetryGroup); |
---|
2697 | } |
---|
2698 | example |
---|
2699 | { |
---|
2700 | echo = 2; |
---|
2701 | G25Action(); |
---|
2702 | } |
---|
2703 | |
---|
2704 | |
---|
2705 | proc findOrbits(list G, int d) |
---|
2706 | "USAGE: findOrbits(G,d); G list of permutations in a subgroup of the symmetric group; d int minimum cardinality of simplices to be considered |
---|
2707 | PURPOSE: Computes the orbit decomposition of the action of G. |
---|
2708 | RETURN: list of intvec. |
---|
2709 | EXAMPLE: example findOrbits; shows an example |
---|
2710 | " |
---|
2711 | { |
---|
2712 | int n = size(permutationToIntvec(G[1])); |
---|
2713 | list listOrbits; |
---|
2714 | list finished; |
---|
2715 | int tst; |
---|
2716 | bigint startel; |
---|
2717 | intvec startelbin; |
---|
2718 | list neworbit,neworbitint; |
---|
2719 | int i,posToInsert; |
---|
2720 | bigint nn; |
---|
2721 | while (size(finished)<2^n){ |
---|
2722 | startel=0; |
---|
2723 | if (size(finished)>0){ |
---|
2724 | tst=0; |
---|
2725 | while ((tst==0) and (startel+1<=size(finished))){ |
---|
2726 | if (finished[int(startel+1)]<>startel){ |
---|
2727 | tst=1; |
---|
2728 | } else { |
---|
2729 | startel=startel+1; |
---|
2730 | } |
---|
2731 | } |
---|
2732 | } |
---|
2733 | if (startel==0){ |
---|
2734 | neworbit[1]= list(); |
---|
2735 | neworbitint[1]=0; |
---|
2736 | } else { |
---|
2737 | startelbin=bigintToBinary(startel,n); |
---|
2738 | neworbitint=list(startel); |
---|
2739 | for (i=2;i<=size(G);i++){ |
---|
2740 | nn=binaryToBigint(applyPermutationToIntvec(startelbin,G[i])); |
---|
2741 | //nn;neworbitint; |
---|
2742 | //"place to insert"; |
---|
2743 | posToInsert = findPlaceToInsert(neworbitint,nn); |
---|
2744 | //"pos";posToInsert; |
---|
2745 | if(posToInsert > 0) |
---|
2746 | { |
---|
2747 | //"vorher";neworbitint; |
---|
2748 | neworbitint = insertToList(neworbitint,nn,posToInsert); |
---|
2749 | //"nachher";neworbitint; |
---|
2750 | } |
---|
2751 | } |
---|
2752 | for (i=1;i<=size(neworbitint);i++){ |
---|
2753 | neworbit[i]=bigintToBinary(neworbitint[i],n); |
---|
2754 | } |
---|
2755 | } |
---|
2756 | if (size(neworbit[1])>=d){ |
---|
2757 | listOrbits[size(listOrbits)+1]=neworbit; |
---|
2758 | } |
---|
2759 | finished=sort(finished+neworbitint)[1]; |
---|
2760 | } |
---|
2761 | return(listOrbits);} |
---|
2762 | example |
---|
2763 | { |
---|
2764 | list G = G25Action(); |
---|
2765 | list orb = findOrbits(G); |
---|
2766 | for (int i=1;i<=size(orb);i++){orb[i][1];} |
---|
2767 | } |
---|
2768 | |
---|