Changeset 724361 in git
- Timestamp:
- Aug 30, 2018, 1:29:14 PM (5 years ago)
- Branches:
- (u'spielwiese', 'a719bcf0b8dbc648b128303a49777a094b57592c')
- Children:
- cfce45f606f08b61ca799377f748c37069f669bf
- Parents:
- a0f2b6b7a8139ad5ce4fb16d58135c9558ba191a46db0814d770d7de29357aac459e015a60f8df24
- Files:
-
- 2 added
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/freegb.lib
r46db08 r724361 1 /////////////////////////////////////////////////////////////////////////////2 1 ///////////////////////////////////////////////////////////////////////////// 3 2 version="version freegb.lib 4.1.1.0 Dec_2017 "; // $Id$ … … 92 91 ERROR("uptodeg and lV do not agree on the basering!"); 93 92 } 94 // a kind of dirty hack 95 list L = ringlist(R); 96 attrib(L,"maxExp",1); 97 def @R = ring(L); 98 // Set letterplace-specific attributes for the output ring! 93 94 // Set letterplace-specific attributes for the output ring! 95 // a kind of dirty hack, getting the ringlist again 96 list RL = ringlist(R); 97 attrib(RL, "isLetterplaceRing", lV); 98 attrib(RL, "maxExp", 1); 99 def @R = ring(RL); 100 99 101 attrib(@R, "uptodeg", uptodeg); 100 102 attrib(@R, "isLetterplaceRing", lV); … … 500 502 // assumes of the ring have been checked 501 503 // run the computation - it will test assumes on the ideal 502 int uptodeg = attrib(save,"uptodeg");503 int lV = attrib(save,"isLetterplaceRing");504 504 dbprint(ppl,"start computing GB"); 505 def J = system("freegb",I ,uptodeg,lV);505 def J = system("freegb",I); 506 506 dbprint(ppl,"finished computing GB"); 507 507 dbprint(ppl-1,"the result is:"); … … 2525 2525 ERROR("Incomplete Letterplace structure on the basering!"); 2526 2526 } 2527 int uptodeg = attrib(basering,"uptodeg"); 2528 int lV = attrib(basering,"isLetterplaceRing"); 2529 return(system("stest",a,i,uptodeg,lV)); 2527 return(system("stest",a,i)); 2530 2528 } 2531 2529 example -
Singular/LIB/primdec.lib
ra0f2b6 r724361 1898 1898 if (typeof(rl[1])=="list") 1899 1899 { 1900 if(size(rl[1])==4) 1901 { 1900 1902 list rl1=rl[1]; 1901 1903 list rl2=rl[2]; … … 1907 1909 rl[2]=list(rl2[1..nnp]); 1908 1910 rl[3]=list(list(order,1:nnp),list("C",0)); 1911 } 1912 else /*Float(..), Complex(..) */ 1913 { 1914 list p=rl[1]; 1915 list rl2=rl[2]; 1916 rl[1]=list(p, 1917 list(rl2[nnp+1..nvars(basering)]), 1918 list(list("lp",1:(nvars(basering)-nnp))), 1919 ideal(0)); 1920 rl[2]=list(rl2[1..nnp]); 1921 rl[3]=list(list(order,1:nnp),list("C",0)); 1922 } 1909 1923 } 1910 1924 else -
Singular/extra.cc
r46db08 r724361 1164 1164 if (strcmp(sys_cmd, "stest") == 0) 1165 1165 { 1166 const short t[]={ 4,POLY_CMD,INT_CMD,INT_CMD,INT_CMD};1166 const short t[]={2,POLY_CMD,INT_CMD}; 1167 1167 if (iiCheckTypes(h,t,1)) 1168 1168 { … … 1170 1170 h=h->next; 1171 1171 int sh=(int)((long)(h->Data())); 1172 h=h->next;1173 int uptodeg=(int)((long)(h->Data()));1174 h=h->next;1175 int lVblock=(int)((long)(h->Data()));1176 1172 if (sh<0) 1177 1173 { … … 1179 1175 return TRUE; 1180 1176 } 1181 int L = pLastVblock(p ,lVblock);1182 if (L+sh > uptodeg)1177 int L = pLastVblock(p); 1178 if (L+sh > currRing->N/currRing->isLPring) 1183 1179 { 1184 1180 WerrorS("pLPshift: too big shift requested\n"); 1185 1181 return TRUE; 1186 1182 } 1187 res->data = p_LPshift(p,sh, uptodeg,lVblock,currRing);1183 res->data = p_LPshift(p,sh,currRing); 1188 1184 res->rtyp = POLY_CMD; 1189 1185 return FALSE; … … 1197 1193 if (strcmp(sys_cmd, "btest") == 0) 1198 1194 { 1199 const short t[]={ 2,POLY_CMD,INT_CMD};1195 const short t[]={1,POLY_CMD}; 1200 1196 if (iiCheckTypes(h,t,1)) 1201 1197 { 1202 1198 poly p=(poly)h->CopyD(); 1203 h=h->next;1204 int lV=(int)((long)(h->Data()));1205 1199 res->rtyp = INT_CMD; 1206 res->data = (void*)(long)pLastVblock(p, lV); 1207 return FALSE; 1208 } 1209 else return TRUE; 1210 } 1211 else 1212 #endif 1213 /*==================== shrink-test for freeGB =================*/ 1214 #ifdef HAVE_SHIFTBBA 1215 if (strcmp(sys_cmd, "shrinktest") == 0) 1216 { 1217 const short t[]={2,POLY_CMD,INT_CMD}; 1218 if (iiCheckTypes(h,t,1)) 1219 { 1220 poly p=(poly)h->Data(); 1221 h=h->next; 1222 int lV=(int)((long)(h->Data())); 1223 res->rtyp = POLY_CMD; 1224 // res->data = p_mShrink(p, lV, currRing); 1225 // kStrategy strat=new skStrategy; 1226 // strat->tailRing = currRing; 1227 res->data = p_Shrink(p, lV, currRing); 1200 res->data = (void*)(long)pLastVblock(p); 1228 1201 return FALSE; 1229 1202 } … … 1504 1477 if (strcmp(sys_cmd, "freegb") == 0) 1505 1478 { 1506 const short t[]={ 3,IDEAL_CMD,INT_CMD,INT_CMD};1507 const short tM[]={ 3,MODUL_CMD,INT_CMD,INT_CMD};1479 const short t[]={1,IDEAL_CMD}; 1480 const short tM[]={1,MODUL_CMD}; 1508 1481 if (iiCheckTypes(h,tM,0) 1509 1482 || (iiCheckTypes(h,t,0))) … … 1511 1484 res->rtyp=h->Typ(); 1512 1485 ideal I=(ideal)h->CopyD(); 1513 h=h->next; 1514 int uptodeg=(int)((long)(h->Data())); 1515 h=h->next; 1516 int lVblock=(int)((long)(h->Data())); 1517 res->data = freegb(I,uptodeg,lVblock); 1486 res->data = freegb(I); 1518 1487 if (res->data == NULL) 1519 1488 { … … 1525 1494 else 1526 1495 { 1527 WerrorS("system(\"freegb\",`ideal/module` ,`int`,`int`) expected");1496 WerrorS("system(\"freegb\",`ideal/module`) expected"); 1528 1497 return TRUE; 1529 1498 } -
Singular/ipshell.cc
ra0f2b6 r724361 2273 2273 R->cf = nInitChar(n_long_C, NULL); 2274 2274 else if ((r1<=SHORT_REAL_LENGTH) 2275 && (r2 =SHORT_REAL_LENGTH))2275 && (r2<=SHORT_REAL_LENGTH)) 2276 2276 R->cf = nInitChar(n_R, NULL); 2277 2277 else … … 2280 2280 p->float_len=r1; 2281 2281 p->float_len2=r2; 2282 R->cf = nInitChar(n_long_R, NULL);2282 R->cf = nInitChar(n_long_R, p); 2283 2283 } 2284 2284 2285 2285 if ((r1<=SHORT_REAL_LENGTH) // should go into nInitChar 2286 && (r2 =SHORT_REAL_LENGTH))2286 && (r2<=SHORT_REAL_LENGTH)) 2287 2287 { 2288 2288 R->cf->float_len=SHORT_REAL_LENGTH/2; … … 2477 2477 else 2478 2478 { 2479 Werror("var name %d must be `string` ",i+1);2479 Werror("var name %d must be `string` (not %d)",i+1, v->m[i].Typ()); 2480 2480 return TRUE; 2481 2481 } -
kernel/GBEngine/kInline.h
r46db08 r724361 31 31 #include "kernel/polys.h" 32 32 33 #include "kernel/GBEngine/shiftgb.h" 33 34 34 35 #define HAVE_TAIL_BIN -
kernel/GBEngine/kspoly.cc
ra0f2b6 r724361 60 60 int ret = 0; 61 61 ring tailRing = PR->tailRing; 62 kTest_L(PR );62 kTest_L(PR,tailRing); 63 63 kTest_T(PW); 64 64 … … 189 189 int ret = 0; 190 190 ring tailRing = PR->tailRing; 191 kTest_L(PR );191 kTest_L(PR,tailRing); 192 192 kTest_T(PW); 193 193 … … 333 333 int ret = 0; 334 334 ring tailRing = PR->tailRing; 335 kTest_L(PR );335 kTest_L(PR,tailRing); 336 336 kTest_T(PW); 337 337 … … 466 466 int ret = 0; 467 467 ring tailRing = PR->tailRing; 468 kTest_L(PR );468 kTest_L(PR,tailRing); 469 469 kTest_T(PW); 470 470 … … 660 660 int ret = 0; 661 661 ring tailRing = PR->tailRing; 662 kTest_L(PR );662 kTest_L(PR,tailRing); 663 663 kTest_T(PW); 664 664 … … 897 897 create_count++; 898 898 #endif 899 kTest_L(Pair );899 kTest_L(Pair,tailRing); 900 900 poly p1 = Pair->p1; 901 901 poly p2 = Pair->p2; … … 1031 1031 poly Save = PW->GetLmCurrRing(); 1032 1032 1033 kTest_L(PR );1033 kTest_L(PR,PR->tailRing); 1034 1034 kTest_T(PW); 1035 1035 pAssume(pIsMonomOf(Lp, Current)); … … 1073 1073 poly Save = PW->GetLmCurrRing(); 1074 1074 1075 kTest_L(PR );1075 kTest_L(PR,PR->tailRing); 1076 1076 kTest_T(PW); 1077 1077 pAssume(pIsMonomOf(Lp, Current)); -
kernel/GBEngine/kstd1.cc
r46db08 r724361 2565 2565 #ifdef HAVE_SHIFTBBA 2566 2566 ideal kStdShift(ideal F, ideal Q, tHomog h,intvec ** w, intvec *hilb,int syzComp, 2567 int newIdeal, intvec *vw , int uptodeg, int lV)2567 int newIdeal, intvec *vw) 2568 2568 { 2569 2569 ideal r; … … 2597 2597 if (h==testHomog) 2598 2598 { 2599 if (delete_w)2600 {2601 temp_w=new intvec((strat->ak)+1);2602 w = &temp_w;2603 }2604 2599 if (strat->ak == 0) 2605 2600 { … … 2646 2641 /* global ordering */ 2647 2642 if (w!=NULL) 2648 r=bbaShift(F,Q,*w,hilb,strat ,uptodeg,lV);2643 r=bbaShift(F,Q,*w,hilb,strat); 2649 2644 else 2650 r=bbaShift(F,Q,NULL,hilb,strat ,uptodeg,lV);2645 r=bbaShift(F,Q,NULL,hilb,strat); 2651 2646 } 2652 2647 #ifdef KDEBUG -
kernel/GBEngine/kstd1.h
r46db08 r724361 40 40 41 41 ideal kStdShift(ideal F, ideal Q, tHomog h,intvec ** w, intvec *hilb,int syzComp, 42 int newIdeal, intvec *vw , int uptodeg, int lVblock);42 int newIdeal, intvec *vw); 43 43 44 44 /* the following global data are defined in kutil.cc */ -
kernel/GBEngine/kstd2.cc
ra0f2b6 r724361 1439 1439 //if (TEST_OPT_PROT) { PrintS("N"); mflush(); } 1440 1440 //L->Normalize(); // HANNES: should have a test 1441 kTest_L(L );1441 kTest_L(L,strat->tailRing); 1442 1442 return L->GetLmCurrRing(); 1443 1443 } -
kernel/GBEngine/kstdfac.cc
r46db08 r724361 229 229 s->noetherSet=o->noetherSet; 230 230 #ifdef HAVE_SHIFTBBA 231 s-> lV=o->lV;231 s->cv=o->cv; 232 232 #endif 233 233 #ifdef HAVE_PLURAL -
kernel/GBEngine/kutil.cc
ra0f2b6 r724361 244 244 if (strat->kHEdgeFound) 245 245 { 246 kTest_L(L );246 kTest_L(L,strat->tailRing); 247 247 poly p1; 248 248 poly p = L->GetLmTailRing(); … … 311 311 kBucketDestroy(&bucket); 312 312 } 313 kTest_L(L );313 kTest_L(L,strat->tailRing); 314 314 } 315 315 } … … 7550 7550 //if (TEST_OPT_PROT) { PrintS("N"); mflush(); } 7551 7551 //L->Normalize(); // HANNES: should have a test 7552 kTest_L(L );7552 kTest_L(L,strat->tailRing); 7553 7553 return L->GetLmCurrRing(); 7554 7554 } … … 7665 7665 //if (TEST_OPT_PROT) { PrintS("N"); mflush(); } 7666 7666 //L->Normalize(); // HANNES: should have a test 7667 kTest_L(L );7667 kTest_L(L,strat->tailRing); 7668 7668 return L->GetLmCurrRing(); 7669 7669 } … … 7780 7780 //if (TEST_OPT_PROT) { PrintS("N"); mflush(); } 7781 7781 //L->Normalize(); // HANNES: should have a test 7782 kTest_L(L );7782 kTest_L(L,strat->tailRing); 7783 7783 return L->GetLmCurrRing(); 7784 7784 } … … 12677 12677 } 12678 12678 L->Normalize(); // HANNES: should have a test 12679 kTest_L(L );12679 kTest_L(L,strat->tailRing); 12680 12680 return L->GetLmCurrRing(); 12681 12681 } -
kernel/GBEngine/kutil.h
ra0f2b6 r724361 640 640 BOOLEAN kTest_TS(kStrategy strat); 641 641 // test LObject 642 BOOLEAN kTest_L(LObject* L, ring tailRing = NULL,642 BOOLEAN kTest_L(LObject* L, ring tailRing, 643 643 BOOLEAN testp = FALSE, int lpos = -1, 644 644 TSet T = NULL, int tlength = -1); … … 652 652 #define kTest_T(T) (TRUE) 653 653 #define kTest_S(T) (TRUE) 654 #define kTest_L(T )(TRUE)654 #define kTest_L(T,R) (TRUE) 655 655 #endif 656 656 -
kernel/GBEngine/shiftgb.cc
r46db08 r724361 35 35 #define freeT(A,v) omFreeSize((ADDRESS)A,(v+1)*sizeof(int)) 36 36 37 38 /* TODO: write p* stuff as instances of p_* for all the functions */ 39 /* p_* functions are new, p* are old */ 40 41 poly p_LPshiftT(poly p, int sh, int uptodeg, int lV, kStrategy strat, const ring r) 37 poly p_LPshiftT(poly p, int sh, kStrategy strat, const ring r) 42 38 { 43 39 /* assume shift takes place, shifts the poly p by sh */ … … 55 51 56 52 poly q = NULL; 57 poly s = p_mLPshift(p_Head(p,r), sh, uptodeg, lV,r); // lm in currRing53 poly s = p_mLPshift(p_Head(p,r), sh, r); // lm in currRing 58 54 /* pNext(s) will be fixed below */ 59 55 poly pp = pNext(p); … … 61 57 while (pp != NULL) 62 58 { 63 poly h=p_mLPshift(p_Head(pp,strat->tailRing),sh, uptodeg,lV,strat->tailRing);59 poly h=p_mLPshift(p_Head(pp,strat->tailRing),sh,strat->tailRing); 64 60 pIter(pp); 65 61 … … 71 67 } 72 68 73 poly p_LPshift(poly p, int sh, int uptodeg, int lV,const ring r)69 poly p_LPshift(poly p, int sh, const ring r) 74 70 { 75 71 /* assume shift takes place */ … … 77 73 78 74 /* assume sh and uptodeg agree TODO check */ 79 assume(sh>=0);80 75 81 76 if (sh == 0) return(p); /* the zero shift */ … … 88 83 pIter(pp); 89 84 pNext(h)=NULL; 90 h=p_mLPshift(h,sh, uptodeg,lV,r);85 h=p_mLPshift(h,sh,r); 91 86 q = p_Add_q(q, h,r); 92 87 } … … 94 89 } 95 90 96 poly p_mLPshift(poly p, int sh, int uptodeg, int lV,const ring r)91 poly p_mLPshift(poly p, int sh, const ring r) 97 92 { 98 93 /* p is a monomial from the ring r */ 99 94 100 if (sh == 0) return(p); /* the zero shift */ 101 102 assume(sh>=0); 103 int L = p_mLastVblock(p,lV,r); 104 assume(L+sh<=uptodeg); 95 int lV = r->isLPring; 96 97 if (sh == 0 || p == NULL || p_LmIsConstantComp(p,r)) return(p); 98 99 int L = p_mLastVblock(p,r); 100 assume(L+sh>=1); 101 assume(L+sh<=r->N/lV); 105 102 106 103 int *e=(int *)omAlloc0((r->N+1)*sizeof(int)); … … 117 114 { 118 115 assume(j + (sh*lV)<=r->N); 116 assume(j + (sh*lV)>=1); 119 117 s[j + (sh*lV)] = e[j]; /* actually 1 */ 120 118 } … … 130 128 } 131 129 132 int p_LastVblockT(poly p, int lV, kStrategy strat, const ring r) 133 { 134 /* returns the number of maximal block */ 135 /* appearing among the monomials of p */ 136 /* the 0th block is the 1st one */ 137 138 /* p is like TObject: lm in currRing = r, tail in tailRing */ 139 assume(p_LmCheckIsFromRing(p,r)); 140 assume(p_CheckIsFromRing(pNext(p),strat->tailRing)); 141 142 int ans = p_mLastVblock(p, lV, r); // Block of LM 143 poly q = pNext(p); 144 int ansnew = 0; 145 while (q != NULL) 146 { 147 ansnew = p_mLastVblock(q, lV, strat->tailRing); 148 ans = si_max(ans,ansnew); 149 pIter(q); 150 } 151 /* do not need to delete q */ 152 return(ans); 153 } 154 155 int p_LastVblock(poly p, int lV, const ring r) 156 { 157 /* returns the number of maximal block */ 158 /* appearing among the monomials of p */ 159 /* the 0th block is the 1st one */ 130 /* returns the number of maximal block */ 131 /* appearing among the monomials of p */ 132 /* the 0th block is the 1st one */ 133 int p_LastVblock(poly p, const ring r) 134 { 160 135 poly q = p; 161 136 int ans = 0; 162 int ansnew = 0;163 137 while (q!=NULL) 164 138 { 165 ansnew = p_mLastVblock(q, lV, r);139 int ansnew = p_mLastVblock(q, r); 166 140 ans = si_max(ans,ansnew); 167 141 pIter(q); … … 170 144 } 171 145 172 int p_mLastVblock(poly p, int lV, const ring r) 173 { 174 /* for a monomial p, returns the number of the last block */ 175 /* where a nonzero exponent is sitting */ 176 if (p _LmIsConstant(p,r))146 /* for a monomial p, returns the number of the last block */ 147 /* where a nonzero exponent is sitting */ 148 int p_mLastVblock(poly p, const ring r) 149 { 150 if (p == NULL || p_LmIsConstantComp(p,r)) 177 151 { 178 152 return(0); 179 153 } 154 155 int lV = r->isLPring; 180 156 int *e=(int *)omAlloc0((r->N+1)*sizeof(int)); 181 157 p_GetExpV(p,e,r); … … 189 165 } 190 166 191 int pFirstVblock(poly p, int lV) 192 { 193 /* returns the number of maximal block */ 194 /* appearing among the monomials of p */ 195 /* the 0th block is the 1st one */ 196 poly q = p; //p_Copy(p,currRing); /* need it ? */ 197 int ans = 0; 198 int ansnew = 0; 167 /* returns the number of maximal block */ 168 /* appearing among the monomials of p */ 169 /* the 0th block is the 1st one */ 170 int p_FirstVblock(poly p, const ring r) 171 { 172 if (p == NULL) { 173 return 0; 174 } 175 176 poly q = p; 177 int ans = p_mFirstVblock(q, r); 199 178 while (q!=NULL) 200 179 { 201 ansnew = pmFirstVblock(q,lV); 202 ans = si_min(ans,ansnew); 180 int ansnew = p_mFirstVblock(q, r); 181 if (ansnew > 0) { // don't count constants 182 ans = si_min(ans,ansnew); 183 } 203 184 pIter(q); 204 185 } … … 207 188 } 208 189 209 int pmFirstVblock(poly p, int lV) 210 { 211 if (pIsConstantPoly(p)) 212 { 213 return(int(0)); 214 } 215 /* for a monomial p, returns the number of the first block */ 216 /* where a nonzero exponent is sitting */ 217 int *e=(int *)omAlloc0((currRing->N+1)*sizeof(int)); 218 p_GetExpV(p,e,currRing); 190 /* for a monomial p, returns the number of the first block */ 191 /* where a nonzero exponent is sitting */ 192 int p_mFirstVblock(poly p, const ring r) 193 { 194 if (p == NULL || p_LmIsConstantComp(p,r)) 195 { 196 return(0); 197 } 198 199 int lV = r->isLPring; 200 int *e=(int *)omAlloc0((r->N+1)*sizeof(int)); 201 p_GetExpV(p,e,r); 219 202 int j,b; 220 203 j = 1; 221 while ( (!e[j]) && (j<=currRing->N-1) ) j++; 222 if (j==currRing->N + 1) 223 { 224 #ifdef PDEBUG 225 PrintS("pmFirstVblock: unexpected zero exponent vector\n"); 226 #endif 227 return(j); 228 } 229 b = (int)(j/lV)+1; /* the number of the block, 1<= N <= currRing->N */ 204 while ( (!e[j]) && (j<=r->N-1) ) j++; 205 freeT(e, r->N); 206 assume(j <= r->N); 207 b = (int)(j+lV-1)/lV; /* the number of the block, 1<= b <= r->N */ 230 208 return (b); 231 209 } 232 210 233 /* there should be two routines: */ 234 /* 1. test place-squarefreeness: in homog this suffices: isInV */ 235 /* 2. test the presence of a hole -> in the tail??? */ 236 237 int isInV(poly p, int lV) 238 { 211 /* there should be two routines: */ 212 /* 1. test place-squarefreeness: in homog this suffices: isInV */ 213 /* 2. test the presence of a hole -> in the tail??? */ 214 215 int isInV(poly p, const ring r) 216 { 217 int lV = r->isLPring; 239 218 /* investigate only the leading monomial of p in currRing */ 240 219 if ( pTotaldegree(p)==0 ) return(1); 241 if (lV <= 0) return(0);242 220 /* returns 1 iff p is in V */ 243 221 /* that is in each block up to a certain one there is only one nonzero exponent */ … … 287 265 } 288 266 289 int poly_isInV(poly p, int lV) 290 { 291 /* tests whether the whole polynomial p in in V */ 267 /* tests whether the whole polynomial p in in V */ 268 int poly_isInV(poly p, const ring r) 269 { 292 270 poly q = p; 293 271 while (q!=NULL) 294 272 { 295 if ( !isInV(q, lV) )273 if ( !isInV(q, r) ) 296 274 { 297 275 return(0); … … 302 280 } 303 281 304 int ideal_isInV(ideal I, int lV) 305 { 306 /* tests whether each polynomial of an ideal I lies in in V */ 282 /* tests whether each polynomial of an ideal I lies in in V */ 283 int ideal_isInV(ideal I, const ring r) 284 { 307 285 int i; 308 286 int s = IDELEMS(I)-1; 309 287 for(i = 0; i <= s; i++) 310 288 { 311 if ( !poly_isInV(I->m[i], lV) )289 if ( !poly_isInV(I->m[i], r) ) 312 290 { 313 291 return(0); … … 318 296 319 297 320 int itoInsert(poly p, int uptodeg, int lV, const ring r) 321 { 322 /* for poly in lmCR/tailTR presentation */ 298 /* for poly in lmCR/tailTR presentation */ 299 int itoInsert(poly p, const ring r) 300 { 323 301 /* the below situation (commented out) might happen! */ 324 302 // if (r == currRing) … … 328 306 // } 329 307 /* compute the number of insertions */ 330 int i = p_mLastVblock(p, lV,currRing);308 int i = p_mLastVblock(p, currRing); 331 309 if (pNext(p) != NULL) 332 310 { 333 i = si_max(i, p_LastVblock(pNext(p), lV,r) );311 i = si_max(i, p_LastVblock(pNext(p), r) ); 334 312 } 335 313 // i = uptodeg - i +1; 336 i = uptodeg - i;314 int uptodeg = r->N/r->isLPring; 337 315 // p_wrp(p,currRing,r); Print("----i:%d",i); PrintLn(); 338 return(i); 339 } 340 341 poly p_ShrinkT(poly p, int lV, kStrategy strat, const ring r) 342 //poly p_Shrink(poly p, int uptodeg, int lV, kStrategy strat, const ring r) 343 { 344 /* p is like TObject: lm in currRing = r, tail in tailRing */ 345 /* proc shrinks the poly p in ring r */ 346 /* lV = the length of V = the number of orig vars */ 347 /* check assumes/exceptions */ 348 /* r->N is a multiple of lV */ 349 350 if (p==NULL) return(p); 351 352 assume(p_LmCheckIsFromRing(p,r)); 353 assume(p_CheckIsFromRing(pNext(p),strat->tailRing)); 354 355 poly q = NULL; 356 poly s = p_mShrink(p, lV, r); // lm in currRing 357 poly pp = pNext(p); 358 359 while (pp != NULL) 360 { 361 // q = p_Add_q(q, p_mShrink(pp,uptodeg,lV,strat->tailRing),strat->tailRing); 362 q = p_Add_q(q, p_mShrink(pp,lV,strat->tailRing),strat->tailRing); 363 pIter(pp); 364 } 365 pNext(s) = q; 366 return(s); 367 } 368 369 poly p_Shrink(poly p, int lV, const ring r) 370 { 371 /* proc shrinks the poly p in ring r */ 372 /* lV = the length of V = the number of orig vars */ 373 /* check assumes/exceptions */ 374 /* r->N is a multiple of lV */ 375 376 if (p==NULL) return(p); 377 assume(p_CheckIsFromRing(p,r)); 378 poly q = NULL; 379 poly pp = p; 380 381 while (pp != NULL) 382 { 383 q = p_Add_q(q, p_mShrink(pp,lV,r),r); 384 pIter(pp); 385 } 386 return(q); 387 } 388 389 poly p_mShrink(poly p, int lV, const ring r) 390 { 391 /* shrinks the monomial p in ring r */ 392 /* lV = the length of V = the number of orig vars */ 393 394 /* check assumes/exceptions */ 395 /* r->N is a multiple of lV */ 396 397 int *e = (int *)omAlloc0((r->N+1)*sizeof(int)); 398 int b = (int)((r->N +lV-1)/lV); /* the number of blocks */ 399 // int *B = (int *)omAlloc0((b+1)*sizeof(int)); /* the num of elements in a block */ 400 int *S = (int *)omAlloc0((r->N+1)*sizeof(int)); /* the shrinked exponent */ 401 p_GetExpV(p,e,r); 402 int i,j; int cnt = 1; //counter for blocks in S 403 for (j=1; j<=b; j++) 404 { 405 /* we go through all the vars */ 406 /* by blocks in lV vars */ 407 for (i=(j-1)*lV + 1; i<= j*lV; i++) 408 { 409 if (e[i]==1) 410 { 411 // B[j] = B[j]+1; // for control in V? 412 S[(cnt-1)*lV + (i - (j-1)*lV)] = e[i]; 413 /* assuming we are in V, can interrupt here */ 414 cnt++; 415 // break; //results in incomplete shrink! 416 i = j*lV; // manual break under assumption p is in V 417 } 418 } 419 } 420 #ifdef PDEBUG 421 // Print("p_mShrink: cnt = [%d], b = %d\n",cnt,b); 316 return uptodeg - i; 317 } 318 319 // splits a frame (e.g. x(1)*y(5)) m1 into m1 and m2 (e.g. m1=x(1) and m2=y(1)) 320 // according to p which is inside the frame 321 void k_SplitFrame(poly &m1, poly &m2, int at, const ring r) { 322 int lV = r->isLPring; 323 324 number m1Coeff = pGetCoeff(m1); 325 326 int hole = lV * at; 327 m2 = p_GetExp_k_n(m1, 1, hole, r); 328 m1 = p_GetExp_k_n(m1, hole, r->N, r); 329 330 p_LPshift(m2, 1 - p_mFirstVblock(m2, r), r); 331 p_SetCoeff(m1, m1Coeff, r); 332 } 333 422 334 #endif 423 // cnt -1 <= b must hold!424 // freeT(B, b);425 poly s = p_One(r);426 p_SetExpV(s,S,r);427 freeT(e, r->N);428 freeT(S, r->N);429 /* p_Setm(s,r); // done by p_SetExpV */430 p_SetComp(s,p_GetComp(p,r),r); // component is preserved431 p_SetCoeff(s,n_Copy(p_GetCoeff(p,r),r->cf),r); // coeff is preserved432 #ifdef PDEBUG433 // Print("p_mShrink: from "); p_wrp(p,r); Print(" to "); p_wrp(s,r); PrintLn();434 #endif435 return(s);436 }437 438 /* shiftgb stuff */439 440 441 /*2442 *if the leading term of p443 *divides the leading term of some T[i] it will be canceled444 */445 // static inline void clearSShift (poly p, unsigned long p_sev,int l, int* at, int* k,446 // kStrategy strat)447 // {448 // assume(p_sev == pGetShortExpVector(p));449 // if (!pLmShortDivisibleBy(p,p_sev, strat->T[*at].p, ~ strat->sevT[*at])) return;450 // // if (l>=strat->lenS[*at]) return;451 // if (TEST_OPT_PROT)452 // PrintS("!");453 // mflush();454 // //pDelete(&strat->S[*at]);455 // deleteInS((*at),strat);456 // (*at)--;457 // (*k)--;458 // // assume(lenS_correct(strat));459 // }460 461 /* remarks: cleanT : just deletion462 enlargeT: just reallocation */463 464 #endif -
kernel/GBEngine/shiftgb.h
r46db08 r724361 12 12 #include "polys/nc/nc.h" 13 13 14 poly p_LPshiftT(poly p, int sh, int uptodeg, int lV, kStrategy strat, const ring r); 15 int p_LastVblockT(poly p, int lV, kStrategy strat, const ring r); 14 poly p_LPshiftT(poly p, int sh, kStrategy strat, const ring r); 16 15 17 poly p_ShrinkT(poly p, int lV, kStrategy strat, const ring r); 18 poly p_Shrink(poly p, int lV, const ring r); 19 poly p_mShrink(poly p, int lV, const ring r); 20 //poly p_Shrink(poly p, int uptodeg, int lV, kStrategy strat, const ring r); 21 //poly p_mShrink(poly p, int uptodeg, int lV, const ring r); 16 poly p_LPshift(poly p, int sh, const ring r); 17 poly p_mLPshift(poly p, int sh, const ring r); 22 18 23 poly p_LPshift(poly p, int sh, int uptodeg, int lV,const ring r);24 poly p_mLPshift(poly p, int sh, int uptodeg, int lV,const ring r);19 int p_mLastVblock(poly p, const ring r); 20 int p_LastVblock(poly p, const ring r); 25 21 26 int p_mLastVblock(poly p, int lV,const ring r); 27 int p_LastVblock(poly p, int lV, const ring r); 22 #define pLastVblock(p) p_LastVblock(p,currRing) 23 #define pmLastVblock(p) p_mLastVblock(p,currRing) 28 24 29 //int pLastVblock(poly p, int lV); 30 #define pLastVblock(p,lV) p_LastVblock(p,lV,currRing) 31 //int pmLastVblock(poly p, int lV); 32 #define pmLastVblock(p,lV) p_mLastVblock(p,lV,currRing) 25 int p_FirstVblock(poly p, const ring r); 26 int p_mFirstVblock(poly p, const ring r); 33 27 34 int pFirstVblock(poly p, int lV); 35 int pmFirstVblock(poly p, int lV); 28 #define pFirstVblock(p) p_FirstVblock(p,currRing) 29 #define pmFirstVblock(p) p_mFirstVblock(p,currRing) 36 30 37 int isInV(poly p, int lV);38 int poly_isInV(poly p, int lV);39 int ideal_isInV(ideal I, int lV);31 int isInV(poly p, const ring r); 32 int poly_isInV(poly p, const ring r); 33 int ideal_isInV(ideal I, const ring r); 40 34 41 int itoInsert(poly p, int uptodeg, int lV,const ring r);35 int itoInsert(poly p, const ring r); 42 36 37 void k_SplitFrame(poly &m1, poly &m2, int at, const ring r); 43 38 #endif 44 39 #endif -
libpolys/coeffs/longrat.cc
r46db08 r724361 1638 1638 #endif 1639 1639 } 1640 1640 #ifdef LDEBUG 1641 1641 memset(*a,0,sizeof(**a)); 1642 1642 #endif 1643 1643 FREE_RNUMBER(*a); // omFreeBin((void *) *a, rnumber_bin); 1644 1644 } -
libpolys/polys/Makefile.am
r46db08 r724361 35 35 kbuckets.cc sbuckets.cc weight.cc weight0.c simpleideals.cc matpol.cc \ 36 36 sparsmat.cc \ 37 shiftop.cc \ 37 38 ${USE_P_PROCS_STATIC_CC} ${USE_P_PROCS_DYNAMIC_CC} mod_raw.cc \ 38 39 ext_fields/algext.cc ext_fields/transext.cc \ … … 47 48 kbuckets.h sbuckets.h simpleideals.h weight.h matpol.h \ 48 49 sparsmat.h clapsing.h clapconv.h coeffrings.h flintconv.h\ 50 shiftop.h \ 49 51 ext_fields/algext.h ext_fields/transext.h mod_raw.h 50 52 -
libpolys/polys/kbuckets.cc
r46db08 r724361 738 738 { 739 739 pSetCoeff0(m, n_InpNeg(pGetCoeff(m),r->cf)); 740 p1= pp_Mult_mm(p,m,r);740 p1=r->p_Procs->pp_mm_Mult(p,m,r); 741 741 pSetCoeff0(m, n_InpNeg(pGetCoeff(m),r->cf)); 742 742 l1=pLength(p1); … … 780 780 else 781 781 { 782 p1 = r->p_Procs->pp_ Mult_mm(p1, m, r);782 p1 = r->p_Procs->pp_mm_Mult(p1, m, r); 783 783 } 784 784 pSetCoeff0(m, n_InpNeg(pGetCoeff(m),r->cf)); -
libpolys/polys/templates/p_Procs_Set.h
r46db08 r724361 16 16 #include "reporter/reporter.h" 17 17 #include "misc/auxiliary.h" 18 #include "shiftop.h" 18 19 19 20 // extract p_Procs properties from a ring … … 165 166 } 166 167 #endif 167 _p_procs->p_mm_Mult=_p_procs->p_Mult_mm; 168 _p_procs->pp_mm_Mult=_p_procs->pp_Mult_mm; 168 if (r->isLPring) { 169 _p_procs->pp_Mult_mm = shift_pp_Mult_mm; 170 _p_procs->p_Mult_mm = shift_p_Mult_mm; 171 _p_procs->p_mm_Mult = shift_p_mm_Mult; 172 _p_procs->pp_mm_Mult = shift_pp_mm_Mult; 173 _p_procs->p_Minus_mm_Mult_qq = shift_p_Minus_mm_Mult_qq; 174 // Unsupported 175 _p_procs->pp_Mult_mm_Noether = shift_pp_Mult_mm_Noether_STUB; 176 _p_procs->pp_Mult_Coeff_mm_DivSelect = shift_pp_Mult_Coeff_mm_DivSelect_STUB; 177 _p_procs->pp_Mult_Coeff_mm_DivSelectMult = shift_pp_Mult_Coeff_mm_DivSelectMult_STUB; 178 } else { 179 _p_procs->p_mm_Mult=_p_procs->p_Mult_mm; 180 _p_procs->pp_mm_Mult=_p_procs->pp_Mult_mm; 181 } 169 182 CheckProc(p_Copy); 170 183 CheckProc(p_Delete);
Note: See TracChangeset
for help on using the changeset viewer.