Changeset bef194 in git for Singular/kutil.cc
- Timestamp:
- Dec 18, 2000, 2:30:39 PM (23 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- 64b116830d916500b5f224c29ed87bb214f3c975
- Parents:
- 35f23db1d98503370c2432aebc628c69b0560444
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/kutil.cc
r35f23d rbef194 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: kutil.cc,v 1.8 3 2000-12-14 16:38:51obachman Exp $ */4 /* $Id: kutil.cc,v 1.84 2000-12-18 13:30:37 obachman Exp $ */ 5 5 /* 6 6 * ABSTRACT: kernel: utils for kStd … … 1886 1886 } 1887 1887 1888 // determines the position based on: 1.) Ecart 2.) FDeg 3.) pLength 1889 int posInT_EcartFDegpLength(const TSet set,const int length,const LObject &p) 1890 { 1891 1892 if (length==-1) return 0; 1893 1894 int o = p.ecart; 1895 int op=p.GetpFDeg(); 1896 int ol = p.GetpLength(); 1897 1898 if (set[length].ecart < o) 1899 return length+1; 1900 if (set[length].ecart == o) 1901 { 1902 int oo=set[length].GetpFDeg(); 1903 if ((oo < op) || ((oo==op) && (set[length].length < ol))) 1904 return length+1; 1905 } 1906 1907 int i; 1908 int an = 0; 1909 int en= length; 1910 loop 1911 { 1912 if (an >= en-1) 1913 { 1914 if (set[an].ecart > o) 1915 return an; 1916 if (set[an].ecart == o) 1917 { 1918 int oo=set[an].GetpFDeg(); 1919 if((oo > op) 1920 || ((oo==op) && (set[an].pLength > ol))) 1921 return an; 1922 } 1923 return en; 1924 } 1925 i=(an+en) / 2; 1926 if (set[i].ecart > o) 1927 en=i; 1928 else if (set[i].ecart == o) 1929 { 1930 int oo=set[i].GetpFDeg(); 1931 if ((oo > op) 1932 || ((oo == op) && (set[i].pLength > ol))) 1933 en=i; 1934 else 1935 an=i; 1936 } 1937 else 1938 an=i; 1939 } 1940 } 1941 1942 // determines the position based on: 1.) FDeg 2.) pLength 1943 int posInT_FDegpLength(const TSet set,const int length,const LObject &p) 1944 { 1945 1946 if (length==-1) return 0; 1947 1948 int op=p.GetpFDeg(); 1949 int ol = p.GetpLength(); 1950 1951 int oo=set[length].GetpFDeg(); 1952 if ((oo < op) || ((oo==op) && (set[length].length < ol))) 1953 return length+1; 1954 1955 int i; 1956 int an = 0; 1957 int en= length; 1958 loop 1959 { 1960 if (an >= en-1) 1961 { 1962 int oo=set[an].GetpFDeg(); 1963 if((oo > op) 1964 || ((oo==op) && (set[an].pLength > ol))) 1965 return an; 1966 return en; 1967 } 1968 i=(an+en) / 2; 1969 int oo=set[i].GetpFDeg(); 1970 if ((oo > op) 1971 || ((oo == op) && (set[i].pLength > ol))) 1972 en=i; 1973 else 1974 an=i; 1975 } 1976 } 1977 1978 // determines the position based on: 1.) Ecart 2.) pLength 1979 int posInT_EcartpLength(const TSet set,const int length,const LObject &p) 1980 { 1981 if (length==-1) return 0; 1982 1983 int op=p.ecart; 1984 int ol = p.GetpLength(); 1985 1986 int oo=set[length].ecart; 1987 if ((oo < op) || ((oo==op) && (set[length].length < ol))) 1988 return length+1; 1989 1990 int i; 1991 int an = 0; 1992 int en= length; 1993 loop 1994 { 1995 if (an >= en-1) 1996 { 1997 int oo=set[an].ecart; 1998 if((oo > op) 1999 || ((oo==op) && (set[an].pLength > ol))) 2000 return an; 2001 return en; 2002 } 2003 i=(an+en) / 2; 2004 int oo=set[i].ecart; 2005 if ((oo > op) 2006 || ((oo == op) && (set[i].pLength > ol))) 2007 en=i; 2008 else 2009 an=i; 2010 } 2011 } 2012 2013 // determines the position based on: 1.) Ecart 2.) FDeg 3.) pLength 2014 int posInT_pLength(const TSet set,const int length,const LObject &p) 2015 { 2016 if (length==-1) 2017 return 0; 2018 if (set[length].length<p.length) 2019 return length+1; 2020 2021 int i; 2022 int an = 0; 2023 int en= length; 2024 int ol = p.GetpLength(); 2025 2026 loop 2027 { 2028 if (an >= en-1) 2029 { 2030 if (set[an].pLength>ol) return an; 2031 return en; 2032 } 2033 i=(an+en) / 2; 2034 if (set[i].pLength>ol) en=i; 2035 else an=i; 2036 } 2037 } 2038 1888 2039 /*2 1889 2040 * looks up the position of p in set … … 2810 2961 *checks the change degree and write progress report 2811 2962 */ 2812 void message (int i,int* reduc,int* olddeg,kStrategy strat )2963 void message (int i,int* reduc,int* olddeg,kStrategy strat, int red_result) 2813 2964 { 2814 2965 if (i != *olddeg) … … 2817 2968 *olddeg = i; 2818 2969 } 2819 if (strat->Ll != *reduc) 2820 { 2821 if (strat->Ll != *reduc-1) 2822 Print("(%d)",strat->Ll+1); 2970 if (K_TEST_OPT_OLDSTD) 2971 { 2972 if (strat->Ll != *reduc) 2973 { 2974 if (strat->Ll != *reduc-1) 2975 Print("(%d)",strat->Ll+1); 2976 else 2977 PrintS("-"); 2978 *reduc = strat->Ll; 2979 } 2823 2980 else 2981 PrintS("."); 2982 mflush(); 2983 } 2984 else 2985 { 2986 if (red_result == 0) 2824 2987 PrintS("-"); 2825 *reduc = strat->Ll; 2826 } 2827 else 2828 PrintS("."); 2829 mflush(); 2988 else if (red_result < 0) 2989 PrintS("."); 2990 else 2991 { 2992 if (strat->Ll != *reduc) 2993 { 2994 Print("(%d)",strat->Ll+1); 2995 *reduc = strat->Ll; 2996 } 2997 } 2998 } 2830 2999 } 2831 3000
Note: See TracChangeset
for help on using the changeset viewer.