Changeset b840b1 in git for Singular/LIB/multigrading.lib
- Timestamp:
- Mar 22, 2011, 6:27:38 PM (13 years ago)
- Branches:
- (u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
- Children:
- fd1b0f2e9e097faef7d6563aeb22798d790e146e
- Parents:
- 086a962ad11bef0e873f25f43c9633ad85216bdb
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/multigrading.lib
r086a96 rb840b1 12 12 @* Simon Keicher, keicher@mail.mathematik.uni-tuebingen.de 13 13 @* Oleksandr Motsak, U@D, where U={motsak}, D={mathematik.uni-kl.de} 14 15 16 OVERVIEW: This library allows one to virtually add multigradings to Singular. 14 @* Anna-Lena Winz, anna-lena.winz@math.fu-berlin.de 15 16 OVERVIEW: This library allows one to virtually add multigradings to Singular: 17 grade multivariate polynomial rings with arbitrary (fin. gen. Abelian) groups. 17 18 For more see http://code.google.com/p/convex-singular/wiki/Multigrading 18 19 For theoretical references see: 19 E. Miller, B. Sturmfels: 'Combinatorial Commutative Algebra' and 20 M. Kreuzer, L. Robbiano: 'Computational Commutative Algebra'. 21 22 NOTE: 'mDegBasis' relies on 4ti2 for computing Hilbert Bases. 20 @* E. Miller, B. Sturmfels: 'Combinatorial Commutative Algebra' 21 and 22 @* M. Kreuzer, L. Robbiano: 'Computational Commutative Algebra'. 23 24 NOTE: 'multiDegBasis' relies on 4ti2 for computing Hilbert Bases. 23 25 All groups are finitely generated Abelian 24 26 … … 51 53 latticeBasis(B); computes an integral basis of the lattice B 52 54 preimageLattice(P,L); computes an integral basis for the preimage of the lattice L under the linear map P. 53 projectLattice s(B);computes a linear map of lattices having the primitive span of B as its kernel.55 projectLattice(B); computes a linear map of lattices having the primitive span of B as its kernel. 54 56 intersectLattices(A,B); computes an integral basis for the intersection of the lattices A and B. 55 57 isIntegralSurjective(P); test whether the map P of lattices is surjective. … … 63 65 productgroup(G,H); create the group G x H 64 66 65 m Deg(A); compute the multidegree of A66 m DegBasis(d); compute all monomials of multidegree d67 m DegPartition(p); compute the multigraded-homogeneous components of p67 multiDeg(A); compute the multidegree of A 68 multiDegBasis(d); compute all monomials of multidegree d 69 multiDegPartition(p); compute the multigraded-homogeneous components of p 68 70 69 71 isTorsionFree(); test whether the current multigrading is free … … 73 75 isHomogeneous(a); test whether 'a' is multigraded-homogeneous 74 76 75 equalM Deg(e1,e2[,V]); test whether e1==e2 in the current multigrading76 77 m DegGroebner(M); compute the multigraded GB/SB of M78 m DegSyzygy(M); compute the multigraded syzygies of M79 m DegModulo(I,J); compute the multigraded 'modulo' module of I and J80 m DegResolution(M,l[,m]); compute the multigraded resolution of M81 m DegTensor(m,n); compute the tensor product of multigraded modules m,n82 m DegTor(i,m,n); compute the Tor_i(m,n) for multigraded modules m,n77 equalMultiDeg(e1,e2[,V]); test whether e1==e2 in the current multigrading 78 79 multiDegGroebner(M); compute the multigraded GB/SB of M 80 multiDegSyzygy(M); compute the multigraded syzygies of M 81 multiDegModulo(I,J); compute the multigraded 'modulo' module of I and J 82 multiDegResolution(M,l[,m]); compute the multigraded resolution of M 83 multiDegTensor(m,n); compute the tensor product of multigraded modules m,n 84 multiDegTor(i,m,n); compute the Tor_i(m,n) for multigraded modules m,n 83 85 84 86 defineHomogeneous(p); get a grading group wrt which p becomes homogeneous … … 104 106 LIB "standard.lib"; // for groebner 105 107 LIB "lll.lib"; // for lll_matrix 106 LIB "matrix.lib"; // for m DegTor108 LIB "matrix.lib"; // for multiDegTor 107 109 108 110 /******************************************************/ … … 174 176 def dst = basering; 175 177 176 intmat result_degs = m Deg(Im);177 print(result_degs);178 intmat result_degs = multiDeg(Im); 179 // print(result_degs); 178 180 179 181 setring src; 180 182 181 intmat input_degs = m Deg(maxideal(1));182 print(input_degs);183 intmat input_degs = multiDeg(maxideal(1)); 184 // print(input_degs); 183 185 184 186 def image_degs = A * input_degs; 185 print( image_degs );187 // print( image_degs ); 186 188 187 189 def df = image_degs - result_degs; 188 print(df);190 // print(df); 189 191 190 192 setring dst; … … 245 247 print(B); 246 248 247 isGradedRingHomomorphism(r, ideal(F), B); 248 def hh = createGradedRingHomomorphism(r, ideal(F), B);249 250 if( defined(hh) ) { ERROR("That input was not valid"); } 249 isGradedRingHomomorphism(r, ideal(F), B); // FALSE: there is no such homomorphism! 250 // Therefore: the following command should return an error 251 // createGradedRingHomomorphism(r, ideal(F), B); 252 251 253 } 252 254 … … 458 460 /******************************************************/ 459 461 proc setBaseMultigrading(intmat M, list #) 460 "USAGE: setBaseMultigrading(M[, G]); M is an intege matrix, G is a group (or lattice)462 "USAGE: setBaseMultigrading(M[, G]); M is an integer matrix, G is a group (or lattice) 461 463 PURPOSE: attaches weights of variables and grading group to the basering. 462 464 NOTE: M encodes the weights of variables column-wise. … … 492 494 if( !defined(L) ){ ERROR("Wrong arguments: no group given?"); } 493 495 494 495 496 496 attrib(basering, attrMgrad, M); 497 497 attrib(basering, attrGradingGroup, L); … … 502 502 "Warning: your quotient ideal is not homogenous (multigrading was set anyway)!"; 503 503 } 504 505 506 507 504 508 505 } … … 1009 1006 isHomogeneous(I); 1010 1007 1011 intmat V = m Deg(I); print(V);1008 intmat V = multiDeg(I); print(V); 1012 1009 1013 1010 module S = syz(I); print(S); … … 1020 1017 getModuleGrading(v) == V; 1021 1018 isHomogeneous(v); 1022 print( m Deg(v) );1019 print( multiDeg(v) ); 1023 1020 1024 1021 isHomogeneous(S); 1025 print( m Deg(S) );1022 print( multiDeg(S) ); 1026 1023 } 1027 1024 … … 1060 1057 1061 1058 ideal I = x, y, xy^5; 1062 intmat V = m Deg(I);1059 intmat V = multiDeg(I); 1063 1060 1064 1061 // V == M; modulo T … … 1075 1072 getModuleGrading(v) == V; 1076 1073 1077 print( m Deg(v) );1074 print( multiDeg(v) ); 1078 1075 1079 1076 isHomogeneous(S); 1080 1077 1081 print( m Deg(S) );1082 } 1083 1084 1085 proc m DegTensor(module m, module n){1078 print( multiDeg(S) ); 1079 } 1080 1081 1082 proc multiDegTensor(module m, module n){ 1086 1083 matrix M = m; 1087 1084 matrix N = n; … … 1140 1137 mm = setModuleGrading(mm, gm); 1141 1138 nn = setModuleGrading(nn, gn); 1142 module mmtnn = m DegTensor(mm, nn);1139 module mmtnn = multiDegTensor(mm, nn); 1143 1140 print(mmtnn); 1144 1141 getModuleGrading(mmtnn); … … 1159 1156 mm = setModuleGrading(mm, gm); 1160 1157 nn = setModuleGrading(nn, gn); 1161 module mmtnn = m DegTensor(mm, nn);1158 module mmtnn = multiDegTensor(mm, nn); 1162 1159 print(mmtnn); 1163 1160 getModuleGrading(mmtnn); … … 1168 1165 } 1169 1166 1170 proc m DegTor(int i, module m, module n)1171 { 1172 def res = m DegResolution(n, 0, 1);1167 proc multiDegTor(int i, module m, module n) 1168 { 1169 def res = multiDegResolution(n, 0, 1); 1173 1170 //print(res); 1174 1171 list l = res; … … 1189 1186 freedim3 = setModuleGrading(freedim3, getModuleGrading(l[i])); 1190 1187 1191 module mimag = m DegTensor(freedim3, m);1188 module mimag = multiDegTensor(freedim3, m); 1192 1189 //"mimag ok."; 1193 module mf = m DegTensor(l[i], freedim);1190 module mf = multiDegTensor(l[i], freedim); 1194 1191 //"mf ok."; 1195 module mim1 = m DegTensor(freedim2 ,m);1196 module mim2 = m DegTensor(l[i+1],freedim);1192 module mim1 = multiDegTensor(freedim2 ,m); 1193 module mim2 = multiDegTensor(l[i+1],freedim); 1197 1194 //"mim1+2 ok."; 1198 module mker = m DegModulo(mf,mimag);1195 module mker = multiDegModulo(mf,mimag); 1199 1196 //"mker ok."; 1200 1197 module mim = mim1,mim2; … … 1206 1203 //matrix mimmat1[16][4]=mimmat[1..16,25..28]; 1207 1204 //print(mimmat1-matrix(mim2)); 1208 return(m DegModulo(mker,mim));1205 return(multiDegModulo(mker,mim)); 1209 1206 //return(0); 1210 1207 } … … 1219 1216 setBaseMultigrading(g); 1220 1217 ideal i = maxideal(1); 1221 module m = m DegSyzygy(i);1218 module m = multiDegSyzygy(i); 1222 1219 module rt = Tor(2,m,m); 1223 module m DegT = mDegTor(2,m,m);1224 print(matrix(rt)-matrix(m DegT));1220 module multiDegT = multiDegTor(2,m,m); 1221 print(matrix(rt)-matrix(multiDegT)); 1225 1222 /* 1226 1223 ring r = 0,(x),dp; … … 1237 1234 isHomogeneous(mm,"checkGens"); 1238 1235 isHomogeneous(nn,"checkGens"); 1239 m DegTor(1,mm, nn);1236 multiDegTor(1,mm, nn); 1240 1237 1241 1238 kill m, mm, n, nn, gm, gn; … … 1251 1248 mm = setModuleGrading(mm, gm); 1252 1249 nn = setModuleGrading(nn, gn); 1253 module mmtnn = m DegTensor(mm, nn);1250 module mmtnn = multiDegTensor(mm, nn); 1254 1251 */ 1255 1252 } … … 1440 1437 m= system ("LLL", m); 1441 1438 list result= list(); 1439 intvec buf; 1442 1440 1443 1441 for (i= 1; i <= sizeA; i++) 1444 1442 { 1445 intvec buf= intvec (m[i , 1]); 1446 for (j= 2; j <= columns; j++) 1447 { 1448 buf= buf,intvec (m [i, j]); 1449 } 1443 buf = intvec (m[i , 1..columns]); 1450 1444 result= result+ list (buf); 1451 1445 … … 1726 1720 poly f = z2; 1727 1721 1728 intmat m[5][2]=m Deg(a)-mDeg(b),mDeg(b)-mDeg(c),mDeg(c)-mDeg(d),mDeg(d)-mDeg(e),mDeg(e)-mDeg(f);1722 intmat m[5][2]=multiDeg(a)-multiDeg(b),multiDeg(b)-multiDeg(c),multiDeg(c)-multiDeg(d),multiDeg(d)-multiDeg(e),multiDeg(e)-multiDeg(f); 1729 1723 m=transpose(m); 1730 1724 areZeroElements(m); … … 1816 1810 poly f = z2; 1817 1811 1818 intvec v1 = m Deg(a) - mDeg(b);1812 intvec v1 = multiDeg(a) - multiDeg(b); 1819 1813 v1; 1820 1814 isZeroElement(v1); 1821 1815 isZeroElement(v1, tt); 1822 1816 1823 intvec v2 = m Deg(a) - mDeg(c);1817 intvec v2 = multiDeg(a) - multiDeg(c); 1824 1818 v2; 1825 1819 isZeroElement(v2); 1826 1820 isZeroElement(v2, tt); 1827 1821 1828 intvec v3 = m Deg(e) - mDeg(f);1822 intvec v3 = multiDeg(e) - multiDeg(f); 1829 1823 v3; 1830 1824 isZeroElement(v3); 1831 1825 isZeroElement(v3, tt); 1832 1826 1833 intvec v4 = m Deg(c) - mDeg(d);1827 intvec v4 = multiDeg(c) - multiDeg(d); 1834 1828 v4; 1835 1829 isZeroElement(v4); … … 2099 2093 2100 2094 /******************************************************/ 2101 proc equalM Deg(intvec exp1, intvec exp2, list #)2102 "USAGE: equalM Deg(exp1, exp2[, V]); intvec exp1, exp2, intmat V2095 proc equalMultiDeg(intvec exp1, intvec exp2, list #) 2096 "USAGE: equalMultiDeg(exp1, exp2[, V]); intvec exp1, exp2, intmat V 2103 2097 PURPOSE: Tests if the exponent vectors of two monomials (given by exp1 and exp2) 2104 2098 represent the same multidegree. 2105 2099 NOTE: the integer matrix V encodes multidegrees of module components, 2106 2100 if module component is present in exp1 and exp2 2107 EXAMPLE: example equalM Deg; shows an example2101 EXAMPLE: example equalMultiDeg; shows an example 2108 2102 " 2109 2103 { … … 2176 2170 2177 2171 2178 equalM Deg(leadexp(a), leadexp(b));2179 equalM Deg(leadexp(a), leadexp(c));2180 equalM Deg(leadexp(a), leadexp(d));2181 equalM Deg(leadexp(a), leadexp(e));2182 equalM Deg(leadexp(a), leadexp(f));2183 2184 equalM Deg(leadexp(b), leadexp(c));2185 equalM Deg(leadexp(b), leadexp(d));2186 equalM Deg(leadexp(b), leadexp(e));2187 equalM Deg(leadexp(b), leadexp(f));2188 2189 equalM Deg(leadexp(c), leadexp(d));2190 equalM Deg(leadexp(c), leadexp(e));2191 equalM Deg(leadexp(c), leadexp(f));2192 2193 equalM Deg(leadexp(d), leadexp(e));2194 equalM Deg(leadexp(d), leadexp(f));2195 2196 equalM Deg(leadexp(e), leadexp(f));2172 equalMultiDeg(leadexp(a), leadexp(b)); 2173 equalMultiDeg(leadexp(a), leadexp(c)); 2174 equalMultiDeg(leadexp(a), leadexp(d)); 2175 equalMultiDeg(leadexp(a), leadexp(e)); 2176 equalMultiDeg(leadexp(a), leadexp(f)); 2177 2178 equalMultiDeg(leadexp(b), leadexp(c)); 2179 equalMultiDeg(leadexp(b), leadexp(d)); 2180 equalMultiDeg(leadexp(b), leadexp(e)); 2181 equalMultiDeg(leadexp(b), leadexp(f)); 2182 2183 equalMultiDeg(leadexp(c), leadexp(d)); 2184 equalMultiDeg(leadexp(c), leadexp(e)); 2185 equalMultiDeg(leadexp(c), leadexp(f)); 2186 2187 equalMultiDeg(leadexp(d), leadexp(e)); 2188 equalMultiDeg(leadexp(d), leadexp(f)); 2189 2190 equalMultiDeg(leadexp(e), leadexp(f)); 2197 2191 2198 2192 } … … 2222 2216 if( (typeof(a) == "poly") or (typeof(a) == "vector") ) 2223 2217 { 2224 return ( size(m DegPartition(a)) <= 1 )2218 return ( size(multiDegPartition(a)) <= 1 ) 2225 2219 } 2226 2220 … … 2252 2246 aa = getGradedGenerator(a, i); 2253 2247 2254 b = m DegPartition(aa);2248 b = multiDegPartition(aa); 2255 2249 for( j = ncols(b); j > 0; j-- ) 2256 2250 { … … 2285 2279 poly f = x-yz; 2286 2280 2287 m DegPartition(f);2288 print(m Deg(_));2281 multiDegPartition(f); 2282 print(multiDeg(_)); 2289 2283 2290 2284 isHomogeneous(f); // f: is not homogeneous … … 2292 2286 poly g = 1-xy2z3; 2293 2287 isHomogeneous(g); // g: is homogeneous 2294 m DegPartition(g);2288 multiDegPartition(g); 2295 2289 2296 2290 kill T; … … 2306 2300 f; 2307 2301 isHomogeneous(f); 2308 m DegPartition(f);2302 multiDegPartition(f); 2309 2303 2310 2304 // --------------------- 2311 2305 g; 2312 2306 isHomogeneous(g); 2313 m DegPartition(g);2307 multiDegPartition(g); 2314 2308 2315 2309 kill r, T, M; … … 2330 2324 2331 2325 // Degree partition: 2332 m DegPartition(x2 - y3 -xy +z);2333 m DegPartition(x3 -y2z + x2 -y3 + z + 1);2326 multiDegPartition(x2 - y3 -xy +z); 2327 multiDegPartition(x3 -y2z + x2 -y3 + z + 1); 2334 2328 2335 2329 … … 2341 2335 2342 2336 v1 = setModuleGrading(N[1], V); v1; 2343 m DegPartition(v1);2344 print( m Deg(_) );2337 multiDegPartition(v1); 2338 print( multiDeg(_) ); 2345 2339 2346 2340 v2 = setModuleGrading(N[2], V); v2; 2347 m DegPartition(v2);2348 print( m Deg(_) );2341 multiDegPartition(v2); 2342 print( multiDeg(_) ); 2349 2343 2350 2344 N = setModuleGrading(N, V); 2351 2345 isHomogeneous(N); 2352 print( m Deg(N) );2346 print( multiDeg(N) ); 2353 2347 2354 2348 /////////////////////////////////////// … … 2359 2353 2360 2354 v1 = setModuleGrading(N[1], V); v1; 2361 m DegPartition(v1);2362 print( m Deg(_) );2355 multiDegPartition(v1); 2356 print( multiDeg(_) ); 2363 2357 2364 2358 v2 = setModuleGrading(N[2], V); v2; 2365 m DegPartition(v2);2366 print( m Deg(_) );2359 multiDegPartition(v2); 2360 print( multiDeg(_) ); 2367 2361 2368 2362 N = setModuleGrading(N, V); 2369 2363 isHomogeneous(N); 2370 print( m Deg(N) );2364 print( multiDeg(N) ); 2371 2365 2372 2366 /////////////////////////////////////// … … 2379 2373 N = setModuleGrading(N, V); print(N); 2380 2374 isHomogeneous(N); 2381 print( m Deg(N) );2375 print( multiDeg(N) ); 2382 2376 v1 = getGradedGenerator(N,1); print(v1); 2383 m DegPartition(v1);2384 print( m Deg(_) );2377 multiDegPartition(v1); 2378 print( multiDeg(_) ); 2385 2379 N = setModuleGrading(N, V); print(N); 2386 2380 isHomogeneous(N); 2387 print( m Deg(N) );2381 print( multiDeg(N) ); 2388 2382 } 2389 2383 2390 2384 /******************************************************/ 2391 proc m Deg(def A)2392 "USAGE: m Deg(A); polynomial/vector/ideal/module A2385 proc multiDeg(def A) 2386 "USAGE: multiDeg(A); polynomial/vector/ideal/module A 2393 2387 PURPOSE: compute multidegree 2394 EXAMPLE: example m Deg; shows an example2388 EXAMPLE: example multiDeg; shows an example 2395 2389 " 2396 2390 { … … 2479 2473 for( i = ncols(A); i > 0; i-- ) 2480 2474 { 2481 d = m Deg( A[i] );2475 d = multiDeg( A[i] ); 2482 2476 2483 2477 for( j = 1; j <= r; j++ ) // see ticket: 253 … … 2499 2493 2500 2494 // G[1..r, i] 2501 d = m Deg(v);2495 d = multiDeg(v); 2502 2496 2503 2497 for( j = 1; j <= r; j++ ) // see ticket: 253 … … 2530 2524 2531 2525 2532 m Deg( x*x, A );2533 m Deg( y*y*y, A );2526 multiDeg( x*x, A ); 2527 multiDeg( y*y*y, A ); 2534 2528 2535 2529 setBaseMultigrading(A, Ta); 2536 2530 2537 m Deg( x*x*y );2538 2539 m Deg( y*y*y*x );2540 2541 m Deg( x*y + x + 1 );2542 2543 m DegPartition(x*y + x + 1);2544 2545 print ( m Deg(0) );2531 multiDeg( x*x*y ); 2532 2533 multiDeg( y*y*y*x ); 2534 2535 multiDeg( x*y + x + 1 ); 2536 2537 multiDegPartition(x*y + x + 1); 2538 2539 print ( multiDeg(0) ); 2546 2540 poly zero = 0; 2547 print ( m Deg(zero) );2541 print ( multiDeg(zero) ); 2548 2542 2549 2543 // "ideal:"; 2550 2544 2551 2545 ideal I = y*x*x, x*y*y*y; 2552 print( m Deg(I) );2553 2554 print ( m Deg(ideal(0)) );2555 print ( m Deg(ideal(0,0,0)) );2546 print( multiDeg(I) ); 2547 2548 print ( multiDeg(ideal(0)) ); 2549 print ( multiDeg(ideal(0,0,0)) ); 2556 2550 2557 2551 // "vectors:"; … … 2560 2554 print(B); 2561 2555 2562 m Deg( setModuleGrading(y*y*y*gen(2), B ));2563 m Deg( setModuleGrading(x*x*gen(1), B ));2556 multiDeg( setModuleGrading(y*y*y*gen(2), B )); 2557 multiDeg( setModuleGrading(x*x*gen(1), B )); 2564 2558 2565 2559 2566 2560 vector V = x*gen(1) + y*gen(2); 2567 2561 V = setModuleGrading(V, B); 2568 m Deg( V );2562 multiDeg( V ); 2569 2563 2570 2564 vector v1 = setModuleGrading([0, 0, 0], B); 2571 print( m Deg( v1 ) );2565 print( multiDeg( v1 ) ); 2572 2566 2573 2567 vector v2 = setModuleGrading([0], B); 2574 print( m Deg( v2 ) );2568 print( multiDeg( v2 ) ); 2575 2569 2576 2570 // "module:"; … … 2579 2573 D; 2580 2574 D = setModuleGrading(D, B); 2581 print( m Deg( D ) );2575 print( multiDeg( D ) ); 2582 2576 2583 2577 2584 2578 module DD = [0, 0],[0, 0, 0]; 2585 2579 DD = setModuleGrading(DD, B); 2586 print( m Deg( DD ) );2580 print( multiDeg( DD ) ); 2587 2581 2588 2582 module DDD = [0, 0]; 2589 2583 DDD = setModuleGrading(DDD, B); 2590 print( m Deg( DDD ) );2584 print( multiDeg( DDD ) ); 2591 2585 2592 2586 }; … … 2597 2591 2598 2592 /******************************************************/ 2599 proc m DegPartition(def p)2600 "USAGE: m DegPartition(def p), p polynomial/vector2593 proc multiDegPartition(def p) 2594 "USAGE: multiDegPartition(def p), p polynomial/vector 2601 2595 RETURNS: an ideal/module consisting of multigraded-homogeneous parts of p 2602 EXAMPLE: example m DegPartition; shows an example2596 EXAMPLE: example multiDegPartition; shows an example 2603 2597 " 2604 2598 { // TODO: What about an ideal or module??? … … 2646 2640 // TODO: we do not cache matrices (M,T,H,V), which remain the same :( 2647 2641 // TODO: we need some low-level procedure with all these arguments...! 2648 if( equalM Deg( leadexp(tt), m, V ) )2642 if( equalMultiDeg( leadexp(tt), m, V ) ) 2649 2643 { 2650 2644 mp = mp + lead(tt); // "mp", mp; … … 2692 2686 poly f = x10yz+x8y2z-x4z2+y5+x2y2-z2+x17z3-y6; 2693 2687 2694 m DegPartition(f);2688 multiDegPartition(f); 2695 2689 2696 2690 vector v = xy*gen(1)-x3y2*gen(2)+x4y*gen(3); … … 2699 2693 getModuleGrading(v); 2700 2694 2701 m DegPartition(v, B);2695 multiDegPartition(v, B); 2702 2696 } 2703 2697 … … 3054 3048 3055 3049 /******************************************************/ 3056 proc m DegBasis(intvec d)3050 proc multiDegBasis(intvec d) 3057 3051 " 3058 3052 USAGE: multidegree d 3059 3053 ASSUME: current ring is multigraded, monomial ordering is global 3060 3054 PURPOSE: compute all monomials of multidegree d 3061 EXAMPLE: example m DegBasis; shows an example3055 EXAMPLE: example multiDegBasis; shows an example 3062 3056 " 3063 3057 { … … 3189 3183 intvec v3=4:1; 3190 3184 v3; 3191 m DegBasis(v3);3185 multiDegBasis(v3); 3192 3186 3193 3187 setBaseMultigrading(g1,l); 3194 m DegBasis(v1);3188 multiDegBasis(v1); 3195 3189 setBaseMultigrading(g2); 3196 m DegBasis(v2);3190 multiDegBasis(v2); 3197 3191 3198 3192 intmat M[2][2] = 1, -1, -1, 1; … … 3201 3195 setBaseMultigrading(M); 3202 3196 3203 m DegBasis(d);3197 multiDegBasis(d); 3204 3198 attrib(_, "ZeroPart"); 3205 3199 3206 kill R ;3200 kill R, M, d; 3207 3201 ring R = 0, (x, y, z), dp; 3208 3202 … … 3215 3209 setBaseMultigrading(M, L); 3216 3210 3217 m DegBasis(d);3211 multiDegBasis(d); 3218 3212 attrib(_, "ZeroPart"); 3219 3213 3220 3214 3221 kill R ;3215 kill R, M, d; 3222 3216 3223 3217 ring R = 0, (x, y, z), dp; … … 3228 3222 // intmat T[2][1] = 0, 2; 3229 3223 3230 setBaseMultigrading(M); 3224 setBaseMultigrading(M); // BUG???? 3231 3225 3232 3226 intvec d = 6, 6; 3233 m DegBasis(d);3227 multiDegBasis(d); 3234 3228 attrib(_, "ZeroPart"); 3235 3229 3236 3230 3237 3231 3238 kill R ;3232 kill R, Q, M, d; 3239 3233 ring R = 0, (x, y, z), dp; 3240 3234 qring Q = std(ideal( x*z^3 - y *z^6, x*y*z - x^4*y^2 )); … … 3246 3240 intvec d = 4, 1; 3247 3241 3248 setBaseMultigrading(M, T); 3249 3250 m DegBasis(d);3242 setBaseMultigrading(M, T); // BUG???? 3243 3244 multiDegBasis(d); 3251 3245 attrib(_, "ZeroPart"); 3252 3246 } 3253 3247 3254 3248 3255 proc m DegSyzygy(def I)3256 "USAGE: m DegSyzygy(I); I is a ideal or a module3249 proc multiDegSyzygy(def I) 3250 "USAGE: multiDegSyzygy(I); I is a ideal or a module 3257 3251 PURPOSE: computes the multigraded syzygy module of I 3258 3252 RETURNS: module, the syzygy module of I 3259 3253 NOTE: generators of I must be multigraded homogeneous 3260 EXAMPLE: example m DegSyzygy; shows an example3254 EXAMPLE: example multiDegSyzygy; shows an example 3261 3255 " 3262 3256 { … … 3266 3260 } 3267 3261 module S = syz(I); 3268 S = setModuleGrading(S, m Deg(I));3262 S = setModuleGrading(S, multiDeg(I)); 3269 3263 return (S); 3270 3264 } … … 3289 3283 3290 3284 isHomogeneous(M); 3291 "Multidegrees: "; print(m Deg(M));3285 "Multidegrees: "; print(multiDeg(M)); 3292 3286 // Let's compute syzygies! 3293 def S = m DegSyzygy(M); S;3287 def S = multiDegSyzygy(M); S; 3294 3288 "Module Units Multigrading: "; print( getModuleGrading(S) ); 3295 "Multidegrees: "; print(m Deg(S));3289 "Multidegrees: "; print(multiDeg(S)); 3296 3290 3297 3291 isHomogeneous(S); … … 3300 3294 3301 3295 3302 proc m DegModulo(def I, def J)3303 "USAGE: m DegModulo(I); I, J are ideals or modules3296 proc multiDegModulo(def I, def J) 3297 "USAGE: multiDegModulo(I); I, J are ideals or modules 3304 3298 PURPOSE: computes the multigraded 'modulo' module of I and J 3305 3299 RETURNS: module, see 'modulo' command 3306 3300 NOTE: I and J should have the same multigrading, and their 3307 3301 generators must be multigraded homogeneous 3308 EXAMPLE: example m DegModulo; shows an example3302 EXAMPLE: example multiDegModulo; shows an example 3309 3303 " 3310 3304 { … … 3314 3308 } 3315 3309 module K = modulo(I, J); 3316 K = setModuleGrading(K, m Deg(I));3310 K = setModuleGrading(K, multiDeg(I)); 3317 3311 return (K); 3318 3312 } … … 3330 3324 ideal h2 = x; 3331 3325 3332 "Multidegrees: "; print(m Deg(h1));3326 "Multidegrees: "; print(multiDeg(h1)); 3333 3327 3334 3328 // Let's compute modulo(h1, h2): 3335 def K = m DegModulo(h1, h2); K;3329 def K = multiDegModulo(h1, h2); K; 3336 3330 3337 3331 "Module Units Multigrading: "; print( getModuleGrading(K) ); 3338 "Multidegrees: "; print(m Deg(K));3332 "Multidegrees: "; print(multiDeg(K)); 3339 3333 3340 3334 isHomogeneous(K); … … 3342 3336 3343 3337 3344 proc m DegGroebner(def I)3345 "USAGE: m DegGroebner(I); I is a poly/vector/ideal/module3338 proc multiDegGroebner(def I) 3339 "USAGE: multiDegGroebner(I); I is a poly/vector/ideal/module 3346 3340 PURPOSE: computes the multigraded standard/groebner basis of I 3347 3341 NOTE: I must be multigraded homogeneous 3348 3342 RETURNS: ideal/module, the computed basis 3349 EXAMPLE: example m DegGroebner; shows an example3343 EXAMPLE: example multiDegGroebner; shows an example 3350 3344 " 3351 3345 { … … 3389 3383 ///////////////////////////////////////////////////////////////////////////// 3390 3384 // GB: 3391 M = m DegGroebner(M); M;3385 M = multiDegGroebner(M); M; 3392 3386 "Module Units Multigrading: "; print( getModuleGrading(M) ); 3393 "Multidegrees: "; print(m Deg(M));3387 "Multidegrees: "; print(multiDeg(M)); 3394 3388 3395 3389 isHomogeneous(M); … … 3397 3391 ///////////////////////////////////////////////////////////////////////////// 3398 3392 // Let's compute Syzygy! 3399 def S = m DegSyzygy(M); S;3393 def S = multiDegSyzygy(M); S; 3400 3394 "Module Units Multigrading: "; print( getModuleGrading(S) ); 3401 "Multidegrees: "; print(m Deg(S));3395 "Multidegrees: "; print(multiDeg(S)); 3402 3396 3403 3397 isHomogeneous(S); … … 3405 3399 ///////////////////////////////////////////////////////////////////////////// 3406 3400 // GB: 3407 S = m DegGroebner(S); S;3401 S = multiDegGroebner(S); S; 3408 3402 "Module Units Multigrading: "; print( getModuleGrading(S) ); 3409 "Multidegrees: "; print(m Deg(S));3403 "Multidegrees: "; print(multiDeg(S)); 3410 3404 3411 3405 isHomogeneous(S); … … 3414 3408 3415 3409 /******************************************************/ 3416 proc m DegResolution(def I, int ll, list #)3417 "USAGE: m DegResolution(I,l,[f]); I is poly/vector/ideal/module; l,f are integers3410 proc multiDegResolution(def I, int ll, list #) 3411 "USAGE: multiDegResolution(I,l,[f]); I is poly/vector/ideal/module; l,f are integers 3418 3412 PURPOSE: computes the multigraded resolution of I of the length l, 3419 3413 or the whole resolution if l is zero. Returns minimal resolution if an optional … … 3422 3416 The returned list is truncated beginning with the first zero differential. 3423 3417 RETURNS: list, the computed resolution 3424 EXAMPLE: example m DegResolution; shows an example3418 EXAMPLE: example multiDegResolution; shows an example 3425 3419 " 3426 3420 { … … 3442 3436 if( size(L[i]) > 0 ) 3443 3437 { 3444 L[i] = setModuleGrading( L[i], m Deg(L[i-1]) );3438 L[i] = setModuleGrading( L[i], multiDeg(L[i-1]) ); 3445 3439 } else 3446 3440 { … … 3476 3470 for(j=1; j<=ncols(A); j++) 3477 3471 { 3478 m DegPartition(A[j]);3472 multiDegPartition(A[j]); 3479 3473 } 3480 3474 … … 3486 3480 3487 3481 // Let's compute Syzygy! 3488 def S = m DegSyzygy(m); S;3482 def S = multiDegSyzygy(m); S; 3489 3483 "Module Units Multigrading: "; print( getModuleGrading(S) ); 3490 "Multidegrees: "; print(m Deg(S));3484 "Multidegrees: "; print(multiDeg(S)); 3491 3485 3492 3486 ///////////////////////////////////////////////////////////////////////////// 3493 3487 3494 S = m DegGroebner(S); S;3488 S = multiDegGroebner(S); S; 3495 3489 "Module Units Multigrading: "; print( getModuleGrading(S) ); 3496 "Multidegrees: "; print(m Deg(S));3490 "Multidegrees: "; print(multiDeg(S)); 3497 3491 3498 3492 ///////////////////////////////////////////////////////////////////////////// 3499 3493 3500 def L = m DegResolution(m, 0, 1);3494 def L = multiDegResolution(m, 0, 1); 3501 3495 3502 3496 for( j =1; j<=size(L); j++) … … 3505 3499 L[j]; 3506 3500 "Module Multigrading: "; print( getModuleGrading(L[j]) ); 3507 "Multigrading: "; print(m Deg(L[j]));3501 "Multigrading: "; print(multiDeg(L[j])); 3508 3502 } 3509 3503 3510 3504 ///////////////////////////////////////////////////////////////////////////// 3511 3505 3512 L = m DegResolution(maxideal(1), 0, 1);3506 L = multiDegResolution(maxideal(1), 0, 1); 3513 3507 3514 3508 for( j =1; j<=size(L); j++) … … 3517 3511 L[j]; 3518 3512 "Module Multigrading: "; print( getModuleGrading(L[j]) ); 3519 "Multigrading: "; print(m Deg(L[j]));3513 "Multigrading: "; print(multiDeg(L[j])); 3520 3514 } 3521 3515 … … 3542 3536 proc hilbertSeries(def I) 3543 3537 "USAGE: hilbertSeries(I); I is poly/vector/ideal/module 3544 PURPOSE: computes the multigraded Hilbert Series of M3538 PURPOSE: computes the multigraded Hilbert Series of I 3545 3539 NOTE: input must have multigraded-homogeneous generators. 3546 3540 Multigrading should be positive. 3547 3541 RETURNS: a ring in variables t_(i), s_(i), with polynomials 3548 numerator1 and denominator1 and mutu rally prime numerator23542 numerator1 and denominator1 and mutually prime numerator2 3549 3543 and denominator2, quotients of which give the series. 3550 3544 EXAMPLE: example hilbertSeries; shows an example … … 3570 3564 } 3571 3565 3572 list RES = m DegResolution(I,0,1);3566 list RES = multiDegResolution(I,0,1); 3573 3567 3574 3568 int l = size(RES); … … 3588 3582 for( j = 1; j <= l; j++) 3589 3583 { 3590 L[j + 1] = m Deg(RES[j]);3584 L[j + 1] = multiDeg(RES[j]); 3591 3585 } 3592 3586 … … 3735 3729 ideal I = x^2, y, z^3; 3736 3730 I = std(I); 3737 def L = m DegResolution(I, 0, 1);3731 def L = multiDegResolution(I, 0, 1); 3738 3732 3739 3733 for( int j = 1; j<=size(L); j++) … … 3742 3736 L[j]; 3743 3737 "Module Multigrading: "; print( getModuleGrading(L[j]) ); 3744 "Multigrading: "; print(m Deg(L[j]));3745 } 3746 3747 m Deg(I);3738 "Multigrading: "; print(multiDeg(L[j])); 3739 } 3740 3741 multiDeg(I); 3748 3742 def h = hilbertSeries(I); setring h; 3749 3743 … … 4097 4091 " 4098 4092 { 4099 ideal I = m DegBasis(0);4093 ideal I = multiDegBasis(0); 4100 4094 ideal J = attrib(I,"ZeroPart"); 4101 4095 /* … … 4114 4108 isPositive(); 4115 4109 4116 intmat A[1][2]=1,1;4117 setBaseMultigrading( A);4118 isPositive( A);4110 intmat B[1][2]=1,1; 4111 setBaseMultigrading(B); 4112 isPositive(B); 4119 4113 } 4120 4114 … … 4132 4126 4133 4127 4134 example m Deg;4135 example m DegPartition;4128 example multiDeg; 4129 example multiDegPartition; 4136 4130 4137 4131 … … 4142 4136 example defineHomogeneous; 4143 4137 4144 example equalM Deg;4138 example equalMultiDeg; 4145 4139 example isZeroElement; 4146 4140 4147 example m DegResolution;4141 example multiDegResolution; 4148 4142 4149 4143 "// ******************* example hilbertSeries ************************//"; … … 4151 4145 4152 4146 4153 // example m DegBasis; // needs 4ti2!4147 // example multiDegBasis; // needs 4ti2! 4154 4148 4155 4149 "The End!"; … … 4157 4151 4158 4152 4159 proc mDegTruncate(def M, intvec md)4153 static proc multiDegTruncate(def M, intvec md) 4160 4154 { 4161 4155 "d: "; … … 4165 4159 module LL = M; // + L for d+1 4166 4160 LL; 4167 print(m Deg(LL));4161 print(multiDeg(LL)); 4168 4162 4169 4163 … … 4180 4174 "v[i]: "; vi; 4181 4175 4182 B = m DegBasis(md - vi); // ZeroPart is always the same...4176 B = multiDegBasis(md - vi); // ZeroPart is always the same... 4183 4177 "B: "; B; 4184 4178 … … 4189 4183 4190 4184 "L: "; L; 4191 print(m Deg(L));4192 4193 L = m DegModulo(L, LL);4194 L = m DegGroebner(L);4185 print(multiDeg(L)); 4186 4187 L = multiDegModulo(L, LL); 4188 L = multiDegGroebner(L); 4195 4189 // L = minbase(prune(L)); 4196 4190 4197 4191 "??????????"; 4198 4192 print(L); 4199 print(m Deg(L));4193 print(multiDeg(L)); 4200 4194 4201 4195 V = getModuleGrading(L); … … 4204 4198 for(i = ncols(L); i > 0; i-- ) 4205 4199 { 4206 if( !equalM Deg( mDeg(getGradedGenerator(L, i)), md ) )4200 if( !equalMultiDeg( multiDeg(getGradedGenerator(L, i)), md ) ) 4207 4201 { 4208 4202 L[i] = 0; … … 4213 4207 L = setModuleGrading(L, V); 4214 4208 print(L); 4215 print(m Deg(L));4209 print(multiDeg(L)); 4216 4210 4217 4211 return(L); … … 4237 4231 module h1 = x; 4238 4232 h1 = setModuleGrading(h1, V); 4239 m DegTruncate(h1, mDeg(x));4240 m DegTruncate(h1, mDeg(y));4233 multiDegTruncate(h1, multiDeg(x)); 4234 multiDegTruncate(h1, multiDeg(y)); 4241 4235 4242 4236 "XY:"; 4243 4237 module h2 = ideal(x, y); 4244 4238 h2 = setModuleGrading(h2, V); 4245 m DegTruncate(h2, mDeg(x));4246 m DegTruncate(h2, mDeg(y));4247 m DegTruncate(h2, mDeg(xy));4239 multiDegTruncate(h2, multiDeg(x)); 4240 multiDegTruncate(h2, multiDeg(y)); 4241 multiDegTruncate(h2, multiDeg(xy)); 4248 4242 } 4249 4243 … … 4267 4261 { 4268 4262 intmat Mul = Q*L; 4269 intmat L = latticeBasis(Mul);4270 4271 return(L );4263 intmat LL = latticeBasis(Mul); 4264 4265 return(LL); 4272 4266 } 4273 4267 example … … 4532 4526 3,6,12; 4533 4527 4534 intmat B = latticeBasis(B); // should be a matrix with columns [1,2,3] and [0,3,6] 4528 intmat B = latticeBasis(B); 4529 print(B); // should be a matrix with columns [1,2,3] and [0,3,6] 4535 4530 4536 4531 kill B,L; … … 4641 4636 4642 4637 4643 print(Con);4638 // print(Con); 4644 4639 4645 4640 intmat L = kernelLattice(Con); 4646 4641 /* 4647 4642 print(L); 4648 4643 print(ncols(P)); 4649 4644 print(ncols(L)); 4650 4645 */ 4651 4646 // delete rows ncols(P)+1 to nrows(L) out of L 4652 4647 intmat Del[ncols(P)][ncols(L)]; … … 4679 4674 0; 4680 4675 4681 // should be a 2x2 matrix with columns4682 // [1,1,-1] and [-2,1,0]4683 4676 intmat L = preimageLattice(P,B); 4684 4677 4678 print(L); // should be a 2x2? matrix with columns [1,1,-1] and [-2,1,0]? 4679 4685 4680 kill B, P, L; 4686 4681 … … 4723 4718 // should be 0 4724 4719 int b = isPrimitiveSublattice(A); 4720 b; 4721 4722 if( b != 0 ){ ERROR("Sorry, something went wrong..."); } 4725 4723 4726 4724 kill A,b; … … 4916 4914 8,11; 4917 4915 4916 intmat U = intersectLattices(A,B); 4917 4918 4918 // should result in a (2x4)-matrix with columns 4919 4919 // [3, 3, 3], [0, 3, 6] 4920 intmat U = intersectLattices(A,B); 4921 4920 print(U); 4922 4921 } 4923 4922 … … 5242 5241 intmat P = intInverse(L[1]); 5243 5242 5244 print(L);5243 // print(L); 5245 5244 5246 5245 if ( r < m )
Note: See TracChangeset
for help on using the changeset viewer.