Changeset c1489f2 in git for Singular/kstd2.cc
- Timestamp:
- Oct 19, 1999, 2:42:51 PM (25 years ago)
- Branches:
- (u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', '38dfc5131670d387a89455159ed1e071997eec94')
- Children:
- 828c28214a338ded17f2365a5cc851ddddadfac3
- Parents:
- d2b6cf082728946a490177ca3d6aba074109fe5c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/kstd2.cc
rd2b6cf rc1489f2 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: kstd2.cc,v 1.3 6 1999-10-18 11:19:27obachman Exp $ */4 /* $Id: kstd2.cc,v 1.37 1999-10-19 12:42:44 obachman Exp $ */ 5 5 /* 6 6 * ABSTRACT - Kernel: alg. of Buchberger … … 40 40 return NULL; 41 41 } 42 43 /*244 * reduction procedure for the syz45 * and TEST_OPT_MINRES: special minimizing during computations46 * assumes homogeneous case and degree-ordering47 */48 #if 049 static int redSyz (LObject* h,kStrategy strat)50 {51 int j = 0,i=0,pos;52 BOOLEAN exchanged=pDivisibleBy((*h).p2,(*h).p1);53 poly p,q;54 unsigned long not_sev;55 56 if (exchanged)57 {58 q = kFromInput((*h).p1,strat);59 if (q==NULL)60 {61 exchanged = FALSE;62 }63 else64 {65 while (i<=strat->Ll)66 {67 if ((strat->L[i].p1==strat->P.p1) || (strat->L[i].p2==strat->P.p1))68 {69 deleteInL(strat->L,&strat->Ll,i,strat);70 }71 else72 i++;73 }74 i = 0;75 }76 }77 if (TEST_OPT_DEBUG)78 {79 PrintS("red:");80 wrp(h->p);81 }82 loop83 {84 i = 0;85 j = strat->sl + 1;86 not_sev = ~ PGetShortExpVector(h->p);87 while (i <= strat->tl)88 {89 if (pShortDivisibleBy(strat->T[i], strat->T[i].sev, h->p, not_sev))90 {91 if ((!exchanged) && (pEqual((*h).p,strat->T[i].p)))92 {93 j = 0;94 while (j<=strat->sl)95 {96 if (strat->S[j] == strat->T[i].p) break;97 }98 if (j <= strat->sl) break;99 }100 else101 {102 break;103 }104 }105 i++;106 }107 108 if (i > strat->tl)109 {110 // nothing to reduce with111 if (exchanged)112 {113 assume(q!= NULL);114 if (pGetComp((*h).p) > strat->syzComp)115 {116 pDelete(&((*h).p));117 pDelete(&q);118 return;119 }120 else121 {122 if (!TEST_OPT_INTSTRATEGY)123 {124 pos = posInS(strat->S,strat->sl,(*h).p);125 pNorm((*h).p);126 (*h).p = redtailSyz((*h).p,pos-1,strat);127 }128 p = (*h).p;129 while ((pNext(p)!=NULL) && (pGetComp(pNext(p))<=strat->syzComp))130 pIter(p);131 pDelete(&pNext(p));132 pNext(p) = q;133 q = NULL;134 }135 }136 else if (!TEST_OPT_INTSTRATEGY)137 {138 pos = posInS(strat->S,strat->sl,(*h).p);139 pNorm((*h).p);140 (*h).p = redtailSyz((*h).p,pos-1,strat);141 }142 if (q != NULL) pDelete(&q);143 enterTBba((*h),strat->tl+1,strat);144 return;145 }146 147 // found one to reduce148 if (j <= strat->sl)149 {150 // might have found a better one ?151 q = kFromInput(strat->S[j],strat);152 if (q!=NULL)153 {154 exchanged = TRUE;155 p = strat->S[j];156 if (!TEST_OPT_INTSTRATEGY)157 pNorm((*h).p);158 else159 {160 //pContent((*h).p);161 pCleardenom((*h).p);// also does a pContent162 }163 strat->S[j] = (*h).p;164 (*h).p = p;165 strat->T[i].p = strat->S[j];166 for (i=0;i<=strat->Ll;i++)167 {168 if (strat->L[i].p1==p) strat->L[i].p1=strat->S[j];169 if (strat->L[i].p2==p) strat->L[i].p2=strat->S[j];170 }171 }172 }173 174 if (TEST_OPT_DEBUG)175 {176 PrintS(" with ");177 wrp(strat->T[i].p);178 }179 kbReducePoly(h, &(strat->T[i]), strat->kNoether);180 if (TEST_OPT_DEBUG)181 {182 PrintS("\nto "); wrp((*h).p);PrintLn();183 }184 if ((*h).p == NULL)185 {186 if (h->lcm!=NULL) pFree1((*h).lcm);187 #ifdef KDEBUG188 (*h).lcm=NULL;189 #endif190 if (q != NULL) pDelete(&q);191 return;192 }193 }194 }195 196 #else197 198 static int redSyz (LObject* h,kStrategy strat)199 {200 int j = 0,i=0,pos;201 BOOLEAN exchanged=pDivisibleBy((*h).p2,(*h).p1);202 poly p,q;203 unsigned long not_sev;204 205 if (exchanged)206 {207 q = kFromInput((*h).p1,strat);208 if (q==NULL)209 {210 exchanged = FALSE;211 }212 else213 {214 while (i<=strat->Ll)215 {216 if ((strat->L[i].p1==strat->P.p1) || (strat->L[i].p2==strat->P.p1))217 {218 deleteInL(strat->L,&strat->Ll,i,strat);219 }220 else221 i++;222 }223 i = 0;224 }225 }226 if (TEST_OPT_DEBUG)227 {228 PrintS("red:");229 wrp(h->p);230 }231 h->sev = pGetShortExpVector(h->p);232 not_sev = ~ h->sev;233 loop234 {235 if (pShortDivisibleBy(strat->S[j], strat->sevS[j], h->p, not_sev))236 {237 if ((!exchanged) && (pEqual((*h).p,strat->S[j])))238 {239 q = kFromInput(strat->S[j],strat);240 if (q!=NULL)241 {242 exchanged = TRUE;243 p = strat->S[j];244 if (!TEST_OPT_INTSTRATEGY)245 pNorm((*h).p);246 else247 {248 //pContent((*h).p);249 pCleardenom((*h).p);// also does a pContent250 }251 strat->S[j] = (*h).p;252 strat->sevS[j] = ~ not_sev;253 (*h).p = p;254 h->sev = strat->sevS[j];255 while ((i<=strat->tl) && (strat->T[i].p!=p)) i++;256 if (i<=strat->tl) strat->T[i].SetP(strat->S[j]);257 for (i=0;i<=strat->Ll;i++)258 {259 if (strat->L[i].p1==p) strat->L[i].p1=strat->S[j];260 if (strat->L[i].p2==p) strat->L[i].p2=strat->S[j];261 }262 }263 }264 //if (strat->interpt) test_int_std(strat->kIdeal);265 /*- compute the s-polynomial -*/266 if (TEST_OPT_DEBUG)267 {268 PrintS(" with ");269 wrp(strat->S[j]);270 }271 (*h).p = ksOldSpolyRed(strat->S[j],(*h).p,strat->kNoether);272 if (TEST_OPT_DEBUG)273 {274 PrintS("\nto "); wrp((*h).p);PrintLn();275 }276 if ((*h).p == NULL)277 {278 if (h->lcm!=NULL) pFree1((*h).lcm);279 #ifdef KDEBUG280 (*h).lcm=NULL;281 #endif282 return 0;283 }284 /*- try to reduce the s-polynomial -*/285 j = 0;286 h->sev = pGetShortExpVector(h->p);287 not_sev = ~ h->sev;288 }289 else290 {291 if (j >= strat->sl)292 {293 if (exchanged)294 {295 if (pGetComp((*h).p) > strat->syzComp)296 {297 pDelete(&((*h).p));298 return 0;299 }300 else301 {302 if (!TEST_OPT_INTSTRATEGY)303 {304 pos = posInS(strat->S,strat->sl,(*h).p);305 pNorm((*h).p);306 (*h).p = redtailSyz((*h).p,pos-1,strat);307 }308 p = (*h).p;309 while ((pNext(p)!=NULL) && (pGetComp(pNext(p))<=strat->syzComp))310 pIter(p);311 pDelete(&pNext(p));312 pNext(p) = q;313 }314 }315 else if (!TEST_OPT_INTSTRATEGY)316 {317 pos = posInS(strat->S,strat->sl,(*h).p);318 pNorm((*h).p);319 (*h).p = redtailSyz((*h).p,pos-1,strat);320 }321 enterTBba((*h),strat->tl+1,strat);322 return 1;323 }324 j++;325 }326 }327 }328 329 #endif330 42 331 43 /*2 … … 805 517 else 806 518 strat->red = redHomog; 807 if (TEST_OPT_MINRES && strat->homog && (strat->syzComp >0))808 {809 strat->red = redSyz;810 strat->posInT = posInT0;811 }812 813 519 if (pLexOrder && strat->honey) 814 520 strat->initEcart = initEcartNormal; … … 926 632 { 927 633 pCleardenom(strat->P.p); 928 if ((!TEST_OPT_MINRES)||(strat->syzComp==0)||(!strat->homog)) 929 { 930 strat->P.p = redtailBba(strat->P.p,pos-1,strat); 931 pCleardenom(strat->P.p); 932 } 634 strat->P.p = redtailBba(strat->P.p,pos-1,strat); 635 pCleardenom(strat->P.p); 933 636 } 934 637 else 935 638 { 936 639 pNorm(strat->P.p); 937 if ((!TEST_OPT_MINRES)||(strat->syzComp==0)||(!strat->homog)) 938 { 939 strat->P.p = redtailBba(strat->P.p,pos-1,strat); 940 } 640 strat->P.p = redtailBba(strat->P.p,pos-1,strat); 941 641 } 942 642 … … 962 662 strat); 963 663 enterpairs(strat->P.p,strat->sl,strat->P.ecart,pos,strat); 964 // do we really need to recompute posInS965 strat->enterS(strat->P, posInS(strat->S,strat->sl,strat->P.p), strat);664 // posInS only depends only onthe leading term 665 strat->enterS(strat->P, pos, strat); 966 666 if (hilb!=NULL) khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat); 967 667 }
Note: See TracChangeset
for help on using the changeset viewer.