Changeset d14712 in git for Singular/kstd1.cc
- Timestamp:
- Sep 29, 1999, 12:59:43 PM (25 years ago)
- Branches:
- (u'spielwiese', '2a584933abf2a2d3082034c7586d38bb6de1a30a')
- Children:
- 4f011a3b4ee2de9e079fb1b3ff36483e9f1f0511
- Parents:
- c88c949ab8d0ed79f5fe01cd33e526815d5e041f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/kstd1.cc
rc88c949 rd14712 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: kstd1.cc,v 1.3 7 1999-09-13 08:16:20 SingularExp $ */4 /* $Id: kstd1.cc,v 1.38 1999-09-29 10:59:30 obachman Exp $ */ 5 5 /* 6 6 * ABSTRACT: … … 14 14 #include "kutil.h" 15 15 #include "kstd1.h" 16 #include "kstd2.h"17 16 #include "khstd.h" 18 #include "spolys.h"19 17 #include "stairc.h" 20 18 #include "weight.h" … … 26 24 #include "timer.h" 27 25 #include "lists.h" 28 #ifdef STDTRACE29 #include "comm.h"30 #endif31 #include "spSpolyLoop.h"32 26 33 27 //#include "ipprint.h" … … 108 102 if (intoT) 109 103 { 110 hp = spSpolyRedNew(*with,(*h).p,strat->kNoether, strat->spSpolyLoop);104 hp = ksOldSpolyRedNew(*with,(*h).p,strat->kNoether); 111 105 enterT(*h,strat); 112 106 (*h).p = hp; … … 114 108 else 115 109 { 116 (*h).p = spSpolyRed(*with,(*h).p,strat->kNoether, strat->spSpolyLoop);110 (*h).p = ksOldSpolyRed(*with,(*h).p,strat->kNoether); 117 111 } 118 112 if (TEST_OPT_DEBUG) … … 216 210 if (at <= strat->Ll) 217 211 { 212 /*test if h is already standardbasis element*/ 213 #ifdef HAVE_HOMOG_T 214 i=strat->tl+1; 215 #else 218 216 i=strat->sl+1; 217 #endif 219 218 do 220 219 { 221 220 i--; 222 221 if (i<0) return; 222 #ifdef HAVE_HOMOG_T 223 } while (!pDivisibleBy1(strat->T[i].p,(*h).p)); 224 #else 223 225 } while (!pDivisibleBy1(strat->S[i],(*h).p)); 226 #endif 224 227 enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at); 225 228 if (TEST_OPT_DEBUG) Print(" degree jumped; ->L%d\n",at); … … 367 370 if (at <= strat->Ll) 368 371 { 372 #ifdef HAVE_HOMOG_T 373 i=strat->tl+1; 374 #else 369 375 i=strat->sl+1; 376 #endif 370 377 do 371 378 { 372 379 i--; 373 380 if (i<0) return; 381 #ifdef HAVE_HOMOG_T 382 } while (!pDivisibleBy1(strat->T[i].p,(*h).p)); 383 #else 374 384 } while (!pDivisibleBy1(strat->S[i],(*h).p)); 385 #endif 375 386 enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at); 376 387 if (TEST_OPT_DEBUG) Print(" degree jumped; ->L%d\n",at); … … 429 440 wrp(strat->T[j].p); 430 441 } 431 (*h).p = spSpolyRed(strat->T[j].p,(*h).p,strat->kNoether, 432 strat->spSpolyLoop); 442 (*h).p = ksOldSpolyRed(strat->T[j].p,(*h).p,strat->kNoether); 433 443 if (TEST_OPT_DEBUG) 434 444 { … … 468 478 if (at <= strat->Ll) 469 479 { 480 #ifdef HAVE_HOMOG_T 481 i=strat->tl+1; 482 #else 470 483 i=strat->sl+1; 484 #endif 471 485 do 472 486 { 473 487 i--; 474 488 if (i<0) return; 489 #ifdef HAVE_HOMOG_T 490 } while (!pDivisibleBy1(strat->T[i].p,(*h).p)); 491 #else 475 492 } while (!pDivisibleBy1(strat->S[i],(*h).p)); 493 #endif 476 494 enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at); 477 495 if (TEST_OPT_DEBUG) Print(" degree jumped; ->L%d\n",at); … … 617 635 if (at <= strat->Ll) 618 636 { 637 #ifdef HAVE_HOMOG_T 638 i=strat->tl+1; 639 #else 619 640 i=strat->sl+1; 641 #endif 620 642 do 621 643 { 622 644 i--; 623 645 if (i<0) return; 646 #ifdef HAVE_HOMOG_T 647 } while (!pDivisibleBy1(strat->T[i].p,(*h).p)); 648 #else 624 649 } while (!pDivisibleBy1(strat->S[i],(*h).p)); 650 #endif 625 651 enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at); 626 652 if (TEST_OPT_DEBUG) Print(" degree jumped; ->L%d\n",at); … … 910 936 { 911 937 pFree1(strat->L[j].p); /*deletes the short spoly and computes*/ 912 strat->L[j].p= spSpolyCreate(strat->L[j].p1,938 strat->L[j].p=ksOldCreateSpoly(strat->L[j].p1, 913 939 strat->L[j].p2, 914 strat->kNoether, 915 strat->spSpolyLoop); /*the real one*/ 940 strat->kNoether); /*the real one*/ 916 941 if (!strat->honey) 917 942 strat->initEcart(&strat->L[j]); … … 951 976 { 952 977 pFree1(strat->L[i].p); 953 strat->L[i].p = spSpolyCreate(strat->L[i].p1, 954 strat->L[i].p2, 955 strat->kNoether, 956 strat->spSpolyLoop); 978 strat->L[i].p = ksOldCreateSpoly(strat->L[i].p1, 979 strat->L[i].p2, 980 strat->kNoether); 981 982 957 983 strat->L[i].ecart = pLDeg(strat->L[i].p,&strat->L[i].length)-pFDeg(strat->L[i].p); 958 984 } … … 1041 1067 int i; 1042 1068 1043 #ifdef SDRING1044 if (pSDRING1045 && (atS<=strat->sl)1046 && pComparePolys(p.p,strat->S[atS]))1047 {1048 if (TEST_OPT_PROT)1049 PrintS("m");1050 p.p=NULL;1051 return;1052 }1053 if (pSDRING1054 && (atS<strat->sl)1055 && pComparePolys(p.p,strat->S[atS+1]))1056 {1057 if (TEST_OPT_PROT)1058 PrintS("m");1059 p.p=NULL;1060 return;1061 }1062 if (pSDRING1063 && (atS>0)1064 && pComparePolys(p.p,strat->S[atS-1]))1065 {1066 if (TEST_OPT_PROT)1067 PrintS("m");1068 p.p=NULL;1069 return;1070 }1071 #endif1072 1069 strat->news = TRUE; 1073 1070 /*- puts p to the standardbasis s at position atS -*/ … … 1248 1245 int hilbeledeg=1,hilbcount=0; 1249 1246 1250 #ifdef SDRING1251 polyset aug=(polyset)Alloc(setmax*sizeof(poly));1252 int augmax=setmax, augl=-1;1253 poly oldLcm;1254 #endif1255 1256 1247 strat->update = TRUE; 1257 1248 /*- setting global variables ------------------- -*/ … … 1315 1306 { 1316 1307 pFree1(strat->P.p);/*- deletes the short spoly and computes -*/ 1317 strat->P.p = spSpolyCreate(strat->P.p1, 1318 strat->P.p2, 1319 strat->kNoether, 1320 strat->spSpolyLoop);/*- the real one -*/ 1308 strat->P.p = ksOldCreateSpoly(strat->P.p1, 1309 strat->P.p2, 1310 strat->kNoether);/*- the real one -*/ 1321 1311 if (!strat->honey) 1322 1312 strat->initEcart(&strat->P); … … 1324 1314 strat->P.length = pLength(strat->P.p); 1325 1315 } 1326 #ifdef SDRING1327 if (strat->P.p != NULL)1328 #endif1329 1316 { 1330 1317 if (TEST_OPT_PROT) message(strat->P.ecart+pFDeg(strat->P.p),&olddeg,&reduc,strat); … … 1333 1320 if (strat->P.p != NULL) 1334 1321 { 1335 #ifdef SDRING1336 aug[0]=strat->P.p;1337 augl=0;1338 if (pSDRING)1339 {1340 oldLcm=strat->P.lcm;1341 #ifdef SRING1342 if (pSRING) psAug(pCopy(strat->P.p),pOne(),&aug,&augl,&augmax);1343 #endif1344 #ifdef DRING1345 if (pDRING) pdAug(pCopy(strat->P.p),&aug,&augl,&augmax);1346 #endif1347 }1348 for (augl++;augl != 0;)1349 {1350 strat->P.p=aug[--augl];1351 if (pSDRING)1352 {1353 if (oldLcm==NULL) strat->P.lcm=NULL;1354 else strat->P.lcm=pCopy1(oldLcm);1355 }1356 if ((augl!=0) && (strat->P.p!=NULL)) strat->red(&strat->P,strat);1357 if (strat->P.p != NULL)1358 {1359 #endif1360 1322 if (TEST_OPT_PROT) PrintS("s");/*- statistic -*/ 1361 1323 /*- enter P.p into s and b: -*/ … … 1378 1340 { 1379 1341 int pos; 1380 #ifdef SDRING1381 pos = posInS(strat->S,strat->sl,strat->P.p);1382 if (pSDRING && (pos<=strat->sl)1383 && (pComparePolys(strat->P.p,strat->S[pos])))1384 {1385 if (TEST_OPT_PROT)1386 PrintS("d");1387 }1388 else1389 #endif1390 1342 { 1391 1343 enterpairs(strat->P.p,strat->sl,strat->P.ecart,0,strat); … … 1404 1356 if (strat->P.lcm!=NULL) pFree1(strat->P.lcm); 1405 1357 strat->P.lcm=NULL; 1406 #ifdef SDRING1407 }1408 }1409 /* delete the old pair */1410 if (pSDRING &&(oldLcm!=NULL)) pFree1(oldLcm);1411 #endif1412 1358 #ifdef KDEBUG 1413 1359 memset(&strat->P,0,sizeof(strat->P)); … … 1450 1396 pDelete(&strat->kNoether); 1451 1397 Free((ADDRESS)strat->NotUsedAxis,(pVariables+1)*sizeof(BOOLEAN)); 1452 #ifdef SDRING1453 Free((ADDRESS)aug,augmax*sizeof(poly));1454 #endif1455 1398 if (TEST_OPT_PROT) messageStat(srmax,lrmax,hilbcount,strat); 1456 1399 if (TEST_OPT_WEIGHTM) … … 1499 1442 initBuchMoraPos(strat); 1500 1443 initMora(F,strat); 1501 strat->spSpolyLoop = spGetSpolyLoop(currRing,1502 max(strat->ak,pMaxComp(q)),1503 strat->syzComp, FALSE);1504 1444 strat->enterS = enterSMoraNF; 1505 1445 /*- set T -*/ … … 1597 1537 strat->enterS = enterSMoraNF; 1598 1538 /*- set T -*/ 1599 strat->spSpolyLoop = spGetSpolyLoop(currRing,1600 max(strat->ak,idRankFreeModule(q)),1601 strat->syzComp, FALSE);1602 1539 strat->tl = -1; 1603 1540 strat->tmax = setmax; … … 1723 1660 } 1724 1661 if ((h==testHomog) 1725 #ifdef DRING1726 && (!pDRING)1727 #endif1728 1662 ) 1729 1663 { … … 1746 1680 } 1747 1681 pLexOrder=b; 1748 #ifdef DRING1749 if (pDRING) h=isNotHomog;1750 #endif1751 1682 if (h==isHomog) 1752 1683 { … … 1765 1696 } 1766 1697 strat->homog=h; 1767 spSet(currRing);1768 strat->spSpolyLoop = spGetSpolyLoop(currRing, strat, syzComp);1769 1698 if (pOrdSgn==-1) 1770 1699 { … … 1776 1705 else 1777 1706 { 1778 #ifdef STDTRACE1779 lists l;1780 if (w!=NULL)1781 l=bbaLink(F,Q,*w,hilb,strat);1782 else1783 l=bbaLink(F,Q,NULL,hilb,strat);1784 r=(ideal)(l->m[0].data);1785 l->m[0].data=NULL;1786 l->Clean();1787 #else1788 1707 if (w!=NULL) 1789 1708 r=bba(F,Q,*w,hilb,strat); 1790 1709 else 1791 1710 r=bba(F,Q,NULL,hilb,strat); 1792 #endif1793 1711 } 1794 1712 #ifdef KDEBUG … … 1813 1731 //############################################################## 1814 1732 //############################################################## 1815 1816 #ifdef STDTRACE1817 lists TraceStd(leftv lv,int rw, ideal F, ideal Q, tHomog h,intvec ** w, intvec *hilb,int syzComp,1818 int newIdeal)1819 {1820 lists l;1821 ideal r;1822 stdLink stdTrace=(stdLink) Alloc0(sizeof(skstdLink));1823 BOOLEAN b=pLexOrder,toReset=FALSE;1824 BOOLEAN delete_w=(w==NULL);1825 kStrategy strat=(kStrategy)Alloc0(sizeof(skStrategy));1826 1827 if(!TEST_OPT_RETURN_SB)1828 strat->syzComp = syzComp;1829 if (TEST_OPT_SB_1)1830 strat->newIdeal = newIdeal;1831 strat->LazyPass=32000;1832 strat->LazyDegree = 10;1833 strat->ak = idRankFreeModule(F);1834 // if(stdTrace!=NULL)1835 // stdTrace->GetPrimes(F,primes); // Array mit Primzahlen muß geordnet sein !1836 1837 if ((h==testHomog)1838 #ifdef DRING1839 && (!pDRING)1840 #endif1841 )1842 {1843 if (strat->ak == 0)1844 {1845 h = (tHomog)idHomIdeal(F,Q);1846 w=NULL;1847 }1848 else1849 h = (tHomog)idHomModule(F,Q,w);1850 }1851 #ifdef DRING1852 if (pDRING) h=isNotHomog;1853 #endif1854 if (h==isHomog)1855 {1856 if ((w!=NULL) && (*w!=NULL))1857 {1858 kModW = *w;1859 strat->kModW = *w;1860 pOldFDeg = pFDeg;1861 pFDeg = kModDeg;1862 toReset = TRUE;1863 }1864 pLexOrder = TRUE;1865 if (hilb==NULL) strat->LazyPass*=2;1866 }1867 strat->homog=h;1868 spSet(currRing);1869 strat->spSpolyLoop = spGetSpolyLoop(currRing, strat syzComp);1870 // if (pOrdSgn==-1)1871 // {1872 // if (w!=NULL)1873 // r=mora(F,Q,*w,hilb,strat);1874 // else1875 // r=mora(F,Q,NULL,hilb,strat);1876 // }1877 // else1878 {1879 stdTrace->Init(lv,rw);1880 if(w==NULL)1881 l=bbaLink(F,Q,NULL,hilb,strat,stdTrace);1882 else1883 l=bbaLink(F,Q,*w,hilb,strat,stdTrace);1884 r=(ideal) (l->m[0].Data());1885 }1886 #ifdef KDEBUG1887 int i;1888 for (i=0; i<IDELEMS(r); i++) pTest(r->m[i]);1889 #endif1890 if (toReset)1891 {1892 kModW = NULL;1893 pFDeg = pOldFDeg;1894 }1895 pLexOrder = b;1896 //Print("%d reductions canceled \n",strat->cel);1897 HCord=strat->HCord;1898 Free((ADDRESS)strat,sizeof(skStrategy));1899 if ((delete_w)&&(w!=NULL)&&(*w!=NULL)) delete *w;1900 if(stdTrace!=NULL)1901 {1902 stdTrace->Kill();1903 Free(stdTrace, sizeof(skstdLink));1904 }1905 1906 return l;1907 }1908 #endif1909 1733 1910 1734 lists min_std(ideal F, ideal Q, tHomog h,intvec ** w, intvec *hilb,int syzComp, … … 1928 1752 strat->ak = idRankFreeModule(F); 1929 1753 if ((h==testHomog) 1930 #ifdef DRING1931 && (!pDRING)1932 #endif1933 1754 ) 1934 1755 { … … 1943 1764 } 1944 1765 } 1945 #ifdef DRING1946 if (pDRING) h=isNotHomog;1947 #endif1948 1766 if (h==isHomog) 1949 1767 { … … 1970 1788 } 1971 1789 strat->homog=h; 1972 spSet(currRing);1973 strat->spSpolyLoop = spGetSpolyLoop(currRing, strat, syzComp);1974 1790 if (pOrdSgn==-1) 1975 1791 { … … 1981 1797 else 1982 1798 { 1983 #ifdef STDTRACE1984 lists rl;1985 if (w!=NULL)1986 rl=bbaLink(F, Q, *w, hilb, strat, NULL);1987 else1988 rl=bbaLink(F, Q, NULL, hilb, strat, NULL);1989 r=(ideal)(rl->m[0].data);1990 rl->m[0].data=NULL;1991 rl->Clean();1992 #else1993 1799 if (w!=NULL) 1994 1800 r=bba(F,Q,*w,hilb,strat); 1995 1801 else 1996 1802 r=bba(F,Q,NULL,hilb,strat); 1997 #endif1998 1803 } 1999 1804 #ifdef KDEBUG … … 2044 1849 kStrategy strat=(kStrategy)Alloc0(sizeof(skStrategy)); 2045 1850 strat->syzComp = syzComp; 2046 spSet(currRing);2047 1851 if (pOrdSgn==-1) 2048 1852 p=kNF1(F,Q,p,strat,lazyReduce); … … 2056 1860 { 2057 1861 ideal res; 2058 spSet(currRing);2059 1862 if (TEST_OPT_PROT) 2060 1863 { … … 2088 1891 strat->kNoether=pCopy(ppNoether); 2089 1892 strat->ak = idRankFreeModule(F); 2090 spSet(currRing);2091 1893 initBuchMoraCrit(strat); 2092 1894 strat->NotUsedAxis = (BOOLEAN *)Alloc((pVariables+1)*sizeof(BOOLEAN)); … … 2099 1901 strat->tmax = setmax; 2100 1902 strat->T = initT(); 2101 strat->spSpolyLoop = spGetSpolyLoop(currRing, strat);2102 1903 if (pOrdSgn == -1) strat->honey = TRUE; 2103 1904 initS(F,Q,strat);
Note: See TracChangeset
for help on using the changeset viewer.