Changeset c8bd75 in git for Singular/kstd2.cc


Ignore:
Timestamp:
Apr 23, 1998, 11:52:15 AM (26 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'c5facdfddea2addfd91babd8b9019161dea4b695')
Children:
d6fc3c5cb4a5d2eed49001686d571df819c5496b
Parents:
5079a04545e2a0f77d583f20b994866d68545a3b
Message:
 *hannes: minor fixes


git-svn-id: file:///usr/local/Singular/svn/trunk@1431 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/kstd2.cc

    r5079a04 rc8bd75  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: kstd2.cc,v 1.16 1998-04-07 17:55:10 Singular Exp $ */
     4/* $Id: kstd2.cc,v 1.17 1998-04-23 09:52:10 Singular Exp $ */
    55/*
    66*  ABSTRACT -  Kernel: alg. of Buchberger
     
    10531053  /* compute------------------------------------------------------- */
    10541054  while ((stdTrace!=NULL && !stdTrace->CheckEnd(strat)) || (stdTrace == NULL && strat->Ll>=0))
    1055     {
     1055  {
    10561056//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    1057       if(stdTrace!=NULL && stdTrace->Receive)
    1058         {
    1059           stdTrace->ReceiveMsg();
    1060           stdTrace->ParseMessage(strat);
    1061         }
     1057    if(stdTrace!=NULL && stdTrace->Receive)
     1058    {
     1059      stdTrace->ReceiveMsg();
     1060      stdTrace->ParseMessage(strat);
     1061    }
    10621062//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    1063       if((stdTrace!=NULL && stdTrace->Verwaltung) || (stdTrace == NULL))
    1064         {
    1065           if (strat->Ll > lrmax) lrmax =strat->Ll;/*stat.*/
    1066 #ifdef KDEBUG
    1067           if (TEST_OPT_DEBUG) messageSets(strat);
    1068 #endif
    1069           //test_int_std(strat->kIdeal);
    1070           if (strat->Ll== 0) strat->interpt=TRUE;
    1071           if (TEST_OPT_DEGBOUND
    1072               && ((strat->honey && (strat->L[strat->Ll].ecart+pFDeg(strat->L[strat->Ll].p)>Kstd1_deg))
    1073                   || ((!strat->honey) && (pFDeg(strat->L[strat->Ll].p)>Kstd1_deg))))
    1074             {
    1075               /*
    1076                *stops computation if
    1077                * 24 IN test and the degree +ecart of L[strat->Ll] is bigger then
    1078                *a predefined number Kstd1_deg
    1079                */
    1080               while (strat->Ll >= 0) deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
    1081               break;
    1082             }
    1083         }
     1063    if((stdTrace!=NULL && stdTrace->Verwaltung) || (stdTrace == NULL))
     1064    {
     1065      if (strat->Ll > lrmax) lrmax =strat->Ll;/*stat.*/
     1066#ifdef KDEBUG
     1067      if (TEST_OPT_DEBUG) messageSets(strat);
     1068#endif
     1069      //test_int_std(strat->kIdeal);
     1070      if (strat->Ll== 0) strat->interpt=TRUE;
     1071      if (TEST_OPT_DEGBOUND
     1072      && ((strat->honey
     1073        && (strat->L[strat->Ll].ecart+pFDeg(strat->L[strat->Ll].p)>Kstd1_deg))
     1074      || ((!strat->honey) && (pFDeg(strat->L[strat->Ll].p)>Kstd1_deg))))
     1075      {
     1076        /*
     1077        *stops computation if
     1078        * 24 IN test and the degree +ecart of L[strat->Ll] is bigger then
     1079        *a predefined number Kstd1_deg
     1080        */
     1081        while (strat->Ll >= 0) deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
     1082        break;
     1083      }
     1084    }
    10841085//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    1085       if((stdTrace!=NULL && stdTrace->TupelL) || (stdTrace == NULL ))
    1086         {
    1087           /* picks the last element from the lazyset L */
    1088           strat->P = strat->L[strat->Ll];
    1089           anzTupel++;
    1090           strat->Ll--;
    1091           if(stdTrace!=NULL && stdTrace->TupelStore)
     1086    if((stdTrace!=NULL && stdTrace->TupelL) || (stdTrace == NULL ))
     1087    {
     1088      /* picks the last element from the lazyset L */
     1089      strat->P = strat->L[strat->Ll];
     1090      anzTupel++;
     1091      strat->Ll--;
     1092      if(stdTrace!=NULL && stdTrace->TupelStore)
     1093      {
     1094        if (TEST_OPT_PROT) PrintS(":");
     1095        stdTrace->Store(strat->P);
     1096        strat->P.p=NULL;
     1097        anzSkipped++;
     1098      }
     1099    }
     1100//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
     1101    if((stdTrace!=NULL && stdTrace->SPoly) || (stdTrace == NULL))
     1102    {
     1103      kTest(strat);
     1104      if (pNext(strat->P.p) == strat->tail)
     1105      {
     1106        /* deletes the short spoly and computes */
     1107        pFree1(strat->P.p);
     1108        /* the real one */
     1109        strat->P.p = spSpolyCreate(strat->P.p1,strat->P.p2,strat->kNoether);
     1110      }
     1111      if((strat->P.p1==NULL) && (strat->minim>0))
     1112        strat->P.p2=pCopy(strat->P.p);
     1113    }
     1114//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
     1115    if((stdTrace!=NULL && stdTrace->Reduzieren) || (stdTrace == NULL))
     1116    {
     1117#ifdef SDRING
     1118      if (strat->P.p != NULL)
     1119#endif
     1120      {
     1121        if (strat->honey)
     1122        {
     1123          if (TEST_OPT_PROT)
     1124            message(strat->P.ecart+pFDeg(strat->P.p),&olddeg,&reduc,strat);
     1125        }
     1126        else
     1127        {
     1128          if (TEST_OPT_PROT)
     1129            message(pFDeg(strat->P.p),&olddeg,&reduc,strat);
     1130        }
     1131        /* reduction of the element choosen from L */
     1132        oldLl=strat->Ll;
     1133        strat->red(&strat->P,strat);
     1134        if(stdTrace!=NULL && stdTrace->TupelPosition)
     1135          stdTrace->CheckPosition(strat,oldLl);
     1136        if((stdTrace!=NULL && stdTrace->TupelMelden))
     1137          stdTrace->SendTupel(strat);
     1138        if(stdTrace!=NULL && strat->P.p!=NULL && stdTrace->Modus==ModCheck)
     1139          anzNew++;
     1140      }
     1141      if (strat->P.p != NULL)
     1142      {
     1143#ifdef SDRING
     1144        aug[0]=strat->P.p;
     1145        augl=0;
     1146        if (pSDRING)
     1147        {
     1148          oldLcm=strat->P.lcm;
     1149#ifdef SRING
     1150          if (pSRING) psAug(pCopy(strat->P.p),pOne(),&aug,&augl,&augmax);
     1151#endif
     1152#ifdef DRING
     1153          if (pDRING) pdAug(pCopy(strat->P.p),&aug,&augl,&augmax);
     1154#endif
     1155#ifdef KDEBUG
     1156          if (TEST_OPT_DEBUG)
     1157          {
     1158            PrintS(" aug of ");
     1159            wrp(aug[0]);
     1160            PrintLn();
     1161            int iiaug=augl;
     1162            while (iiaug>=0)
    10921163            {
    1093               if (TEST_OPT_PROT) PrintS(":");
    1094               stdTrace->Store(strat->P);
    1095               strat->P.p=NULL;
    1096               anzSkipped++;
     1164              Print(" to %d:",iiaug);
     1165              wrp(aug[iiaug]);
     1166              PrintLn();
     1167              iiaug--;
    10971168            }
    1098         }
    1099 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    1100       if((stdTrace!=NULL && stdTrace->SPoly) || (stdTrace == NULL))
    1101         {
    1102           kTest(strat);
    1103           if (pNext(strat->P.p) == strat->tail)
    1104             {
    1105               /* deletes the short spoly and computes */
    1106               pFree1(strat->P.p);
    1107               /* the real one */
    1108               strat->P.p = spSpolyCreate(strat->P.p1,strat->P.p2,strat->kNoether);
    1109             }
    1110           if((strat->P.p1==NULL) && (strat->minim>0))
    1111             strat->P.p2=pCopy(strat->P.p);
    1112         }
    1113 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    1114       if((stdTrace!=NULL && stdTrace->Reduzieren) || (stdTrace == NULL))
    1115         {
     1169          }
     1170#endif
     1171        }
     1172        for (augl++;augl != 0;)
     1173        {
     1174          strat->P.p=aug[--augl];
     1175          aug[augl]=NULL;
     1176          if (pSDRING)
     1177          {
     1178            if (oldLcm==NULL) strat->P.lcm=NULL;
     1179            else  strat->P.lcm=pCopy1(oldLcm);
     1180          }
     1181          if ((augl!=0)&&(strat->P.p!=NULL))
     1182            strat->red(&strat->P,strat);
     1183          if (strat->P.p != NULL)
     1184          {
     1185#endif
     1186            /* statistic */
     1187            if (TEST_OPT_PROT) PrintS("s");
     1188            /* enter P.p into s and L */
     1189            {
     1190              int pos=posInS(strat->S,strat->sl,strat->P.p);
    11161191#ifdef SDRING
    1117           if (strat->P.p != NULL)
    1118 #endif
    1119             {
    1120               if (strat->honey)
    1121                 {
    1122                   if (TEST_OPT_PROT) message(strat->P.ecart+pFDeg(strat->P.p),&olddeg,&reduc,strat);
    1123                 }
    1124               else
    1125                 {
    1126                   if (TEST_OPT_PROT) message(pFDeg(strat->P.p),&olddeg,&reduc,strat);
    1127                 }
    1128               /* reduction of the element choosen from L */
    1129               oldLl=strat->Ll;
    1130               strat->red(&strat->P,strat);
    1131               if(stdTrace!=NULL && stdTrace->TupelPosition)
    1132                 stdTrace->CheckPosition(strat,oldLl);
    1133               if((stdTrace!=NULL && stdTrace->TupelMelden))
    1134                 stdTrace->SendTupel(strat);
    1135               if(stdTrace!=NULL && strat->P.p!=NULL && stdTrace->Modus==ModCheck)
    1136                 anzNew++;
    1137             }
    1138           if (strat->P.p != NULL)
    1139             {
    1140 #ifdef SDRING
    1141               aug[0]=strat->P.p;
    1142               augl=0;
    1143               if (pSDRING)
    1144           {
    1145             oldLcm=strat->P.lcm;
    1146 #ifdef SRING
    1147             if (pSRING) psAug(pCopy(strat->P.p),pOne(),&aug,&augl,&augmax);
    1148 #endif
    1149 #ifdef DRING
    1150             if (pDRING) pdAug(pCopy(strat->P.p),&aug,&augl,&augmax);
    1151 #endif
    1152 #ifdef KDEBUG
    1153             if (TEST_OPT_DEBUG)
    1154             {
    1155               PrintS(" aug of ");
    1156               wrp(aug[0]);
    1157               PrintLn();
    1158               int iiaug=augl;
    1159               while (iiaug>=0)
     1192              if ((pSDRING)
     1193              && (pos<=strat->sl)
     1194              && (pComparePolys(strat->P.p,strat->S[pos])))
    11601195              {
    1161                 Print(" to %d:",iiaug);
    1162                 wrp(aug[iiaug]);
    1163                 PrintLn();
    1164                 iiaug--;
     1196                if (TEST_OPT_PROT)
     1197                  PrintS("d");
     1198              }
     1199              else
     1200#endif
     1201              {
     1202                if (TEST_OPT_INTSTRATEGY)
     1203                {
     1204                  if ((!TEST_OPT_MINRES)||(strat->syzComp==0)||(!strat->homog))
     1205                  {
     1206                    strat->P.p = redtailBba(strat->P.p,pos-1,strat);
     1207                    //if (strat->redTailChange)
     1208                      pCleardenom(strat->P.p);
     1209                  }
     1210                }
     1211                else
     1212                {
     1213                  pNorm(strat->P.p);
     1214                  if ((!TEST_OPT_MINRES)||(strat->syzComp==0)||(!strat->homog))
     1215                  {
     1216                    strat->P.p = redtailBba(strat->P.p,pos-1,strat);
     1217                  }
     1218                }
     1219#ifdef KDEBUG
     1220                if (TEST_OPT_DEBUG)
     1221                {
     1222                  PrintS("new s:");
     1223                  wrp(strat->P.p);
     1224                  PrintLn();
     1225                }
     1226#endif
     1227                if((strat->P.p1==NULL) && (strat->minim>0))
     1228                {
     1229                  if (strat->minim==1)
     1230                  {
     1231                    strat->M->m[minimcnt]=pCopy(strat->P.p);
     1232                    pDelete(&strat->P.p2);
     1233                  }
     1234                  else
     1235                  {
     1236                    strat->M->m[minimcnt]=strat->P.p2;
     1237                    strat->P.p2=NULL;
     1238                  }
     1239                  minimcnt++;
     1240                }
     1241                enterpairs(strat->P.p,strat->sl,strat->P.ecart,pos,strat);
     1242                if (strat->sl==-1) pos=0;
     1243                else pos=posInS(strat->S,strat->sl,strat->P.p);
     1244                strat->enterS(strat->P,pos,strat);
     1245              }
     1246              if (hilb!=NULL)
     1247              {  // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
     1248                oldLl=strat->Ll;
     1249                khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat);
     1250                if(stdTrace!=NULL)
     1251                  stdTrace->CheckHilb(strat,oldLl);
    11651252              }
    11661253            }
    1167 #endif
    1168           }
    1169               for (augl++;augl != 0;)
    1170                 {
    1171                   strat->P.p=aug[--augl];
    1172                   aug[augl]=NULL;
    1173                   if (pSDRING)
    1174                     {
    1175                       if (oldLcm==NULL) strat->P.lcm=NULL;
    1176                       else  strat->P.lcm=pCopy1(oldLcm);
    1177                     }
    1178                   if ((augl!=0)&&(strat->P.p!=NULL))
    1179                     strat->red(&strat->P,strat);
    1180                   if (strat->P.p != NULL)
    1181                     {
    1182 #endif
    1183                       /* statistic */
    1184                       if (TEST_OPT_PROT) PrintS("s");
    1185                       /* enter P.p into s and L */
    1186                       {
    1187                         int pos=posInS(strat->S,strat->sl,strat->P.p);
     1254            if (strat->P.lcm!=NULL) pFree1(strat->P.lcm);
    11881255#ifdef SDRING
    1189                         if ((pSDRING) && (pos<=strat->sl)&& (pComparePolys(strat->P.p,strat->S[pos])))
    1190                           {
    1191                             if (TEST_OPT_PROT)
    1192                               PrintS("d");
    1193                           }
    1194                         else
    1195 #endif
    1196                           {
    1197                             if (TEST_OPT_INTSTRATEGY)
    1198                               {
    1199                                 if ((!TEST_OPT_MINRES)||(strat->syzComp==0)||(!strat->homog))
    1200                                   {
    1201                                     strat->P.p = redtailBba(strat->P.p,pos-1,strat);
    1202                                     pCleardenom(strat->P.p);
    1203                                   }
    1204                               }
    1205                             else
    1206                               {
    1207                                 pNorm(strat->P.p);
    1208                                 if ((!TEST_OPT_MINRES)||(strat->syzComp==0)||(!strat->homog))
    1209                                   {
    1210                                     strat->P.p = redtailBba(strat->P.p,pos-1,strat);
    1211                                   }
    1212                               }
    1213 #ifdef KDEBUG
    1214                             if (TEST_OPT_DEBUG)
    1215                               {
    1216                                 PrintS("new s:");
    1217                                 wrp(strat->P.p);
    1218                                 PrintLn();
    1219                               }
    1220 #endif
    1221                             if((strat->P.p1==NULL) && (strat->minim>0))
    1222                               {
    1223                                 if (strat->minim==1)
    1224                                   {
    1225                                     strat->M->m[minimcnt]=pCopy(strat->P.p);
    1226                                     pDelete(&strat->P.p2);
    1227                                   }
    1228                                 else
    1229                                   {
    1230                                     strat->M->m[minimcnt]=strat->P.p2;
    1231                                     strat->P.p2=NULL;
    1232                                   }
    1233                                 minimcnt++;
    1234                               }
    1235                             enterpairs(strat->P.p,strat->sl,strat->P.ecart,pos,strat);
    1236                             if (strat->sl==-1) pos=0;
    1237                             else pos=posInS(strat->S,strat->sl,strat->P.p);
    1238                             strat->enterS(strat->P,pos,strat);
    1239                           }
    1240                         if (hilb!=NULL)
    1241                           {  // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    1242                             oldLl=strat->Ll;
    1243                             khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat);
    1244                             if(stdTrace!=NULL)
    1245                               stdTrace->CheckHilb(strat,oldLl);
    1246                           }
    1247                       }
    1248                       if (strat->P.lcm!=NULL) pFree1(strat->P.lcm);
     1256          }
     1257        }
     1258        /* delete the old pair */
     1259        if (pSDRING &&(oldLcm!=NULL)) pFree1(oldLcm);
     1260#endif
     1261        if (strat->sl>srmax) srmax = strat->sl;
     1262      }
     1263      if(stdTrace!=NULL && stdTrace->TupelTesten)
     1264        stdTrace->TupelDifferent(strat);
     1265    }
     1266#ifdef KDEBUG
     1267    strat->P.lcm=NULL;
     1268#endif
     1269    kTest(strat);
     1270  }
     1271  if(stdTrace !=NULL)
     1272  {
     1273    if(TEST_OPT_PROT)
     1274    {
     1275      Print("\n(Tupel  Skipped  New) = (%i  %i  %i)\n",anzTupel, anzSkipped, anzNew);
     1276    }
     1277  }
     1278  if((stdTrace!=NULL && stdTrace->ResultSend) || (stdTrace == NULL))
     1279  {
     1280#ifdef KDEBUG
     1281    if (TEST_OPT_DEBUG) messageSets(strat);
     1282#endif
     1283    /* complete reduction of the standard basis--------- */
     1284    if (TEST_OPT_REDSB) completeReduce(strat);
     1285    /* release temp data-------------------------------- */
     1286    exitBuchMora(strat);
     1287    if (TEST_OPT_WEIGHTM)
     1288    {
     1289      pFDeg=pFDegOld;
     1290      pLDeg=pLDegOld;
     1291      if (ecartWeights)
     1292      {
     1293        Free((ADDRESS)ecartWeights,(pVariables+1)*sizeof(short));
     1294        ecartWeights=NULL;
     1295      }
     1296    }
    12491297#ifdef SDRING
    1250                     }
    1251                 }
    1252               /* delete the old pair */
    1253               if (pSDRING &&(oldLcm!=NULL)) pFree1(oldLcm);
    1254 #endif
    1255               if (strat->sl>srmax) srmax = strat->sl;
    1256             }
    1257           if(stdTrace!=NULL && stdTrace->TupelTesten)
    1258             stdTrace->TupelDifferent(strat);
    1259         }
    1260 #ifdef KDEBUG
    1261       strat->P.lcm=NULL;
    1262 #endif
    1263       kTest(strat);
    1264     }
    1265   if(stdTrace !=NULL)
    1266     if(TEST_OPT_PROT)
    1267       {
    1268         Print("\n(Tupel  Skipped  New) = (%i  %i  %i)\n",anzTupel, anzSkipped, anzNew);
    1269       }
    1270   if((stdTrace!=NULL && stdTrace->ResultSend) || (stdTrace == NULL))
    1271     {
    1272 #ifdef KDEBUG
    1273       if (TEST_OPT_DEBUG) messageSets(strat);
    1274 #endif
    1275       /* complete reduction of the standard basis--------- */
    1276       if (TEST_OPT_REDSB) completeReduce(strat);
    1277       /* release temp data-------------------------------- */
    1278       exitBuchMora(strat);
    1279       if (TEST_OPT_WEIGHTM)
    1280         {
    1281           pFDeg=pFDegOld;
    1282           pLDeg=pLDegOld;
    1283           if (ecartWeights)
    1284             {
    1285               Free((ADDRESS)ecartWeights,(pVariables+1)*sizeof(short));
    1286               ecartWeights=NULL;
    1287             }
    1288         }
    1289 #ifdef SDRING
    1290       Free((ADDRESS)aug,augmax*sizeof(poly));
    1291 #endif
    1292       if (TEST_OPT_PROT) messageStat(srmax,lrmax,hilbcount,strat);
    1293       if (Q!=NULL) updateResult(strat->Shdl,Q,strat);
    1294     }
     1298    Free((ADDRESS)aug,augmax*sizeof(poly));
     1299#endif
     1300    if (TEST_OPT_PROT) messageStat(srmax,lrmax,hilbcount,strat);
     1301    if (Q!=NULL) updateResult(strat->Shdl,Q,strat);
     1302  }
    12951303  if(stdTrace!=NULL)
    12961304    stdTrace->End(strat);
     
    14491457                {
    14501458                  strat->P.p = redtailBba(strat->P.p,pos-1,strat);
    1451                   pCleardenom(strat->P.p);
     1459                  //if (strat->redTailChange)
     1460                    pCleardenom(strat->P.p);
    14521461                }
    14531462              }
     
    15891598  /*- set S -*/
    15901599  strat->sl = -1;
    1591   strat->spSpolyLoop =  spGetSpolyLoop(currRing, 
     1600  strat->spSpolyLoop =  spGetSpolyLoop(currRing,
    15921601                                       max(strat->ak, idRankFreeModule(q)),
    15931602                                       strat->syzComp, FALSE);
Note: See TracChangeset for help on using the changeset viewer.