Changeset 16493d in git
- Timestamp:
- May 2, 2007, 12:01:23 PM (16 years ago)
- Branches:
- (u'spielwiese', 'd1ba061a762c62d3a25159d8da8b6e17332291fa')
- Children:
- 320251bb9a9fd2cc3608cd66855a56fb98188476
- Parents:
- 580ab50138ac90a455bc8ccfd0bfb17268011c18
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/kstd1.cc
r580ab5 r16493d 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: kstd1.cc,v 1.1 7 2007-01-05 17:59:32Singular Exp $ */4 /* $Id: kstd1.cc,v 1.18 2007-05-02 10:01:23 Singular Exp $ */ 5 5 /* 6 6 * ABSTRACT: … … 389 389 } 390 390 } 391 #endif 391 #endif 392 392 if (!strat->homog) 393 393 { … … 1876 1876 #if 0 1877 1877 // new version 1878 ideal kInterRed(ideal F, ideal Q) 1879 { 1880 ideal r; 1881 BOOLEAN b=pLexOrder,toReset=FALSE; 1882 kStrategy strat=new skStrategy; 1883 strat->interred_flag=TRUE; 1884 tHomog h; 1885 intvec *w=NULL; 1886 1887 if (rField_has_simple_inverse()) 1888 strat->LazyPass=20; 1889 else 1890 strat->LazyPass=2; 1891 strat->LazyDegree = 1; 1878 ideal kInterRed (ideal F, ideal Q) 1879 { 1880 int srmax,lrmax, red_result = 1; 1881 int olddeg,reduc,j; 1882 BOOLEAN need_update=FALSE; 1883 1884 kStrategy strat = new skStrategy; 1885 strat->kHEdgeFound = ppNoether != NULL; 1886 strat->kNoether=pCopy(ppNoether); 1892 1887 strat->ak = idRankFreeModule(F); 1893 if (strat->ak == 0) 1894 { 1895 h = (tHomog)idHomIdeal(F,Q); 1896 } 1897 else 1898 { 1899 h = (tHomog)idHomModule(F,Q,&w); 1900 } 1901 pLexOrder=b; 1902 if (h==isHomog) 1903 { 1904 if (strat->ak > 0 && (w!=NULL)) 1905 { 1906 strat->kModW = kModW = w; 1907 pFDegOld = pFDeg; 1908 pLDegOld = pLDeg; 1909 pSetDegProcs(kModDeg); 1910 toReset = TRUE; 1911 } 1912 pLexOrder = TRUE; 1913 strat->LazyPass*=2; 1914 } 1915 strat->homog=h; 1888 initBuchMoraCrit(strat); 1889 initBuchMoraPos(strat); 1890 strat->NotUsedAxis = (BOOLEAN *)omAlloc((pVariables+1)*sizeof(BOOLEAN)); 1891 for (j=pVariables; j>0; j--) strat->NotUsedAxis[j] = TRUE; 1892 strat->enterS = enterSBba; 1893 strat->posInT = posInT17; 1894 strat->initEcart = initEcartNormal; 1895 strat->sl = -1; 1896 strat->tl = -1; 1897 strat->Ll = -1; 1898 strat->tmax = setmaxT; 1899 strat->Lmax = setmaxL; 1900 strat->T = initT(); 1901 strat->R = initR(); 1902 strat->L = initL(); 1903 strat->sevT = initsevT(); 1904 strat->red = redLazy; 1905 strat->tailRing = currRing; 1906 if (pOrdSgn == -1) 1907 strat->honey = TRUE; 1908 initSL(F,Q,strat); 1909 for(j=strat->Ll; j>=0; j--) 1910 strat->L[j].tailRing=currRing; 1911 if (TEST_OPT_REDSB) 1912 strat->noTailReduction=FALSE; 1913 1914 srmax = strat->sl; 1915 reduc = olddeg = lrmax = 0; 1916 1917 #ifndef NO_BUCKETS 1918 if (!TEST_OPT_NOT_BUCKETS) 1919 strat->use_buckets = 1; 1920 #endif 1921 1922 // strat->posInT = posInT_pLength; 1923 kTest_TS(strat); 1924 1925 /* compute------------------------------------------------------- */ 1926 while (strat->Ll >= 0) 1927 { 1928 if (strat->Ll > lrmax) lrmax =strat->Ll;/*stat.*/ 1916 1929 #ifdef KDEBUG 1917 idTest(F); 1918 #endif 1919 if (pOrdSgn==-1) 1920 { 1921 if (w!=NULL) 1922 r=mora(F,Q,w,NULL,strat); 1930 if (TEST_OPT_DEBUG) messageSets(strat); 1931 #endif 1932 if (strat->Ll== 0) strat->interpt=TRUE; 1933 /* picks the last element from the lazyset L */ 1934 strat->P = strat->L[strat->Ll]; 1935 strat->Ll--; 1936 1937 // for input polys, prepare reduction 1938 strat->P.PrepareRed(strat->use_buckets); 1939 1940 if (strat->P.p == NULL && strat->P.t_p == NULL) 1941 { 1942 red_result = 0; 1943 } 1923 1944 else 1924 r=mora(F,Q,NULL,NULL,strat); 1925 } 1926 else 1927 { 1928 if (w!=NULL) 1929 r=bba(F,Q,w,NULL,strat); 1930 else 1931 r=bba(F,Q,NULL,NULL,strat); 1932 } 1945 { 1946 if (TEST_OPT_PROT) 1947 message((strat->honey ? strat->P.ecart : 0) + strat->P.pFDeg(), 1948 &olddeg,&reduc,strat, red_result); 1949 1950 /* reduction of the element choosen from L */ 1951 red_result = strat->red(&strat->P,strat); 1952 } 1953 1954 // reduction to non-zero new poly 1955 if (red_result == 1) 1956 { 1957 /* statistic */ 1958 if (TEST_OPT_PROT) PrintS("s"); 1959 1960 // get the polynomial (canonicalize bucket, make sure P.p is set) 1961 strat->P.GetP(strat->lmBin); 1962 1963 int pos=posInS(strat,strat->sl,strat->P.p,strat->P.ecart); 1964 1965 // reduce the tail and normalize poly 1966 if (TEST_OPT_INTSTRATEGY) 1967 { 1968 strat->P.pCleardenom(); 1969 if ((TEST_OPT_REDSB)||(TEST_OPT_REDTAIL)) 1970 { 1971 strat->P.p = redtailBba(&(strat->P),pos-1,strat, FALSE); 1972 strat->P.pCleardenom(); 1973 } 1974 } 1975 else 1976 { 1977 strat->P.pNorm(); 1978 if ((TEST_OPT_REDSB)||(TEST_OPT_REDTAIL)) 1979 strat->P.p = redtailBba(&(strat->P),pos-1,strat, FALSE); 1980 } 1981 1933 1982 #ifdef KDEBUG 1934 idTest(r); 1935 #endif 1936 if (toReset) 1937 { 1938 kModW = NULL; 1939 pRestoreDegProcs(pFDegOld, pLDegOld); 1940 } 1941 pLexOrder = b; 1942 //Print("%d reductions canceled \n",strat->cel); 1943 HCord=strat->HCord; 1983 if (TEST_OPT_DEBUG){PrintS("new s:");strat->P.wrp();PrintLn();} 1984 #endif 1985 1986 // enter into S, L, and T 1987 enterT(strat->P, strat); 1988 // posInS only depends on the leading term 1989 strat->enterS(strat->P, pos, strat, strat->tl); 1990 if (pos<strat->sl) 1991 { 1992 need_update=TRUE; 1993 #if 0 1994 LObject h; 1995 for(j=strat->sl;j>pos;j--) 1996 { 1997 if (TEST_OPT_PROT) { PrintS("+"); mflush(); } 1998 memset(&h, 0, sizeof(h)); 1999 h.p=strat->S[j]; 2000 int i; 2001 for(i=strat->tl;i>=0;i--) 2002 { 2003 if (pLmCmp(h.p,strat->T[i].p)==0) 2004 { 2005 if (i < strat->tl) 2006 { 2007 #ifdef ENTER_USE_MEMMOVE 2008 memmove(&(strat->T[i]), &(strat->T[i+1]), 2009 (strat->tl-i)*sizeof(TObject)); 2010 memmove(&(strat->sevT[i]), &(strat->sevT[i+1]), 2011 (strat->tl-i)*sizeof(unsigned long)); 2012 #endif 2013 for (int l=i; l<strat->tl; l++) 2014 { 2015 #ifndef ENTER_USE_MEMMOVE 2016 strat->T[l] = strat->T[l+1]; 2017 strat->sevT[l] = strat->sevT[l+1]; 2018 #endif 2019 strat->R[strat->T[l].i_r] = &(strat->T[l]); 2020 } 2021 } 2022 strat->tl--; 2023 break; 2024 } 2025 } 2026 strat->S[j]=NULL; 2027 strat->sl--; 2028 if (TEST_OPT_INTSTRATEGY) 2029 { 2030 //pContent(h.p); 2031 h.pCleardenom(); // also does a pContent 2032 } 2033 else 2034 { 2035 h.pNorm(); 2036 } 2037 strat->initEcart(&h); 2038 if (strat->Ll==-1) 2039 pos =0; 2040 else 2041 pos = strat->posInL(strat->L,strat->Ll,&h,strat); 2042 h.sev = pGetShortExpVector(h.p); 2043 enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos); 2044 } 2045 #endif 2046 } 2047 if (strat->P.lcm!=NULL) pLmFree(strat->P.lcm); 2048 if (strat->sl>srmax) srmax = strat->sl; 2049 } 2050 #ifdef KDEBUG 2051 memset(&(strat->P), 0, sizeof(strat->P)); 2052 #endif 2053 kTest_TS(strat); 2054 } 2055 #ifdef KDEBUG 2056 if (TEST_OPT_DEBUG) messageSets(strat); 2057 #endif 2058 /* complete reduction of the standard basis--------- */ 2059 if (TEST_OPT_REDSB) 2060 { 2061 completeReduce(strat); 2062 if (strat->completeReduce_retry) 2063 { 2064 // completeReduce needed larger exponents, retry 2065 // to reduce with S (instead of T) 2066 // and in currRing (instead of strat->tailRing) 2067 cleanT(strat);strat->tailRing=currRing; 2068 int i; 2069 for(i=strat->sl;i>=0;i--) strat->S_2_R[i]=-1; 2070 completeReduce(strat); 2071 } 2072 } 2073 2074 /* release temp data-------------------------------- */ 2075 if (TEST_OPT_PROT) messageStat(srmax,lrmax,0,strat); 2076 if (Q!=NULL) updateResult(strat->Shdl,Q,strat); 2077 ideal shdl=strat->Shdl; 2078 idSkipZeroes(shdl); 2079 pDelete(&strat->kHEdge); 2080 omFreeSize((ADDRESS)strat->T,strat->tmax*sizeof(TObject)); 2081 omFreeSize((ADDRESS)strat->ecartS,IDELEMS(strat->Shdl)*sizeof(int)); 2082 omFreeSize((ADDRESS)strat->sevS,IDELEMS(strat->Shdl)*sizeof(unsigned long)); 2083 omFreeSize((ADDRESS)strat->NotUsedAxis,(pVariables+1)*sizeof(BOOLEAN)); 2084 omFreeSize((ADDRESS)strat->L,(strat->Lmax)*sizeof(LObject)); 2085 omfree(strat->sevT); 2086 omfree(strat->S_2_R); 2087 omfree(strat->R); 2088 2089 if (strat->fromQ) 2090 { 2091 for (j=IDELEMS(strat->Shdl)-1;j>=0;j--) 2092 { 2093 if(strat->fromQ[j]) pDelete(&strat->Shdl->m[j]); 2094 } 2095 omFreeSize((ADDRESS)strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int)); 2096 strat->fromQ=NULL; 2097 } 1944 2098 delete(strat); 1945 if (w!=NULL) delete w; 1946 return r; 2099 #if 0 2100 if (need_update) 2101 { 2102 ideal res=kInterRed(shdl,Q); 2103 idDelete(&shdl); 2104 shdl=res; 2105 } 2106 #endif 2107 return shdl; 1947 2108 } 1948 2109 #else
Note: See TracChangeset
for help on using the changeset viewer.