Changeset 3d391f4 in git
- Timestamp:
- Jan 30, 2020, 11:58:50 PM (4 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- 636fa5455e699fa8c0a820dd60e00a059f96f8efbbc88372fd4d9c3bc704e6afef375197fdd09810
- Parents:
- 928d43353be8cce56dabc86bd3b35ebd48f1cdd0ed01f112cee60b9d71fdcff8400dab5c67a23882
- Files:
-
- 15 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/fpaprops.lib
red01f11 r3d391f4 28 28 lpGlDimBound(<GB>); compute an upper bound for the global dimension of A/<GB> 29 29 lpSubstitute(); substitute a variable with polynomials (ring homomorphism) 30 lpUfGraph(<GB>); constructs the Ufnarovskij graph for <LM(GB)>31 30 lpCalcSubstDegBound(); utility for lpSubstitute 32 31 "; … … 44 43 example lpGlDimBound; 45 44 example lpSubstitute; 46 example lpUfGraph;47 45 example lpCalcSubstDegBound; 48 46 }; … … 83 81 // also if G is the whole ring 84 82 if (leadmonom(G[i]) == 1) { 85 ERROR(" noetherianity not defined for 0-ring")83 ERROR("Noetherianity not defined for 0-ring") 86 84 } 87 85 kill d; … … 90 88 if (l == 1) { 91 89 int n = lpVarBlockSize(basering); // variable count 90 int ncgenCount = lpNcgenCount(basering); 92 91 int k = size(G); 93 if (k == n ) { // only the field left92 if (k == n - ncgenCount) { // only the field left 94 93 return(3); // every field is noetherian 95 94 } 96 if (k == n -1) { // V = {1} with loop95 if (k == n - ncgenCount - 1) { // V = {1} with loop 97 96 return(3); 98 97 } 99 if (k <= n -2) { // V = {1} with more than one loop98 if (k <= n ncgenCount - 2) { // V = {1} with more than one loop 100 99 return(0); 101 100 } 102 101 } 103 102 104 intmat UG = lpUf Graph(G);103 intmat UG = lpUfnarovskiGraph(G)[1]; 105 104 106 105 // check special case 2 … … 311 310 } 312 311 313 list VUG = lpUf Graph(G, 1);312 list VUG = lpUfnarovskiGraph(G); 314 313 intmat UG = VUG[1]; // the Ufnarovskij graph 315 314 ideal V = VUG[2]; // the vertices of UG (standard words with length = l-1) … … 419 418 } 420 419 421 list VUG = lpUf Graph(G, 1);420 list VUG = lpUfnarovskiGraph(G); 422 421 intmat UG = VUG[1]; // the Ufnarovskij graph 423 422 ideal V = VUG[2]; // the vertices of UG (standard words with length = l-1) … … 726 725 } 727 726 728 proc lpUfGraph(ideal G, list #) 729 "USAGE: lpUfGraph(G); G a set of monomials in a letterplace ring. 730 RETURN: intmat or list 731 NOTE: lpUfGraph(G); returns intmat. lpUfGraph(G,1); returns list L with L[1] an intmat and L[2] an ideal. 732 The intmat is the Ufnarovskij Graph and the ideal contains the vertices. 733 PURPOSE: Constructs the Ufnarovskij graph induced by G 734 the adjacency matrix of the Ufnarovskij graph induced by G 735 ASSUME: - basering is a Letterplace ring 736 - G are the leading monomials of a Groebner basis 737 " 738 { 739 dbprint("computing maxDeg"); 740 int l = maxDeg(G); 741 if (l - 1 == 0) { 742 // TODO: how should the graph look like when l - 1 = 0 ? 743 ERROR("Ufnarovskij graph not implemented for l = 1"); 744 } 745 int lV = lpVarBlockSize(basering); 746 // TODO: what if l <= 0? 747 dbprint("computing standard words"); 748 ideal SW = lpStandardWords(G, l - 1); // vertices 749 int n = ncols(SW); 750 dbprint("n = " + string(n)); 751 intmat UG[n][n]; // Ufnarovskij graph 752 for (int i = 1; i <= n; i++) { 753 for (int j = 1; j <= n; j++) { 754 dbprint("Ufnarovskii graph: " + string((i-1)*n + j) + "/" + string(n*n) + " entries"); 755 // [Studzinski page 76] 756 poly v = SW[i]; 757 poly w = SW[j]; 758 intvec v_overlap; 759 intvec w_overlap; 760 if (l - 1 > 1) { 761 v_overlap = leadexp(v); 762 w_overlap = leadexp(w); 763 v_overlap = v_overlap[(lV+1) .. (l-1)*lV]; 764 w_overlap = w_overlap[1 .. (l-2)*lV]; 765 } 766 if (v_overlap == w_overlap && !lpLmDivides(G, v * lpVarAt(w, l - 1))) { 767 UG[i,j] = 1; 768 } 769 kill v; kill w; kill v_overlap; kill w_overlap; 770 } kill j; 771 } kill i; 772 if (size(#) > 0) { 773 if (typeof(#[1]) == "int") { 774 if (#[1] != 0) { 775 list ret = UG; 776 ret[2] = SW; // the vertices 777 return (ret); 778 } 779 } 780 } 781 return (UG); 782 } 783 example 784 { 785 "EXAMPLE:"; echo = 2; 786 ring r = 0,(x,y,z),dp; 787 def R = freeAlgebra(r, 5); // constructs a Letterplace ring 788 setring R; // sets basering to Letterplace ring 789 ideal I = x*y, x*z, z*y, z*z; 790 lpUfGraph(I); 791 lpUfGraph(I,1); 792 } 727 // Ufnarovskii graph is now implemented in the dynamic module (freeAlgebra.cc) 728 /* proc lpUfnarovskiGraph(ideal G, list #) */ 729 /* "USAGE: lpUfnarovskiGraph(G); G a set of monomials in a letterplace ring. */ 730 /* RETURN: intmat or list */ 731 /* NOTE: lpUfnarovskiGraph(G); returns intmat. lpUfnarovskiGraph(G,1); returns list L with L[1] an intmat and L[2] an ideal. */ 732 /* The intmat is the Ufnarovskij Graph and the ideal contains the vertices. */ 733 /* PURPOSE: Constructs the Ufnarovskij graph induced by G */ 734 /* the adjacency matrix of the Ufnarovskij graph induced by G */ 735 /* ASSUME: - basering is a Letterplace ring */ 736 /* - G are the leading monomials of a Groebner basis */ 737 /* " */ 738 /* { */ 739 /* dbprint("computing maxDeg"); */ 740 /* int l = maxDeg(G); */ 741 /* if (l - 1 == 0) { */ 742 /* // TODO: how should the graph look like when l - 1 = 0 ? */ 743 /* ERROR("Ufnarovskij graph not implemented for l = 1"); */ 744 /* } */ 745 /* int lV = lpVarBlockSize(basering); */ 746 /* // TODO: what if l <= 0? */ 747 /* dbprint("computing standard words"); */ 748 /* ideal SW = lpStandardWords(G, l - 1); // vertices */ 749 /* int n = ncols(SW); */ 750 /* dbprint("n = " + string(n)); */ 751 /* intmat UG[n][n]; // Ufnarovskij graph */ 752 /* for (int i = 1; i <= n; i++) { */ 753 /* for (int j = 1; j <= n; j++) { */ 754 /* dbprint("Ufnarovskii graph: " + string((i-1)*n + j) + "/" + string(n*n) + " entries"); */ 755 /* // [Studzinski page 76] */ 756 /* poly v = SW[i]; */ 757 /* poly w = SW[j]; */ 758 /* intvec v_overlap; */ 759 /* intvec w_overlap; */ 760 /* if (l - 1 > 1) { */ 761 /* v_overlap = leadexp(v); */ 762 /* w_overlap = leadexp(w); */ 763 /* v_overlap = v_overlap[(lV+1) .. (l-1)*lV]; */ 764 /* w_overlap = w_overlap[1 .. (l-2)*lV]; */ 765 /* } */ 766 /* if (v_overlap == w_overlap && !lpLmDivides(G, v * lpVarAt(w, l - 1))) { */ 767 /* UG[i,j] = 1; */ 768 /* } */ 769 /* kill v; kill w; kill v_overlap; kill w_overlap; */ 770 /* } kill j; */ 771 /* } kill i; */ 772 /* if (size(#) > 0) { */ 773 /* if (typeof(#[1]) == "int") { */ 774 /* if (#[1] != 0) { */ 775 /* list ret = UG; */ 776 /* ret[2] = SW; // the vertices */ 777 /* return (ret); */ 778 /* } */ 779 /* } */ 780 /* } */ 781 /* return (UG); */ 782 /* } */ 783 /* example */ 784 /* { */ 785 /* "EXAMPLE:"; echo = 2; */ 786 /* ring r = 0,(x,y,z),dp; */ 787 /* def R = freeAlgebra(r, 5); // constructs a Letterplace ring */ 788 /* setring R; // sets basering to Letterplace ring */ 789 /* ideal I = x*y, x*z, z*y, z*z; */ 790 /* lpUfnarovskiGraph(I); */ 791 /* lpUfnarovskiGraph(I,1); */ 792 /* } */ 793 793 794 794 static proc maxDeg(ideal G) … … 833 833 return (words); // no standard words 834 834 } 835 int lV = lpVarBlockSize(basering); // variable count835 int nVars = lpVarBlockSize(basering) - lpNcgenCount(basering); // variable count 836 836 list prevWords = ivStandardWords(G, length - 1); 837 837 list words; 838 for (int i = 1; i <= lV; i++) {838 for (int i = 1; i <= nVars; i++) { 839 839 for (int j = 1; j <= size(prevWords); j++) { 840 840 intvec word = prevWords[j]; … … 919 919 920 920 /* dbprint("computing Ufnarovskii graph"); */ 921 /* intmat UG = lpUf Graph(G); */921 /* intmat UG = lpUfnarovskiGraph(G)[1]; */ 922 922 /* if (printlevel >= voice + 1) { */ 923 923 /* UG; */ … … 1002 1002 if (size(G1) > 0) { 1003 1003 while (size(G1) > 0) { 1004 if (lpVarBlockSize(R) > 1) {1004 if (lpVarBlockSize(R) - lpNcgenCount(R) > 1) { 1005 1005 def @R = R - string(G1[1]); 1006 1006 R = @R; -
Singular/LIB/freegb.lib
red01f11 r3d391f4 26 26 lpDegBound(R); returns the degree bound of a letterplace ring 27 27 lpVarBlockSize(R); returns the size of the letterplace blocks 28 lpNcgenCount(R); returns the number of ncgen variables 28 29 lpDivision(f,I); two-sided division with remainder 29 30 lpGBPres2Poly(L,I); reconstructs a polynomial from the output of lpDivision … … 1004 1005 def R = freeAlgebra(r, 7); 1005 1006 isFreeAlgebra(R); 1007 } 1008 1009 proc lpNcgenCount(def R) 1010 "USAGE: lpNcgenCount(R); R a letterplace ring 1011 RETURN: int 1012 PURPOSE: returns the number of ncgen variables in the letterplace ring. 1013 EXAMPLE: example ncgenCount; shows examples 1014 " 1015 { 1016 return(attrib(R, "ncgenCount")); 1017 } 1018 example 1019 { 1020 "EXAMPLE:"; echo = 2; 1021 ring r = 0,(x,y,z),dp; 1022 def R = freeAlgebra(r, 7, 10); 1023 lpNcgenCount(R); // should be 10 1006 1024 } 1007 1025 -
Singular/attrib.cc
red01f11 r3d391f4 259 259 #ifdef HAVE_SHIFTBBA 260 260 PrintS("attr:isLetterplaceRing, type int\n"); 261 PrintS("attr:ncgenCount, type int\n"); 261 262 #endif 262 263 … … 331 332 res->data=(void *)(long)(((ring)v->Data())->isLPring); 332 333 } 334 else if ((strcmp(name,"ncgenCount")==0) 335 &&(/*v->Typ()*/t==RING_CMD)) 336 { 337 res->rtyp=INT_CMD; 338 res->data=(void *)(long)(((ring)v->Data())->LPncGenCount); 339 } 333 340 #endif 334 341 else … … 436 443 } 437 444 } 445 else if ((strcmp(name,"ncgenCount")==0) 446 &&(/*v->Typ()*/t==RING_CMD)) 447 { 448 if (c->Typ()==INT_CMD) 449 ((ring)v->Data())->LPncGenCount=(int)(long)c->Data(); 450 else 451 { 452 WerrorS("attribute `ncgenCount` must be int"); 453 return TRUE; 454 } 455 } 438 456 #endif 439 457 else -
Singular/dyn_modules/freealgebra/freealgebra.cc
red01f11 r3d391f4 136 136 static void _computeStandardWords(ideal words, int n, ideal M, int& last) 137 137 { 138 // assume <M> != <1> 138 139 if (n <= 0){ 139 140 words->m[0] = pOne(); … … 144 145 _computeStandardWords(words, n - 1, M, last); 145 146 146 int nVars = currRing->isLPring ;147 int nVars = currRing->isLPring - currRing->LPncGenCount; 147 148 148 149 for (int j = nVars - 1; j >= 0; j--) … … 158 159 } 159 160 160 int varOffset = ((n - 1) * nVars) + 1;161 int varOffset = ((n - 1) * currRing->isLPring) + 1; 161 162 pSetExp(words->m[index], varOffset + j, 1); 162 163 pSetm(words->m[index]); … … 177 178 static ideal computeStandardWords(int n, ideal M) 178 179 { 179 int nVars = currRing->isLPring ;180 int nVars = currRing->isLPring - currRing->LPncGenCount; 180 181 181 182 int maxElems = 1; … … 190 191 191 192 // NULL if graph is undefined 192 static intvec* ufnarovskiGraph(ideal G )193 static intvec* ufnarovskiGraph(ideal G, ideal &standardWords) 193 194 { 194 195 long l = 0; … … 203 204 int lV = currRing->isLPring; 204 205 205 idealstandardWords = computeStandardWords(l, G);206 standardWords = computeStandardWords(l, G); 206 207 207 208 int n = IDELEMS(standardWords); … … 250 251 } 251 252 253 static BOOLEAN lpUfnarovskiGraph(leftv res, leftv h) 254 { 255 const short t[]={1,IDEAL_CMD}; 256 if (iiCheckTypes(h,t,1)) 257 { 258 ideal I = (ideal) h->Data(); 259 res->rtyp = LIST_CMD; 260 261 ideal standardWords; 262 intvec* graph = ufnarovskiGraph(I, standardWords); 263 264 lists li=(lists)omAllocBin(slists_bin); 265 li->Init(2); 266 li->m[0].rtyp=INTMAT_CMD; 267 li->m[1].rtyp=IDEAL_CMD; 268 li->m[0].data=graph; 269 li->m[1].data=standardWords; 270 271 res->data = li; 272 273 if (errorreported) return TRUE; 274 return FALSE; 275 } 276 else return TRUE; 277 } 278 252 279 static std::vector<int> countCycles(const intvec* _G, int v, std::vector<int> path, std::vector<BOOLEAN> visited, std::vector<BOOLEAN> cyclic, std::vector<int> cache) 253 280 { … … 353 380 return -2; 354 381 } 382 if (pGetNCGen(_G->m[i]) != 0) 383 { 384 WerrorS("GK-Dim not implemented for bi-modules"); 385 return -2; 386 } 355 387 } 356 388 … … 377 409 { 378 410 int lV = currRing->isLPring; 379 if (IDELEMS(G) == lV) // V = {1} no edges 411 int ncGenCount = currRing->LPncGenCount; 412 if (IDELEMS(G) == lV - ncGenCount) // V = {1} no edges 380 413 return 0; 381 if (IDELEMS(G) == lV - 1) // V = {1} with loop414 if (IDELEMS(G) == lV - ncGenCount - 1) // V = {1} with loop 382 415 return 1; 383 if (IDELEMS(G) <= lV - 2) // V = {1} with more than one loop416 if (IDELEMS(G) <= lV - ncGenCount - 2) // V = {1} with more than one loop 384 417 return -1; 385 418 } 386 419 387 intvec* UG = ufnarovskiGraph(G); 420 ideal standardWords; 421 intvec* UG = ufnarovskiGraph(G, standardWords); 388 422 if (errorreported || UG == NULL) return -2; 389 423 return graphGrowth(UG); … … 416 450 p->iiAddCproc("freealgebra.so","lpVarAt",FALSE,lpVarAt); 417 451 p->iiAddCproc("freealgebra.so","lpGkDim",FALSE,lpGkDim); 452 p->iiAddCproc("freealgebra.so","lpUfnarovskiGraph",FALSE,lpUfnarovskiGraph); 418 453 419 454 p->iiAddCproc("freealgebra.so","stest",TRUE,stest); -
Tst/Letterplace.lst
red01f11 r3d391f4 11 11 12 12 Manual/lpGkDim.tst 13 Manual/lpNoetherian.tst 14 Manual/lpIsPrime.tst 15 Manual/lpIsSemiPrime.tst 16 Manual/lpGlDimBound.tst 13 17 Manual/lpKDim.tst 14 18 Manual/lpKDimCheck.tst 19 Manual/lpUfnarovskiGraph.tst 15 20 Manual/lpMonomialBasis.tst 16 21 Manual/lpSickleDim.tst -
kernel/GBEngine/kutil.cc
r928d43 r3d391f4 9374 9374 void enterSBbaShift (LObject &p,int atS,kStrategy strat, int atR) 9375 9375 { 9376 enterSBba(p, atS, strat, atR); 9377 9376 9378 int maxPossibleShift = p_mLPmaxPossibleShift(p.p, strat->tailRing); 9377 9379 for (int i = maxPossibleShift; i > 0; i--) 9378 9380 { 9381 9379 9382 LObject qq; 9380 9383 qq.p = pLPCopyAndShiftLM(p.p, i); // don't use Set() because it'll test the poly order 9381 9384 qq.shift = i; 9382 9385 strat->initEcart(&qq); // initEcartBBA sets length, pLength, FDeg and ecart 9386 int atS = posInS(strat, strat->sl, qq.p, qq.ecart); // S needs to stay sorted because this is for example assumed when searching S later 9383 9387 enterSBba(qq, atS, strat, -1); 9384 9388 } 9385 enterSBba(p, atS, strat, atR);9386 9389 } 9387 9390 #endif -
libpolys/polys/shiftop.cc
red01f11 r3d391f4 613 613 } 614 614 615 BOOLEAN _p_mLPNCGenValid(poly p, const ring r) 616 { 617 if (p == NULL) return TRUE; 618 int *e=(int *)omAlloc((r->N+1)*sizeof(int)); 619 p_GetExpV(p,e,r); 620 int b = _p_mLPNCGenValid(e, r); 621 omFreeSize((ADDRESS) e, (r->N+1)*sizeof(int)); 622 return b; 623 } 624 615 625 BOOLEAN _p_mLPNCGenValid(int *mExpV, const ring r) 616 626 { … … 634 644 } 635 645 return TRUE; 646 } 647 648 int p_GetNCGen(poly p, const ring r) 649 { 650 if (p == NULL) return 0; 651 assume(_p_mLPNCGenValid(p, r)); 652 653 int lV = r->isLPring; 654 int degbound = r->N/lV; 655 int ncGenCount = r->LPncGenCount; 656 for (int i = 1; i <= degbound; i++) 657 { 658 for (int j = i*lV; j > (i*lV - ncGenCount); j--) 659 { 660 if (p_GetExp(p, j, r)) 661 { 662 return j - i*lV + ncGenCount; 663 } 664 } 665 } 666 return 0; 636 667 } 637 668 -
libpolys/polys/shiftop.h
red01f11 r3d391f4 55 55 BOOLEAN _p_LPLmDivisibleByNoComp(poly a, poly b, const ring r); 56 56 57 BOOLEAN _p_mLPNCGenValid(poly p, const ring r); 57 58 BOOLEAN _p_mLPNCGenValid(int *mExpV, const ring r); 58 59 59 60 poly p_LPVarAt(poly p, int pos, const ring r); 61 62 #define pGetNCGen(p) p_GetNCGen(p, currRing) 63 int p_GetNCGen(poly p, const ring r); 60 64 61 65 #define pLPSubst(p, n, e) p_LPSubst(p, n, e, r)
Note: See TracChangeset
for help on using the changeset viewer.