Changeset c01764 in git
- Timestamp:
- Mar 16, 2018, 6:30:03 PM (6 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- 01a1e69963e02904f3ebb7e48ddd938c9489cc76d1bb4ad41c5c390887e85591280f23792d561fb2
- Parents:
- 0ffcd2e4895401f8aa6557ccbabaca11e287d05a9db8343e5043f1916262be4000d0b798d2cf2b8c
- Location:
- Singular/LIB
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/fpadim.lib
r9db834 rc01764 2378 2378 return (words); 2379 2379 } 2380 example { 2380 example 2381 { 2381 2382 "EXAMPLE:"; echo = 2; 2382 2383 ring r = 0,(a,b,c),dp; … … 2399 2400 return(ivL2lpI(ivMaxIdeal(d, donly))); 2400 2401 } 2401 example { 2402 example 2403 { 2402 2404 "EXAMPLE:"; echo = 2; 2403 2405 ring r = 0,(a,b,c),dp; … … 2489 2491 return(I); 2490 2492 } 2491 example { 2493 example 2494 { 2492 2495 "EXAMPLE:"; echo = 2; 2493 2496 ring r = 0,(x,y),dp; -
Singular/LIB/fpaprops.lib
r9db834 rc01764 19 19 PROCEDURES: 20 20 lpNoetherian(<GB>); check whether A/<GB> is (left/right) noetherian 21 lpIsSemiPrime(<GB>); check whether A/< GB> is semi prime22 lpIsPrime(<GB>); check whether A/< GB> is prime21 lpIsSemiPrime(<GB>); check whether A/<LM(GB)> is semi prime 22 lpIsPrime(<GB>); check whether A/<LM(GB)> is prime 23 23 lpGkDim(<GB>); compute the Gelfand Kirillov dimension of A/<GB> 24 24 lpGlDimBound(<GB>); compute an upper bound for the global dimension of A/<GB> … … 37 37 @* 2 right noetherian 38 38 @* 3 noetherian 39 PURPOSE: Check whether R/<G> is (left/right) noetherian, where R is the basering39 PURPOSE: Check whether A/<G> is (left/right) noetherian 40 40 ASSUME: - basering is a Letterplace ring 41 41 @* - G is a Groebner basis … … 108 108 return (3 - inFlag - outFlag); 109 109 } 110 example { 110 example 111 { 111 112 "EXAMPLE:"; echo = 2; 112 113 ring r = 0,(x,y),dp; … … 198 199 "USAGE: lpIsSemiPrime(G); G an ideal in a Letterplace ring 199 200 RETURN: boolean 200 PURPOSE: Check whether R/<G> is semi prime, where R is the basering201 PURPOSE: Check whether A/<LM(G)> is semi prime, that is when p * (A/<LM(G)>) * p != 0 for all p in (A/<LM(G)> - {0}). 201 202 ASSUME: - basering is a Letterplace ring 202 203 - G is a Groebner basis … … 249 250 return (1); 250 251 } 251 example { 252 example 253 { 252 254 "EXAMPLE:"; echo = 2; 253 255 ring r = 0,(x1,x2),dp; … … 298 300 "USAGE: lpIsPrime(G); G an ideal in a Letterplace ring 299 301 RETURN: boolean 300 PURPOSE: Check whether R/<G> is prime, where R is the basering302 PURPOSE: Check whether A/<LM(G)> is prime, that is when p1 * (A/<LM(G)>) * p2 != 0 for all p1, p2 in (A/<LM(G)> - {0}). 301 303 ASSUME: - basering is a Letterplace ring 302 304 - G is a Groebner basis … … 362 364 return (1); 363 365 } 364 example { 366 example 367 { 365 368 "EXAMPLE:"; echo = 2; 366 369 ring r = 0,(x,y),dp; … … 681 684 return (UG); 682 685 } 683 example { 686 example 687 { 684 688 "EXAMPLE:"; echo = 2; 685 689 ring r = 0,(x,y,z),dp; … … 1047 1051 for (int j = 1; j <= size(ivfi); j++) { 1048 1052 int varindex = ivfi[j]; 1049 int subindex = lpIndexOf(s1, var(varindex)); 1050 if (subindex > 0) { 1051 s2[subindex] = lpNF(s2[subindex],G); 1052 fis = lpMult(fis, s2[subindex]); 1053 } else { 1054 fis = lpMult(fis, lpNF(iv2lp(varindex),G)); 1055 } 1056 /*fis = lpNF(fis,G);*/ 1057 kill varindex; kill subindex; 1053 if (varindex > 0) { 1054 int subindex = lpIndexOf(s1, var(varindex)); 1055 if (subindex > 0) { 1056 s2[subindex] = lpNF(s2[subindex],G); 1057 fis = lpMult(fis, s2[subindex]); 1058 } else { 1059 fis = lpMult(fis, lpNF(iv2lp(varindex),G)); 1060 } 1061 /*fis = lpNF(fis,G);*/ 1062 kill subindex; 1063 } 1064 kill varindex; 1058 1065 } kill j; 1059 1066 kill ivfi; … … 1065 1072 return (fs); 1066 1073 } 1067 example { 1074 example 1075 { 1076 "EXAMPLE:"; echo = 2; 1068 1077 //////// EXAMPLE A //////// 1069 1078 ring r = 0,(x,y,z),dp; … … 1144 1153 for (int j = 1; j <= size(ivfi); j++) { 1145 1154 int varindex = ivfi[j]; 1146 int subindex = lpIndexOf(s1, var(varindex)); 1147 if (subindex > 0) { 1148 tmpDegBound = tmpDegBound + deg(s2[subindex]); 1149 } else { 1150 tmpDegBound = tmpDegBound + 1; 1151 } 1152 kill varindex; kill subindex; 1155 if (varindex > 0) { 1156 int subindex = lpIndexOf(s1, var(varindex)); 1157 if (subindex > 0) { 1158 tmpDegBound = tmpDegBound + deg(s2[subindex]); 1159 } else { 1160 tmpDegBound = tmpDegBound + 1; 1161 } 1162 kill subindex; 1163 } 1164 kill varindex; 1153 1165 } kill j; 1154 1166 if (tmpDegBound > maxDegBound) { … … 1160 1172 // increase degbound by 50% when ideal is provided 1161 1173 // needed for lpNF 1162 maxDegBound = maxDegBound + maxDegBound/2;1174 maxDegBound = maxDegBound + (maxDegBound div 2); 1163 1175 1164 1176 return (maxDegBound); 1165 1177 } 1166 example { 1178 example 1179 { 1167 1180 // see lpSubstitute() 1168 1181 } … … 1187 1200 return (maxDegBound); 1188 1201 } 1189 example { 1202 example 1203 { 1190 1204 // see lpSubstitute() 1191 1205 } … … 1277 1291 def R = lpDelVar(2); setring R; R; 1278 1292 } 1293 -
Singular/LIB/freegb.lib
r9db834 rc01764 37 37 ademRelations(i,j); compute the ideal of Adem relations for i<2j in char 0 38 38 39 lpPrint(ideal I, def @r); print a letterplace ideal as an easily readable string 40 39 41 SEE ALSO: fpadim_lib, LETTERPLACE 40 42 "; … … 49 51 LIB "qhmoduli.lib"; // for Max 50 52 LIB "bfun.lib"; // for inForm 53 LIB "fpadim.lib"; // for intvec conversion 51 54 52 55 proc tstfreegb() … … 2521 2524 int uptodeg = attrib(basering,"uptodeg"); 2522 2525 int lV = attrib(basering,"lV"); 2523 if (deg(a) + i > uptodeg)2524 {2525 ERROR("degree bound violated by the shift!");2526 }2527 2526 return(system("stest",a,i,uptodeg,lV)); 2528 2527 } … … 2539 2538 } 2540 2539 2540 proc lastBlock(poly p) 2541 "USAGE: lastBlock(p); p letterplace poly 2542 RETURN: int 2543 ASSUME: basering has letterplace ring structure 2544 PURPOSE: get the number of the last block occuring in the poly 2545 EXAMPLE: example lastBlock; shows examples 2546 " 2547 { 2548 if (lpAssumeViolation()) 2549 { 2550 ERROR("Incomplete Letterplace structure on the basering!"); 2551 } 2552 int lV = attrib(basering,"lV"); 2553 // calls pLastVblock(p,lV); 2554 return(system("btest",p,lV)); 2555 } 2556 example 2557 { 2558 "EXAMPLE:"; echo = 2; 2559 ring r = 0,(x,y,z),dp; 2560 int uptodeg = 5; 2561 def R = makeLetterplaceRing(uptodeg); 2562 setring R; 2563 poly f = x(1)*z(2)*y(3) - 2*z(1)*y(2) + 3*x(1); 2564 lastBlock(f); // should be 3 2565 } 2541 2566 2542 2567 static proc mmLiebr(poly a, poly b) … … 3276 3301 } 3277 3302 3303 proc lpDivision(poly p, ideal I) 3304 "ASSUME: I is a Groebner basis G = {g1,...,gN}, the original ring of the Letterplace ring has the name 'r' and no variable is called 'tag_i' for i in 1...N 3305 RETURN: list L 3306 NOTE: - L[1] NF(p,I) 3307 - L[2] list of expressions [i,l_{ij},r_{ij}] with \sum_{i,j} l_{ij} g_i r_{ij} = p - NF(p,I) 3308 " 3309 { 3310 if (p == 0 || size(I) == 0) { 3311 list L = 0; 3312 list empty; 3313 L[2] = empty; 3314 return (L); 3315 } 3316 poly pNF = lpNF(p,I); 3317 p = p - pNF; 3318 3319 // make new ring 3320 def save = basering; 3321 int norigvars = nvars(r); 3322 string tagvarstr = "(tag_1"; 3323 for (int i = 2; i <= size(I); i++) { 3324 tagvarstr = tagvarstr + ",tag_" + string(i); 3325 } kill i; 3326 tagvarstr = tagvarstr + ")"; 3327 string field = string(ringlist(r)[1]); 3328 execute("ring @tags = " + field + "," + tagvarstr + ",dp;"); 3329 ring @tagged = (r + @tags); 3330 def @R = makeLetterplaceRing(attrib(save,"uptodeg")); setring @R; 3331 3332 // restore vars 3333 poly p = imap(save, p); 3334 poly pNF = imap(save, pNF); 3335 ideal I = imap(save, I); 3336 for (int i = 1; i <= size(I); i++) { 3337 I[i] = I[i] - var(norigvars + i); 3338 } kill i; 3339 3340 list summands; 3341 list L = pNF; 3342 poly pTaggedNF = lpNF(p,I); 3343 for (int i = 1; i <= size(pTaggedNF); i++) { 3344 intvec iv = lp2iv(pTaggedNF[i]); 3345 for (int j = 1; j <= size(iv); j++) { 3346 if (iv[j] > norigvars) { 3347 intvec left; 3348 intvec right; 3349 if (j > 1) { 3350 left = iv[1..(j-1)]; 3351 } 3352 if (j < size(iv)) { 3353 right = iv[(j+1)..size(iv)]; 3354 } 3355 list summand = (iv[j] - norigvars), leadcoef(pTaggedNF[i])*iv2lp(left), iv2lp(right); 3356 summands = insert(summands, summand, size(summands)); 3357 3358 kill left; 3359 kill right; 3360 kill summand; 3361 break; 3362 } 3363 } kill j; 3364 kill iv; 3365 } kill i; 3366 3367 L[2] = summands; 3368 3369 setring save; 3370 list L = imap(@R,L); 3371 return (L); 3372 } 3373 3374 proc lpGBPres2Poly(list L, ideal I) 3375 "ASSUME: L is a valid Groebner presentation as for example the result of lpDivision 3376 RETURN: poly 3377 NOTE: computes p = \sum_{i,j} l_{ij} g_i r_{ij} + NF(p,I) = \sum_{i} L[2][i][2] I[L[2][i][1]] L[2][i][3] + L[1] 3378 " 3379 { 3380 poly p; 3381 for (int i = 1; i <= size(L[2]); i++) { 3382 p = p + lpMult(lpMult(L[2][i][2], I[L[2][i][1]]), L[2][i][3]); 3383 } 3384 p = p + L[1]; 3385 return (p); 3386 } 3387 3278 3388 //procedures to convert monomials into the DVec representation, all static 3279 3389 //////////////////////////////////////////////////////// … … 3473 3583 } 3474 3584 3475 3585 proc isOrderingShiftInvariant(int withHoles) 3586 "USAGE: isOrderingShiftInvariant(b); b an integer interpreted as a boolean 3587 RETURN: int 3588 NOTE: Tests whether the ordering of the current ring is shift invariant, which is the case, when LM(p) > LM(p') for all p and p' where p' is p shifted by any number of places. 3589 @* If withHoles != 0 even Letterplace polynomials with holes (eg. x(1)*y(4)) are considered. 3590 ASSUME: - basering is a Letterplace ring. 3591 " 3592 { 3593 int shiftInvariant = 1; 3594 3595 int n = attrib(basering, "lV"); 3596 int d = attrib(basering, "uptodeg"); 3597 3598 ideal monomials; 3599 if (withHoles) { 3600 monomials = delete(lpMonomialsWithHoles(d-1), 1); // ignore the first element (1) 3601 } else { 3602 monomials = lpMaxIdeal(d-1, 0); 3603 } 3604 3605 for (int i = 1; i <= size(monomials); i++) { 3606 poly monom = monomials[i]; 3607 int lastblock = lastBlock(monom); 3608 for (int s = 1; s <= d - lastblock; s++) { 3609 for (int s2 = 0; s2 < s; s2++) { // paranoid, check every pair 3610 poly first = shiftPoly(monom,s2); 3611 poly second = shiftPoly(monom,s); 3612 if (!(first > second)) { 3613 dbprint(string(first) + " <= " + string(second)); 3614 shiftInvariant = 0; 3615 } 3616 kill first; kill second; 3617 } kill s2; 3618 } kill s; 3619 kill monom; kill lastblock; 3620 } kill i; 3621 3622 return(shiftInvariant); 3623 } 3624 example 3625 { 3626 "EXAMPLE:"; echo = 2; 3627 ring r = 0,(x,y,z),dp; 3628 def R = makeLetterplaceRing(5); 3629 setring R; 3630 isOrderingShiftInvariant(0);// should be 1 3631 3632 ring r = 0,(x,y,z),dp; 3633 def R = makeLetterplaceRing(5); 3634 list RL = ringlist(R); 3635 RL[3][1][1] = "wp"; 3636 intvec weights = 1,1,1,1,1,1,1,2,3,1,1,1,1,1,1; 3637 RL[3][1][2] = weights; 3638 def Rw = setLetterplaceAttributes(ring(RL),5,3); 3639 setring Rw; 3640 printlevel = voice + 1; 3641 isOrderingShiftInvariant(0); 3642 isOrderingShiftInvariant(1); 3643 } 3644 3645 static proc lpMonomialsWithHoles(int d) 3646 { 3647 if (d < 0) { 3648 ERROR("d must not be negative") 3649 } 3650 3651 ideal monomials = 1; 3652 if (d == 0) { 3653 return (monomials); 3654 } 3655 3656 int lV = attrib(basering, "lV"); // variable count 3657 ideal prevMonomials = lpMonomialsWithHoles(d - 1); 3658 3659 for (int i = 1; i <= size(prevMonomials); i++) { 3660 /* if (deg(prevMonomials[i]) >= d - 1) { */ 3661 for (int j = 1; j <= lV; j++) { 3662 poly m = prevMonomials[i]; 3663 m = m * var(j + (d-1)*lV); 3664 monomials = monomials, m; 3665 kill m; 3666 } kill j; 3667 /* } */ 3668 } kill i; 3669 3670 if (d > 1) { 3671 // removes the 1 3672 monomials[1] = 0; 3673 monomials = simplify(monomials,2); 3674 3675 monomials = prevMonomials, monomials; 3676 } 3677 return (monomials); 3678 } 3476 3679 3477 3680 … … 3479 3682 3480 3683 static proc getlpCoeffs(poly q, poly p) 3481 "3482 "3483 3684 {list R; poly m; intvec cq,t,lv,rv,bla; 3484 3685 int n = attrib(basering,"lV"); int d = attrib(basering,"uptodeg"); … … 3503 3704 " 3504 3705 {poly l,r,qt; int i; 3505 g = shiftPoly(g,s); 3506 list K = getlpCoeffs(lead(g),lead(p)); 3706 list K = getlpCoeffs(lead(shiftPoly(g,s)), lead(p)); 3507 3707 l = K[1]; r = K[2]; 3508 3708 kill K; 3509 3709 for (i = 1; i <= size(g); i++) 3510 {qt = qt + lpMult(lpMult(l,g[i]),r); 3710 { 3711 qt = qt + lpMult(lpMult(l,g[i]),r); 3511 3712 } 3512 return( (leadcoef(qt)*p - leadcoef(p)*qt));3713 return(p - leadcoef(p)*normalize(qt)); 3513 3714 } 3514 3715 … … 3730 3931 lpMultX(b,a); 3731 3932 lpMultX(a,b); // seems to work properly 3933 } 3934 3935 proc lpPrint(ideal I, def @r) 3936 "USAGE: lpPrint(I, r); I an ideal, r a ring 3937 RETURN: list of strings 3938 PURPOSE: represent Letterplace ideal in the form of words 3939 ASSUME: - basering is a Letterplace ring, r is the commutative ring 3940 from which basering has been built 3941 EXAMPLE: example lpPrint; shows example 3942 " 3943 { 3944 def save = basering; 3945 lp2lstr(I,@r); // export an object called @code{@LN} to the ring r 3946 setring @r; // change to the ring r 3947 list @L = lst2str(@LN,1); 3948 export @L; 3949 setring save; 3950 list @@L = @L; 3951 setring @r; 3952 kill @L; 3953 kill @LN; 3954 setring save; 3955 return(@@L); 3956 } 3957 example 3958 { 3959 "EXAMPLE:"; echo = 2; 3960 ring r = (0,a,b,g),(x,y),Dp; 3961 def R = makeLetterplaceRing(4); // constructs a Letterplace ring 3962 setring R; // downup algebra A 3963 ideal J = x(1)*x(2)*y(3)-a*x(1)*y(2)*x(3) - b*y(1)*x(2)*x(3) - g*x(1), 3964 x(1)*y(2)*y(3)-a*y(1)*x(2)*y(3) - b*y(1)*y(2)*x(3) - g*y(1); 3965 list L = lpPrint(J,r); 3966 L; 3732 3967 } 3733 3968
Note: See TracChangeset
for help on using the changeset viewer.