1 | /////////////////////////////////////////////////////////////////////////////// |
---|
2 | version="$Id$"; |
---|
3 | category="Commutative Algebra"; |
---|
4 | info=" |
---|
5 | LIBRARY: ellipticCovers.lib Gromov Witten numbers of elliptic curves |
---|
6 | |
---|
7 | AUTHORS: J. Boehm, boehm @ mathematik.uni-kl.de |
---|
8 | A. Buchholz, buchholz @ math.uni-sb.de |
---|
9 | H. Markwig hannah @ math.uni-sb.de |
---|
10 | |
---|
11 | OVERVIEW: |
---|
12 | |
---|
13 | KEYWORDS: |
---|
14 | |
---|
15 | TYPES: |
---|
16 | |
---|
17 | PROCEDURES: |
---|
18 | |
---|
19 | "; |
---|
20 | |
---|
21 | |
---|
22 | LIB "parallel.lib"; |
---|
23 | |
---|
24 | |
---|
25 | proc mod_init() |
---|
26 | { |
---|
27 | newstruct("graph","list vertices, list edges"); |
---|
28 | newstruct("Net","list rows"); |
---|
29 | |
---|
30 | system("install","graph","print",printGraph,1); |
---|
31 | system("install","Net","print",printNet,1); |
---|
32 | system("install","Net","+",catNet,2); |
---|
33 | |
---|
34 | } |
---|
35 | |
---|
36 | |
---|
37 | proc max(int n, int m){ |
---|
38 | if (n>m){return(n);} |
---|
39 | return(m);} |
---|
40 | |
---|
41 | |
---|
42 | proc catNet(Net N, Net M) |
---|
43 | { |
---|
44 | list L; |
---|
45 | list LN=N.rows; |
---|
46 | list LM=M.rows; |
---|
47 | int widthN=size(LN[1]); |
---|
48 | int widthM=size(LM[1]); |
---|
49 | int nm=max(size(LN),size(LM)); |
---|
50 | for (int j=1; j<=nm; j++) |
---|
51 | { |
---|
52 | if (j>size(LN)){LN[j]=emptyString(widthN);} |
---|
53 | if (j>size(LM)){LM[j]=emptyString(widthM);} |
---|
54 | L[j]=LN[j]+LM[j]; |
---|
55 | } |
---|
56 | Net NM; |
---|
57 | NM.rows=L; |
---|
58 | return(NM);} |
---|
59 | |
---|
60 | |
---|
61 | proc netList(list L1) |
---|
62 | { |
---|
63 | Net N=net("["); |
---|
64 | for (int j=1; j<=size(L1)-1; j++) |
---|
65 | { |
---|
66 | N=N+net(L1[j])+net(", "); |
---|
67 | } |
---|
68 | N=N+net(L1[size(L1)])+net("]"); |
---|
69 | return(N); |
---|
70 | } |
---|
71 | |
---|
72 | proc printNet(Net N) |
---|
73 | { |
---|
74 | list L = N.rows; |
---|
75 | for (int j=1; j<=size(L); j++) |
---|
76 | { |
---|
77 | print(L[j]); |
---|
78 | } |
---|
79 | } |
---|
80 | |
---|
81 | proc net(def M){ |
---|
82 | if (typeof(M)=="list"){ |
---|
83 | return(netList(M)); |
---|
84 | } |
---|
85 | Net N; |
---|
86 | list L; |
---|
87 | L[1]=string(M); |
---|
88 | N.rows=L; |
---|
89 | return(N);} |
---|
90 | |
---|
91 | |
---|
92 | |
---|
93 | proc printGraph(graph G) |
---|
94 | { |
---|
95 | print(netList(G.edges)); |
---|
96 | print("Graph with "+string(size(G.vertices))+" vertices and "+string(size(G.edges))+" edges") |
---|
97 | } |
---|
98 | |
---|
99 | |
---|
100 | |
---|
101 | proc makeGraph(list v, list e) |
---|
102 | { |
---|
103 | graph G; |
---|
104 | G.vertices = v; |
---|
105 | G.edges = e; |
---|
106 | return(G); |
---|
107 | } |
---|
108 | |
---|
109 | |
---|
110 | proc propagator(def xy, def d) |
---|
111 | { |
---|
112 | if ((typeof(xy)=="list")||(typeof(d)=="int")) { |
---|
113 | number x = xy[1]; |
---|
114 | number y = xy[2]; |
---|
115 | if (d<0) {ERROR("expected non-negative degree");} |
---|
116 | if (d==0) {return(x^2*y^2/(x^2-y^2)^2);} |
---|
117 | number p=0; |
---|
118 | for (int j=1; j<=d; j++){ |
---|
119 | if (d%j==0){p=p+(j*x^(4*j)+j*y^(4*j))/(x*y)^(2*j);} |
---|
120 | } |
---|
121 | return(p); |
---|
122 | } |
---|
123 | if ((typeof(xy)=="graph")||(typeof(d)=="list")) { |
---|
124 | list xl = ringlist(R)[1][2]; |
---|
125 | list ed = xy.edges; |
---|
126 | number f=1; |
---|
127 | for (int j=1; j<=size(ed); j++){ |
---|
128 | execute("number xx1 = "+xl[ed[j][1]]); |
---|
129 | execute("number xx2 = "+xl[ed[j][2]]); |
---|
130 | f=f*propagator(list(xx1,xx2),d[j]); |
---|
131 | kill xx1; |
---|
132 | kill xx2; |
---|
133 | } |
---|
134 | return(f); |
---|
135 | } |
---|
136 | if ((typeof(xy)=="graph")||(typeof(d)=="int")) { |
---|
137 | } |
---|
138 | ERROR("wrong input type");} |
---|
139 | |
---|
140 | proc computeConstant(number f,number xx) |
---|
141 | { |
---|
142 | int tst=0; |
---|
143 | number ff=f; |
---|
144 | int k; |
---|
145 | int j; |
---|
146 | poly de; |
---|
147 | while (tst==0){ |
---|
148 | ff=f*xx^k; |
---|
149 | for (j=1; j<=k; j++){ |
---|
150 | ff=diff(ff,xx)/j; |
---|
151 | } |
---|
152 | de = subst(denominator(ff),xx,0); |
---|
153 | if (de!=0){ |
---|
154 | poly nu = subst(numerator(ff),xx,0); |
---|
155 | return(number(nu/de)); |
---|
156 | } |
---|
157 | k=k+1; |
---|
158 | } |
---|
159 | ERROR("error in computeConstant");} |
---|
160 | |
---|
161 | proc evaluateIntegral(number P, list xL) |
---|
162 | { |
---|
163 | number p = P; |
---|
164 | for(int j=1; j<=size(xL); j++){ |
---|
165 | p=computeConstant(p,xL[j]); |
---|
166 | } |
---|
167 | return(p);} |
---|
168 | |
---|
169 | |
---|
170 | proc permute (list N) |
---|
171 | { |
---|
172 | int i,j,k; |
---|
173 | list L,L1; |
---|
174 | if (size(N)==1){ |
---|
175 | return(list(N)); |
---|
176 | } else { |
---|
177 | k=1; |
---|
178 | for (i=1; i<=size(N); i++){ |
---|
179 | L=permute(delete(N,i)); |
---|
180 | for (j=1; j<=size(L); j++){ |
---|
181 | L1[k]=L[j]+list(N[i]); |
---|
182 | k=k+1; |
---|
183 | } |
---|
184 | } |
---|
185 | } |
---|
186 | return(L1);} |
---|
187 | |
---|
188 | //permute(list(x1,x2,x3,x4)); |
---|
189 | |
---|
190 | |
---|
191 | proc partitions(int n, int a){ |
---|
192 | ring R = 2,(x(1..n)),dp; |
---|
193 | ideal I = maxideal(a); |
---|
194 | list L; |
---|
195 | for (int j=1;j<=size(I);j++){ |
---|
196 | L[j]=leadexp(I[j]); |
---|
197 | } |
---|
198 | return(L);} |
---|
199 | |
---|
200 | |
---|
201 | proc gromovWitten(def P,list #) |
---|
202 | { |
---|
203 | if (typeof(P)=="number") { |
---|
204 | list xl = ringlist(R)[1][2]; |
---|
205 | int j; |
---|
206 | for(j=1; j<=size(xl); j++){ |
---|
207 | execute("number n= "+xl[j]); |
---|
208 | xl[j]=n; |
---|
209 | kill n; |
---|
210 | } |
---|
211 | list pxl = permute(xl); |
---|
212 | number p = 0; |
---|
213 | for(j=1; j<=size(pxl); j++){ |
---|
214 | p=p+evaluateIntegral(P,pxl[j]); |
---|
215 | } |
---|
216 | return(p); |
---|
217 | } |
---|
218 | if (typeof(P)=="graph"){ |
---|
219 | int d =#[1]; |
---|
220 | number s =0; |
---|
221 | number p; |
---|
222 | list pararg; |
---|
223 | list re; |
---|
224 | list pa = partitions(size(P.edges),d); |
---|
225 | int ti; |
---|
226 | for (int j=1; j<=size(pa); j++) { |
---|
227 | ti=timer; |
---|
228 | //pararg[j]=list(propagator(G,pa[j])); |
---|
229 | re[j]=gromovWitten(propagator(G,pa[j])); |
---|
230 | ti=timer-ti; |
---|
231 | print(string(j)+" / "+string(size(pa))+" "+string(pa[j])+" "+string(re[j])+" "+string(ti)); |
---|
232 | } |
---|
233 | //list re = parallelWaitAll("gromovWitten", pararg, list(list(list(2)))); |
---|
234 | return(re); |
---|
235 | } |
---|
236 | } |
---|
237 | |
---|
238 | proc sum(list L){ |
---|
239 | number s; |
---|
240 | for(int j=1; j<=size(L); j++){ |
---|
241 | s=s+L[j]; |
---|
242 | } |
---|
243 | return(s);} |
---|
244 | |
---|
245 | |
---|
246 | |
---|