Changeset f006a1 in git
- Timestamp:
- Jul 23, 2019, 4:33:05 PM (4 years ago)
- Branches:
- (u'spielwiese', '828514cf6e480e4bafc26df99217bf2a1ed1ef45')
- Children:
- 9102bbc549613cd829348b8de22f634afde32b53
- Parents:
- dcddf9cfa6c64ce8c0dc05e26e136194af70b1e3
- git-author:
- Karim Abou Zeid <karim23697@gmail.com>2019-07-23 16:33:05+02:00
- git-committer:
- Karim Abou Zeid <karim23697@gmail.com>2019-07-24 14:54:41+02:00
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/dyn_modules/freealgebra/freealgebra.cc
rdcddf9c rf006a1 5 5 { 6 6 const short t1[]={2,RING_CMD,INT_CMD}; 7 if (iiCheckTypes(args,t1,1)) 7 const short t2[]={3,RING_CMD,INT_CMD,INT_CMD}; 8 if (iiCheckTypes(args, t2, 0) || iiCheckTypes(args, t1, 1)) 8 9 { 9 10 ring r=(ring)args->Data(); … … 32 33 return TRUE; 33 34 } 34 ring R=freeAlgebra(r,d); 35 int ncGenCount = 0; 36 if (iiCheckTypes(args,t2,0)) 37 ncGenCount = (int)(long) args->next->next->Data(); 38 ring R=freeAlgebra(r,d,ncGenCount); 35 39 res->rtyp=RING_CMD; 36 40 res->data=R; … … 124 128 else return TRUE; 125 129 } 126 127 // copied from iparith.cc128 // NOTE: they do not set res->rtyp129 static BOOLEAN jjSYZYGY(leftv res, leftv v)130 {131 intvec *ww=(intvec *)atGet(v,"isHomog",INTVEC_CMD);132 intvec *w=NULL;133 ideal v_id=(ideal)v->Data();134 tHomog hom=testHomog;135 if (ww!=NULL)136 {137 if (idTestHomModule(v_id,currRing->qideal,ww))138 {139 w=ivCopy(ww);140 int add_row_shift=w->min_in();141 (*w)-=add_row_shift;142 hom=isHomog;143 }144 else145 {146 //WarnS("wrong weights");147 delete ww; ww=NULL;148 hom=testHomog;149 }150 }151 else152 {153 if (v->Typ()==IDEAL_CMD)154 if (idHomIdeal(v_id,currRing->qideal))155 hom=isHomog;156 }157 ideal S=idSyzygies(v_id,hom,&w);158 res->data = (char *)S;159 if (hom==isHomog)160 {161 int vl=S->rank;162 intvec *vv=new intvec(vl);163 if ((v->Typ()==IDEAL_CMD)||(ww==NULL))164 {165 for(int i=0;i<vl;i++)166 {167 if (v_id->m[i]!=NULL)168 (*vv)[i]=p_Deg(v_id->m[i],currRing);169 }170 }171 else172 {173 p_SetModDeg(ww, currRing);174 for(int i=0;i<vl;i++)175 {176 if (v_id->m[i]!=NULL)177 (*vv)[i]=currRing->pFDeg(v_id->m[i],currRing);178 }179 p_SetModDeg(NULL, currRing);180 }181 if (idTestHomModule(S,currRing->qideal,vv))182 atSet(res,omStrDup("isHomog"),vv,INTVEC_CMD);183 else184 delete vv;185 }186 if (w!=NULL) delete w;187 return FALSE;188 }189 190 static ring tagRing(ideal I)191 {192 ring tagRing = currRing;193 for (int i = 1; i <= IDELEMS(I); i++)194 {195 char *varname=(char *)omAlloc(256);196 sprintf(varname, "ncgen(%d)", i);197 tagRing = rPlusVar(tagRing, varname, 0);198 omFreeSize(varname, 256);199 }200 return tagRing;201 }202 203 static BOOLEAN lpSyzRing(leftv res, leftv v)204 {205 const short t1[]={1,IDEAL_CMD};206 const short t2[]={1,MODUL_CMD};207 if (iiCheckTypes(v,t1,1) || iiCheckTypes(v,t2,1))208 {209 ring origRing = currRing;210 currRing = tagRing((ideal)v->Data());211 212 BOOLEAN error = jjSYZYGY(res, v);213 if (error || errorreported) return TRUE;214 215 ideal syzygy = (ideal) res->data;216 for (int i = 0; i < IDELEMS(syzygy); i++)217 {218 pWrite(syzygy->m[i]);219 }220 221 res->rtyp = RING_CMD;222 res->data = currRing;223 currRing = origRing;224 return FALSE;225 }226 else return TRUE;227 }228 229 static BOOLEAN lpTagRing(leftv res, leftv v)230 {231 const short t[]={1,IDEAL_CMD};232 if (iiCheckTypes(v,t,1))233 {234 res->rtyp = RING_CMD;235 res->data = tagRing((ideal)v->Data());236 return FALSE;237 }238 else return TRUE;239 }240 130 #endif 241 131 … … 248 138 p->iiAddCproc("freealgebra.so","lpLmDivides",FALSE,lpLmDivides); 249 139 p->iiAddCproc("freealgebra.so","lpVarAt",FALSE,lpVarAt); 250 p->iiAddCproc("freealgebra.so","lpSyzRing",FALSE,lpSyzRing);251 p->iiAddCproc("freealgebra.so","lpTagRing",FALSE,lpTagRing);252 140 p->iiAddCproc("freealgebra.so","stest",TRUE,stest); 253 141 p->iiAddCproc("freealgebra.so","btest",TRUE,btest); -
Singular/iparith.cc
rdcddf9c rf006a1 5153 5153 ideal v_id=(ideal)v->Data(); 5154 5154 tHomog hom=testHomog; 5155 #ifdef HAVE_SHIFTBBA 5156 if (rIsLPRing(currRing)) 5157 { 5158 if (currRing->LPncGenCount < IDELEMS(v_id)) 5159 { 5160 Werror("At least %d ncgen variables are needed for this computation.", IDELEMS(v_id)); 5161 return TRUE; 5162 } 5163 } 5164 #endif 5155 5165 if (ww!=NULL) 5156 5166 { -
kernel/GBEngine/kstd1.cc
rdcddf9c rf006a1 2832 2832 2833 2833 strat->rightGB = rightGB; 2834 // this relies on the implementation of idPrepare,2835 // nonMultiplicativeVars should be the number of rows added in idPrepare() (relevant for syzygies)2836 strat->nonMultiplicativeVars = syzComp > 0 ? F->rank - syzComp : 0;2837 assume(syzComp <= 0 || strat->nonMultiplicativeVars == IDELEMS(F));2838 Print("#tagvars: %d\n", strat->nonMultiplicativeVars);2839 2834 2840 2835 if(!TEST_OPT_RETURN_SB) 2841 2836 strat->syzComp = syzComp; 2842 Print("syzComp: %d\n", strat->syzComp);2843 2837 if (TEST_OPT_SB_1) 2844 2838 if(!rField_is_Ring(currRing)) -
kernel/GBEngine/kutil.cc
rdcddf9c rf006a1 12271 12271 * put the pair (q,p) into the set B, ecart=ecart(p), q is the shift of some s[i] 12272 12272 */ 12273 #define CRITERION_DEBUG12274 12273 void enterOnePairShift (poly q, poly p, int ecart, int isFromQ, kStrategy strat, int atR, int ecartq, int qisFromQ, int shiftcount, int ifromS) 12275 12274 { … … 12313 12312 /*- computes the lcm(s[i],p) -*/ 12314 12313 Lp.lcm = p_Lcm(p,q, currRing); // q is what was strat->S[i], so a poly in LM/TR presentation 12315 12316 BOOLEAN lcmHasNonMultiplicativeVar = FALSE;12317 int lV = currRing->isLPring;12318 int degbound = currRing->N/lV;12319 for (int i = 1; i <= degbound; i++)12320 {12321 for (int j = i*lV; j > (i*lV - strat->nonMultiplicativeVars); j--)12322 {12323 if (pGetExp(Lp.lcm,j))12324 {12325 if (lcmHasNonMultiplicativeVar) {12326 pLmFree(Lp.lcm);12327 #ifdef CRITERION_DEBUG12328 /* if (TEST_OPT_DEBUG) PrintS("--- NCGEN crit\n"); */12329 if (TEST_OPT_DEBUG) PrintS("--- NCGEN crit\n");12330 #endif12331 return;12332 }12333 lcmHasNonMultiplicativeVar = TRUE;12334 }12335 }12336 }12337 12314 12338 12315 /* the V criterion */ -
kernel/GBEngine/kutil.h
rdcddf9c rf006a1 367 367 int cv; // in shift bases: counting V criterion 368 368 /*BOOLEAN*/ char rightGB; 369 int nonMultiplicativeVars; // number of variables at the end that are non multipicative (needed for syzygies)370 369 #endif 371 370 /*BOOLEAN*/ char interpt; -
kernel/ideals.cc
rdcddf9c rf006a1 621 621 if (rIsLPRing(currRing)) 622 622 { 623 pSetExp(q, currRing->isLPring - i+ j + 1, 1);623 pSetExp(q, currRing->isLPring - currRing->LPncGenCount + j + 1, 1); 624 624 p_Setm(q, currRing); 625 625 } -
libpolys/polys/monomials/ring.cc
rdcddf9c rf006a1 432 432 if (rIsLPRing(r)) 433 433 { 434 Print("\n// letterplace ring (block size %d )",r->isLPring);434 Print("\n// letterplace ring (block size %d, ncgen count %d)",r->isLPring, r->LPncGenCount); 435 435 } 436 436 #endif … … 1393 1393 #ifdef HAVE_SHIFTBBA 1394 1394 res->isLPring=r->isLPring; /* 0 for non-letterplace rings, otherwise the number of LP blocks, at least 1, known also as lV */ 1395 res->LPncGenCount=r->LPncGenCount; 1395 1396 #endif 1396 1397 … … 1522 1523 #ifdef HAVE_SHIFTBBA 1523 1524 res->isLPring=r->isLPring; /* 0 for non-letterplace rings, otherwise the number of LP blocks, at least 1, known also as lV */ 1525 res->LPncGenCount=r->LPncGenCount; 1524 1526 #endif 1525 1527 … … 1667 1669 #ifdef HAVE_SHIFTBBA 1668 1670 if (r1->isLPring!=r2->isLPring) return FALSE; 1671 if (r1->LPncGenCount!=r2->LPncGenCount) return FALSE; 1669 1672 #endif 1670 1673 -
libpolys/polys/monomials/ring.h
rdcddf9c rf006a1 312 312 #ifdef HAVE_SHIFTBBA 313 313 short isLPring; /* 0 for non-letterplace rings, otherwise the number of LP blocks, at least 1, known also as lV */ 314 short LPncGenCount; 314 315 #endif 315 316 -
libpolys/polys/shiftop.cc
rdcddf9c rf006a1 529 529 PrintLn(); WriteLPExpV(m1ExpV, ri); 530 530 #endif 531 assume(_p_mLPNCGenValid(m1ExpV, ri)); 531 532 } 532 533 … … 564 565 PrintLn(); WriteLPExpV(m1ExpV, ri); 565 566 #endif 567 assume(_p_mLPNCGenValid(m1ExpV, ri)); 566 568 } 567 569 … … 608 610 assume(p_FirstVblock(m1,r) <= 1); 609 611 assume(p_FirstVblock(m2,r) <= 1); 612 } 613 614 BOOLEAN _p_mLPNCGenValid(int *mExpV, const ring r) 615 { 616 BOOLEAN hasNCGen = FALSE; 617 int lV = r->isLPring; 618 int degbound = r->N/lV; 619 int ncGenCount = r->LPncGenCount; 620 for (int i = 1; i <= degbound; i++) 621 { 622 for (int j = i*lV; j > (i*lV - ncGenCount); j--) 623 { 624 if (mExpV[j]) 625 { 626 if (hasNCGen) 627 { 628 return FALSE; 629 } 630 hasNCGen = TRUE; 631 } 632 } 633 } 634 return TRUE; 610 635 } 611 636 … … 673 698 if (B[j]!=0) break; 674 699 } 675 /* do not need e anymore */ 700 701 if (j==0) 702 { 703 omFreeSize((ADDRESS) e, (r->N+1)*sizeof(int)); 704 omFreeSize((ADDRESS) B, (b+1)*sizeof(int)); 705 return 1; 706 } 707 708 if (!_p_mLPNCGenValid(e, r)) 709 { 710 omFreeSize((ADDRESS) e, (r->N+1)*sizeof(int)); 711 omFreeSize((ADDRESS) B, (b+1)*sizeof(int)); 712 return 0; 713 } 714 676 715 omFreeSize((ADDRESS) e, (r->N+1)*sizeof(int)); 677 716 678 if (j==0) goto ret_true;679 717 // { 680 718 // /* it is a zero exp vector, which is in V */ … … 688 726 { 689 727 omFreeSize((ADDRESS) B, (b+1)*sizeof(int)); 690 return (0);691 } 692 } 693 ret_true: 728 return 0; 729 } 730 } 731 694 732 omFreeSize((ADDRESS) B, (b+1)*sizeof(int)); 695 return (1);733 return 1; 696 734 } 697 735 … … 783 821 } 784 822 785 ring freeAlgebra(ring r, int d) 786 { 823 ring freeAlgebra(ring r, int d, int ncGenCount) 824 { 825 if (ncGenCount) r = rCopy0(r); 826 for (int i = 1; i <= ncGenCount; i++) 827 { 828 char *varname=(char *)omAlloc(256); 829 sprintf(varname, "ncgen(%d)", i); 830 ring save = r; 831 r = rPlusVar(r, varname, 0); 832 omFreeSize(varname, 256); 833 rDelete(save); 834 } 787 835 ring R=rCopy0(r); 788 836 int p; … … 795 843 R->N=r->N*d; 796 844 R->isLPring=r->N; 845 R->LPncGenCount=ncGenCount; 797 846 // create R->order 798 847 BOOLEAN has_order_a=FALSE; … … 883 932 R->names=names; 884 933 934 if (ncGenCount) rDelete(r); 885 935 rComplete(R,TRUE); 886 936 return R; -
libpolys/polys/shiftop.h
rdcddf9c rf006a1 55 55 BOOLEAN _p_LPLmDivisibleByNoComp(poly a, poly b, const ring r); 56 56 57 BOOLEAN _p_mLPNCGenValid(int *mExpV, const ring r); 58 57 59 poly p_LPVarAt(poly p, int pos, const ring r); 58 60 59 61 /// create the letterplace ring corresponding to r up to degree d 60 ring freeAlgebra(ring r, int d );62 ring freeAlgebra(ring r, int d, int LPncGenCount = 0); 61 63 #endif 62 64 #endif
Note: See TracChangeset
for help on using the changeset viewer.