Changeset 6e3023a in git for kernel/kstd2.cc
- Timestamp:
- Dec 18, 2013, 2:57:02 PM (10 years ago)
- Branches:
- (u'spielwiese', '5b153614cbc72bfa198d75b1e9e33dab2645d9fe')
- Children:
- 3a9e92a717b194d4a06a429b452258c0269579076235be46a7d664256bb99b1bd6340cd8ad800e2c
- Parents:
- 74c446222122656dc7859919b51f3806768e7fd331b00db0e867fa73d4415e16969423de4337f6f7
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/kstd2.cc
r74c4462 r6e3023a 48 48 #endif 49 49 50 #define F5C 050 #define F5C 1 51 51 #if F5C 52 52 #define F5CTAILRED 1 53 53 #endif 54 54 55 #define SBA_PRODUCT_CRITERION 0 56 #define SBA_PRINT_ZERO_REDUCTIONS 1 57 #define SBA_PRINT_REDUCTION_STEPS 1 58 #define SBA_PRINT_SIZE_G 1 59 #define SBA_PRINT_SIZE_SYZ 1 60 #define SBA_PRINT_PRODUCT_CRITERION 0 61 55 #define SBA_INTERRED_START 0 56 #define SBA_TAIL_RED 1 57 #define SBA_PRODUCT_CRITERION 0 58 #define SBA_PRINT_ZERO_REDUCTIONS 0 59 #define SBA_PRINT_REDUCTION_STEPS 0 60 #define SBA_PRINT_OPERATIONS 0 61 #define SBA_PRINT_SIZE_G 0 62 #define SBA_PRINT_SIZE_SYZ 0 63 #define SBA_PRINT_PRODUCT_CRITERION 0 64 65 // counts sba's reduction steps 66 #if SBA_PRINT_REDUCTION_STEPS 62 67 long sba_reduction_steps; 68 long sba_interreduction_steps; 69 #endif 70 #if SBA_PRINT_OPERATIONS 71 long sba_operations; 72 long sba_interreduction_operations; 73 #endif 74 63 75 /*********************************************** 64 76 * SBA stuff -- done … … 466 478 467 479 ksReducePoly(h, &(strat->T[ii]), NULL, NULL, strat); 480 #if SBA_PRINT_REDUCTION_STEPS 481 sba_interreduction_steps++; 482 #endif 483 #if SBA_PRINT_OPERATIONS 484 sba_interreduction_operations += pLength(strat->T[ii].p); 485 #endif 468 486 469 487 #ifdef KDEBUG … … 513 531 } 514 532 } 533 } 534 535 KINLINE int ksReducePolyTailSig(LObject* PR, TObject* PW, LObject* Red) 536 { 537 BOOLEAN ret; 538 number coef; 539 540 assume(PR->GetLmCurrRing() != PW->GetLmCurrRing()); 541 Red->HeadNormalize(); 542 /* 543 printf("------------------------\n"); 544 pWrite(Red->GetLmCurrRing()); 545 */ 546 ret = ksReducePolySig(Red, PW, 1, NULL, &coef); 547 548 549 if (!ret) 550 { 551 if (! n_IsOne(coef, currRing->cf)) 552 { 553 PR->Mult_nn(coef); 554 // HANNES: mark for Normalize 555 } 556 n_Delete(&coef, currRing->cf); 557 } 558 return ret; 515 559 } 516 560 … … 623 667 sigSafe = ksReducePolySig(h, &(strat->T[ii]), strat->S_2_R[ii], NULL, NULL, strat); 624 668 #if SBA_PRINT_REDUCTION_STEPS 625 sba_reduction_steps++; 669 if (sigSafe != 3) 670 sba_reduction_steps++; 671 #endif 672 #if SBA_PRINT_OPERATIONS 673 if (sigSafe != 3) 674 sba_operations += pLength(strat->T[ii].p); 626 675 #endif 627 676 // if reduction has taken place, i.e. the reduction was sig-safe … … 685 734 } 686 735 } 736 } 737 738 // tail reduction for SBA 739 poly redtailSba (LObject* L, int pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize) 740 { 741 #define REDTAIL_CANONICALIZE 100 742 strat->redTailChange=FALSE; 743 if (strat->noTailReduction) return L->GetLmCurrRing(); 744 poly h, p; 745 p = h = L->GetLmTailRing(); 746 if ((h==NULL) || (pNext(h)==NULL)) 747 return L->GetLmCurrRing(); 748 749 TObject* With; 750 // placeholder in case strat->tl < 0 751 TObject With_s(strat->tailRing); 752 753 LObject Ln(pNext(h), strat->tailRing); 754 Ln.sig = L->sig; 755 Ln.sevSig = L->sevSig; 756 Ln.pLength = L->GetpLength() - 1; 757 758 pNext(h) = NULL; 759 if (L->p != NULL) pNext(L->p) = NULL; 760 L->pLength = 1; 761 762 Ln.PrepareRed(strat->use_buckets); 763 764 int cnt=REDTAIL_CANONICALIZE; 765 while(!Ln.IsNull()) 766 { 767 loop 768 { 769 Ln.SetShortExpVector(); 770 if (withT) 771 { 772 int j; 773 j = kFindDivisibleByInT(strat->T, strat->sevT, strat->tl, &Ln); 774 if (j < 0) break; 775 With = &(strat->T[j]); 776 } 777 else 778 { 779 With = kFindDivisibleByInS(strat, pos, &Ln, &With_s); 780 if (With == NULL) break; 781 } 782 cnt--; 783 if (cnt==0) 784 { 785 cnt=REDTAIL_CANONICALIZE; 786 /*poly tmp=*/Ln.CanonicalizeP(); 787 if (normalize) 788 { 789 Ln.Normalize(); 790 //pNormalize(tmp); 791 //if (TEST_OPT_PROT) { PrintS("n"); mflush(); } 792 } 793 } 794 if (normalize && (!TEST_OPT_INTSTRATEGY) && (!nIsOne(pGetCoeff(With->p)))) 795 { 796 With->pNorm(); 797 } 798 strat->redTailChange=TRUE; 799 int ret = ksReducePolyTailSig(L, With, &Ln); 800 #if SBA_PRINT_REDUCTION_STEPS 801 if (ret != 3) 802 sba_reduction_steps++; 803 #endif 804 #if SBA_PRINT_OPERATIONS 805 if (ret != 3) 806 sba_operations += pLength(With->p); 807 #endif 808 if (ret) 809 { 810 // reducing the tail would violate the exp bound 811 // set a flag and hope for a retry (in bba) 812 strat->completeReduce_retry=TRUE; 813 if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL; 814 do 815 { 816 pNext(h) = Ln.LmExtractAndIter(); 817 pIter(h); 818 L->pLength++; 819 } while (!Ln.IsNull()); 820 goto all_done; 821 } 822 if (Ln.IsNull()) goto all_done; 823 if (! withT) With_s.Init(currRing); 824 } 825 pNext(h) = Ln.LmExtractAndIter(); 826 pIter(h); 827 pNormalize(h); 828 L->pLength++; 829 } 830 831 all_done: 832 Ln.Delete(); 833 if (L->p != NULL) pNext(L->p) = pNext(p); 834 835 if (strat->redTailChange) 836 { 837 L->length = 0; 838 } 839 840 //if (TEST_OPT_PROT) { PrintS("N"); mflush(); } 841 //L->Normalize(); // HANNES: should have a test 842 assume(kTest_L(L)); 843 return L->GetLmCurrRing(); 687 844 } 688 845 … … 772 929 773 930 ksReducePoly(h, &(strat->T[ii]), NULL, NULL, strat); 931 #if SBA_PRINT_REDUCTION_STEPS 932 sba_interreduction_steps++; 933 #endif 934 #if SBA_PRINT_OPERATIONS 935 sba_interreduction_operations += pLength(strat->T[ii].p); 936 #endif 774 937 775 938 #ifdef KDEBUG … … 942 1105 number coef; 943 1106 ksReducePoly(h,&(strat->T[ii]),strat->kNoetherTail(),&coef,strat); 1107 #if SBA_PRINT_REDUCTION_STEPS 1108 sba_interreduction_steps++; 1109 #endif 1110 #if SBA_PRINT_OPERATIONS 1111 sba_interreduction_operations += pLength(strat->T[ii].p); 1112 #endif 944 1113 #ifdef KDEBUG 945 1114 if (TEST_OPT_DEBUG) … … 1509 1678 // induced Schreyer order. 1510 1679 // The corresponding orders are computed in sbaRing(), depending 1511 // on the flag strat->incremental 1512 long zeroreductions = 0; 1513 long product_criterion = 0; 1514 long size_g = 0; 1515 long size_syz = 0; 1680 // on the flag strat->sbaOrder 1681 #if SBA_PRINT_ZERO_REDUCTIONS 1682 long zeroreductions = 0; 1683 #endif 1684 #if SBA_PRINT_PRODUCT_CRITERION 1685 long product_criterion = 0; 1686 #endif 1687 #if SBA_PRINT_SIZE_G 1688 long size_g = 0; 1689 #endif 1690 #if SBA_PRINT_SIZE_SYZ 1691 long size_syz = 0; 1692 #endif 1516 1693 // global variable 1517 sba_reduction_steps = 0; 1518 1519 ideal F = F0; 1694 #if SBA_PRINT_REDUCTION_STEPS 1695 sba_reduction_steps = 0; 1696 sba_interreduction_steps = 0; 1697 #endif 1698 #if SBA_PRINT_OPERATIONS 1699 sba_operations = 0; 1700 sba_interreduction_operations = 0; 1701 #endif 1702 1703 ideal F1 = F0; 1520 1704 ring sRing, currRingOld; 1521 1705 currRingOld = currRing; 1522 if (strat-> incremental)1706 if (strat->sbaOrder == 1 || strat->sbaOrder == 3) 1523 1707 { 1524 1708 sRing = sbaRing(strat); … … 1526 1710 { 1527 1711 rChangeCurrRing (sRing); 1528 F = idrMoveR (F0, currRingOld, currRing); 1529 } 1530 } 1531 #if 0 1712 F1 = idrMoveR (F0, currRingOld, currRing); 1713 } 1714 } 1715 // sort ideal F 1716 ideal F = idInit(IDELEMS(F1),F1->rank); 1717 intvec *sort = idSort(F1); 1718 for (int i=0; i<sort->length();++i) 1719 F->m[i] = F1->m[(*sort)[i]-1]; 1720 #if SBA_INTERRED_START 1721 F = kInterRed(F,NULL); 1722 #endif 1723 #if F5DEBUG 1532 1724 printf("SBA COMPUTATIONS DONE IN THE FOLLOWING RING:\n"); 1533 1725 rWrite (currRing); 1726 printf("ordSgn = %d\n",currRing->OrdSgn); 1534 1727 printf("\n"); 1535 1728 #endif … … 1542 1735 int hilbeledeg=1,hilbcount=0,minimcnt=0; 1543 1736 LObject L; 1544 // BOOLEAN withT = FALSE;1737 BOOLEAN withT = TRUE; 1545 1738 strat->max_lower_index = 0; 1546 1739 … … 1605 1798 #endif 1606 1799 if (strat->Ll== 0) strat->interpt=TRUE; 1800 /* 1607 1801 if (TEST_OPT_DEGBOUND 1608 1802 && ((strat->honey && (strat->L[strat->Ll].ecart+currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg)) 1609 1803 || ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg)))) 1610 1804 { 1611 /* 1612 *stops computation if 1613 * 24 IN test and the degree +ecart of L[strat->Ll] is bigger then 1614 *a predefined number Kstd1_deg 1615 */ 1805 1806 //stops computation if 1807 // 24 IN test and the degree +ecart of L[strat->Ll] is bigger then 1808 //a predefined number Kstd1_deg 1616 1809 while ((strat->Ll >= 0) 1617 1810 && (strat->L[strat->Ll].p1!=NULL) && (strat->L[strat->Ll].p2!=NULL) … … 1623 1816 else strat->noClearS=TRUE; 1624 1817 } 1625 if (strat->incremental && pGetComp(strat->L[strat->Ll].sig) != strat->currIdx) 1818 */ 1819 if (strat->sbaOrder == 1 && pGetComp(strat->L[strat->Ll].sig) != strat->currIdx) 1626 1820 { 1627 1821 strat->currIdx = pGetComp(strat->L[strat->Ll].sig); … … 1630 1824 // 2. generation of new principal syzygy rules for syzCriterion 1631 1825 f5c ( strat, olddeg, minimcnt, hilbeledeg, hilbcount, srmax, 1632 1826 lrmax, reduc, Q, w, hilb ); 1633 1827 #endif 1634 1828 // initialize new syzygy rules for the next iteration step 1635 1829 initSyzRules(strat); 1830 1636 1831 } 1637 1832 /********************************************************************* 1638 * interrreduction step is done, we can go on with the next iteration1639 * step of the signature-based algorithm1640 ********************************************************************/1833 * interrreduction step is done, we can go on with the next iteration 1834 * step of the signature-based algorithm 1835 ********************************************************************/ 1641 1836 /* picks the last element from the lazyset L */ 1642 1837 strat->P = strat->L[strat->Ll]; 1643 1838 strat->Ll--; 1644 //#if 1 1839 /* reduction of the element choosen from L */ 1840 1841 if (!strat->rewCrit2(strat->P.sig, ~strat->P.sevSig, strat->P.GetLmCurrRing(), strat, strat->P.checked+1)) { 1842 //#if 1 1645 1843 #ifdef DEBUGF5 1646 Print("SIG OF NEXT PAIR TO HANDLE IN SIG-BASED ALGORITHM\n"); 1647 Print("-------------------------------------------------\n"); 1648 pWrite(strat->P.sig); 1649 pWrite(pHead(strat->P.p)); 1650 pWrite(pHead(strat->P.p1)); 1651 pWrite(pHead(strat->P.p2)); 1652 Print("-------------------------------------------------\n"); 1653 #endif 1654 if (pNext(strat->P.p) == strat->tail) 1655 { 1656 // deletes the short spoly 1844 Print("SIG OF NEXT PAIR TO HANDLE IN SIG-BASED ALGORITHM\n"); 1845 Print("-------------------------------------------------\n"); 1846 pWrite(strat->P.sig); 1847 pWrite(pHead(strat->P.p)); 1848 pWrite(pHead(strat->P.p1)); 1849 pWrite(pHead(strat->P.p2)); 1850 Print("-------------------------------------------------\n"); 1851 #endif 1852 if (pNext(strat->P.p) == strat->tail) 1853 { 1854 // deletes the short spoly 1855 /* 1657 1856 #ifdef HAVE_RINGS 1658 if (rField_is_Ring(currRing)) 1659 pLmDelete(strat->P.p); 1857 if (rField_is_Ring(currRing)) 1858 pLmDelete(strat->P.p); 1859 else 1860 #endif 1861 pLmFree(strat->P.p); 1862 */ 1863 // TODO: needs some masking 1864 // TODO: masking needs to vanish once the signature 1865 // sutff is completely implemented 1866 strat->P.p = NULL; 1867 poly m1 = NULL, m2 = NULL; 1868 1869 // check that spoly creation is ok 1870 while (strat->tailRing != currRing && 1871 !kCheckSpolyCreation(&(strat->P), strat, m1, m2)) 1872 { 1873 assume(m1 == NULL && m2 == NULL); 1874 // if not, change to a ring where exponents are at least 1875 // large enough 1876 if (!kStratChangeTailRing(strat)) 1877 { 1878 WerrorS("OVERFLOW..."); 1879 break; 1880 } 1881 } 1882 // create the real one 1883 ksCreateSpoly(&(strat->P), NULL, strat->use_buckets, 1884 strat->tailRing, m1, m2, strat->R); 1885 1886 } 1887 else if (strat->P.p1 == NULL) 1888 { 1889 if (strat->minim > 0) 1890 strat->P.p2=p_Copy(strat->P.p, currRing, strat->tailRing); 1891 // for input polys, prepare reduction 1892 strat->P.PrepareRed(strat->use_buckets); 1893 } 1894 if (strat->P.p == NULL && strat->P.t_p == NULL) 1895 { 1896 red_result = 0; 1897 } 1660 1898 else 1661 #endif 1662 pLmFree(strat->P.p); 1663 1664 // TODO: needs some masking 1665 // TODO: masking needs to vanish once the signature 1666 // sutff is completely implemented 1667 strat->P.p = NULL; 1668 poly m1 = NULL, m2 = NULL; 1669 1670 // check that spoly creation is ok 1671 while (strat->tailRing != currRing && 1672 !kCheckSpolyCreation(&(strat->P), strat, m1, m2)) 1673 { 1674 assume(m1 == NULL && m2 == NULL); 1675 // if not, change to a ring where exponents are at least 1676 // large enough 1677 if (!kStratChangeTailRing(strat)) 1678 { 1679 WerrorS("OVERFLOW..."); 1680 break; 1681 } 1682 } 1683 // create the real one 1684 ksCreateSpoly(&(strat->P), NULL, strat->use_buckets, 1685 strat->tailRing, m1, m2, strat->R); 1686 1687 } 1688 else if (strat->P.p1 == NULL) 1689 { 1690 if (strat->minim > 0) 1691 strat->P.p2=p_Copy(strat->P.p, currRing, strat->tailRing); 1692 // for input polys, prepare reduction 1693 strat->P.PrepareRed(strat->use_buckets); 1694 } 1695 1696 if (strat->P.p == NULL && strat->P.t_p == NULL) 1697 { 1698 red_result = 0; 1699 } 1700 else 1701 { 1702 if (TEST_OPT_PROT) 1703 message((strat->honey ? strat->P.ecart : 0) + strat->P.pFDeg(), 1704 &olddeg,&reduc,strat, red_result); 1705 1706 //#if 1 1899 { 1900 //#if 1 1707 1901 #ifdef DEBUGF5 1708 Print("Poly before red: "); 1709 pWrite(strat->P.p); 1710 #endif 1711 /* reduction of the element choosen from L */ 1712 if (!strat->rewCrit2(strat->P.sig, ~strat->P.sevSig, strat, strat->P.checked+1)) { 1902 Print("Poly before red: "); 1903 pWrite(pHead(strat->P.p)); 1904 pWrite(strat->P.sig); 1905 #endif 1713 1906 #if SBA_PRODUCT_CRITERION 1714 if (strat->P.checked == 3) { 1907 if (strat->P.prod_crit) { 1908 #if SBA_PRINT_PRODUCT_CRITERION 1715 1909 product_criterion++; 1716 enterSyz(strat->P, strat); 1910 #endif 1911 int pos = posInSyz(strat, strat->P.sig); 1912 enterSyz(strat->P, strat, pos); 1717 1913 if (strat->P.lcm!=NULL) 1718 1914 pLmFree(strat->P.lcm); … … 1722 1918 } 1723 1919 #else 1724 red_result = strat->red(&strat->P,strat); 1725 #endif 1726 } else { 1727 if (strat->P.lcm!=NULL) 1728 pLmFree(strat->P.lcm); 1729 red_result = 2; 1730 } 1731 if (errorreported) break; 1732 } 1920 red_result = strat->red(&strat->P,strat); 1921 #endif 1922 } 1923 } else { 1924 /* 1925 if (strat->P.lcm != NULL) 1926 pLmFree(strat->P.lcm); 1927 */ 1928 red_result = 2; 1929 } 1930 if (errorreported) break; 1931 1932 //#if 1 1933 #ifdef DEBUGF5 1934 if (red_result != 0) { 1935 Print("Poly after red: "); 1936 pWrite(pHead(strat->P.p)); 1937 pWrite(strat->P.GetLmCurrRing()); 1938 pWrite(strat->P.sig); 1939 printf("%d\n",red_result); 1940 } 1941 #endif 1733 1942 1734 1943 if (strat->overflow) 1735 1944 { 1736 1945 if (!kStratChangeTailRing(strat)) { Werror("OVERFLOW.."); break;} 1737 }1738 if (strat->incremental)1739 {1740 for (int jj = 0; jj<strat->tl+1; jj++)1741 {1742 if (pGetComp(strat->T[jj].sig) == strat->currIdx)1743 {1744 strat->T[jj].is_sigsafe = FALSE;1745 }1746 }1747 }1748 else1749 {1750 for (int jj = 0; jj<strat->tl+1; jj++)1751 {1752 strat->T[jj].is_sigsafe = FALSE;1753 }1754 1946 } 1755 1947 … … 1785 1977 // in the ring case we cannot expect LC(f) = 1, 1786 1978 // therefore we call pContent instead of pNorm 1787 /* 1788 if ((TEST_OPT_INTSTRATEGY) || (rField_is_Ring(currRing))) 1789 { 1790 strat->P.pCleardenom(); 1791 if ((TEST_OPT_REDSB)||(TEST_OPT_REDTAIL)) 1792 { 1793 strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT); 1979 #if SBA_TAIL_RED 1980 if (strat->sbaOrder != 2) { 1981 if ((TEST_OPT_INTSTRATEGY) || (rField_is_Ring(currRing))) 1982 { 1794 1983 strat->P.pCleardenom(); 1795 } 1796 } 1797 else 1798 { 1799 strat->P.pNorm(); 1800 if ((TEST_OPT_REDSB)||(TEST_OPT_REDTAIL)) 1801 strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT); 1802 } 1803 */ 1984 if ((TEST_OPT_REDSB)||(TEST_OPT_REDTAIL)) 1985 { 1986 strat->P.p = redtailSba(&(strat->P),pos-1,strat, withT); 1987 strat->P.pCleardenom(); 1988 } 1989 } 1990 else 1991 { 1992 strat->P.pNorm(); 1993 if ((TEST_OPT_REDSB)||(TEST_OPT_REDTAIL)) 1994 strat->P.p = redtailSba(&(strat->P),pos-1,strat, withT); 1995 } 1996 } 1997 #endif 1998 1999 // remove sigsafe label since it is no longer valid for the next element to 2000 // be reduced 2001 if (strat->sbaOrder == 1) 2002 { 2003 for (int jj = 0; jj<strat->tl+1; jj++) 2004 { 2005 if (pGetComp(strat->T[jj].sig) == strat->currIdx) 2006 { 2007 strat->T[jj].is_sigsafe = FALSE; 2008 } 2009 } 2010 } 2011 else 2012 { 2013 for (int jj = 0; jj<strat->tl+1; jj++) 2014 { 2015 strat->T[jj].is_sigsafe = FALSE; 2016 } 2017 } 1804 2018 #ifdef KDEBUG 1805 2019 if (TEST_OPT_DEBUG){PrintS("new s:");strat->P.wrp();PrintLn();} … … 1833 2047 // enter into S, L, and T 1834 2048 //if ((!TEST_OPT_IDLIFT) || (pGetComp(strat->P.p) <= strat->syzComp)) 1835 if(!strat->incremental) 1836 { 1837 BOOLEAN overwrite = TRUE; 2049 enterT(strat->P, strat); 2050 strat->T[strat->tl].is_sigsafe = FALSE; 2051 /* 2052 printf("hier\n"); 2053 pWrite(strat->P.GetLmCurrRing()); 2054 pWrite(strat->P.sig); 2055 */ 2056 #ifdef HAVE_RINGS 2057 if (rField_is_Ring(currRing)) 2058 superenterpairs(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl); 2059 else 2060 #endif 2061 enterpairsSig(strat->P.p,strat->P.sig,strat->sl+1,strat->sl,strat->P.ecart,pos,strat, strat->tl); 2062 // posInS only depends on the leading term 2063 strat->enterS(strat->P, pos, strat, strat->tl); 2064 if(strat->sbaOrder != 1) 2065 { 2066 BOOLEAN overwrite = FALSE; 1838 2067 for (int tk=0; tk<strat->sl+1; tk++) 1839 2068 { … … 1855 2084 1856 2085 strat->P.sevSig = pGetShortExpVector (strat->P.sig); 2086 int i; 2087 LObject Q; 1857 2088 for(int ps=0;ps<strat->sl+1;ps++) 1858 2089 { 1859 int i = strat->syzl;1860 2090 1861 2091 strat->newt = TRUE; … … 1869 2099 strat->syzmax += setmaxTinc; 1870 2100 } 1871 strat->syz[i]= pCopy(strat->P.sig);2101 Q.sig = pCopy(strat->P.sig); 1872 2102 // add LM(F->m[i]) to the signature to get a Schreyer order 1873 2103 // without changing the underlying polynomial ring at all 1874 p_ExpVectorAdd (strat->syz[i],strat->S[ps],currRing); 2104 if (strat->sbaOrder == 0) 2105 p_ExpVectorAdd (Q.sig,strat->S[ps],currRing); 1875 2106 // since p_Add_q() destroys all input 1876 2107 // data we need to recreate help … … 1881 2112 // the corresponding principal syzygy 1882 2113 // => we do not need to compute the "real" syzygy completely 1883 poly help = p Copy(strat->sig[ps]);2114 poly help = p_Copy(strat->sig[ps],currRing); 1884 2115 p_ExpVectorAdd (help,strat->P.p,currRing); 1885 strat->syz[i] = p_Add_q(strat->syz[i],help,currRing);2116 Q.sig = p_Add_q(Q.sig,help,currRing); 1886 2117 //printf("%d. SYZ ",i+1); 1887 2118 //pWrite(strat->syz[i]); 1888 strat->sevSyz[i] = p_GetShortExpVector(strat->syz[i],currRing); 1889 strat->syzl++; 2119 Q.sevSig = p_GetShortExpVector(Q.sig,currRing); 2120 i = posInSyz(strat, Q.sig); 2121 enterSyz(Q, strat, i); 1890 2122 } 1891 2123 } 1892 2124 } 1893 enterT(strat->P, strat); 1894 strat->T[strat->tl].is_sigsafe = FALSE; 1895 #ifdef HAVE_RINGS 1896 if (rField_is_Ring(currRing)) 1897 superenterpairs(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl); 1898 else 1899 #endif 1900 enterpairsSig(strat->P.p,strat->P.sig,strat->sl+1,strat->sl,strat->P.ecart,pos,strat, strat->tl); 1901 // posInS only depends on the leading term 1902 strat->enterS(strat->P, pos, strat, strat->tl); 2125 // deg - idx - lp/rp 2126 // => we need to add syzygies with indices > pGetComp(strat->P.sig) 2127 if(strat->sbaOrder == 0 || strat->sbaOrder == 3) 2128 { 2129 int cmp = pGetComp(strat->P.sig); 2130 int max_cmp = IDELEMS(F); 2131 int* vv = (int*)omAlloc((currRing->N+1)*sizeof(int)); 2132 pGetExpV (strat->P.p,vv); 2133 LObject Q; 2134 int pos; 2135 int idx = p_GetComp(strat->P.sig,currRing); 2136 //printf("++ -- adding syzygies -- ++\n"); 2137 // if new element is the first one in this index 2138 if (strat->currIdx < idx) { 2139 for (int i=0; i<strat->sl; ++i) { 2140 Q.sig = p_Copy(strat->P.sig,currRing); 2141 p_ExpVectorAdd(Q.sig,strat->S[i],currRing); 2142 poly help = p_Copy(strat->sig[i],currRing); 2143 p_ExpVectorAdd(help,strat->P.p,currRing); 2144 Q.sig = p_Add_q(Q.sig,help,currRing); 2145 //pWrite(Q.sig); 2146 pos = posInSyz(strat, Q.sig); 2147 enterSyz(Q, strat, pos); 2148 } 2149 strat->currIdx = idx; 2150 } else { 2151 // if the element is not the first one in the given index we build all 2152 // possible syzygies with elements of higher index 2153 for (int i=cmp+1; i<=max_cmp; ++i) { 2154 pos = -1; 2155 for (int j=0; j<strat->sl; ++j) { 2156 if (p_GetComp(strat->sig[j],currRing) == i) { 2157 pos = j; 2158 break; 2159 } 2160 } 2161 if (pos != -1) { 2162 Q.sig = p_One(currRing); 2163 p_SetExpV(Q.sig, vv, currRing); 2164 // F->m[i-1] corresponds to index i 2165 p_ExpVectorAdd(Q.sig,F->m[i-1],currRing); 2166 p_SetComp(Q.sig, i, currRing); 2167 poly help = p_Copy(strat->P.sig,currRing); 2168 p_ExpVectorAdd(help,strat->S[pos],currRing); 2169 Q.sig = p_Add_q(Q.sig,help,currRing); 2170 if (strat->sbaOrder == 0) { 2171 if (p_LmCmp(Q.sig,strat->syz[strat->syzl-1],currRing) == -currRing->OrdSgn) { 2172 pos = posInSyz(strat, Q.sig); 2173 enterSyz(Q, strat, pos); 2174 } 2175 } else { 2176 pos = posInSyz(strat, Q.sig); 2177 enterSyz(Q, strat, pos); 2178 } 2179 } 2180 } 2181 //printf("++ -- done adding syzygies -- ++\n"); 2182 } 2183 } 1903 2184 //#if 1 1904 2185 #if DEBUGF50 … … 1945 2226 // pair was not detected by the rewritten criterion in strat->red = redSig 1946 2227 if (red_result!=2) { 2228 #if SBA_PRINT_ZERO_REDUCTIONS 1947 2229 zeroreductions++; 1948 enterSyz(strat->P,strat); 2230 #endif 2231 int pos = posInSyz(strat, strat->P.sig); 2232 enterSyz(strat->P, strat, pos); 1949 2233 //#if 1 1950 2234 #ifdef DEBUGF5 1951 2235 Print("ADDING STUFF TO SYZ : "); 1952 pWrite(strat->P.p);2236 //pWrite(strat->P.p); 1953 2237 pWrite(strat->P.sig); 1954 2238 #endif … … 2012 2296 #endif 2013 2297 #if SBA_PRINT_SIZE_SYZ 2014 size_syz = strat->syzl+1;2015 #endif 2016 2298 // that is correct, syzl is counting one too far 2299 size_syz = strat->syzl; 2300 #endif 2017 2301 exitSba(strat); 2018 2302 // if (TEST_OPT_WEIGHTM) … … 2043 2327 } 2044 2328 #endif 2045 if ( strat->incremental&& sRing!=currRingOld)2329 if ((strat->sbaOrder == 1 || strat->sbaOrder == 3) && sRing!=currRingOld) 2046 2330 { 2047 2331 rChangeCurrRing (currRingOld); 2048 F0 = idrMoveR (F , sRing, currRing);2332 F0 = idrMoveR (F1, sRing, currRing); 2049 2333 strat->Shdl = idrMoveR_NoSort (strat->Shdl, sRing, currRing); 2050 2334 rDelete (sRing); … … 2063 2347 #endif 2064 2348 #if SBA_PRINT_ZERO_REDUCTIONS 2065 printf("ZERO REDUCTIONS: %ld\n",zeroreductions); 2349 printf("----------------------------------------------------------\n"); 2350 printf("ZERO REDUCTIONS: %ld\n",zeroreductions); 2351 zeroreductions = 0; 2066 2352 #endif 2067 2353 #if SBA_PRINT_REDUCTION_STEPS 2068 printf("TOP S-REDUCTIONS: %ld\n",sba_reduction_steps); 2354 printf("----------------------------------------------------------\n"); 2355 printf("S-REDUCTIONS: %ld\n",sba_reduction_steps); 2356 #endif 2357 #if SBA_PRINT_OPERATIONS 2358 printf("OPERATIONS: %ld\n",sba_operations); 2359 #endif 2360 #if SBA_PRINT_REDUCTION_STEPS 2361 printf("- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \n"); 2362 printf("INTERREDUCTIONS: %ld\n",sba_interreduction_steps); 2363 #endif 2364 #if SBA_PRINT_OPERATIONS 2365 printf("INTERREDUCTION OPERATIONS: %ld\n",sba_interreduction_operations); 2366 #endif 2367 #if SBA_PRINT_REDUCTION_STEPS 2368 printf("- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \n"); 2369 printf("ALL REDUCTIONS: %ld\n",sba_reduction_steps+sba_interreduction_steps); 2370 sba_interreduction_steps = 0; 2371 sba_reduction_steps = 0; 2372 #endif 2373 #if SBA_PRINT_OPERATIONS 2374 printf("ALL OPERATIONS: %ld\n",sba_operations+sba_interreduction_operations); 2375 sba_interreduction_operations = 0; 2376 sba_operations = 0; 2069 2377 #endif 2070 2378 #if SBA_PRINT_SIZE_G 2071 printf("SIZE OF G: %ld\n",size_g); 2379 printf("----------------------------------------------------------\n"); 2380 printf("SIZE OF G: %ld\n",size_g); 2381 size_g = 0; 2072 2382 #endif 2073 2383 #if SBA_PRINT_SIZE_SYZ 2074 printf("SIZE OF SYZ: %ld\n",size_syz); 2384 printf("SIZE OF SYZ: %ld\n",size_syz); 2385 printf("----------------------------------------------------------\n"); 2386 size_syz = 0; 2075 2387 #endif 2076 2388 #if SBA_PRINT_PRODUCT_CRITERION 2077 printf("PRODUCT CRITERIA: %ld\n",product_criterion); 2078 #endif 2079 zeroreductions = 0; 2080 size_g = 0; 2081 size_syz = 0; 2082 product_criterion = 0; 2083 sba_reduction_steps = 0; 2389 printf("PRODUCT CRITERIA: %ld\n",product_criterion); 2390 product_criterion = 0; 2391 #endif 2084 2392 return (strat->Shdl); 2085 2393 } … … 2404 2712 // therefore we call pContent instead of pNorm 2405 2713 #if F5CTAILRED 2714 BOOLEAN withT = TRUE; 2406 2715 if ((TEST_OPT_INTSTRATEGY) || (rField_is_Ring(currRing))) 2407 2716 {
Note: See TracChangeset
for help on using the changeset viewer.