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 | LIB "gitfan.lib"; |
---|
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 simplexSymmetryGroup = G25Action(); |
---|
438 | list simplexOrbitRepresentatives = intvec( 1, 2, 3, 4, 5 ), |
---|
439 | intvec( 1, 2, 3, 5, 6 ), |
---|
440 | intvec( 1, 2, 3, 5, 7 ), |
---|
441 | intvec( 1, 2, 3, 5, 10 ), |
---|
442 | intvec( 1, 2, 3, 7, 9 ), |
---|
443 | intvec( 1, 2, 6, 9, 10 ), |
---|
444 | intvec( 1, 2, 3, 4, 5, 6 ), |
---|
445 | intvec( 1, 2, 3, 4, 5, 10 ), |
---|
446 | intvec( 1, 2, 3, 5, 6, 8 ), |
---|
447 | intvec( 1, 2, 3, 5, 6, 9 ), |
---|
448 | intvec( 1, 2, 3, 5, 7, 10 ), |
---|
449 | intvec( 1, 2, 3, 7, 9, 10 ), |
---|
450 | intvec( 1, 2, 3, 4, 5, 6, 7 ), |
---|
451 | intvec( 1, 2, 3, 4, 5, 6, 8 ), |
---|
452 | intvec( 1, 2, 3, 4, 5, 6, 9 ), |
---|
453 | intvec( 1, 2, 3, 5, 6, 9, 10 ), |
---|
454 | intvec( 1, 2, 3, 4, 5, 6, 7, 8 ), |
---|
455 | intvec( 1, 2, 3, 4, 5, 6, 9, 10 ), |
---|
456 | intvec( 1, 2, 3, 4, 5, 6, 7, 8, 9 ), |
---|
457 | intvec( 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ); |
---|
458 | list afaceOrbitRepresentatives=afaces(J,simplexOrbitRepresentatives); |
---|
459 | list fulldimAfaceOrbitRepresentatives=fullDimImages(afaceOrbitRepresentatives,Q); |
---|
460 | list afaceOrbits=computeAfaceOrbits(fulldimAfaceOrbitRepresentatives,simplexSymmetryGroup); |
---|
461 | apply(afaceOrbits,size);} |
---|
462 | |
---|
463 | |
---|
464 | |
---|
465 | |
---|
466 | static proc isSubset(intvec v, intvec w) |
---|
467 | { |
---|
468 | int i,j; |
---|
469 | int jStart=1; |
---|
470 | for (i=1; i<=size(v); i++) |
---|
471 | { |
---|
472 | for (j=jStart; j<=size(w); j++) |
---|
473 | { |
---|
474 | if (v[i]==w[j]) |
---|
475 | { |
---|
476 | break; |
---|
477 | } |
---|
478 | } |
---|
479 | if (j<=size(w)) |
---|
480 | { |
---|
481 | jStart = j+1; |
---|
482 | } |
---|
483 | else |
---|
484 | { |
---|
485 | return (0); |
---|
486 | } |
---|
487 | } |
---|
488 | return (1); |
---|
489 | } |
---|
490 | |
---|
491 | |
---|
492 | |
---|
493 | static proc containsOrbitd(list A, list B) |
---|
494 | { |
---|
495 | intvec a = A[1]; |
---|
496 | for (int i=1; i<=size(B); i++) |
---|
497 | { |
---|
498 | if (isSubset(a,B[i])) |
---|
499 | { |
---|
500 | return (1); |
---|
501 | } |
---|
502 | } |
---|
503 | return (0); |
---|
504 | } |
---|
505 | |
---|
506 | |
---|
507 | proc minimalAfaceOrbits(list listOfOrbits) |
---|
508 | "USAGE: minimalAfaceOrbits(afaceOrbits); afaceOrbits: list |
---|
509 | PURPOSE: Returns a list of all minimal a-face orbits. |
---|
510 | RETURN: a list of intvecs |
---|
511 | EXAMPLE: example minimalAfaceOrbits; shows an example |
---|
512 | " |
---|
513 | { |
---|
514 | int i,j; |
---|
515 | list L = listOfOrbits; |
---|
516 | for (i=1; i<=size(L); i++) |
---|
517 | { |
---|
518 | dbprint(string(i)+" of "+string(size(L))); |
---|
519 | for (j=1; j<=size(L); j++) |
---|
520 | { |
---|
521 | if (i!=j) |
---|
522 | { |
---|
523 | if (containsOrbitd(L[i],L[j])) |
---|
524 | { |
---|
525 | dbprint("werfe raus (Laenge): " + string(size(L[j]))); |
---|
526 | L = delete(L,j); |
---|
527 | if (j<i) |
---|
528 | { |
---|
529 | i = i-1; |
---|
530 | } |
---|
531 | j = j-1; |
---|
532 | } |
---|
533 | } |
---|
534 | } |
---|
535 | } |
---|
536 | return(L); |
---|
537 | } |
---|
538 | example |
---|
539 | { |
---|
540 | echo = 2; |
---|
541 | ring R = 0,T(1..10),wp(1,1,1,1,1,1,1,1,1,1); |
---|
542 | ideal J = |
---|
543 | T(5)*T(10)-T(6)*T(9)+T(7)*T(8), |
---|
544 | T(1)*T(9)-T(2)*T(7)+T(4)*T(5), |
---|
545 | T(1)*T(8)-T(2)*T(6)+T(3)*T(5), |
---|
546 | T(1)*T(10)-T(3)*T(7)+T(4)*T(6), |
---|
547 | T(2)*T(10)-T(3)*T(9)+T(4)*T(8); |
---|
548 | intmat Q[5][10] = |
---|
549 | 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, |
---|
550 | 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, |
---|
551 | 0, 1, 1, 0, 0, 0, -1, 1, 0, 0, |
---|
552 | 0, 1, 0, 1, 0, -1, 0, 0, 1, 0, |
---|
553 | 0, 0, 1, 1, -1, 0, 0, 0, 0, 1; |
---|
554 | list simplexSymmetryGroup = G25Action(); |
---|
555 | list simplexOrbitRepresentatives = intvec( 1, 2, 3, 4, 5 ), |
---|
556 | intvec( 1, 2, 3, 5, 6 ), |
---|
557 | intvec( 1, 2, 3, 5, 7 ), |
---|
558 | intvec( 1, 2, 3, 5, 10 ), |
---|
559 | intvec( 1, 2, 3, 7, 9 ), |
---|
560 | intvec( 1, 2, 6, 9, 10 ), |
---|
561 | intvec( 1, 2, 3, 4, 5, 6 ), |
---|
562 | intvec( 1, 2, 3, 4, 5, 10 ), |
---|
563 | intvec( 1, 2, 3, 5, 6, 8 ), |
---|
564 | intvec( 1, 2, 3, 5, 6, 9 ), |
---|
565 | intvec( 1, 2, 3, 5, 7, 10 ), |
---|
566 | intvec( 1, 2, 3, 7, 9, 10 ), |
---|
567 | intvec( 1, 2, 3, 4, 5, 6, 7 ), |
---|
568 | intvec( 1, 2, 3, 4, 5, 6, 8 ), |
---|
569 | intvec( 1, 2, 3, 4, 5, 6, 9 ), |
---|
570 | intvec( 1, 2, 3, 5, 6, 9, 10 ), |
---|
571 | intvec( 1, 2, 3, 4, 5, 6, 7, 8 ), |
---|
572 | intvec( 1, 2, 3, 4, 5, 6, 9, 10 ), |
---|
573 | intvec( 1, 2, 3, 4, 5, 6, 7, 8, 9 ), |
---|
574 | intvec( 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ); |
---|
575 | list afaceOrbitRepresentatives=afaces(J,simplexOrbitRepresentatives); |
---|
576 | list fulldimAfaceOrbitRepresentatives=fullDimImages(afaceOrbitRepresentatives,Q); |
---|
577 | list afaceOrbits=computeAfaceOrbits(fulldimAfaceOrbitRepresentatives,simplexSymmetryGroup); |
---|
578 | apply(afaceOrbits,size); |
---|
579 | list minAfaceOrbits = minimalAfaceOrbits(afaceOrbits); |
---|
580 | apply(minAfaceOrbits,size); |
---|
581 | } |
---|
582 | |
---|
583 | |
---|
584 | static proc list2string(list L){ |
---|
585 | string s = ""; |
---|
586 | |
---|
587 | for(int i = 1; i <=size(L); i++){ |
---|
588 | s = s + string(size(L[i])) + ", "; |
---|
589 | } |
---|
590 | |
---|
591 | return(s); |
---|
592 | } |
---|
593 | |
---|
594 | |
---|
595 | |
---|
596 | proc fullDimImages(list afaces,intmat Q) |
---|
597 | "USAGE: fullDimImages(afaces, Q); afaces: list, Q: intmat |
---|
598 | PURPOSE: Determines the a-faces (represented as intvecs) from the list afaces which have a full-dimensional projection with respect to Q. |
---|
599 | RETURN: a list of intvecs |
---|
600 | EXAMPLE: example fullDimImages; shows an example |
---|
601 | " |
---|
602 | { |
---|
603 | list L; |
---|
604 | for (int i=1; i<=size(afaces); i++) |
---|
605 | { |
---|
606 | intvec gam0 = afaces[i]; |
---|
607 | intmat Qgam0[nrows(Q)][size(gam0)] = Q[intvec(1..nrows(Q)),gam0]; |
---|
608 | //cone c = coneViaPoints(Qgam0); |
---|
609 | if(rank(Qgam0) == nrows(Q)){ |
---|
610 | L[size(L)+1]=afaces[i]; |
---|
611 | } |
---|
612 | kill gam0,Qgam0; |
---|
613 | } |
---|
614 | return(L); |
---|
615 | } |
---|
616 | example |
---|
617 | { |
---|
618 | echo=2; |
---|
619 | ring R = 0,T(1..10),wp(1,1,1,1,1,1,1,1,1,1); |
---|
620 | ideal J = |
---|
621 | T(5)*T(10)-T(6)*T(9)+T(7)*T(8), |
---|
622 | T(1)*T(9)-T(2)*T(7)+T(4)*T(5), |
---|
623 | T(1)*T(8)-T(2)*T(6)+T(3)*T(5), |
---|
624 | T(1)*T(10)-T(3)*T(7)+T(4)*T(6), |
---|
625 | T(2)*T(10)-T(3)*T(9)+T(4)*T(8); |
---|
626 | intmat Q[5][10] = |
---|
627 | 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, |
---|
628 | 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, |
---|
629 | 0, 1, 1, 0, 0, 0, -1, 1, 0, 0, |
---|
630 | 0, 1, 0, 1, 0, -1, 0, 0, 1, 0, |
---|
631 | 0, 0, 1, 1, -1, 0, 0, 0, 0, 1; |
---|
632 | |
---|
633 | list AF= afaces(J,nrows(Q)); |
---|
634 | size(AF); |
---|
635 | size(fullDimImages(AF,Q)); |
---|
636 | } |
---|
637 | |
---|
638 | |
---|
639 | |
---|
640 | |
---|
641 | proc orbitConeOrbits(list F, intmat Q) |
---|
642 | "USAGE: orbitConeOrbits(F, Q); F: list, Q: intmat |
---|
643 | 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. |
---|
644 | RETURN: a list of lists of cones |
---|
645 | EXAMPLE: example orbitConeOrbits; shows an example |
---|
646 | " |
---|
647 | { |
---|
648 | list OC; |
---|
649 | int j; |
---|
650 | intmat Qt = transpose(Q); |
---|
651 | for(int i = 1; i <= size(F); i++){ |
---|
652 | list Orbit = F[i]; |
---|
653 | list U; |
---|
654 | for(j = 1; j <= size(Orbit); j++){ |
---|
655 | intvec aface = Orbit[j]; |
---|
656 | intmat Qgam0[size(aface)][ncols(Qt)] = Qt[aface,intvec(1..ncols(Qt))]; |
---|
657 | cone c = coneViaPoints(Qgam0); |
---|
658 | if (dimension(c)!=ncols(Qt)){ERROR("cone should have full dimension");} |
---|
659 | // insert it even if it is already inside (mincones will take care of this) |
---|
660 | U[size(U)+1] = c; |
---|
661 | kill aface; |
---|
662 | kill Qgam0; |
---|
663 | kill c; |
---|
664 | } |
---|
665 | OC[size(OC)+1] = U; |
---|
666 | dbprint("current size of OC:"); |
---|
667 | dbprint(size(OC)); |
---|
668 | kill U; |
---|
669 | kill Orbit; |
---|
670 | } |
---|
671 | return(OC); |
---|
672 | } |
---|
673 | example |
---|
674 | { |
---|
675 | echo = 2; |
---|
676 | // Note that simplexOrbitRepresentatives and simplexSymmetryGroup are subsets of the actual sets for G25. For the full example see the examples in the documentation |
---|
677 | ring R = 0,T(1..10),wp(1,1,1,1,1,1,1,1,1,1); |
---|
678 | ideal J = |
---|
679 | T(5)*T(10)-T(6)*T(9)+T(7)*T(8), |
---|
680 | T(1)*T(9)-T(2)*T(7)+T(4)*T(5), |
---|
681 | T(1)*T(8)-T(2)*T(6)+T(3)*T(5), |
---|
682 | T(1)*T(10)-T(3)*T(7)+T(4)*T(6), |
---|
683 | T(2)*T(10)-T(3)*T(9)+T(4)*T(8); |
---|
684 | intmat Q[5][10] = |
---|
685 | 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, |
---|
686 | 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, |
---|
687 | 0, 1, 1, 0, 0, 0, -1, 1, 0, 0, |
---|
688 | 0, 1, 0, 1, 0, -1, 0, 0, 1, 0, |
---|
689 | 0, 0, 1, 1, -1, 0, 0, 0, 0, 1; |
---|
690 | list simplexOrbitRepresentatives = intvec( 1, 2, 3, 4, 5 ), |
---|
691 | intvec( 1, 2, 3, 5, 6 ), |
---|
692 | intvec( 1, 2, 3, 5, 7 ), |
---|
693 | intvec( 1, 2, 3, 5, 10 ), |
---|
694 | intvec( 1, 2, 3, 7, 9 ), |
---|
695 | intvec( 1, 2, 3, 4, 5, 6, 9, 10 ), |
---|
696 | intvec( 1, 2, 3, 4, 5, 6, 7, 8, 9 ), |
---|
697 | intvec( 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ); |
---|
698 | list afaceOrbitRepresentatives=afaces(J,simplexOrbitRepresentatives); |
---|
699 | list simplexSymmetryGroup = permutationFromIntvec(intvec( 1 .. 10 )), |
---|
700 | permutationFromIntvec(intvec( 1, 2, 4, 3, 5, 7, 6, 9, 8, 10 )), |
---|
701 | permutationFromIntvec(intvec( 1, 3, 2, 4, 6, 5, 7, 8, 10, 9 )), |
---|
702 | permutationFromIntvec(intvec( 1, 3, 4, 2, 6, 7, 5, 10, 8, 9 )), |
---|
703 | permutationFromIntvec(intvec( 1, 4, 2, 3, 7, 5, 6, 9, 10, 8 )), |
---|
704 | permutationFromIntvec(intvec( 1, 4, 3, 2, 7, 6, 5, 10, 9, 8 )); |
---|
705 | list fulldimAfaceOrbitRepresentatives=fullDimImages(afaceOrbitRepresentatives,Q); |
---|
706 | list afaceOrbits=computeAfaceOrbits(fulldimAfaceOrbitRepresentatives,simplexSymmetryGroup); |
---|
707 | apply(afaceOrbits,size); |
---|
708 | list minAfaceOrbits = minimalAfaceOrbits(afaceOrbits); |
---|
709 | apply(minAfaceOrbits,size); |
---|
710 | list listOfOrbitConeOrbits = orbitConeOrbits(minAfaceOrbits,Q); |
---|
711 | } |
---|
712 | |
---|
713 | |
---|
714 | proc minimalOrbitConeOrbits(list listOfOrbits) |
---|
715 | "USAGE: minimalOrbitConeOrbits(listOfOrbits); listOfOrbits: list of lists of cones |
---|
716 | PURPOSE: Minimizes a list of orbit cone orbits. |
---|
717 | RETURN: a list of lists of cones |
---|
718 | EXAMPLE: example minimalOrbitConeOrbits; shows an example |
---|
719 | " |
---|
720 | { |
---|
721 | int i,j; |
---|
722 | list L = listOfOrbits; |
---|
723 | |
---|
724 | |
---|
725 | for (i=1; i<=size(L); i++) |
---|
726 | { |
---|
727 | dbprint("::::: " + string(i)+" of "+string(size(L))); |
---|
728 | |
---|
729 | for (j=1; j<=size(L); j++) |
---|
730 | { |
---|
731 | dbprint("outer: "+string(i)+" inner: " + string(j)); |
---|
732 | if (i!=j) |
---|
733 | { |
---|
734 | if (containsOrbitdCone(L[i],L[j])) |
---|
735 | { |
---|
736 | dbprint("werfe raus, i="+string(i)+", j="+string(j)+" (Laenge): " + string(size(L[j]))); |
---|
737 | L = delete(L,j); |
---|
738 | if (j<i) |
---|
739 | { |
---|
740 | i = i-1; |
---|
741 | } |
---|
742 | j = j-1; |
---|
743 | } |
---|
744 | } |
---|
745 | } |
---|
746 | } |
---|
747 | return(L); |
---|
748 | } |
---|
749 | example |
---|
750 | { |
---|
751 | echo = 2; |
---|
752 | ring R = 0,T(1..10),wp(1,1,1,1,1,1,1,1,1,1); |
---|
753 | ideal J = |
---|
754 | T(5)*T(10)-T(6)*T(9)+T(7)*T(8), |
---|
755 | T(1)*T(9)-T(2)*T(7)+T(4)*T(5), |
---|
756 | T(1)*T(8)-T(2)*T(6)+T(3)*T(5), |
---|
757 | T(1)*T(10)-T(3)*T(7)+T(4)*T(6), |
---|
758 | T(2)*T(10)-T(3)*T(9)+T(4)*T(8); |
---|
759 | intmat Q[5][10] = |
---|
760 | 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, |
---|
761 | 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, |
---|
762 | 0, 1, 1, 0, 0, 0, -1, 1, 0, 0, |
---|
763 | 0, 1, 0, 1, 0, -1, 0, 0, 1, 0, |
---|
764 | 0, 0, 1, 1, -1, 0, 0, 0, 0, 1; |
---|
765 | list simplexSymmetryGroup = G25Action(); |
---|
766 | list simplexOrbitRepresentatives = intvec( 1, 2, 3, 4, 5 ), |
---|
767 | intvec( 1, 2, 3, 5, 6 ), |
---|
768 | intvec( 1, 2, 3, 5, 7 ), |
---|
769 | intvec( 1, 2, 3, 5, 10 ), |
---|
770 | intvec( 1, 2, 3, 7, 9 ), |
---|
771 | intvec( 1, 2, 6, 9, 10 ), |
---|
772 | intvec( 1, 2, 3, 4, 5, 6 ), |
---|
773 | intvec( 1, 2, 3, 4, 5, 10 ), |
---|
774 | intvec( 1, 2, 3, 5, 6, 8 ), |
---|
775 | intvec( 1, 2, 3, 5, 6, 9 ), |
---|
776 | intvec( 1, 2, 3, 5, 7, 10 ), |
---|
777 | intvec( 1, 2, 3, 7, 9, 10 ), |
---|
778 | intvec( 1, 2, 3, 4, 5, 6, 7 ), |
---|
779 | intvec( 1, 2, 3, 4, 5, 6, 8 ), |
---|
780 | intvec( 1, 2, 3, 4, 5, 6, 9 ), |
---|
781 | intvec( 1, 2, 3, 5, 6, 9, 10 ), |
---|
782 | intvec( 1, 2, 3, 4, 5, 6, 7, 8 ), |
---|
783 | intvec( 1, 2, 3, 4, 5, 6, 9, 10 ), |
---|
784 | intvec( 1, 2, 3, 4, 5, 6, 7, 8, 9 ), |
---|
785 | intvec( 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ); |
---|
786 | list afaceOrbitRepresentatives=afaces(J,simplexOrbitRepresentatives); |
---|
787 | list fulldimAfaceOrbitRepresentatives=fullDimImages(afaceOrbitRepresentatives,Q); |
---|
788 | list afaceOrbits=computeAfaceOrbits(fulldimAfaceOrbitRepresentatives,simplexSymmetryGroup); |
---|
789 | apply(afaceOrbits,size); |
---|
790 | list minAfaceOrbits = minimalAfaceOrbits(afaceOrbits); |
---|
791 | apply(minAfaceOrbits,size); |
---|
792 | list listOfOrbitConeOrbits = orbitConeOrbits(minAfaceOrbits,Q); |
---|
793 | apply(listOfOrbitConeOrbits,size); |
---|
794 | list listOfMinimalOrbitConeOrbits = minimalOrbitConeOrbits(listOfOrbitConeOrbits); |
---|
795 | size(listOfMinimalOrbitConeOrbits); |
---|
796 | } |
---|
797 | |
---|
798 | |
---|
799 | static proc containsOrbitdCone(list A, list B) |
---|
800 | { |
---|
801 | cone a = A[1]; |
---|
802 | for (int i=1; i<=size(B); i++) |
---|
803 | { |
---|
804 | if (isSubcone(a,B[i])) |
---|
805 | { |
---|
806 | dbprint("found subcone i="+string(i)); |
---|
807 | return (1); |
---|
808 | } |
---|
809 | } |
---|
810 | return (0); |
---|
811 | } |
---|
812 | |
---|
813 | static proc isSubcone(cone c1, cone c2) |
---|
814 | { |
---|
815 | return(containsInSupport(c2, c1)); |
---|
816 | } |
---|
817 | |
---|
818 | |
---|
819 | |
---|
820 | |
---|
821 | |
---|
822 | |
---|
823 | proc intersectOrbitsWithMovingCone(list OCmin,cone mov) |
---|
824 | "USAGE: intersectOrbitsWithMovingCone(OCmin, mov); OCmin: list of lists of cones, mov: cone |
---|
825 | 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. |
---|
826 | RETURN: a list of lists of cones |
---|
827 | EXAMPLE: example intersectOrbitsWithMovingCone; shows an example |
---|
828 | " |
---|
829 | { |
---|
830 | list OCmov; |
---|
831 | cone ocmov; |
---|
832 | int i,j; |
---|
833 | int fulldim=dimension(mov); |
---|
834 | for (i=1; i<=size(OCmin); i++) |
---|
835 | { |
---|
836 | dbprint("intersecting orbit "+string(i)+" with moving cone"); |
---|
837 | ocmov = convexIntersection(OCmin[i][1],mov); |
---|
838 | if (dimension(ocmov)==fulldim) |
---|
839 | { |
---|
840 | list currentOrbit; |
---|
841 | for (j=1; j<=size(OCmin[i]); j++) |
---|
842 | { |
---|
843 | dbprint("checking cone "+string(j)+" of "+string(size(OCmin[i]))); |
---|
844 | ocmov = convexIntersection(OCmin[i][j],mov); |
---|
845 | ocmov = canonicalizeCone(ocmov); |
---|
846 | if (!listContainsCone(currentOrbit,ocmov)) |
---|
847 | { |
---|
848 | dbprint("inserting cone"); |
---|
849 | currentOrbit[size(currentOrbit)+1] = ocmov; |
---|
850 | } |
---|
851 | } |
---|
852 | OCmov[size(OCmov)+1] = currentOrbit; |
---|
853 | kill currentOrbit; |
---|
854 | } |
---|
855 | else |
---|
856 | { |
---|
857 | dbprint("intersection with moving cone lower-dimensional, abandoning orbit"); |
---|
858 | } |
---|
859 | } |
---|
860 | return(OCmov); |
---|
861 | } |
---|
862 | example { |
---|
863 | echo=2; |
---|
864 | ring R = 0,T(1..10),wp(1,1,1,1,1,1,1,1,1,1); |
---|
865 | ideal J = |
---|
866 | T(5)*T(10)-T(6)*T(9)+T(7)*T(8), |
---|
867 | T(1)*T(9)-T(2)*T(7)+T(4)*T(5), |
---|
868 | T(1)*T(8)-T(2)*T(6)+T(3)*T(5), |
---|
869 | T(1)*T(10)-T(3)*T(7)+T(4)*T(6), |
---|
870 | T(2)*T(10)-T(3)*T(9)+T(4)*T(8); |
---|
871 | intmat Q[5][10] = |
---|
872 | 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, |
---|
873 | 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, |
---|
874 | 0, 1, 1, 0, 0, 0, -1, 1, 0, 0, |
---|
875 | 0, 1, 0, 1, 0, -1, 0, 0, 1, 0, |
---|
876 | 0, 0, 1, 1, -1, 0, 0, 0, 0, 1; |
---|
877 | list simplexSymmetryGroup = G25Action(); |
---|
878 | list simplexOrbitRepresentatives = intvec( 1, 2, 3, 4, 5 ), |
---|
879 | intvec( 1, 2, 3, 5, 6 ), |
---|
880 | intvec( 1, 2, 3, 5, 7 ), |
---|
881 | intvec( 1, 2, 3, 5, 10 ), |
---|
882 | intvec( 1, 2, 3, 7, 9 ), |
---|
883 | intvec( 1, 2, 6, 9, 10 ), |
---|
884 | intvec( 1, 2, 3, 4, 5, 6 ), |
---|
885 | intvec( 1, 2, 3, 4, 5, 10 ), |
---|
886 | intvec( 1, 2, 3, 5, 6, 8 ), |
---|
887 | intvec( 1, 2, 3, 5, 6, 9 ), |
---|
888 | intvec( 1, 2, 3, 5, 7, 10 ), |
---|
889 | intvec( 1, 2, 3, 7, 9, 10 ), |
---|
890 | intvec( 1, 2, 3, 4, 5, 6, 7 ), |
---|
891 | intvec( 1, 2, 3, 4, 5, 6, 8 ), |
---|
892 | intvec( 1, 2, 3, 4, 5, 6, 9 ), |
---|
893 | intvec( 1, 2, 3, 5, 6, 9, 10 ), |
---|
894 | intvec( 1, 2, 3, 4, 5, 6, 7, 8 ), |
---|
895 | intvec( 1, 2, 3, 4, 5, 6, 9, 10 ), |
---|
896 | intvec( 1, 2, 3, 4, 5, 6, 7, 8, 9 ), |
---|
897 | intvec( 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ); |
---|
898 | list afaceOrbitRepresentatives=afaces(J,simplexOrbitRepresentatives); |
---|
899 | list fulldimAfaceOrbitRepresentatives=fullDimImages(afaceOrbitRepresentatives,Q); |
---|
900 | list afaceOrbits=computeAfaceOrbits(fulldimAfaceOrbitRepresentatives,simplexSymmetryGroup); |
---|
901 | apply(afaceOrbits,size); |
---|
902 | list minAfaceOrbits = minimalAfaceOrbits(afaceOrbits); |
---|
903 | apply(minAfaceOrbits,size); |
---|
904 | list listOfOrbitConeOrbits = orbitConeOrbits(minAfaceOrbits,Q); |
---|
905 | cone mov = movingCone(Q); |
---|
906 | intersectOrbitsWithMovingCone(listOfOrbitConeOrbits,mov); |
---|
907 | } |
---|
908 | |
---|
909 | |
---|
910 | static proc coneToString(cone C){ |
---|
911 | bigintmat F = facets(C); |
---|
912 | ring R=0,(x),dp; |
---|
913 | matrix FF[nrows(F)][ncols(F)]; |
---|
914 | int i,j; |
---|
915 | for (i=1; i<=nrows(F);i++){ |
---|
916 | for (j=1; j<=ncols(F);j++){ |
---|
917 | FF[i,j]=number(F[i,j]); |
---|
918 | } |
---|
919 | } |
---|
920 | return("bigintmat F["+string(nrows(F))+"]["+string(ncols(F))+"]="+string(FF)+";cone C=canonicalizeCone(coneViaInequalities(F));"); |
---|
921 | } |
---|
922 | |
---|
923 | proc storeOrbitConeOrbits(list OC, string fn) |
---|
924 | "USAGE: storeOrbitConeOrbits(OC, fn); OC: list of lists of cones, fn: string |
---|
925 | PURPOSE: Writes OC to file fn in Singular readable format. Can be importet using <. |
---|
926 | RETURN: nothing |
---|
927 | " |
---|
928 | { |
---|
929 | int i,j; |
---|
930 | write(":w "+fn,"list OC;"); |
---|
931 | for (i=1;i<=size(OC);i++){ |
---|
932 | write(":a "+fn,"list OCj;"); |
---|
933 | for (j=1;j<=size(OC[i]);j++){ |
---|
934 | write(":a "+fn,coneToString(OC[i][j])); |
---|
935 | write(":a "+fn,"OCj[size(OCj)+1]=C;"); |
---|
936 | write(":a "+fn,"kill C;kill F;"); |
---|
937 | } |
---|
938 | write(":a "+fn,"OC[size(OC)+1]=OCj;"); |
---|
939 | write(":a "+fn,"kill OCj;"); |
---|
940 | } |
---|
941 | } |
---|
942 | |
---|
943 | static proc storeCone(cone C,string fn){ |
---|
944 | intmat H = intmat(inequalities(C)); |
---|
945 | write(":w "+fn,"bigintmat H["+string(nrows(H))+"]["+string(ncols(H))+"] ="); |
---|
946 | write(":w "+fn,string(H)+";"); |
---|
947 | write(":a "+fn,"cone C= coneViaInequalities(H); kill H;"); |
---|
948 | } |
---|
949 | |
---|
950 | static proc listToIntvec(list L){ |
---|
951 | intvec v; |
---|
952 | for (int i = 1;i<=size(L);i++){ |
---|
953 | v[i]=L[i];} |
---|
954 | return(v); |
---|
955 | } |
---|
956 | |
---|
957 | static proc intvecToList(intvec L){ |
---|
958 | list v; |
---|
959 | for (int i = 1;i<=size(L);i++){ |
---|
960 | v[i]=L[i];} |
---|
961 | return(v); |
---|
962 | } |
---|
963 | |
---|
964 | static proc stackMatrices(bigintmat M, bigintmat N){ |
---|
965 | if (ncols(M)!=ncols(N)){ERROR("matrices should have the same number of columns");} |
---|
966 | bigintmat MN[nrows(M)+nrows(N)][ncols(N)]; |
---|
967 | MN[1..nrows(M),1..ncols(M)]=M[1..nrows(M),1..ncols(M)]; |
---|
968 | MN[(nrows(M)+1)..(nrows(M)+nrows(N)),1..ncols(M)]=N[1..nrows(N),1..ncols(N)]; |
---|
969 | return(MN); |
---|
970 | } |
---|
971 | |
---|
972 | |
---|
973 | proc movingCone(intmat Q) |
---|
974 | "USAGE: movingCone(Q); Q: intmat |
---|
975 | PURPOSE: Computes the moving cone from the grading matrix, with the degrees in the columns of Q. |
---|
976 | RETURN: a cone |
---|
977 | EXAMPLE: example movingCone; shows an example |
---|
978 | " |
---|
979 | { |
---|
980 | cone Qgammadual = coneViaInequalities(transpose(Q)); |
---|
981 | bigintmat R = facets(Qgammadual); |
---|
982 | list idx1=intvecToList(intvec(1..nrows(R))); |
---|
983 | intvec idx2=1..ncols(R); |
---|
984 | intvec idx1iv; |
---|
985 | bigintmat Ri[nrows(R)-1][ncols(R)]; |
---|
986 | list C; |
---|
987 | for (int i = 1; i<=nrows(R);i++){ |
---|
988 | idx1iv = listToIntvec(delete(idx1,i)); |
---|
989 | Ri=R[idx1iv,idx2]; |
---|
990 | C[i]=coneViaPoints(Ri); |
---|
991 | dbprint(string(i)+" "+string(nrows(facets(C[i])))); |
---|
992 | } |
---|
993 | cone mov = convexIntersection(C); |
---|
994 | return(mov); |
---|
995 | } |
---|
996 | example |
---|
997 | { |
---|
998 | echo=2; |
---|
999 | intmat Q[5][10] = |
---|
1000 | 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, |
---|
1001 | 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, |
---|
1002 | 0, 1, 1, 0, 0, 0, -1, 1, 0, 0, |
---|
1003 | 0, 1, 0, 1, 0, -1, 0, 0, 1, 0, |
---|
1004 | 0, 0, 1, 1, -1, 0, 0, 0, 0, 1; |
---|
1005 | cone mov = movingCone(Q); |
---|
1006 | mov; |
---|
1007 | rays(mov); |
---|
1008 | } |
---|
1009 | |
---|
1010 | |
---|
1011 | static proc pivotIndices(matrix H) |
---|
1012 | { |
---|
1013 | intvec p; |
---|
1014 | int pp; |
---|
1015 | int i,j; |
---|
1016 | int l=1; |
---|
1017 | for (i=1; i<=ncols(H); i++) |
---|
1018 | { |
---|
1019 | for (j=nrows(H); j>=0; j--) |
---|
1020 | { |
---|
1021 | if (H[j,i]!=0) |
---|
1022 | { |
---|
1023 | if (j>pp) |
---|
1024 | { |
---|
1025 | p[l] = i; |
---|
1026 | l++; |
---|
1027 | pp = j; |
---|
1028 | } |
---|
1029 | break; |
---|
1030 | } |
---|
1031 | } |
---|
1032 | } |
---|
1033 | return (p); |
---|
1034 | } |
---|
1035 | |
---|
1036 | |
---|
1037 | |
---|
1038 | proc groupActionOnQImage(list G,intmat Q) |
---|
1039 | "USAGE: groupActionOnQImage(G,Q); G: list of permutations, Q: intmat |
---|
1040 | 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. |
---|
1041 | RETURN: list of matrices |
---|
1042 | EXAMPLE: example groupActionOnQImage; shows an example |
---|
1043 | " |
---|
1044 | { |
---|
1045 | matrix Qmat = transpose(matrix(Q)); |
---|
1046 | matrix H = gauss_nf(Qmat); |
---|
1047 | intvec indices = pivotIndices(H); |
---|
1048 | intmat Qbasis[nrows(Q)][size(indices)]=Q[1..nrows(Q),indices]; |
---|
1049 | matrix QbasisInv = inverse(Qbasis); |
---|
1050 | list L; |
---|
1051 | intmat Qt = transpose(Q); |
---|
1052 | for(int i = 1; i <= size(G); i++){ |
---|
1053 | i; |
---|
1054 | intvec sig = permutationToIntvec(G[i]); |
---|
1055 | intmat Bsig = perm2mat(sig, indices,Qt); |
---|
1056 | matrix Asig = Bsig * QbasisInv; |
---|
1057 | L[size(L)+1] = matrixToIntmat(Asig); |
---|
1058 | kill sig; |
---|
1059 | kill Bsig; |
---|
1060 | kill Asig; |
---|
1061 | } |
---|
1062 | return(L); |
---|
1063 | } |
---|
1064 | example { |
---|
1065 | echo=2; |
---|
1066 | ring R = 0,(x),dp; |
---|
1067 | intmat Q[5][10] = |
---|
1068 | 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, |
---|
1069 | 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, |
---|
1070 | 0, 1, 1, 0, 0, 0, -1, 1, 0, 0, |
---|
1071 | 0, 1, 0, 1, 0, -1, 0, 0, 1, 0, |
---|
1072 | 0, 0, 1, 1, -1, 0, 0, 0, 0, 1; |
---|
1073 | list generatorsG = permutationFromIntvec(intvec( 1, 3, 2, 4, 6, 5, 7, 8, 10, 9 )), |
---|
1074 | permutationFromIntvec(intvec( 5, 7, 1, 6, 9, 2, 8, 4, 10, 3 )); |
---|
1075 | groupActionOnQImage(generatorsG,Q); |
---|
1076 | } |
---|
1077 | |
---|
1078 | |
---|
1079 | |
---|
1080 | static proc perm2mat(intvec sig, intvec indices, intmat Q){ |
---|
1081 | intvec sigind = 1:size(indices); |
---|
1082 | for(int i = 1; i <= size(indices); i++){ |
---|
1083 | if(indices[i] > size(sig)){ |
---|
1084 | sigind[i] = indices[i]; |
---|
1085 | } else { |
---|
1086 | sigind[i] = sig[indices[i]]; |
---|
1087 | } |
---|
1088 | } |
---|
1089 | intmat Asig[size(indices)][ncols(Q)]; |
---|
1090 | for(i = 1; i <= size(sigind); i++){ |
---|
1091 | Asig[i,1..ncols(Q)] = Q[sigind[i], 1..ncols(Q)]; |
---|
1092 | } |
---|
1093 | // the new basis must be in the cols: |
---|
1094 | return(transpose(Asig)); |
---|
1095 | } |
---|
1096 | |
---|
1097 | /////// |
---|
1098 | |
---|
1099 | |
---|
1100 | |
---|
1101 | |
---|
1102 | static proc imageCone(cone c, intmat A){ |
---|
1103 | bigintmat ineqs = inequalities(c); |
---|
1104 | cone cc = coneViaInequalities (ineqs * A); |
---|
1105 | return(cc); |
---|
1106 | } |
---|
1107 | |
---|
1108 | |
---|
1109 | static proc matrixToIntmat(matrix A){ |
---|
1110 | int i,j; |
---|
1111 | intmat Aint[nrows(A)][ncols(A)]; |
---|
1112 | for(i = 1; i<=nrows(A); i++){ |
---|
1113 | for(j = 1; j<=ncols(A); j++){ |
---|
1114 | if (deg(A[i,j])>0){ERROR("entries should be constants");} |
---|
1115 | if (denominator(number(A[i,j]))!=1){ERROR("entries should be integers");} |
---|
1116 | Aint[i,j]=int(number(A[i,j])); |
---|
1117 | } |
---|
1118 | } |
---|
1119 | return(Aint); |
---|
1120 | } |
---|
1121 | |
---|
1122 | |
---|
1123 | proc groupActionOnHashes(list Asigma, list OCmov) |
---|
1124 | "USAGE: groupActionOnHashes(Asigma,OCmov); Asigma: list, OCmov: list of list of cones |
---|
1125 | 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. |
---|
1126 | RETURN: list of permutations |
---|
1127 | EXAMPLE: example groupActionOnHashes; shows an example |
---|
1128 | " |
---|
1129 | { |
---|
1130 | // for each A in S6: |
---|
1131 | // for each c in OC90: |
---|
1132 | // store index of A*c |
---|
1133 | // --> intvec v_A |
---|
1134 | // store this in the list Ind |
---|
1135 | list Ind; |
---|
1136 | int i,j,b,k,sizepreviousorbits; |
---|
1137 | list remaining; |
---|
1138 | intmat A; |
---|
1139 | cone c,Ac; |
---|
1140 | for(i = 1; i<=size(Asigma); i++){ |
---|
1141 | intvec vA; |
---|
1142 | A = intmat(Asigma[i]); |
---|
1143 | dbprint("element "+string(i)+" of symmetry group"); |
---|
1144 | sizepreviousorbits=0; |
---|
1145 | for(b = 1; b <= size(OCmov); b++){ |
---|
1146 | remaining = intvecToList(intvec(1..size(OCmov[b]))); |
---|
1147 | for(j = 1; j <= size(OCmov[b]); j++){ |
---|
1148 | Ac = imageCone(OCmov[b][j], A); |
---|
1149 | |
---|
1150 | // find out index: |
---|
1151 | for(k= 1; k <= size(remaining); k++){ |
---|
1152 | if(OCmov[b][remaining[k]] == Ac){ |
---|
1153 | vA[j+sizepreviousorbits] = remaining[k]+sizepreviousorbits; |
---|
1154 | remaining = delete(remaining,k); |
---|
1155 | break; |
---|
1156 | } |
---|
1157 | } |
---|
1158 | } |
---|
1159 | |
---|
1160 | sizepreviousorbits=size(vA); |
---|
1161 | } |
---|
1162 | Ind[size(Ind)+1] = permutationFromIntvec(vA); |
---|
1163 | dbprint("vA: "+string(vA)); |
---|
1164 | kill vA; |
---|
1165 | } |
---|
1166 | return(Ind); |
---|
1167 | } |
---|
1168 | example |
---|
1169 | { |
---|
1170 | ring R = 0,T(1..10),wp(1,1,1,1,1,1,1,1,1,1); |
---|
1171 | ideal J = |
---|
1172 | T(5)*T(10)-T(6)*T(9)+T(7)*T(8), |
---|
1173 | T(1)*T(9)-T(2)*T(7)+T(4)*T(5), |
---|
1174 | T(1)*T(8)-T(2)*T(6)+T(3)*T(5), |
---|
1175 | T(1)*T(10)-T(3)*T(7)+T(4)*T(6), |
---|
1176 | T(2)*T(10)-T(3)*T(9)+T(4)*T(8); |
---|
1177 | intmat Q[5][10] = |
---|
1178 | 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, |
---|
1179 | 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, |
---|
1180 | 0, 1, 1, 0, 0, 0, -1, 1, 0, 0, |
---|
1181 | 0, 1, 0, 1, 0, -1, 0, 0, 1, 0, |
---|
1182 | 0, 0, 1, 1, -1, 0, 0, 0, 0, 1; |
---|
1183 | list AF= afaces(J); |
---|
1184 | list OC = orbitCones(AF,Q); |
---|
1185 | list generatorsG = permutationFromIntvec(intvec( 1, 3, 2, 4, 6, 5, 7, 8, 10, 9 )), |
---|
1186 | permutationFromIntvec(intvec( 5, 7, 1, 6, 9, 2, 8, 4, 10, 3 )); |
---|
1187 | list Asigmagens = groupActionOnQImage(generatorsG,Q); |
---|
1188 | groupActionOnHashes(Asigmagens,OC); |
---|
1189 | } |
---|
1190 | |
---|
1191 | |
---|
1192 | |
---|
1193 | |
---|
1194 | |
---|
1195 | |
---|
1196 | static proc composePermutationsGAP(permutation sigma, permutation tau){ |
---|
1197 | intvec sigmaTauImage; |
---|
1198 | |
---|
1199 | for (int i=1;i<=size(sigma.image);i++){ |
---|
1200 | sigmaTauImage[i]=tau.image[sigma.image[i]]; |
---|
1201 | } |
---|
1202 | |
---|
1203 | permutation sigmaTau; |
---|
1204 | sigmaTau.image = sigmaTauImage; |
---|
1205 | return(sigmaTau); |
---|
1206 | } |
---|
1207 | |
---|
1208 | static proc composePermutations(permutation sigma, permutation tau){ |
---|
1209 | intvec sigmaTauImage; |
---|
1210 | |
---|
1211 | for (int i=1;i<=size(sigma.image);i++){ |
---|
1212 | sigmaTauImage[i]=sigma.image[tau.image[i]]; |
---|
1213 | } |
---|
1214 | |
---|
1215 | permutation sigmaTau; |
---|
1216 | sigmaTau.image = sigmaTauImage; |
---|
1217 | return(sigmaTau); |
---|
1218 | } |
---|
1219 | |
---|
1220 | |
---|
1221 | static proc permutationPower(permutation sigma, int k){ |
---|
1222 | int i; |
---|
1223 | if (k==0) |
---|
1224 | { |
---|
1225 | permutation identity; |
---|
1226 | identity.image = intvec(1..size(sigma.image)); |
---|
1227 | return (identity); |
---|
1228 | } |
---|
1229 | if (k<0) |
---|
1230 | { |
---|
1231 | // if k<0 invert sigma and replace k with -k |
---|
1232 | intvec sigmaImage = sigma.image; |
---|
1233 | for (i=1; i<=size(sigmaImage); i++) |
---|
1234 | { |
---|
1235 | sigma.image[sigmaImage[i]] = i; |
---|
1236 | } |
---|
1237 | k = -k; |
---|
1238 | } |
---|
1239 | permutation sigmaToPowerK = sigma; |
---|
1240 | for (i=2; i<=k; i++) |
---|
1241 | { |
---|
1242 | sigmaToPowerK = composePermutations(sigmaToPowerK, sigma); |
---|
1243 | } |
---|
1244 | return (sigmaToPowerK); |
---|
1245 | } |
---|
1246 | |
---|
1247 | proc permutationFromIntvec(intvec sigmaImage) |
---|
1248 | "USAGE: permutationFromIntvec(sigmaImage); sigmaImage: intvec |
---|
1249 | PURPOSE: Create a permutation from an intvec of images. |
---|
1250 | RETURN: permutation |
---|
1251 | EXAMPLE: example permutationFromIntvec; shows an example |
---|
1252 | " |
---|
1253 | { |
---|
1254 | permutation sigma; |
---|
1255 | sigma.image = sigmaImage; |
---|
1256 | return (sigma); |
---|
1257 | } |
---|
1258 | |
---|
1259 | |
---|
1260 | proc evaluateProduct(list generatorsGperm, string st) |
---|
1261 | "USAGE: evaluateProduct(generatorsGperm,st); generatorsGperm: list, st: string |
---|
1262 | PURPOSE: Evaluates a formal product of variables xi in st, where xi corresponds to the permutation generatorsGperm[i]. |
---|
1263 | RETURN: permutation |
---|
1264 | EXAMPLE: example evaluateProduct; shows an example |
---|
1265 | " |
---|
1266 | { |
---|
1267 | for (int i=1;i<=size(generatorsGperm);i++){ |
---|
1268 | execute("permutation x"+string(i)+"= generatorsGperm[i];"); |
---|
1269 | } |
---|
1270 | if (st==""){ |
---|
1271 | st="x1^0"; |
---|
1272 | } |
---|
1273 | execute("permutation sigma = "+st); |
---|
1274 | return(sigma);} |
---|
1275 | example |
---|
1276 | { |
---|
1277 | ring R = 0,T(1..10),wp(1,1,1,1,1,1,1,1,1,1); |
---|
1278 | ideal J = |
---|
1279 | T(5)*T(10)-T(6)*T(9)+T(7)*T(8), |
---|
1280 | T(1)*T(9)-T(2)*T(7)+T(4)*T(5), |
---|
1281 | T(1)*T(8)-T(2)*T(6)+T(3)*T(5), |
---|
1282 | T(1)*T(10)-T(3)*T(7)+T(4)*T(6), |
---|
1283 | T(2)*T(10)-T(3)*T(9)+T(4)*T(8); |
---|
1284 | intmat Q[5][10] = |
---|
1285 | 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, |
---|
1286 | 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, |
---|
1287 | 0, 1, 1, 0, 0, 0, -1, 1, 0, 0, |
---|
1288 | 0, 1, 0, 1, 0, -1, 0, 0, 1, 0, |
---|
1289 | 0, 0, 1, 1, -1, 0, 0, 0, 0, 1; |
---|
1290 | list AF= afaces(J); |
---|
1291 | list OC = orbitCones(AF,Q); |
---|
1292 | list generatorsG = permutationFromIntvec(intvec( 1, 3, 2, 4, 6, 5, 7, 8, 10, 9 )), |
---|
1293 | permutationFromIntvec(intvec( 5, 7, 1, 6, 9, 2, 8, 4, 10, 3 )); |
---|
1294 | list Asigmagens = groupActionOnQImage(generatorsG,Q); |
---|
1295 | list actionOnOrbitconeIndicesForGenerators = groupActionOnHashes(Asigmagens,OC); |
---|
1296 | string elementInTermsOfGenerators = |
---|
1297 | "(x2^-1*x1^-1)^3*x1^-1"; |
---|
1298 | evaluateProduct(actionOnOrbitconeIndicesForGenerators, elementInTermsOfGenerators); |
---|
1299 | } |
---|
1300 | |
---|
1301 | |
---|
1302 | proc permutationToIntvec(permutation sigma) |
---|
1303 | "USAGE: permutationToIntvec(sigma); sigma: permutation |
---|
1304 | PURPOSE: Convert a permutation to an intvec of images. |
---|
1305 | RETURN: intvec |
---|
1306 | EXAMPLE: example permutationToIntvec; shows an example |
---|
1307 | " |
---|
1308 | {return(sigma.image);} |
---|
1309 | example |
---|
1310 | { |
---|
1311 | permutation sigma = permutationFromIntvec(intvec( 1, 2, 4, 3, 5, 7, 6, 9, 8, 10 )); |
---|
1312 | sigma; |
---|
1313 | permutationToIntvec(sigma); |
---|
1314 | } |
---|
1315 | |
---|
1316 | |
---|
1317 | |
---|
1318 | |
---|
1319 | |
---|
1320 | |
---|
1321 | |
---|
1322 | |
---|
1323 | |
---|
1324 | |
---|
1325 | |
---|
1326 | |
---|
1327 | proc storeActionOnOrbitConeIndices(list Ind,string fn) |
---|
1328 | "USAGE: storeActionOnOrbitConeIndices(generatorsGperm,st); generatorsGperm: list, fn: string |
---|
1329 | PURPOSE: Write the action on the set of orbit cones to the file fn in Singular readable format. |
---|
1330 | RETURN: nothing |
---|
1331 | " |
---|
1332 | { |
---|
1333 | string s = "list actionOnOrbitconeIndices;"; |
---|
1334 | for(int i =1; i <= size(Ind); i++){ |
---|
1335 | s = s + "intvec v = " + string(Ind[i]) + ";" + newline; |
---|
1336 | s = s + "actionOnOrbitconeIndices[size(actionOnOrbitconeIndices)+1] = permutationFromIntvec(v);" + newline + "kill v;" + newline; |
---|
1337 | } |
---|
1338 | write(":w "+fn, s); |
---|
1339 | } |
---|
1340 | |
---|
1341 | |
---|
1342 | |
---|
1343 | |
---|
1344 | |
---|
1345 | static proc getNeighborHash(list OC, bigintmat w, bigintmat v, int mu) |
---|
1346 | { |
---|
1347 | int success = 0; |
---|
1348 | int zz; |
---|
1349 | intvec Jtmp; |
---|
1350 | bigintmat wtmp; |
---|
1351 | |
---|
1352 | while(!success) |
---|
1353 | { |
---|
1354 | mu = mu*2; |
---|
1355 | wtmp = mu*w - v; |
---|
1356 | success = 1; |
---|
1357 | for(zz = 1; zz <= size(OC); zz++) |
---|
1358 | { |
---|
1359 | if(containsInSupport(OC[zz], wtmp)) |
---|
1360 | { |
---|
1361 | if(!containsInSupport(OC[zz], w)) |
---|
1362 | { |
---|
1363 | success = 0; |
---|
1364 | Jtmp = 0; |
---|
1365 | break; |
---|
1366 | } |
---|
1367 | // insert index zz: |
---|
1368 | if(size(Jtmp) ==1 && Jtmp[1] == 0) |
---|
1369 | { |
---|
1370 | Jtmp[1] = zz; |
---|
1371 | } |
---|
1372 | else |
---|
1373 | { |
---|
1374 | Jtmp[size(Jtmp)+1] = zz; |
---|
1375 | } |
---|
1376 | } |
---|
1377 | } |
---|
1378 | } |
---|
1379 | |
---|
1380 | return(Jtmp); |
---|
1381 | } |
---|
1382 | |
---|
1383 | |
---|
1384 | |
---|
1385 | |
---|
1386 | /////////////////////////////////////// |
---|
1387 | |
---|
1388 | proc GITfanSymmetric(list OC, bigintmat Q, cone Qgamma, list actiononorbitcones, list #) |
---|
1389 | "USAGE: GITfanSymmetric(OC, Q, Qgamma, actiononorbitcones [, file1, file2]); OC:list, Q:bigintmat, Qgamma:cone, actiononorbitcones: list of intvec, file1:string, file2:string |
---|
1390 | PURPOSE: Returns the common refinement of the cones given in |
---|
1391 | 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. |
---|
1392 | To obtain the whole GIT-fan Qgamma has to be take the cone generated by the columns of Q. |
---|
1393 | RETURN: a list containing the bigint hashes of the GIT cones. |
---|
1394 | EXAMPLE: example GITfanSymmetric; shows an example |
---|
1395 | " |
---|
1396 | { |
---|
1397 | actiononorbitcones=apply(actiononorbitcones,permutationToIntvec); |
---|
1398 | /** |
---|
1399 | * stores the hashes of all maximal GIT cones computed |
---|
1400 | */ |
---|
1401 | list hashesOfCones; |
---|
1402 | /** |
---|
1403 | * stores to the corresponding maximal GIT cone in hashesOfCones |
---|
1404 | * - 0, if guaranteed that all adjacent GIT cones are known |
---|
1405 | * or are to be computed in the next iteration (*) |
---|
1406 | * - hash as intvec, otherwise |
---|
1407 | */ |
---|
1408 | list workingList; |
---|
1409 | |
---|
1410 | |
---|
1411 | /** |
---|
1412 | * compute starting cone |
---|
1413 | */ |
---|
1414 | bigintmat w,v; |
---|
1415 | cone lambda; |
---|
1416 | intvec lambdaHash; |
---|
1417 | while(dimension(lambda) <> nrows(Q)){ |
---|
1418 | w = randConeEl(transpose(Q),100); |
---|
1419 | dbprint("testing "+string(w)); |
---|
1420 | if (containsRelatively(Qgamma,w)) { |
---|
1421 | lambda,lambdaHash = GITcone(OC,w); |
---|
1422 | dbprint("computed cone of dimension "+string(dimension(lambda))); |
---|
1423 | } |
---|
1424 | } |
---|
1425 | int nCones = 1; // essentially size(hashesOfCones) |
---|
1426 | int nConesOpen = 1; // essentially size(workingList)+1, see (*) above |
---|
1427 | |
---|
1428 | |
---|
1429 | /** |
---|
1430 | * initialize lists |
---|
1431 | */ |
---|
1432 | int posToInsert = 1; |
---|
1433 | bigint hashToInsert = binaryToBigint(lambdaHash); |
---|
1434 | intvec sigLambdaHash; |
---|
1435 | for(int i = 2; i <= size(actiononorbitcones); i++){ |
---|
1436 | sigLambdaHash = composeIntvecs(actiononorbitcones[i],lambdaHash); |
---|
1437 | hashToInsert = min(hashToInsert,binaryToBigint(sigLambdaHash)); |
---|
1438 | } |
---|
1439 | hashesOfCones[1] = hashToInsert; |
---|
1440 | workingList[1] = int(0); |
---|
1441 | if (size(#)>0) {write(":w "+#[1],string(hashesOfCones[1]) + ",");} |
---|
1442 | if (size(#)>1) {write(":w "+#[2],"");writeGitconeToFile(lambda,#[2]);} |
---|
1443 | |
---|
1444 | |
---|
1445 | /** |
---|
1446 | * traverse fan |
---|
1447 | */ |
---|
1448 | int t,tt; |
---|
1449 | list FL; |
---|
1450 | intvec neighbourHash; |
---|
1451 | int mu = 1024; |
---|
1452 | while (lambdaHash>0) |
---|
1453 | { |
---|
1454 | tt=timer; |
---|
1455 | |
---|
1456 | /** |
---|
1457 | * compute all facets of lambda |
---|
1458 | */ |
---|
1459 | t = timer; |
---|
1460 | FL = listOfFacetsAndInteriorVectors(lambda, Qgamma); |
---|
1461 | dbprint("time for facets: "+string(timer - t)); |
---|
1462 | |
---|
1463 | /** |
---|
1464 | * compute all neighbours of lambda |
---|
1465 | */ |
---|
1466 | for (i=size(FL[1]); i>0; i--) |
---|
1467 | { |
---|
1468 | v = FL[1][i][1]; // interior facet normal |
---|
1469 | w = FL[1][i][2]; // interior facet point |
---|
1470 | neighbourHash = getNeighborHash(OC,w,v,mu); |
---|
1471 | posToInsert,hashToInsert = findPosToInsertSymmetric(hashesOfCones,neighbourHash,actiononorbitcones); |
---|
1472 | if(posToInsert > 0) |
---|
1473 | { |
---|
1474 | if (size(#)>0){write(":a "+#[1],string(binaryToBigint(neighbourHash)) + ",");} |
---|
1475 | hashesOfCones = insertToList(hashesOfCones,hashToInsert,posToInsert); |
---|
1476 | workingList = insertToList(workingList,neighbourHash,posToInsert); |
---|
1477 | nConesOpen++; |
---|
1478 | nCones++; |
---|
1479 | } |
---|
1480 | } |
---|
1481 | |
---|
1482 | /** |
---|
1483 | * pick lambdaHash and lambda for next iteration, |
---|
1484 | * set respective entry in workingList to 0 |
---|
1485 | */ |
---|
1486 | lambdaHash = 0; |
---|
1487 | for (i=size(workingList); i>0; i--) |
---|
1488 | { |
---|
1489 | if (typeof(workingList[i])=="intvec") |
---|
1490 | { |
---|
1491 | lambdaHash = workingList[i]; |
---|
1492 | lambda = gitConeFromHash(OC,lambdaHash); |
---|
1493 | if (size(#)>1) {writeGitconeToFile(lambda,#[2]);} |
---|
1494 | workingList[i] = int(0); |
---|
1495 | break; |
---|
1496 | } |
---|
1497 | } |
---|
1498 | nConesOpen--; |
---|
1499 | |
---|
1500 | dbprint("overall: "+string(nCones)+" open: "+string(nConesOpen)+" time for loop: "+string(timer-tt)); |
---|
1501 | } |
---|
1502 | return(hashesOfCones); |
---|
1503 | } |
---|
1504 | example |
---|
1505 | { |
---|
1506 | ring R = 0,T(1..10),wp(1,1,1,1,1,1,1,1,1,1); |
---|
1507 | ideal J = |
---|
1508 | T(5)*T(10)-T(6)*T(9)+T(7)*T(8), |
---|
1509 | T(1)*T(9)-T(2)*T(7)+T(4)*T(5), |
---|
1510 | T(1)*T(8)-T(2)*T(6)+T(3)*T(5), |
---|
1511 | T(1)*T(10)-T(3)*T(7)+T(4)*T(6), |
---|
1512 | T(2)*T(10)-T(3)*T(9)+T(4)*T(8); |
---|
1513 | intmat Q[5][10] = |
---|
1514 | 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, |
---|
1515 | 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, |
---|
1516 | 0, 1, 1, 0, 0, 0, -1, 1, 0, 0, |
---|
1517 | 0, 1, 0, 1, 0, -1, 0, 0, 1, 0, |
---|
1518 | 0, 0, 1, 1, -1, 0, 0, 0, 0, 1; |
---|
1519 | list simplexSymmetryGroup = G25Action(); |
---|
1520 | list simplexOrbitRepresentatives = intvec( 1, 2, 3, 4, 5 ), |
---|
1521 | intvec( 1, 2, 3, 5, 6 ), |
---|
1522 | intvec( 1, 2, 3, 5, 7 ), |
---|
1523 | intvec( 1, 2, 3, 5, 10 ), |
---|
1524 | intvec( 1, 2, 3, 7, 9 ), |
---|
1525 | intvec( 1, 2, 6, 9, 10 ), |
---|
1526 | intvec( 1, 2, 3, 4, 5, 6 ), |
---|
1527 | intvec( 1, 2, 3, 4, 5, 10 ), |
---|
1528 | intvec( 1, 2, 3, 5, 6, 8 ), |
---|
1529 | intvec( 1, 2, 3, 5, 6, 9 ), |
---|
1530 | intvec( 1, 2, 3, 5, 7, 10 ), |
---|
1531 | intvec( 1, 2, 3, 7, 9, 10 ), |
---|
1532 | intvec( 1, 2, 3, 4, 5, 6, 7 ), |
---|
1533 | intvec( 1, 2, 3, 4, 5, 6, 8 ), |
---|
1534 | intvec( 1, 2, 3, 4, 5, 6, 9 ), |
---|
1535 | intvec( 1, 2, 3, 5, 6, 9, 10 ), |
---|
1536 | intvec( 1, 2, 3, 4, 5, 6, 7, 8 ), |
---|
1537 | intvec( 1, 2, 3, 4, 5, 6, 9, 10 ), |
---|
1538 | intvec( 1, 2, 3, 4, 5, 6, 7, 8, 9 ), |
---|
1539 | intvec( 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ); |
---|
1540 | list afaceOrbitRepresentatives=afaces(J,simplexOrbitRepresentatives); |
---|
1541 | list fulldimAfaceOrbitRepresentatives=fullDimImages(afaceOrbitRepresentatives,Q); |
---|
1542 | list afaceOrbits=computeAfaceOrbits(fulldimAfaceOrbitRepresentatives,simplexSymmetryGroup); |
---|
1543 | apply(afaceOrbits,size); |
---|
1544 | list minAfaceOrbits = minimalAfaceOrbits(afaceOrbits); |
---|
1545 | apply(minAfaceOrbits,size); |
---|
1546 | list listOfOrbitConeOrbits = orbitConeOrbits(minAfaceOrbits,Q); |
---|
1547 | apply(listOfOrbitConeOrbits,size); |
---|
1548 | list listOfMinimalOrbitConeOrbits = minimalOrbitConeOrbits(listOfOrbitConeOrbits); |
---|
1549 | size(listOfMinimalOrbitConeOrbits); |
---|
1550 | list Asigma = groupActionOnQImage(simplexSymmetryGroup,Q); |
---|
1551 | list actionOnOrbitconeIndices = groupActionOnHashes(Asigma,listOfOrbitConeOrbits); |
---|
1552 | list OClist = listOfOrbitConeOrbits[1]; |
---|
1553 | for (int i =2;i<=size(listOfOrbitConeOrbits);i++){ |
---|
1554 | OClist = OClist + listOfOrbitConeOrbits[i]; |
---|
1555 | } |
---|
1556 | cone mov = coneViaPoints(transpose(Q)); |
---|
1557 | mov = canonicalizeCone(mov); |
---|
1558 | printlevel = 3; |
---|
1559 | list Sigma = GITfanSymmetric(OClist, Q, mov, actionOnOrbitconeIndices); |
---|
1560 | Sigma; |
---|
1561 | } |
---|
1562 | |
---|
1563 | |
---|
1564 | proc GITfanParallelSymmetric(list OC, bigintmat Q, cone Qgamma, list actiononorbitcones, list #) |
---|
1565 | "USAGE: GITfanParallelSymmetric(OC, Q, Qgamma, actiononorbitcones [, file1]); OC:list, Q:bigintmat, Qgamma:cone, actiononorbitcones: list of intvec, file1:string |
---|
1566 | PURPOSE: Returns the common refinement of the cones given in |
---|
1567 | 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. |
---|
1568 | To obtain the whole GIT-fan Qgamma has to be take the cone generated by the columns of Q. |
---|
1569 | RETURN: a list containing the bigint hashes of the GIT cones. |
---|
1570 | NOTE: The proceduce uses parallel computation for the construction of the GIT-cones. |
---|
1571 | EXAMPLE: example GITfanParallelSymmetric; shows an example |
---|
1572 | " |
---|
1573 | { |
---|
1574 | actiononorbitcones=apply(actiononorbitcones,permutationToIntvec); |
---|
1575 | /** |
---|
1576 | * stores the hashes of all maximal GIT cones computed |
---|
1577 | */ |
---|
1578 | list hashesOfCones; |
---|
1579 | /** |
---|
1580 | * stores to the corresponding maximal GIT cone in hashesOfCones |
---|
1581 | * - 0, if guaranteed that all adjacent GIT cones are known |
---|
1582 | * or are to be computed in the next iteration (*) |
---|
1583 | * - hash as intvec, otherwise |
---|
1584 | */ |
---|
1585 | list workingList; |
---|
1586 | |
---|
1587 | |
---|
1588 | /** |
---|
1589 | * compute starting cone |
---|
1590 | */ |
---|
1591 | bigintmat w,v; |
---|
1592 | cone lambda; |
---|
1593 | intvec lambdaHash; |
---|
1594 | while(dimension(lambda) <> nrows(Q)){ |
---|
1595 | w = randConeEl(transpose(Q),100); |
---|
1596 | dbprint("testing "+string(w)); |
---|
1597 | if (containsRelatively(Qgamma,w)) { |
---|
1598 | lambda,lambdaHash = GITcone(OC,w); |
---|
1599 | dbprint("computed cone of dimension "+string(dimension(lambda))); |
---|
1600 | } |
---|
1601 | } |
---|
1602 | int nCones = 1; // essentially size(hashesOfCones) |
---|
1603 | int nConesOpen = 1; // essentially size(workingList)+1, see (*) above |
---|
1604 | |
---|
1605 | |
---|
1606 | /** |
---|
1607 | * initialize lists |
---|
1608 | */ |
---|
1609 | bigint hashToInsert = binaryToBigint(lambdaHash); |
---|
1610 | int posToInsert = 1; |
---|
1611 | intvec sigLambdaHash; |
---|
1612 | for(int i = 2; i <= size(actiononorbitcones); i++){ |
---|
1613 | sigLambdaHash = composeIntvecs(actiononorbitcones[i],lambdaHash); |
---|
1614 | hashToInsert = min(hashToInsert,binaryToBigint(sigLambdaHash)); |
---|
1615 | } |
---|
1616 | hashesOfCones[1] = hashToInsert; |
---|
1617 | workingList[1] = int(0); |
---|
1618 | if (size(#)>0) {write(":w "+#[1],string(binaryToBigint(lambdaHash)) + ",");} |
---|
1619 | //if (size(#)>1) {write(":w "+#[2],"list listOfMaximalCones;");writeGitconeToFile(lambda,#[2]);} |
---|
1620 | |
---|
1621 | |
---|
1622 | list iterationArgs = list(list(lambdaHash,OC,Qgamma,actiononorbitcones)); |
---|
1623 | list iterationRes; |
---|
1624 | |
---|
1625 | /** |
---|
1626 | * traverse fan |
---|
1627 | */ |
---|
1628 | int j,t,tloop; |
---|
1629 | list FL; |
---|
1630 | list neighbourHashes; |
---|
1631 | intvec neighbourHash; |
---|
1632 | while (size(iterationArgs)>0) |
---|
1633 | { |
---|
1634 | tloop=rtimer; |
---|
1635 | |
---|
1636 | /** |
---|
1637 | * compute all neighbours of lambda |
---|
1638 | */ |
---|
1639 | t = rtimer; |
---|
1640 | iterationRes = parallelWaitAll("computeNeighbourMinimalHashes",iterationArgs); |
---|
1641 | dbprint("time neighbours: "+string(rtimer - t)); |
---|
1642 | |
---|
1643 | /** |
---|
1644 | * central book keeping |
---|
1645 | */ |
---|
1646 | t = rtimer; |
---|
1647 | for (i=1; i<=size(iterationRes); i++) |
---|
1648 | { |
---|
1649 | neighbourHashes = iterationRes[i]; |
---|
1650 | for (j=1; j<=size(neighbourHashes); j++) |
---|
1651 | { |
---|
1652 | neighbourHash = neighbourHashes[j]; |
---|
1653 | hashToInsert = binaryToBigint(neighbourHash); |
---|
1654 | posToInsert = findPlaceToInsert(hashesOfCones,hashToInsert); |
---|
1655 | if(posToInsert > 0) |
---|
1656 | { |
---|
1657 | if (size(#)>0){write(":a "+#[1],string(binaryToBigint(neighbourHash)) + ",");} |
---|
1658 | hashesOfCones = insertToList(hashesOfCones,hashToInsert,posToInsert); |
---|
1659 | workingList = insertToList(workingList,neighbourHash,posToInsert); |
---|
1660 | nConesOpen++; |
---|
1661 | nCones++; |
---|
1662 | } |
---|
1663 | } |
---|
1664 | } |
---|
1665 | nConesOpen = nConesOpen - size(iterationArgs); |
---|
1666 | dbprint("time bookkeeping: "+string(rtimer - t)); |
---|
1667 | |
---|
1668 | /** |
---|
1669 | * pick arguments for next iteration, |
---|
1670 | * set respective entry in workingList to 0 |
---|
1671 | */ |
---|
1672 | t = rtimer; |
---|
1673 | iterationArgs = list(); |
---|
1674 | for (i=size(workingList); i>0; i--) |
---|
1675 | { |
---|
1676 | if (typeof(workingList[i])=="intvec") |
---|
1677 | { |
---|
1678 | iterationArgs[size(iterationArgs)+1] = list(workingList[i],OC,Qgamma,actiononorbitcones); |
---|
1679 | workingList[i] = int(0); |
---|
1680 | if (size(iterationArgs) >= getcores()) |
---|
1681 | { |
---|
1682 | break; |
---|
1683 | } |
---|
1684 | } |
---|
1685 | } |
---|
1686 | dbprint("time preparation: "+string(rtimer - t)); |
---|
1687 | |
---|
1688 | dbprint("overall: "+string(nCones)+" open: "+string(nConesOpen)+" time loop: "+string(rtimer-tloop)); |
---|
1689 | } |
---|
1690 | return(hashesOfCones); |
---|
1691 | } |
---|
1692 | example |
---|
1693 | { |
---|
1694 | ring R = 0,T(1..10),wp(1,1,1,1,1,1,1,1,1,1); |
---|
1695 | ideal J = |
---|
1696 | T(5)*T(10)-T(6)*T(9)+T(7)*T(8), |
---|
1697 | T(1)*T(9)-T(2)*T(7)+T(4)*T(5), |
---|
1698 | T(1)*T(8)-T(2)*T(6)+T(3)*T(5), |
---|
1699 | T(1)*T(10)-T(3)*T(7)+T(4)*T(6), |
---|
1700 | T(2)*T(10)-T(3)*T(9)+T(4)*T(8); |
---|
1701 | intmat Q[5][10] = |
---|
1702 | 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, |
---|
1703 | 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, |
---|
1704 | 0, 1, 1, 0, 0, 0, -1, 1, 0, 0, |
---|
1705 | 0, 1, 0, 1, 0, -1, 0, 0, 1, 0, |
---|
1706 | 0, 0, 1, 1, -1, 0, 0, 0, 0, 1; |
---|
1707 | list simplexSymmetryGroup = G25Action(); |
---|
1708 | list simplexOrbitRepresentatives = intvec( 1, 2, 3, 4, 5 ), |
---|
1709 | intvec( 1, 2, 3, 5, 6 ), |
---|
1710 | intvec( 1, 2, 3, 5, 7 ), |
---|
1711 | intvec( 1, 2, 3, 5, 10 ), |
---|
1712 | intvec( 1, 2, 3, 7, 9 ), |
---|
1713 | intvec( 1, 2, 6, 9, 10 ), |
---|
1714 | intvec( 1, 2, 3, 4, 5, 6 ), |
---|
1715 | intvec( 1, 2, 3, 4, 5, 10 ), |
---|
1716 | intvec( 1, 2, 3, 5, 6, 8 ), |
---|
1717 | intvec( 1, 2, 3, 5, 6, 9 ), |
---|
1718 | intvec( 1, 2, 3, 5, 7, 10 ), |
---|
1719 | intvec( 1, 2, 3, 7, 9, 10 ), |
---|
1720 | intvec( 1, 2, 3, 4, 5, 6, 7 ), |
---|
1721 | intvec( 1, 2, 3, 4, 5, 6, 8 ), |
---|
1722 | intvec( 1, 2, 3, 4, 5, 6, 9 ), |
---|
1723 | intvec( 1, 2, 3, 5, 6, 9, 10 ), |
---|
1724 | intvec( 1, 2, 3, 4, 5, 6, 7, 8 ), |
---|
1725 | intvec( 1, 2, 3, 4, 5, 6, 9, 10 ), |
---|
1726 | intvec( 1, 2, 3, 4, 5, 6, 7, 8, 9 ), |
---|
1727 | intvec( 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ); |
---|
1728 | list afaceOrbitRepresentatives=afaces(J,simplexOrbitRepresentatives); |
---|
1729 | list fulldimAfaceOrbitRepresentatives=fullDimImages(afaceOrbitRepresentatives,Q); |
---|
1730 | list afaceOrbits=computeAfaceOrbits(fulldimAfaceOrbitRepresentatives,simplexSymmetryGroup); |
---|
1731 | apply(afaceOrbits,size); |
---|
1732 | list minAfaceOrbits = minimalAfaceOrbits(afaceOrbits); |
---|
1733 | apply(minAfaceOrbits,size); |
---|
1734 | list listOfOrbitConeOrbits = orbitConeOrbits(minAfaceOrbits,Q); |
---|
1735 | apply(listOfOrbitConeOrbits,size); |
---|
1736 | list listOfMinimalOrbitConeOrbits = minimalOrbitConeOrbits(listOfOrbitConeOrbits); |
---|
1737 | size(listOfMinimalOrbitConeOrbits); |
---|
1738 | list Asigma = groupActionOnQImage(simplexSymmetryGroup,Q); |
---|
1739 | list actionOnOrbitconeIndices = groupActionOnHashes(Asigma,listOfOrbitConeOrbits); |
---|
1740 | list OClist = listOfOrbitConeOrbits[1]; |
---|
1741 | for (int i =2;i<=size(listOfOrbitConeOrbits);i++){ |
---|
1742 | OClist = OClist + listOfOrbitConeOrbits[i]; |
---|
1743 | } |
---|
1744 | cone mov = coneViaPoints(transpose(Q)); |
---|
1745 | mov = canonicalizeCone(mov); |
---|
1746 | list Sigma = GITfanParallelSymmetric(OClist, Q, mov, actionOnOrbitconeIndices); |
---|
1747 | Sigma; |
---|
1748 | } |
---|
1749 | |
---|
1750 | |
---|
1751 | // not static to be used in parallel.lib |
---|
1752 | proc computeNeighbourMinimalHashes(intvec lambdaHash, list OC, cone Qgamma, list actiononorbitcones) |
---|
1753 | { |
---|
1754 | /** |
---|
1755 | * compute all facets of lambda |
---|
1756 | */ |
---|
1757 | cone lambda = gitConeFromHash(OC,lambdaHash); |
---|
1758 | list FL = listOfFacetsAndInteriorVectors(lambda, Qgamma); |
---|
1759 | |
---|
1760 | /** |
---|
1761 | * compute all minimal hashes of neighbours of lambda |
---|
1762 | */ |
---|
1763 | int i,j; |
---|
1764 | bigintmat v,w; |
---|
1765 | intvec neighbourHash; |
---|
1766 | intvec neighbourHashPerm; |
---|
1767 | bigint nPerm; |
---|
1768 | intvec neighbourHashMin; |
---|
1769 | bigint nMin; |
---|
1770 | list neighbourHashes; |
---|
1771 | for (i=size(FL[1]); i>0; i--) |
---|
1772 | { |
---|
1773 | v = FL[1][i][1]; // interior facet normal |
---|
1774 | w = FL[1][i][2]; // interior facet point |
---|
1775 | neighbourHash = getNeighborHash(OC,w,v,1024); |
---|
1776 | neighbourHashMin = neighbourHash; |
---|
1777 | nMin = binaryToBigint(neighbourHash); |
---|
1778 | for (j=size(actiononorbitcones); j>1; j--) |
---|
1779 | { |
---|
1780 | neighbourHashPerm = composeIntvecs(actiononorbitcones[j],neighbourHash); |
---|
1781 | nPerm = binaryToBigint(neighbourHashPerm); |
---|
1782 | if (nPerm < nMin) |
---|
1783 | { |
---|
1784 | nMin = nPerm; |
---|
1785 | neighbourHashMin = neighbourHashPerm; |
---|
1786 | } |
---|
1787 | } |
---|
1788 | neighbourHashes[i] = neighbourHashMin; |
---|
1789 | } |
---|
1790 | |
---|
1791 | return (neighbourHashes); |
---|
1792 | } |
---|
1793 | |
---|
1794 | |
---|
1795 | |
---|
1796 | static proc writeGitconeToFile(cone lambda,string fn) |
---|
1797 | { |
---|
1798 | bigintmat H = facets(lambda); |
---|
1799 | |
---|
1800 | int rows = nrows(H); |
---|
1801 | int cols = ncols(H); |
---|
1802 | string toBeWritten = "bigintmat H["+string(rows)+"]["+string(cols)+"]="; |
---|
1803 | int i,j; |
---|
1804 | for (i=1; i<=rows; i++) |
---|
1805 | { |
---|
1806 | for (j=1; j<=cols; j++) |
---|
1807 | { |
---|
1808 | toBeWritten = toBeWritten + string(H[i,j]) + ","; |
---|
1809 | } |
---|
1810 | } |
---|
1811 | toBeWritten = toBeWritten[1..size(toBeWritten)-1]; |
---|
1812 | toBeWritten = toBeWritten + ";"; |
---|
1813 | write(":a "+fn,toBeWritten); |
---|
1814 | |
---|
1815 | toBeWritten = "listOfMaximalCones[size(listOfMaximalCones)+1] = coneViaInequalities(V);"; |
---|
1816 | write(":a "+fn,toBeWritten); |
---|
1817 | |
---|
1818 | toBeWritten = "kill V;"; |
---|
1819 | write(":a "+fn,toBeWritten); |
---|
1820 | |
---|
1821 | toBeWritten = ""; |
---|
1822 | write(":a "+fn,toBeWritten); |
---|
1823 | } |
---|
1824 | |
---|
1825 | |
---|
1826 | |
---|
1827 | static proc listOfFacetsAndInteriorVectors(cone lambda, cone Qgamma, list #){ |
---|
1828 | list FL; |
---|
1829 | int numboundary; |
---|
1830 | |
---|
1831 | bigintmat FL0 = facets(lambda); |
---|
1832 | bigintmat H[1][ncols(FL0)]; |
---|
1833 | bigintmat FL1[nrows(FL0)-1][ncols(FL0)]; // delete row of H from FL0 |
---|
1834 | |
---|
1835 | bigintmat w; |
---|
1836 | cone facetCone; |
---|
1837 | for(int i = 1; i <= nrows(FL0); i++){ |
---|
1838 | H = FL0[i,1..ncols(FL0)]; |
---|
1839 | |
---|
1840 | if(i > 1 and i < nrows(FL0)){ |
---|
1841 | FL1 = FL0[1..i-1, 1..ncols(FL0)], FL0[i+1..nrows(FL0), 1..ncols(FL0)]; |
---|
1842 | } else { |
---|
1843 | if(i == nrows(FL0)){ |
---|
1844 | FL1 = FL0[1..i-1, 1..ncols(FL0)]; |
---|
1845 | } else { // i = 1: |
---|
1846 | FL1 = FL0[2..nrows(FL0), 1..ncols(FL0)]; |
---|
1847 | } |
---|
1848 | } |
---|
1849 | |
---|
1850 | facetCone = coneViaInequalities(FL1, H); |
---|
1851 | |
---|
1852 | if (size(#)>0) |
---|
1853 | { |
---|
1854 | if (containsInSupport(facetCone,#[1])) |
---|
1855 | { |
---|
1856 | i++; |
---|
1857 | continue; |
---|
1858 | } |
---|
1859 | } |
---|
1860 | |
---|
1861 | w = relativeInteriorPoint(facetCone); |
---|
1862 | |
---|
1863 | if(containsRelatively(Qgamma,w)){ |
---|
1864 | FL[size(FL) + 1] = list(H,w); |
---|
1865 | } else { |
---|
1866 | numboundary=numboundary+1; |
---|
1867 | } |
---|
1868 | } |
---|
1869 | |
---|
1870 | return(list(FL,numboundary)); |
---|
1871 | } |
---|
1872 | |
---|
1873 | |
---|
1874 | |
---|
1875 | |
---|
1876 | |
---|
1877 | //////////////////////////////// |
---|
1878 | |
---|
1879 | // CAREFUL: we assume that actiononorbitcones[1] = id. |
---|
1880 | static proc findPosToInsertSymmetric(list hashesOfCones, intvec J, list actiononorbitcones){ |
---|
1881 | |
---|
1882 | // 1.: compute minimal hash sigJ |
---|
1883 | bigint n = binaryToBigint(J); |
---|
1884 | intvec sigJ; |
---|
1885 | for(int i = 2; i <= size(actiononorbitcones); i++){ |
---|
1886 | sigJ = composeIntvecs(actiononorbitcones[i],J); |
---|
1887 | n = min(n,binaryToBigint(sigJ)); |
---|
1888 | } |
---|
1889 | |
---|
1890 | // 2.:check if minimal hash is already in list |
---|
1891 | return(findPlaceToInsert(hashesOfCones,n),n); |
---|
1892 | } |
---|
1893 | |
---|
1894 | ////////////////////// |
---|
1895 | |
---|
1896 | // insert n at position pos and move bigger elements by one index |
---|
1897 | proc insertToList(list L, def elementToInsert, int posToInsert){ |
---|
1898 | if(posToInsert == 1){ |
---|
1899 | return(list(elementToInsert)+L); |
---|
1900 | } |
---|
1901 | if(posToInsert == size(L)+1){ |
---|
1902 | return(L+list(elementToInsert)); |
---|
1903 | } |
---|
1904 | return(list(L[1..(posToInsert-1)],elementToInsert,L[posToInsert..size(L)])); |
---|
1905 | } |
---|
1906 | |
---|
1907 | proc GITcone(list OCcones, bigintmat w) |
---|
1908 | "USAGE: GITcone(OCcones, w); OCcones: list of orbit cones, w: bigintmat with one row |
---|
1909 | PURPOSE: Returns the intersection of all orbit cones containing w. |
---|
1910 | 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) |
---|
1911 | EXAMPLE: example GITcone; shows an example |
---|
1912 | " |
---|
1913 | { |
---|
1914 | list OCrelcones; |
---|
1915 | intvec Hash; |
---|
1916 | for(int i = 1; i <= size(OCcones); i++){ |
---|
1917 | if(containsInSupport(OCcones[i], w)){ |
---|
1918 | OCrelcones[size(OCrelcones)+1]=OCcones[i]; |
---|
1919 | Hash[size(Hash)+1] = i; |
---|
1920 | } |
---|
1921 | } |
---|
1922 | Hash = intvec(Hash[2..size(Hash)]); |
---|
1923 | return(convexIntersection(OCrelcones),Hash); |
---|
1924 | } |
---|
1925 | example { |
---|
1926 | echo=2; |
---|
1927 | ring R = 0,T(1..10),wp(1,1,1,1,1,1,1,1,1,1); |
---|
1928 | ideal J = |
---|
1929 | T(5)*T(10)-T(6)*T(9)+T(7)*T(8), |
---|
1930 | T(1)*T(9)-T(2)*T(7)+T(4)*T(5), |
---|
1931 | T(1)*T(8)-T(2)*T(6)+T(3)*T(5), |
---|
1932 | T(1)*T(10)-T(3)*T(7)+T(4)*T(6), |
---|
1933 | T(2)*T(10)-T(3)*T(9)+T(4)*T(8); |
---|
1934 | intmat Q[5][10] = |
---|
1935 | 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, |
---|
1936 | 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, |
---|
1937 | 0, 1, 1, 0, 0, 0, -1, 1, 0, 0, |
---|
1938 | 0, 1, 0, 1, 0, -1, 0, 0, 1, 0, |
---|
1939 | 0, 0, 1, 1, -1, 0, 0, 0, 0, 1; |
---|
1940 | |
---|
1941 | list AF= afaces(J,nrows(Q)); |
---|
1942 | AF=fullDimImages(AF,Q); |
---|
1943 | AF = minimalAfaces(AF); |
---|
1944 | list OC = orbitCones(AF,Q); |
---|
1945 | bigintmat w[1][nrows(Q)]; |
---|
1946 | for(int i = 1; i <= nrows(Q); i++){ |
---|
1947 | w = w + Q[1..nrows(Q),i]; |
---|
1948 | } |
---|
1949 | GITcone(OC,w); |
---|
1950 | } |
---|
1951 | |
---|
1952 | |
---|
1953 | static proc gitConeFromHash(list OC, intvec Hash) |
---|
1954 | { |
---|
1955 | list OCtoIntersect = OC[Hash]; |
---|
1956 | return (convexIntersection(OCtoIntersect)); |
---|
1957 | } |
---|
1958 | |
---|
1959 | |
---|
1960 | |
---|
1961 | |
---|
1962 | |
---|
1963 | static proc randConeEl(bigintmat Q, int bound){ |
---|
1964 | bigintmat w[1][ncols(Q)]; |
---|
1965 | |
---|
1966 | for(int i = 1; i <= nrows(Q); i++){ |
---|
1967 | bigintmat v[1][ncols(Q)] = Q[i,1..ncols(Q)]; |
---|
1968 | |
---|
1969 | w = w + random(1,bound) * v; |
---|
1970 | |
---|
1971 | kill v; |
---|
1972 | } |
---|
1973 | |
---|
1974 | return(w); |
---|
1975 | } |
---|
1976 | |
---|
1977 | |
---|
1978 | |
---|
1979 | proc subdividelist(list OC,int ncores){ |
---|
1980 | if (ncores>size(OC)){ncores=size(OC);} |
---|
1981 | int percore = size(OC) div (ncores); |
---|
1982 | int lastcore = size(OC) mod (ncores); |
---|
1983 | list OCLL; |
---|
1984 | int j=1; |
---|
1985 | int starti=1; |
---|
1986 | int endi; |
---|
1987 | for (int i=1;i<=ncores;i++){ |
---|
1988 | endi = starti+percore-1; |
---|
1989 | if (i<=lastcore) {endi=endi+1;} |
---|
1990 | list OCLLi=OC[starti..endi]; |
---|
1991 | starti=endi+1; |
---|
1992 | OCLL[i]=OCLLi; |
---|
1993 | kill OCLLi; |
---|
1994 | } |
---|
1995 | return(OCLL); |
---|
1996 | } |
---|
1997 | //list OC = 1,2,3,4,5,6,7,8,9,10,11,12; |
---|
1998 | //subdividelist(OC,4); |
---|
1999 | |
---|
2000 | |
---|
2001 | |
---|
2002 | |
---|
2003 | |
---|
2004 | |
---|
2005 | |
---|
2006 | |
---|
2007 | |
---|
2008 | |
---|
2009 | |
---|
2010 | |
---|
2011 | proc orbitCones(list AF, intmat Q, list #) |
---|
2012 | "USAGE: orbitCones(AF, Q[, d]); AF: list of intvecs, Q: intmat, d: int |
---|
2013 | 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 |
---|
2014 | RETURN: a list of cones |
---|
2015 | EXAMPLE: example orbitCones; shows an example |
---|
2016 | " |
---|
2017 | { |
---|
2018 | list OC; |
---|
2019 | intvec gam0; |
---|
2020 | int j; |
---|
2021 | cone c; |
---|
2022 | int d = 0; |
---|
2023 | if (size(#)>0) { |
---|
2024 | d = #[1]; |
---|
2025 | } |
---|
2026 | |
---|
2027 | for(int i = 1; i <= size(AF); i++){ |
---|
2028 | gam0 = AF[i]; |
---|
2029 | |
---|
2030 | if(gam0 == 0){ |
---|
2031 | bigintmat M[1][nrows(Q)]; |
---|
2032 | } else { |
---|
2033 | bigintmat M[size(gam0)][nrows(Q)]; |
---|
2034 | |
---|
2035 | for (j = 1; j <= size(gam0); j++){ |
---|
2036 | M[j,1..ncols(M)] = Q[1..nrows(Q),gam0[j]]; |
---|
2037 | } |
---|
2038 | } |
---|
2039 | |
---|
2040 | c = coneViaPoints(M); |
---|
2041 | |
---|
2042 | if(listContainsCone(OC, c) == 0 && dimension(c)>=d){ |
---|
2043 | OC[size(OC)+1] = c; |
---|
2044 | } |
---|
2045 | |
---|
2046 | kill M; |
---|
2047 | } |
---|
2048 | |
---|
2049 | return(OC); |
---|
2050 | } |
---|
2051 | example |
---|
2052 | { |
---|
2053 | echo=2; |
---|
2054 | ring R = 0,T(1..10),wp(1,1,1,1,1,1,1,1,1,1); |
---|
2055 | ideal J = |
---|
2056 | T(5)*T(10)-T(6)*T(9)+T(7)*T(8), |
---|
2057 | T(1)*T(9)-T(2)*T(7)+T(4)*T(5), |
---|
2058 | T(1)*T(8)-T(2)*T(6)+T(3)*T(5), |
---|
2059 | T(1)*T(10)-T(3)*T(7)+T(4)*T(6), |
---|
2060 | T(2)*T(10)-T(3)*T(9)+T(4)*T(8); |
---|
2061 | intmat Q[5][10] = |
---|
2062 | 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, |
---|
2063 | 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, |
---|
2064 | 0, 1, 1, 0, 0, 0, -1, 1, 0, 0, |
---|
2065 | 0, 1, 0, 1, 0, -1, 0, 0, 1, 0, |
---|
2066 | 0, 0, 1, 1, -1, 0, 0, 0, 0, 1; |
---|
2067 | |
---|
2068 | list AF= afaces(J); |
---|
2069 | print(size(AF)); |
---|
2070 | list OC = orbitCones(AF,Q); |
---|
2071 | size(OC); |
---|
2072 | } |
---|
2073 | |
---|
2074 | |
---|
2075 | |
---|
2076 | /////////////////////////////////////// |
---|
2077 | |
---|
2078 | proc GITfanFromOrbitCones(list OC, bigintmat Q, cone Qgamma, list #) |
---|
2079 | "USAGE: GITfanFromOrbitCones(OC, Q, Qgamma [, file1, file2]); OC:list, Q:bigintmat, Qgamma:cone, file1:string, file2:string |
---|
2080 | PURPOSE: Returns the common refinement of the cones given in |
---|
2081 | the list OC which is supposed to contain the orbit cones intersected with Qgamma. The optional argument can be used |
---|
2082 | to specify one or two strings with file names, where the first file will contain the hashes of the |
---|
2083 | GIT-cones and the second argument the actual cones in their H-representation. |
---|
2084 | To obtain the whole GIT-fan Qgamma has to be take the cone generated by the columns of Q. |
---|
2085 | RETURN: a list containing the bigint hashes of the GIT cones. |
---|
2086 | EXAMPLE: example GITfanFromOrbitCones; shows an example |
---|
2087 | " |
---|
2088 | { |
---|
2089 | /** |
---|
2090 | * stores the hashes of all maximal GIT cones computed |
---|
2091 | */ |
---|
2092 | list hashesOfCones; |
---|
2093 | /** |
---|
2094 | * stores to the corresponding maximal GIT cone in hashesOfCones |
---|
2095 | * - 0, if guaranteed that all adjacent GIT cones are known |
---|
2096 | * or are to be computed in the next iteration (*) |
---|
2097 | * - hash as intvec, otherwise |
---|
2098 | */ |
---|
2099 | list workingList; |
---|
2100 | |
---|
2101 | |
---|
2102 | /** |
---|
2103 | * compute starting cone |
---|
2104 | */ |
---|
2105 | bigintmat w,v; |
---|
2106 | cone lambda; |
---|
2107 | intvec lambdaHash; |
---|
2108 | while(dimension(lambda) <> nrows(Q)){ |
---|
2109 | w = randConeEl(transpose(Q),100); |
---|
2110 | dbprint("testing "+string(w)); |
---|
2111 | if (containsRelatively(Qgamma,w)) { |
---|
2112 | lambda,lambdaHash = GITcone(OC,w); |
---|
2113 | dbprint("computed cone of dimension "+string(dimension(lambda))); |
---|
2114 | } |
---|
2115 | } |
---|
2116 | int nCones = 1; // essentially size(hashesOfCones) |
---|
2117 | int nConesOpen = 1; // essentially size(workingList)+1, see (*) above |
---|
2118 | |
---|
2119 | |
---|
2120 | /** |
---|
2121 | * initialize lists |
---|
2122 | */ |
---|
2123 | int posToInsert = 1; |
---|
2124 | bigint hashToInsert = binaryToBigint(lambdaHash); |
---|
2125 | hashesOfCones[1] = hashToInsert; |
---|
2126 | workingList[1] = int(0); |
---|
2127 | if (size(#)>0) {write(":w "+#[1],string(hashesOfCones[1]) + ",");} |
---|
2128 | if (size(#)>1) {write(":w "+#[2],"list listOfMaximalCones;");writeGitconeToFile(lambda,#[2]);} |
---|
2129 | |
---|
2130 | |
---|
2131 | /** |
---|
2132 | * traverse fan |
---|
2133 | */ |
---|
2134 | int i,t,tt; |
---|
2135 | list FL; |
---|
2136 | intvec neighbourHash; |
---|
2137 | int mu = 1024; |
---|
2138 | while (lambdaHash>0) |
---|
2139 | { |
---|
2140 | tt=timer; |
---|
2141 | |
---|
2142 | /** |
---|
2143 | * compute all facets of lambda |
---|
2144 | */ |
---|
2145 | t = timer; |
---|
2146 | FL = listOfFacetsAndInteriorVectors(lambda, Qgamma); |
---|
2147 | dbprint("time for facets: "+string(timer - t)); |
---|
2148 | |
---|
2149 | /** |
---|
2150 | * compute all neighbours of lambda |
---|
2151 | */ |
---|
2152 | for (i=size(FL[1]); i>0; i--) |
---|
2153 | { |
---|
2154 | v = FL[1][i][1]; // interior facet normal |
---|
2155 | w = FL[1][i][2]; // interior facet point |
---|
2156 | neighbourHash = getNeighborHash(OC,w,v,mu); |
---|
2157 | hashToInsert = binaryToBigint(neighbourHash); |
---|
2158 | posToInsert = findPlaceToInsert(hashesOfCones,hashToInsert); |
---|
2159 | |
---|
2160 | if(posToInsert > 0) |
---|
2161 | { |
---|
2162 | if (size(#)>0){write(":a "+#[1],string(binaryToBigint(neighbourHash)) + ",");} |
---|
2163 | hashesOfCones = insertToList(hashesOfCones,hashToInsert,posToInsert); |
---|
2164 | workingList = insertToList(workingList,neighbourHash,posToInsert); |
---|
2165 | nConesOpen++; |
---|
2166 | nCones++; |
---|
2167 | } |
---|
2168 | } |
---|
2169 | |
---|
2170 | /** |
---|
2171 | * pick lambdaHash and lambda for next iteration, |
---|
2172 | * set respective entry in workingList to 0 |
---|
2173 | */ |
---|
2174 | lambdaHash = 0; |
---|
2175 | for (i=size(workingList); i>0; i--) |
---|
2176 | { |
---|
2177 | if (typeof(workingList[i])=="intvec") |
---|
2178 | { |
---|
2179 | lambdaHash = workingList[i]; |
---|
2180 | lambda = gitConeFromHash(OC,lambdaHash); |
---|
2181 | if (size(#)>1) {writeGitconeToFile(lambda,#[2]);} |
---|
2182 | workingList[i] = int(0); |
---|
2183 | break; |
---|
2184 | } |
---|
2185 | } |
---|
2186 | nConesOpen--; |
---|
2187 | |
---|
2188 | dbprint("overall: "+string(nCones)+" open: "+string(nConesOpen)+" time for loop: "+string(timer-tt)); |
---|
2189 | } |
---|
2190 | return(hashesOfCones); |
---|
2191 | } |
---|
2192 | example |
---|
2193 | { |
---|
2194 | echo=2; |
---|
2195 | ring R = 0,T(1..10),wp(1,1,1,1,1,1,1,1,1,1); |
---|
2196 | ideal J = |
---|
2197 | T(5)*T(10)-T(6)*T(9)+T(7)*T(8), |
---|
2198 | T(1)*T(9)-T(2)*T(7)+T(4)*T(5), |
---|
2199 | T(1)*T(8)-T(2)*T(6)+T(3)*T(5), |
---|
2200 | T(1)*T(10)-T(3)*T(7)+T(4)*T(6), |
---|
2201 | T(2)*T(10)-T(3)*T(9)+T(4)*T(8); |
---|
2202 | intmat Q[5][10] = |
---|
2203 | 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, |
---|
2204 | 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, |
---|
2205 | 0, 1, 1, 0, 0, 0, -1, 1, 0, 0, |
---|
2206 | 0, 1, 0, 1, 0, -1, 0, 0, 1, 0, |
---|
2207 | 0, 0, 1, 1, -1, 0, 0, 0, 0, 1; |
---|
2208 | |
---|
2209 | list AF= afaces(J,nrows(Q)); |
---|
2210 | AF=fullDimImages(AF,Q); |
---|
2211 | AF = minimalAfaces(AF); |
---|
2212 | list OC = orbitCones(AF,Q); |
---|
2213 | cone Qgamma = coneViaPoints(transpose(Q)); |
---|
2214 | list GIT = GITfanFromOrbitCones(OC,Q,Qgamma); |
---|
2215 | size(GIT); |
---|
2216 | } |
---|
2217 | |
---|
2218 | |
---|
2219 | |
---|
2220 | |
---|
2221 | |
---|
2222 | proc GITfanParallel(list OC, intmat Q, cone Qgamma, list #) |
---|
2223 | "USAGE: GITfanParallel(OC, Q, Qgamma [, file1]); OC:list, Q:intmat, Qgamma:cone, file1:string |
---|
2224 | PURPOSE: Returns the common refinement of the cones given in |
---|
2225 | 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. |
---|
2226 | To obtain the whole GIT-fan Qgamma has to be take the cone generated by the columns of Q. |
---|
2227 | RETURN: a list containing the bigint hashes of the GIT cones. |
---|
2228 | NOTE: The proceduce uses parallel computation for the construction of the GIT-cones. |
---|
2229 | EXAMPLE: example GITfanParallel; shows an example |
---|
2230 | " |
---|
2231 | { |
---|
2232 | /** |
---|
2233 | * stores the hashes of all maximal GIT cones computed |
---|
2234 | */ |
---|
2235 | list hashesOfCones; |
---|
2236 | /** |
---|
2237 | * stores to the corresponding maximal GIT cone in hashesOfCones |
---|
2238 | * - 0, if guaranteed that all adjacent GIT cones are known |
---|
2239 | * or are to be computed in the next iteration (*) |
---|
2240 | * - hash as intvec, otherwise |
---|
2241 | */ |
---|
2242 | list workingList; |
---|
2243 | |
---|
2244 | |
---|
2245 | /** |
---|
2246 | * compute starting cone |
---|
2247 | */ |
---|
2248 | bigintmat w,v; |
---|
2249 | cone lambda; |
---|
2250 | intvec lambdaHash; |
---|
2251 | while(dimension(lambda) <> nrows(Q)){ |
---|
2252 | w = randConeEl(transpose(Q),100); |
---|
2253 | dbprint("testing "+string(w)); |
---|
2254 | if (containsRelatively(Qgamma,w)) { |
---|
2255 | lambda,lambdaHash = GITcone(OC,w); |
---|
2256 | dbprint("computed cone of dimension "+string(dimension(lambda))); |
---|
2257 | } |
---|
2258 | } |
---|
2259 | int nCones = 1; // essentially size(hashesOfCones) |
---|
2260 | int nConesOpen = 1; // essentially size(workingList)+1, see (*) above |
---|
2261 | |
---|
2262 | |
---|
2263 | /** |
---|
2264 | * initialize lists |
---|
2265 | */ |
---|
2266 | bigint hashToInsert = binaryToBigint(lambdaHash); |
---|
2267 | int posToInsert = 1; |
---|
2268 | hashesOfCones[1] = hashToInsert; |
---|
2269 | workingList[1] = int(0); |
---|
2270 | if (size(#)>0) {write(":w "+#[1],string(binaryToBigint(lambdaHash)) + ",");} |
---|
2271 | //if (size(#)>1) {write(":w "+#[2],"list listOfMaximalCones;");writeGitconeToFile(lambda,#[2]);} |
---|
2272 | |
---|
2273 | |
---|
2274 | list iterationArgs = list(list(lambdaHash,OC,Qgamma)); |
---|
2275 | list iterationRes; |
---|
2276 | |
---|
2277 | /** |
---|
2278 | * traverse fan |
---|
2279 | */ |
---|
2280 | int i,j,t,tloop; |
---|
2281 | list FL; |
---|
2282 | list neighbourHashes; |
---|
2283 | intvec neighbourHash; |
---|
2284 | while (size(iterationArgs)>0) |
---|
2285 | { |
---|
2286 | tloop=rtimer; |
---|
2287 | |
---|
2288 | /** |
---|
2289 | * compute all neighbours of lambda |
---|
2290 | */ |
---|
2291 | t = rtimer; |
---|
2292 | iterationRes = parallelWaitAll("computeNeighbourHashes",iterationArgs); |
---|
2293 | dbprint("time neighbours: "+string(rtimer - t)); |
---|
2294 | |
---|
2295 | /** |
---|
2296 | * central book keeping |
---|
2297 | */ |
---|
2298 | t = rtimer; |
---|
2299 | for (i=1; i<=size(iterationRes); i++) |
---|
2300 | { |
---|
2301 | neighbourHashes = iterationRes[i]; |
---|
2302 | for (j=1; j<=size(neighbourHashes); j++) |
---|
2303 | { |
---|
2304 | neighbourHash = neighbourHashes[j]; |
---|
2305 | hashToInsert = binaryToBigint(neighbourHash); |
---|
2306 | posToInsert = findPlaceToInsert(hashesOfCones,hashToInsert); |
---|
2307 | if(posToInsert > 0) |
---|
2308 | { |
---|
2309 | if (size(#)>0){write(":a "+#[1],string(binaryToBigint(neighbourHash)) + ",");} |
---|
2310 | hashesOfCones = insertToList(hashesOfCones,hashToInsert,posToInsert); |
---|
2311 | workingList = insertToList(workingList,neighbourHash,posToInsert); |
---|
2312 | nConesOpen++; |
---|
2313 | nCones++; |
---|
2314 | } |
---|
2315 | } |
---|
2316 | } |
---|
2317 | nConesOpen = nConesOpen - size(iterationArgs); |
---|
2318 | dbprint("time bookkeeping: "+string(rtimer - t)); |
---|
2319 | |
---|
2320 | /** |
---|
2321 | * pick arguments for next iteration, |
---|
2322 | * set respective entry in workingList to 0 |
---|
2323 | */ |
---|
2324 | t = rtimer; |
---|
2325 | iterationArgs = list(); |
---|
2326 | for (i=size(workingList); i>0; i--) |
---|
2327 | { |
---|
2328 | if (typeof(workingList[i])=="intvec") |
---|
2329 | { |
---|
2330 | iterationArgs[size(iterationArgs)+1] = list(workingList[i],OC,Qgamma); |
---|
2331 | workingList[i] = int(0); |
---|
2332 | if (size(iterationArgs) >= getcores()) |
---|
2333 | { |
---|
2334 | break; |
---|
2335 | } |
---|
2336 | } |
---|
2337 | } |
---|
2338 | dbprint("time preparation: "+string(rtimer - t)); |
---|
2339 | |
---|
2340 | dbprint("overall: "+string(nCones)+" open: "+string(nConesOpen)+" time loop: "+string(rtimer-tloop)); |
---|
2341 | } |
---|
2342 | |
---|
2343 | if (size(#)==0) |
---|
2344 | { |
---|
2345 | return(hashesOfCones); |
---|
2346 | } |
---|
2347 | } |
---|
2348 | example |
---|
2349 | { |
---|
2350 | echo=2; |
---|
2351 | setcores(4); |
---|
2352 | ring R = 0,T(1..10),wp(1,1,1,1,1,1,1,1,1,1); |
---|
2353 | ideal J = |
---|
2354 | T(5)*T(10)-T(6)*T(9)+T(7)*T(8), |
---|
2355 | T(1)*T(9)-T(2)*T(7)+T(4)*T(5), |
---|
2356 | T(1)*T(8)-T(2)*T(6)+T(3)*T(5), |
---|
2357 | T(1)*T(10)-T(3)*T(7)+T(4)*T(6), |
---|
2358 | T(2)*T(10)-T(3)*T(9)+T(4)*T(8); |
---|
2359 | intmat Q[5][10] = |
---|
2360 | 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, |
---|
2361 | 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, |
---|
2362 | 0, 1, 1, 0, 0, 0, -1, 1, 0, 0, |
---|
2363 | 0, 1, 0, 1, 0, -1, 0, 0, 1, 0, |
---|
2364 | 0, 0, 1, 1, -1, 0, 0, 0, 0, 1; |
---|
2365 | |
---|
2366 | list AF= afaces(J); |
---|
2367 | print(size(AF)); |
---|
2368 | list OC = orbitCones(AF,Q); |
---|
2369 | cone Qgamma = coneViaPoints(transpose(Q)); |
---|
2370 | list GIT = GITfanParallel(OC,Q,Qgamma); |
---|
2371 | size(GIT); |
---|
2372 | } |
---|
2373 | |
---|
2374 | // not static to be used in parallel.lib |
---|
2375 | proc computeNeighbourHashes(intvec lambdaHash, list OC, cone Qgamma) |
---|
2376 | { |
---|
2377 | /** |
---|
2378 | * compute all facets of lambda |
---|
2379 | */ |
---|
2380 | cone lambda = gitConeFromHash(OC,lambdaHash); |
---|
2381 | list FL = listOfFacetsAndInteriorVectors(lambda, Qgamma); |
---|
2382 | |
---|
2383 | /** |
---|
2384 | * compute all minimal hashes of neighbours of lambda |
---|
2385 | */ |
---|
2386 | bigintmat v,w; |
---|
2387 | intvec neighbourHash; |
---|
2388 | list neighbourHashes; |
---|
2389 | for (int i=size(FL[1]); i>0; i--) |
---|
2390 | { |
---|
2391 | v = FL[1][i][1]; // interior facet normal |
---|
2392 | w = FL[1][i][2]; // interior facet point |
---|
2393 | neighbourHash = getNeighborHash(OC,w,v,1024); |
---|
2394 | neighbourHashes[i] = neighbourHash; |
---|
2395 | } |
---|
2396 | |
---|
2397 | return (neighbourHashes); |
---|
2398 | } |
---|
2399 | |
---|
2400 | |
---|
2401 | |
---|
2402 | proc minimalAfaces(list listOfAfaces) |
---|
2403 | "USAGE: minimalAfaces(listOfAfaces); listOfAfaces: list |
---|
2404 | PURPOSE: Returns a list of all minimal a-faces. Note that listOfAfaces must only contain |
---|
2405 | afaces which project to full dimension. |
---|
2406 | RETURN: a list of intvecs |
---|
2407 | EXAMPLE: example minimalAfaces; shows an example |
---|
2408 | " |
---|
2409 | { |
---|
2410 | int i,j; |
---|
2411 | for (i=1; i<=size(listOfAfaces); i++) |
---|
2412 | { |
---|
2413 | for (j=1; j<=size(listOfAfaces); j++) |
---|
2414 | { |
---|
2415 | if (i!=j) |
---|
2416 | { |
---|
2417 | if (isSubset(listOfAfaces[i],listOfAfaces[j])) |
---|
2418 | { |
---|
2419 | listOfAfaces = delete(listOfAfaces,j); |
---|
2420 | if (j<i) |
---|
2421 | { |
---|
2422 | i = i-1; |
---|
2423 | } |
---|
2424 | j = j-1; |
---|
2425 | } |
---|
2426 | } |
---|
2427 | } |
---|
2428 | } |
---|
2429 | return(listOfAfaces); |
---|
2430 | } |
---|
2431 | example |
---|
2432 | { |
---|
2433 | echo=2; |
---|
2434 | setcores(4); |
---|
2435 | ring R = 0,T(1..10),wp(1,1,1,1,1,1,1,1,1,1); |
---|
2436 | ideal J = |
---|
2437 | T(5)*T(10)-T(6)*T(9)+T(7)*T(8), |
---|
2438 | T(1)*T(9)-T(2)*T(7)+T(4)*T(5), |
---|
2439 | T(1)*T(8)-T(2)*T(6)+T(3)*T(5), |
---|
2440 | T(1)*T(10)-T(3)*T(7)+T(4)*T(6), |
---|
2441 | T(2)*T(10)-T(3)*T(9)+T(4)*T(8); |
---|
2442 | intmat Q[5][10] = |
---|
2443 | 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, |
---|
2444 | 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, |
---|
2445 | 0, 1, 1, 0, 0, 0, -1, 1, 0, 0, |
---|
2446 | 0, 1, 0, 1, 0, -1, 0, 0, 1, 0, |
---|
2447 | 0, 0, 1, 1, -1, 0, 0, 0, 0, 1; |
---|
2448 | list AF= afaces(J,nrows(Q)); |
---|
2449 | size(AF); |
---|
2450 | AF=fullDimImages(AF,Q); |
---|
2451 | size(AF); |
---|
2452 | AF=minimalAfaces(AF); |
---|
2453 | size(AF); |
---|
2454 | } |
---|
2455 | |
---|
2456 | |
---|
2457 | |
---|
2458 | proc GITfan(ideal J, intmat Q, list #) |
---|
2459 | "USAGE: GITfan(J,Q [, G]); J:ideal, Q:intmat, G:list |
---|
2460 | PURPOSE: Computes the GIT fan associated to J and Q. Optionally a symmetry group action on the column space of Q can be specified. |
---|
2461 | RETURN: a fan, the GIT fan. |
---|
2462 | 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. If used with the optional argument G, the orbit decomposition of the simplex of columns of Q is computed. Refer to the Singular documentation how to do this more efficiently using GAP. |
---|
2463 | EXAMPLE: example GITfan; shows an example |
---|
2464 | " |
---|
2465 | { |
---|
2466 | list GIT; |
---|
2467 | list OC; |
---|
2468 | if (size(#)>0){ |
---|
2469 | (GIT,OC) = GITfanWrapperWithSymmetry(J,Q,#); |
---|
2470 | } else { |
---|
2471 | list AF= afaces(J,nrows(Q)); |
---|
2472 | AF=fullDimImages(AF,Q); |
---|
2473 | AF = minimalAfaces(AF); |
---|
2474 | list OC = orbitCones(AF,Q); |
---|
2475 | cone Qgamma = coneViaPoints(transpose(Q)); |
---|
2476 | list GIT = GITfanParallel(OC,Q,Qgamma); |
---|
2477 | } |
---|
2478 | fan Sigma = hashesToFan(GIT,OC); |
---|
2479 | return(Sigma); |
---|
2480 | } |
---|
2481 | example |
---|
2482 | { |
---|
2483 | echo=2; |
---|
2484 | setcores(4); |
---|
2485 | ring R = 0,T(1..10),wp(1,1,1,1,1,1,1,1,1,1); |
---|
2486 | ideal J = |
---|
2487 | T(5)*T(10)-T(6)*T(9)+T(7)*T(8), |
---|
2488 | T(1)*T(9)-T(2)*T(7)+T(4)*T(5), |
---|
2489 | T(1)*T(8)-T(2)*T(6)+T(3)*T(5), |
---|
2490 | T(1)*T(10)-T(3)*T(7)+T(4)*T(6), |
---|
2491 | T(2)*T(10)-T(3)*T(9)+T(4)*T(8); |
---|
2492 | intmat Q[5][10] = |
---|
2493 | 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, |
---|
2494 | 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, |
---|
2495 | 0, 1, 1, 0, 0, 0, -1, 1, 0, 0, |
---|
2496 | 0, 1, 0, 1, 0, -1, 0, 0, 1, 0, |
---|
2497 | 0, 0, 1, 1, -1, 0, 0, 0, 0, 1; |
---|
2498 | fan GIT = GITfan(J,Q); |
---|
2499 | |
---|
2500 | intmat Q[5][10] = |
---|
2501 | 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, |
---|
2502 | 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, |
---|
2503 | 0, 1, 1, 0, 0, 0, -1, 1, 0, 0, |
---|
2504 | 0, 1, 0, 1, 0, -1, 0, 0, 1, 0, |
---|
2505 | 0, 0, 1, 1, -1, 0, 0, 0, 0, 1; |
---|
2506 | list simplexSymmetryGroup = G25Action(); |
---|
2507 | fan GIT2 = GITfan(J,Q,simplexSymmetryGroup); |
---|
2508 | |
---|
2509 | } |
---|
2510 | |
---|
2511 | |
---|
2512 | proc hashToCone(bigint v, list OC) |
---|
2513 | "USAGE: hashToCone(v, OC): v bigint, OC list of cones. |
---|
2514 | ASSUME: the elements of OC are the orbit cones used in the hash representation of the GIT cones. |
---|
2515 | RETURN: a cone, the intersection of the cones in OC according to the binary representation of the hash v. |
---|
2516 | EXAMPLE: example hashToCone; shows an example |
---|
2517 | " |
---|
2518 | { |
---|
2519 | intvec J = bigintToBinary(v, size(OC)); |
---|
2520 | return(convexIntersection(list(OC[J]))); |
---|
2521 | } |
---|
2522 | example |
---|
2523 | { |
---|
2524 | echo = 2; |
---|
2525 | setcores(4); |
---|
2526 | ring R = 0,T(1..10),wp(1,1,1,1,1,1,1,1,1,1); |
---|
2527 | ideal J = |
---|
2528 | T(5)*T(10)-T(6)*T(9)+T(7)*T(8), |
---|
2529 | T(1)*T(9)-T(2)*T(7)+T(4)*T(5), |
---|
2530 | T(1)*T(8)-T(2)*T(6)+T(3)*T(5), |
---|
2531 | T(1)*T(10)-T(3)*T(7)+T(4)*T(6), |
---|
2532 | T(2)*T(10)-T(3)*T(9)+T(4)*T(8); |
---|
2533 | intmat Q[5][10] = |
---|
2534 | 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, |
---|
2535 | 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, |
---|
2536 | 0, 1, 1, 0, 0, 0, -1, 1, 0, 0, |
---|
2537 | 0, 1, 0, 1, 0, -1, 0, 0, 1, 0, |
---|
2538 | 0, 0, 1, 1, -1, 0, 0, 0, 0, 1; |
---|
2539 | list AF= afaces(J,nrows(Q)); |
---|
2540 | AF=fullDimImages(AF,Q); |
---|
2541 | AF = minimalAfaces(AF); |
---|
2542 | list OC = orbitCones(AF,Q); |
---|
2543 | bigint v = 21300544; |
---|
2544 | hashToCone(v, OC); |
---|
2545 | } |
---|
2546 | |
---|
2547 | |
---|
2548 | proc bigintToBinary(bigint n, int r) |
---|
2549 | " |
---|
2550 | USAGE: bigintToBinary(n, r): n bigint, r int. |
---|
2551 | ASSUME: n is smaller then 2^r. |
---|
2552 | RETURN: an intvec, with entries the positions of 1 in the binary representation of n with r bits. |
---|
2553 | EXAMPLE: example bigintToBinary; shows an example |
---|
2554 | " |
---|
2555 | { |
---|
2556 | int k = r-1; |
---|
2557 | |
---|
2558 | intvec v; |
---|
2559 | bigint n0 = n; |
---|
2560 | |
---|
2561 | while(n0 > 0){ |
---|
2562 | bigint tmp = bigint(2)^k; |
---|
2563 | |
---|
2564 | while(tmp > n0){ |
---|
2565 | k--; |
---|
2566 | tmp = bigint(2)^k; |
---|
2567 | } |
---|
2568 | |
---|
2569 | v = k+1,v; |
---|
2570 | n0 = n0 - tmp; |
---|
2571 | k--; |
---|
2572 | |
---|
2573 | kill tmp; |
---|
2574 | } |
---|
2575 | |
---|
2576 | v = v[1..size(v)-1]; |
---|
2577 | return(v); |
---|
2578 | } |
---|
2579 | example |
---|
2580 | { |
---|
2581 | echo = 2; |
---|
2582 | bigintToBinary(bigint(2)^90-1, 90); |
---|
2583 | } |
---|
2584 | |
---|
2585 | |
---|
2586 | |
---|
2587 | |
---|
2588 | proc hashesToFan(list hashes, list OC) |
---|
2589 | "USAGE: hashesToFan(hashes, OC): hashes list of bigint, OC list of cones. |
---|
2590 | ASSUME: the elements of OC are the orbit cones used in the hash representation of the GIT cones. |
---|
2591 | RETURN: a fan, with maximal cones the intersections of the cones in OC according to the binary representation of the hashes. |
---|
2592 | EXAMPLE: example hashesToFan; shows an example |
---|
2593 | " |
---|
2594 | { |
---|
2595 | fan Sigma = emptyFan(ambientDimension(OC[1])); |
---|
2596 | for (int i=1;i<=size(hashes);i++){ |
---|
2597 | insertCone(Sigma,hashToCone(hashes[i],OC),0); |
---|
2598 | } |
---|
2599 | return(Sigma); |
---|
2600 | } |
---|
2601 | example |
---|
2602 | { |
---|
2603 | echo = 2; |
---|
2604 | setcores(4); |
---|
2605 | ring R = 0,T(1..10),wp(1,1,1,1,1,1,1,1,1,1); |
---|
2606 | ideal J = |
---|
2607 | T(5)*T(10)-T(6)*T(9)+T(7)*T(8), |
---|
2608 | T(1)*T(9)-T(2)*T(7)+T(4)*T(5), |
---|
2609 | T(1)*T(8)-T(2)*T(6)+T(3)*T(5), |
---|
2610 | T(1)*T(10)-T(3)*T(7)+T(4)*T(6), |
---|
2611 | T(2)*T(10)-T(3)*T(9)+T(4)*T(8); |
---|
2612 | intmat Q[5][10] = |
---|
2613 | 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, |
---|
2614 | 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, |
---|
2615 | 0, 1, 1, 0, 0, 0, -1, 1, 0, 0, |
---|
2616 | 0, 1, 0, 1, 0, -1, 0, 0, 1, 0, |
---|
2617 | 0, 0, 1, 1, -1, 0, 0, 0, 0, 1; |
---|
2618 | list AF= afaces(J,nrows(Q)); |
---|
2619 | AF=fullDimImages(AF,Q); |
---|
2620 | AF = minimalAfaces(AF); |
---|
2621 | list OC = orbitCones(AF,Q); |
---|
2622 | cone Qgamma = coneViaPoints(transpose(Q)); |
---|
2623 | list GIT = GITfanParallel(OC,Q,Qgamma); |
---|
2624 | fan Sigma = hashesToFan(GIT,OC); |
---|
2625 | } |
---|
2626 | |
---|
2627 | |
---|
2628 | |
---|
2629 | |
---|
2630 | ///////////////////////////////////// |
---|
2631 | |
---|
2632 | proc gkzFan(intmat Q) |
---|
2633 | "USAGE: gkzFan(Q); a: ideal, Q:intmat |
---|
2634 | PURPOSE: Returns the GKZ-fan of the matrix Q. |
---|
2635 | RETURN: a fan. |
---|
2636 | EXAMPLE: example gkzFan; shows an example |
---|
2637 | " |
---|
2638 | { |
---|
2639 | // only difference to gitFan: |
---|
2640 | // it suffices to consider all faces |
---|
2641 | // that are simplicial: |
---|
2642 | list OC = simplicialToricOrbitCones(Q); |
---|
2643 | print(size(OC)); |
---|
2644 | cone Qgamma = coneViaPoints(transpose(Q)); |
---|
2645 | list GIT = GITfanParallel(OC,Q,Qgamma); |
---|
2646 | fan Sigma = hashesToFan(GIT,OC); |
---|
2647 | return(Sigma); |
---|
2648 | } |
---|
2649 | example |
---|
2650 | { |
---|
2651 | echo=2; |
---|
2652 | intmat Q[3][4] = |
---|
2653 | 1,0,1,0, |
---|
2654 | 0,1,0,1, |
---|
2655 | 0,0,1,1; |
---|
2656 | |
---|
2657 | gkzFan(Q); |
---|
2658 | } |
---|
2659 | |
---|
2660 | |
---|
2661 | |
---|
2662 | ///////////////////////////////////// |
---|
2663 | |
---|
2664 | // Computes all simplicial orbit cones |
---|
2665 | // w.r.t. the 0-ideal: |
---|
2666 | static proc simplicialToricOrbitCones(bigintmat Q){ |
---|
2667 | intvec gam0; |
---|
2668 | list OC; |
---|
2669 | cone c; |
---|
2670 | int r = ncols(Q); |
---|
2671 | int j; |
---|
2672 | |
---|
2673 | for(int i = 1; i < 2^r; i++ ){ |
---|
2674 | gam0 = int2face(i,r); |
---|
2675 | |
---|
2676 | // each simplicial cone is generated by |
---|
2677 | // exactly nrows(Q) many columns of Q: |
---|
2678 | if(size(gam0) == nrows(Q)){ |
---|
2679 | bigintmat M[size(gam0)][nrows(Q)]; |
---|
2680 | |
---|
2681 | for(j = 1; j <= size(gam0); j++){ |
---|
2682 | M[j,1..ncols(M)] = Q[1..nrows(Q),gam0[j]]; |
---|
2683 | } |
---|
2684 | |
---|
2685 | c = coneViaPoints(M); |
---|
2686 | |
---|
2687 | if((dimension(c) == nrows(Q)) and (!(listContainsCone(OC, c)))){ |
---|
2688 | OC[size(OC)+1] = c; |
---|
2689 | } |
---|
2690 | |
---|
2691 | kill M; |
---|
2692 | } |
---|
2693 | } |
---|
2694 | |
---|
2695 | return(OC); |
---|
2696 | } |
---|
2697 | example |
---|
2698 | { |
---|
2699 | echo = 2; |
---|
2700 | bigintmat Q[3][4] = |
---|
2701 | 1,0,1,0, |
---|
2702 | 0,1,0,1, |
---|
2703 | 0,0,1,1; |
---|
2704 | |
---|
2705 | list OC = simplicialToricOrbitCones(Q); |
---|
2706 | print(OC); |
---|
2707 | |
---|
2708 | bigintmat Q[5][15] = |
---|
2709 | 1,0,0,0,0,1,1,1,1,0,0,0,0,0,0, |
---|
2710 | 0,1,0,0,0,1,0,0,0,1,1,1,0,0,0, |
---|
2711 | 0,0,1,0,0,0,1,0,0,1,0,0,1,1,0, |
---|
2712 | 0,0,0,1,0,0,0,1,0,0,1,0,1,0,1, |
---|
2713 | 0,0,0,0,1,0,0,0,1,0,0,1,0,1,1; |
---|
2714 | |
---|
2715 | list OC = simplicialToricOrbitCones(Q); |
---|
2716 | print(size(OC)); |
---|
2717 | } |
---|
2718 | |
---|
2719 | |
---|
2720 | proc G25Action() |
---|
2721 | "USAGE: G25Action(Q); |
---|
2722 | PURPOSE: Returns a representation of S5 as a subgroup of S10 with the action on the Grassmannian G25. |
---|
2723 | RETURN: list of with elements of type permutation. |
---|
2724 | EXAMPLE: example G25Action; shows an example |
---|
2725 | " |
---|
2726 | { |
---|
2727 | list simplexSymmetryGroup = permutationFromIntvec(intvec( 1 .. 10 )), |
---|
2728 | permutationFromIntvec(intvec( 1, 2, 4, 3, 5, 7, 6, 9, 8, 10 )), |
---|
2729 | permutationFromIntvec(intvec( 1, 3, 2, 4, 6, 5, 7, 8, 10, 9 )), |
---|
2730 | permutationFromIntvec(intvec( 1, 3, 4, 2, 6, 7, 5, 10, 8, 9 )), |
---|
2731 | permutationFromIntvec(intvec( 1, 4, 2, 3, 7, 5, 6, 9, 10, 8 )), |
---|
2732 | permutationFromIntvec(intvec( 1, 4, 3, 2, 7, 6, 5, 10, 9, 8 )), |
---|
2733 | permutationFromIntvec(intvec( 1, 5, 6, 7, 2, 3, 4, 8, 9, 10 )), |
---|
2734 | permutationFromIntvec(intvec( 1, 5, 7, 6, 2, 4, 3, 9, 8, 10 )), |
---|
2735 | permutationFromIntvec(intvec( 1, 6, 5, 7, 3, 2, 4, 8, 10, 9 )), |
---|
2736 | permutationFromIntvec(intvec( 1, 6, 7, 5, 3, 4, 2, 10, 8, 9 )), |
---|
2737 | permutationFromIntvec(intvec( 1, 7, 5, 6, 4, 2, 3, 9, 10, 8 )), |
---|
2738 | permutationFromIntvec(intvec( 1, 7, 6, 5, 4, 3, 2, 10, 9, 8 )), |
---|
2739 | permutationFromIntvec(intvec( 2, 1, 3, 4, 5, 8, 9, 6, 7, 10 )), |
---|
2740 | permutationFromIntvec(intvec( 2, 1, 4, 3, 5, 9, 8, 7, 6, 10 )), |
---|
2741 | permutationFromIntvec(intvec( 2, 3, 1, 4, 8, 5, 9, 6, 10, 7 )), |
---|
2742 | permutationFromIntvec(intvec( 2, 3, 4, 1, 8, 9, 5, 10, 6, 7 )), |
---|
2743 | permutationFromIntvec(intvec( 2, 4, 1, 3, 9, 5, 8, 7, 10, 6 )), |
---|
2744 | permutationFromIntvec(intvec( 2, 4, 3, 1, 9, 8, 5, 10, 7, 6 )), |
---|
2745 | permutationFromIntvec(intvec( 2, 5, 8, 9, 1, 3, 4, 6, 7, 10 )), |
---|
2746 | permutationFromIntvec(intvec( 2, 5, 9, 8, 1, 4, 3, 7, 6, 10 )), |
---|
2747 | permutationFromIntvec(intvec( 2, 8, 5, 9, 3, 1, 4, 6, 10, 7 )), |
---|
2748 | permutationFromIntvec(intvec( 2, 8, 9, 5, 3, 4, 1, 10, 6, 7 )), |
---|
2749 | permutationFromIntvec(intvec( 2, 9, 5, 8, 4, 1, 3, 7, 10, 6 )), |
---|
2750 | permutationFromIntvec(intvec( 2, 9, 8, 5, 4, 3, 1, 10, 7, 6 )), |
---|
2751 | permutationFromIntvec(intvec( 3, 1, 2, 4, 6, 8, 10, 5, 7, 9 )), |
---|
2752 | permutationFromIntvec(intvec( 3, 1, 4, 2, 6, 10, 8, 7, 5, 9 )), |
---|
2753 | permutationFromIntvec(intvec( 3, 2, 1, 4, 8, 6, 10, 5, 9, 7 )), |
---|
2754 | permutationFromIntvec(intvec( 3, 2, 4, 1, 8, 10, 6, 9, 5, 7 )), |
---|
2755 | permutationFromIntvec(intvec( 3, 4, 1, 2, 10, 6, 8, 7, 9, 5 )), |
---|
2756 | permutationFromIntvec(intvec( 3, 4, 2, 1, 10, 8, 6, 9, 7, 5 )), |
---|
2757 | permutationFromIntvec(intvec( 3, 6, 8, 10, 1, 2, 4, 5, 7, 9 )), |
---|
2758 | permutationFromIntvec(intvec( 3, 6, 10, 8, 1, 4, 2, 7, 5, 9 )), |
---|
2759 | permutationFromIntvec(intvec( 3, 8, 6, 10, 2, 1, 4, 5, 9, 7 )), |
---|
2760 | permutationFromIntvec(intvec( 3, 8, 10, 6, 2, 4, 1, 9, 5, 7 )), |
---|
2761 | permutationFromIntvec(intvec( 3, 10, 6, 8, 4, 1, 2, 7, 9, 5 )), |
---|
2762 | permutationFromIntvec(intvec( 3, 10, 8, 6, 4, 2, 1, 9, 7, 5 )), |
---|
2763 | permutationFromIntvec(intvec( 4, 1, 2, 3, 7, 9, 10, 5, 6, 8 )), |
---|
2764 | permutationFromIntvec(intvec( 4, 1, 3, 2, 7, 10, 9, 6, 5, 8 )), |
---|
2765 | permutationFromIntvec(intvec( 4, 2, 1, 3, 9, 7, 10, 5, 8, 6 )), |
---|
2766 | permutationFromIntvec(intvec( 4, 2, 3, 1, 9, 10, 7, 8, 5, 6 )), |
---|
2767 | permutationFromIntvec(intvec( 4, 3, 1, 2, 10, 7, 9, 6, 8, 5 )), |
---|
2768 | permutationFromIntvec(intvec( 4, 3, 2, 1, 10, 9, 7, 8, 6, 5 )), |
---|
2769 | permutationFromIntvec(intvec( 4, 7, 9, 10, 1, 2, 3, 5, 6, 8 )), |
---|
2770 | permutationFromIntvec(intvec( 4, 7, 10, 9, 1, 3, 2, 6, 5, 8 )), |
---|
2771 | permutationFromIntvec(intvec( 4, 9, 7, 10, 2, 1, 3, 5, 8, 6 )), |
---|
2772 | permutationFromIntvec(intvec( 4, 9, 10, 7, 2, 3, 1, 8, 5, 6 )), |
---|
2773 | permutationFromIntvec(intvec( 4, 10, 7, 9, 3, 1, 2, 6, 8, 5 )), |
---|
2774 | permutationFromIntvec(intvec( 4, 10, 9, 7, 3, 2, 1, 8, 6, 5 )), |
---|
2775 | permutationFromIntvec(intvec( 5, 1, 6, 7, 2, 8, 9, 3, 4, 10 )), |
---|
2776 | permutationFromIntvec(intvec( 5, 1, 7, 6, 2, 9, 8, 4, 3, 10 )), |
---|
2777 | permutationFromIntvec(intvec( 5, 2, 8, 9, 1, 6, 7, 3, 4, 10 )), |
---|
2778 | permutationFromIntvec(intvec( 5, 2, 9, 8, 1, 7, 6, 4, 3, 10 )), |
---|
2779 | permutationFromIntvec(intvec( 5, 6, 1, 7, 8, 2, 9, 3, 10, 4 )), |
---|
2780 | permutationFromIntvec(intvec( 5, 6, 7, 1, 8, 9, 2, 10, 3, 4 )), |
---|
2781 | permutationFromIntvec(intvec( 5, 7, 1, 6, 9, 2, 8, 4, 10, 3 )), |
---|
2782 | permutationFromIntvec(intvec( 5, 7, 6, 1, 9, 8, 2, 10, 4, 3 )), |
---|
2783 | permutationFromIntvec(intvec( 5, 8, 2, 9, 6, 1, 7, 3, 10, 4 )), |
---|
2784 | permutationFromIntvec(intvec( 5, 8, 9, 2, 6, 7, 1, 10, 3, 4 )), |
---|
2785 | permutationFromIntvec(intvec( 5, 9, 2, 8, 7, 1, 6, 4, 10, 3 )), |
---|
2786 | permutationFromIntvec(intvec( 5, 9, 8, 2, 7, 6, 1, 10, 4, 3 )), |
---|
2787 | permutationFromIntvec(intvec( 6, 1, 5, 7, 3, 8, 10, 2, 4, 9 )), |
---|
2788 | permutationFromIntvec(intvec( 6, 1, 7, 5, 3, 10, 8, 4, 2, 9 )), |
---|
2789 | permutationFromIntvec(intvec( 6, 3, 8, 10, 1, 5, 7, 2, 4, 9 )), |
---|
2790 | permutationFromIntvec(intvec( 6, 3, 10, 8, 1, 7, 5, 4, 2, 9 )), |
---|
2791 | permutationFromIntvec(intvec( 6, 5, 1, 7, 8, 3, 10, 2, 9, 4 )), |
---|
2792 | permutationFromIntvec(intvec( 6, 5, 7, 1, 8, 10, 3, 9, 2, 4 )), |
---|
2793 | permutationFromIntvec(intvec( 6, 7, 1, 5, 10, 3, 8, 4, 9, 2 )), |
---|
2794 | permutationFromIntvec(intvec( 6, 7, 5, 1, 10, 8, 3, 9, 4, 2 )), |
---|
2795 | permutationFromIntvec(intvec( 6, 8, 3, 10, 5, 1, 7, 2, 9, 4 )), |
---|
2796 | permutationFromIntvec(intvec( 6, 8, 10, 3, 5, 7, 1, 9, 2, 4 )), |
---|
2797 | permutationFromIntvec(intvec( 6, 10, 3, 8, 7, 1, 5, 4, 9, 2 )), |
---|
2798 | permutationFromIntvec(intvec( 6, 10, 8, 3, 7, 5, 1, 9, 4, 2 )), |
---|
2799 | permutationFromIntvec(intvec( 7, 1, 5, 6, 4, 9, 10, 2, 3, 8 )), |
---|
2800 | permutationFromIntvec(intvec( 7, 1, 6, 5, 4, 10, 9, 3, 2, 8 )), |
---|
2801 | permutationFromIntvec(intvec( 7, 4, 9, 10, 1, 5, 6, 2, 3, 8 )), |
---|
2802 | permutationFromIntvec(intvec( 7, 4, 10, 9, 1, 6, 5, 3, 2, 8 )), |
---|
2803 | permutationFromIntvec(intvec( 7, 5, 1, 6, 9, 4, 10, 2, 8, 3 )), |
---|
2804 | permutationFromIntvec(intvec( 7, 5, 6, 1, 9, 10, 4, 8, 2, 3 )), |
---|
2805 | permutationFromIntvec(intvec( 7, 6, 1, 5, 10, 4, 9, 3, 8, 2 )), |
---|
2806 | permutationFromIntvec(intvec( 7, 6, 5, 1, 10, 9, 4, 8, 3, 2 )), |
---|
2807 | permutationFromIntvec(intvec( 7, 9, 4, 10, 5, 1, 6, 2, 8, 3 )), |
---|
2808 | permutationFromIntvec(intvec( 7, 9, 10, 4, 5, 6, 1, 8, 2, 3 )), |
---|
2809 | permutationFromIntvec(intvec( 7, 10, 4, 9, 6, 1, 5, 3, 8, 2 )), |
---|
2810 | permutationFromIntvec(intvec( 7, 10, 9, 4, 6, 5, 1, 8, 3, 2 )), |
---|
2811 | permutationFromIntvec(intvec( 8, 2, 5, 9, 3, 6, 10, 1, 4, 7 )), |
---|
2812 | permutationFromIntvec(intvec( 8, 2, 9, 5, 3, 10, 6, 4, 1, 7 )), |
---|
2813 | permutationFromIntvec(intvec( 8, 3, 6, 10, 2, 5, 9, 1, 4, 7 )), |
---|
2814 | permutationFromIntvec(intvec( 8, 3, 10, 6, 2, 9, 5, 4, 1, 7 )), |
---|
2815 | permutationFromIntvec(intvec( 8, 5, 2, 9, 6, 3, 10, 1, 7, 4 )), |
---|
2816 | permutationFromIntvec(intvec( 8, 5, 9, 2, 6, 10, 3, 7, 1, 4 )), |
---|
2817 | permutationFromIntvec(intvec( 8, 6, 3, 10, 5, 2, 9, 1, 7, 4 )), |
---|
2818 | permutationFromIntvec(intvec( 8, 6, 10, 3, 5, 9, 2, 7, 1, 4 )), |
---|
2819 | permutationFromIntvec(intvec( 8, 9, 2, 5, 10, 3, 6, 4, 7, 1 )), |
---|
2820 | permutationFromIntvec(intvec( 8, 9, 5, 2, 10, 6, 3, 7, 4, 1 )), |
---|
2821 | permutationFromIntvec(intvec( 8, 10, 3, 6, 9, 2, 5, 4, 7, 1 )), |
---|
2822 | permutationFromIntvec(intvec( 8, 10, 6, 3, 9, 5, 2, 7, 4, 1 )), |
---|
2823 | permutationFromIntvec(intvec( 9, 2, 5, 8, 4, 7, 10, 1, 3, 6 )), |
---|
2824 | permutationFromIntvec(intvec( 9, 2, 8, 5, 4, 10, 7, 3, 1, 6 )), |
---|
2825 | permutationFromIntvec(intvec( 9, 4, 7, 10, 2, 5, 8, 1, 3, 6 )), |
---|
2826 | permutationFromIntvec(intvec( 9, 4, 10, 7, 2, 8, 5, 3, 1, 6 )), |
---|
2827 | permutationFromIntvec(intvec( 9, 5, 2, 8, 7, 4, 10, 1, 6, 3 )), |
---|
2828 | permutationFromIntvec(intvec( 9, 5, 8, 2, 7, 10, 4, 6, 1, 3 )), |
---|
2829 | permutationFromIntvec(intvec( 9, 7, 4, 10, 5, 2, 8, 1, 6, 3 )), |
---|
2830 | permutationFromIntvec(intvec( 9, 7, 10, 4, 5, 8, 2, 6, 1, 3 )), |
---|
2831 | permutationFromIntvec(intvec( 9, 8, 2, 5, 10, 4, 7, 3, 6, 1 )), |
---|
2832 | permutationFromIntvec(intvec( 9, 8, 5, 2, 10, 7, 4, 6, 3, 1 )), |
---|
2833 | permutationFromIntvec(intvec( 9, 10, 4, 7, 8, 2, 5, 3, 6, 1 )), |
---|
2834 | permutationFromIntvec(intvec( 9, 10, 7, 4, 8, 5, 2, 6, 3, 1 )), |
---|
2835 | permutationFromIntvec(intvec( 10, 3, 6, 8, 4, 7, 9, 1, 2, 5 )), |
---|
2836 | permutationFromIntvec(intvec( 10, 3, 8, 6, 4, 9, 7, 2, 1, 5 )), |
---|
2837 | permutationFromIntvec(intvec( 10, 4, 7, 9, 3, 6, 8, 1, 2, 5 )), |
---|
2838 | permutationFromIntvec(intvec( 10, 4, 9, 7, 3, 8, 6, 2, 1, 5 )), |
---|
2839 | permutationFromIntvec(intvec( 10, 6, 3, 8, 7, 4, 9, 1, 5, 2 )), |
---|
2840 | permutationFromIntvec(intvec( 10, 6, 8, 3, 7, 9, 4, 5, 1, 2 )), |
---|
2841 | permutationFromIntvec(intvec( 10, 7, 4, 9, 6, 3, 8, 1, 5, 2 )), |
---|
2842 | permutationFromIntvec(intvec( 10, 7, 9, 4, 6, 8, 3, 5, 1, 2 )), |
---|
2843 | permutationFromIntvec(intvec( 10, 8, 3, 6, 9, 4, 7, 2, 5, 1 )), |
---|
2844 | permutationFromIntvec(intvec( 10, 8, 6, 3, 9, 7, 4, 5, 2, 1 )), |
---|
2845 | permutationFromIntvec(intvec( 10, 9, 4, 7, 8, 3, 6, 2, 5, 1 )), |
---|
2846 | permutationFromIntvec(intvec( 10, 9, 7, 4, 8, 6, 3, 5, 2, 1 )); |
---|
2847 | return(simplexSymmetryGroup); |
---|
2848 | } |
---|
2849 | example |
---|
2850 | { |
---|
2851 | echo = 2; |
---|
2852 | G25Action(); |
---|
2853 | } |
---|
2854 | |
---|
2855 | |
---|
2856 | proc findOrbits(list G, int #) |
---|
2857 | "USAGE: findOrbits(G [,d]); G list of permutations in a subgroup of the symmetric group; d int minimum cardinality of simplices to be considered; if d is not specified all orbits are computed. |
---|
2858 | PURPOSE: Computes the orbit decomposition of the action of G. |
---|
2859 | RETURN: list of intvec. |
---|
2860 | EXAMPLE: example findOrbits; shows an example |
---|
2861 | " |
---|
2862 | { |
---|
2863 | int d; |
---|
2864 | if (size(#)>0){d=#;} |
---|
2865 | int n = size(permutationToIntvec(G[1])); |
---|
2866 | list listOrbits; |
---|
2867 | list finished; |
---|
2868 | int tst; |
---|
2869 | bigint startel; |
---|
2870 | intvec startelbin; |
---|
2871 | list neworbit,neworbitint; |
---|
2872 | int i,posToInsert; |
---|
2873 | bigint nn; |
---|
2874 | while (size(finished)<2^n){ |
---|
2875 | startel=0; |
---|
2876 | if (size(finished)>0){ |
---|
2877 | tst=0; |
---|
2878 | while ((tst==0) and (startel+1<=size(finished))){ |
---|
2879 | if (finished[int(startel+1)]<>startel){ |
---|
2880 | tst=1; |
---|
2881 | } else { |
---|
2882 | startel=startel+1; |
---|
2883 | } |
---|
2884 | } |
---|
2885 | } |
---|
2886 | if (startel==0){ |
---|
2887 | neworbit[1]= list(); |
---|
2888 | neworbitint[1]=0; |
---|
2889 | } else { |
---|
2890 | startelbin=bigintToBinary(startel,n); |
---|
2891 | neworbitint=list(startel); |
---|
2892 | for (i=2;i<=size(G);i++){ |
---|
2893 | nn=binaryToBigint(applyPermutationToIntvec(startelbin,G[i])); |
---|
2894 | //nn;neworbitint; |
---|
2895 | //"place to insert"; |
---|
2896 | posToInsert = findPlaceToInsert(neworbitint,nn); |
---|
2897 | //"pos";posToInsert; |
---|
2898 | if(posToInsert > 0) |
---|
2899 | { |
---|
2900 | //"vorher";neworbitint; |
---|
2901 | neworbitint = insertToList(neworbitint,nn,posToInsert); |
---|
2902 | //"nachher";neworbitint; |
---|
2903 | } |
---|
2904 | } |
---|
2905 | for (i=1;i<=size(neworbitint);i++){ |
---|
2906 | neworbit[i]=bigintToBinary(neworbitint[i],n); |
---|
2907 | } |
---|
2908 | } |
---|
2909 | if (size(neworbit[1])>=d){ |
---|
2910 | listOrbits[size(listOrbits)+1]=neworbit; |
---|
2911 | } |
---|
2912 | finished=sort(finished+neworbitint)[1]; |
---|
2913 | } |
---|
2914 | return(listOrbits);} |
---|
2915 | example |
---|
2916 | { |
---|
2917 | list G = G25Action(); |
---|
2918 | list orb = findOrbits(G); |
---|
2919 | for (int i=1;i<=size(orb);i++){orb[i][1];} |
---|
2920 | } |
---|
2921 | |
---|
2922 | |
---|
2923 | |
---|
2924 | static proc GITfanWrapperWithSymmetry(ideal J, intmat Q, list simplexSymmetryGroup){ |
---|
2925 | list orb = findOrbits(simplexSymmetryGroup,nrows(Q)); |
---|
2926 | list simplexOrbitRepresentatives; |
---|
2927 | for (int i=1;i<=size(orb);i++){simplexOrbitRepresentatives[i]=orb[i][1];} |
---|
2928 | list afaceOrbitRepresentatives=afaces(J,simplexOrbitRepresentatives); |
---|
2929 | list fulldimAfaceOrbitRepresentatives=fullDimImages(afaceOrbitRepresentatives,Q); |
---|
2930 | list afaceOrbits=computeAfaceOrbits(fulldimAfaceOrbitRepresentatives,simplexSymmetryGroup); |
---|
2931 | list minAfaceOrbits = minimalAfaceOrbits(afaceOrbits); |
---|
2932 | list listOfOrbitConeOrbits = orbitConeOrbits(minAfaceOrbits,Q); |
---|
2933 | list listOfMinimalOrbitConeOrbits = minimalOrbitConeOrbits(listOfOrbitConeOrbits); |
---|
2934 | list Asigma = groupActionOnQImage(simplexSymmetryGroup,Q); |
---|
2935 | list actionOnOrbitconeIndices = groupActionOnHashes(Asigma,listOfOrbitConeOrbits); |
---|
2936 | list OClist = listOfOrbitConeOrbits[1]; |
---|
2937 | for (i =2;i<=size(listOfOrbitConeOrbits);i++){ |
---|
2938 | OClist = OClist + listOfOrbitConeOrbits[i]; |
---|
2939 | } |
---|
2940 | cone mov = coneViaPoints(transpose(Q)); |
---|
2941 | mov = canonicalizeCone(mov); |
---|
2942 | list Sigma = GITfanParallelSymmetric(OClist, Q, mov, actionOnOrbitconeIndices); |
---|
2943 | return(Sigma, OClist); |
---|
2944 | } |
---|