Changeset 750069 in git
- Timestamp:
- Sep 22, 2016, 3:41:32 PM (8 years ago)
- Branches:
- (u'spielwiese', '5b153614cbc72bfa198d75b1e9e33dab2645d9fe')
- Children:
- 4ef909357cd2764e39044e78dc5f8f271de19c21
- Parents:
- c4ea0bb97e0fcd6d7e4ea58106ce9935683b32de6c086a438d710cf8f1f5eac494377370eacf969c
- git-author:
- Hans Schoenemann <hannes@mathematik.uni-kl.de>2016-09-22 15:41:32+02:00
- git-committer:
- GitHub <noreply@github.com>2016-09-22 15:41:32+02:00
- Files:
-
- 1 added
- 52 edited
Legend:
- Unmodified
- Added
- Removed
-
README.md
r6c086a4 r750069 26 26 27 27 * [Developer and Reference Manual:](@ref main_page) 28 <http://www. mathematik.uni-kl.de/~motsak/dox/html>28 <http://www.singular.uni-kl.de/dox/html> 29 29 -
Singular/LIB/classify_aeq.lib
r6c086a4 r750069 1 1 /////////////////////////////////////////////////////////////////////////////// 2 version="version classify_aeq.lib 4.0. 0.0 Jun_2013"; // $Id$2 version="version classify_aeq.lib 4.0.3.2 Sep_2016 "; // $Id$ 3 3 category="Singularities"; 4 4 info=" … … 25 25 [5] Ishikawa,G; Janeczko,S.: The Complex Symplectic Moduli Spaces of Unimodal Parametric Plane Curve NEU Singularities. Insitute of Mathematics of the Polish Academy of Sciences,Preprint 664(2006) 26 26 PROCEDURES: 27 sagbiAlg(G); Compute the Sagbi-basis of the Algebra. 28 sagbiMod(I,A); Compute the Sagbi- basis of the Module. 29 semiGroup(G); Compute the Semi-Group of the Algebra provided the input is Sagbi Bases of the Algebra. 30 semiMod(I,A); Compute the Semi-Module provided that the input are the Sagbi Bases of the Algebra resp.Module. 31 planeCur(I); Compute the type of the Simple Plane Curve singularity. 32 spaceCur(I); Compute the type of the simple Space Curve singularity. 27 sagbiAlg(G); Compute the Sagbi-basis of the Algebra. 28 sagbiMod(I,A); Compute the Sagbi- basis of the Module. 29 semiGroup(G); Compute the Semi-Group of the Algebra provided the input is Sagbi Bases of the Algebra. 30 semiMod(I,A); Compute the Semi-Module provided that the input are the Sagbi Bases of the Algebra resp.Module. 31 planeCur(I); Compute the type of the Simple Plane Curve singularity. 32 spaceCur(I); Compute the type of the simple Space Curve singularity. 33 inVar(I); computes for the parametrization defined by Is 34 semi group, semi module of differentials, 35 Zariski number and moduli 36 normalForm(I); computes for the parametrization defined by I 37 normal form, semi group, semi module of differentials, 38 Zariski number and moduli 33 39 "; 34 40 LIB "algebra.lib"; … … 1921 1927 return(K); 1922 1928 } 1929 1930 proc inVar(ideal I) 1931 "USAGE: inVar(I); I=ideal, I=<x(t),y(t)>, ord(x(t))=n<ord(y(t))=m, 1932 n does not divide m 1933 COMPUTE: for the parametrization defined by I semi group, semi module 1934 of differentials, Zariski number and moduli 1935 RETURN: a list L with 5 entries 1936 L[1] the semi group Gamma 1937 L[2] the semi module Lambda 1938 L[3] 0 if Lambda=Gamma or lambda=min(Lambda-Gamma) -n, the Zariski number 1939 L[4] the integers i, i>lambda, i+n not in Lambda, 0 if this set is empty 1940 L[5] 0 or the smallest integer i, i not in Gamma, i+m-n not in Gamma 1941 i-lambda not in Gamma but i+n in Lambda 1942 EXAMPLE: example inVar; shows an example" 1943 { 1944 ideal G=sagbiAlg(I); 1945 ideal M=diff(I,t); 1946 ideal K=sagbiMod(M,G); 1947 list L=semiMod(K,G); 1948 intvec v=L[3]; //semi group Gamma 1949 intvec w=L[6]+1; 1950 w=0,w; //semin module Lambda 1951 intvec mo; 1952 int i,l,k; 1953 l=-1; 1954 int n=ord(G[1]); 1955 int m=ord(G[2]); 1956 for(i=1;i<=size(w);i++) 1957 { 1958 if(v[i]!=w[i]) 1959 { 1960 l=w[i]-v[2]; //lambda 1961 break; 1962 } 1963 } 1964 if(i==size(w)+1) 1965 { 1966 for(k=i;k<=size(v);k++) 1967 { 1968 if(v[k]!=w[i-1]+k-i+1) 1969 { 1970 l=w[i-1]+k-i+1-v[2]; //lambda 1971 break; 1972 } 1973 } 1974 } 1975 1976 if(l==-1){return(-1);} 1977 for(i=l+1;i<=w[size(w)]-n;i++) 1978 { 1979 if(!ivec(i+n,w)) 1980 { 1981 mo=mo,i; //i+n not in Lambda 1982 } 1983 } 1984 if(size(mo)>1){mo=mo[2..size(mo)];} 1985 for(i=l+1;i<=v[size(v)]-1;i++) 1986 { 1987 if(!ivec(i,v)&&!ivec(i+n-m,v)&&ivec(i+n,w)&&(i<mo[size(mo)])) 1988 { 1989 return(list(v,w,l,mo,i)); 1990 } 1991 } 1992 return(list(v,w,l,mo,0)); 1993 } 1994 example 1995 { 1996 "EXAMPLE"; echo=2; 1997 ring r=0,t,Ds; 1998 ideal I=t6+3t7,t8+t13+t19; 1999 inVar(I); 2000 } 2001 2002 static proc ivec(int a, intvec v) 2003 { 2004 int i; 2005 if(a>=v[size(v)]){return(a);} 2006 for(i=1;i<=size(v);i++) 2007 { 2008 if(a==v[i]){return(i);} 2009 } 2010 return(0); 2011 } 2012 2013 proc normalMap(ideal I, int bound) 2014 { 2015 // returns (t^n,h) A-equivalent to I modulo <t>^bound+1 2016 2017 I=jet(I,bound); 2018 def R=basering; 2019 map phi; 2020 poly p; 2021 if(ord(I[1])>ord(I[2])){p=I[1];I[1]=I[2];I[2]=p;} 2022 I[1]=simplify(I[1],1); 2023 int n=ord(I[1]); 2024 phi=R,var(1)-1/number(n)*I[1][2]/var(1)^(n-1); 2025 I=phi(I); 2026 while(size(I[1])>1) 2027 { 2028 phi=R,var(1)-1/number(n)*I[1][2]/var(1)^(n-1); 2029 2030 I=jet(phi(I),bound); 2031 } 2032 I[2]=simplify(I[2],1); 2033 p=lead(I[2])+reduc(I[2]-lead(I[2]),I,bound); 2034 I[2]=p; 2035 return(I); 2036 } 2037 2038 static proc reduc(poly f,ideal I, int b) 2039 { 2040 // computes the normal form of f with respect to the algebra generated by I 2041 list L=1; 2042 map psi; 2043 f=jet(f,b); 2044 if(f==0){return(f);} 2045 while((f!=0) && (L[1]!=0)) 2046 { 2047 L= algebra_containment(lead(f),lead(I),1); 2048 if (L[1]==1) 2049 { 2050 def S= L[2]; 2051 psi= S,maxideal(1),I; 2052 f=jet(f-psi(check),b); 2053 kill S; 2054 } 2055 } 2056 return (lead(f)+reduc(f-lead(f),I,b)); 2057 } 2058 2059 proc normalForm(ideal I, list #) 2060 "USAGE: normalForm(I), I=<x(t),y(t)> an ideal, # optional, a bound for the 2061 conductor 2062 COMPUTE: computes the Hefez-Hernandez normal form of the ideal I=<x(t),y(t)> 2063 RETURN: a list L with 5 entries 2064 L[1] the Hefei-Hernandez normal form of the ideal I=<x(t),y(t)> 2065 L[2] the semi group Gamma 2066 L[3] the semi module Lambda 2067 L[4] 0 if Lambda=Gamma or lambda=min(Lambda-Gamma) -n, the Zariski number 2068 L[5] the integers i, i>lambda, i+n not in Lambda, 0 if this set is empty 2069 EXAMPLE: example normalForm; shows an example" 2070 { 2071 int b,i,l,k; 2072 poly p; 2073 map phi; 2074 def R=basering; 2075 if(size(#)>0) 2076 { 2077 b=#[1]; 2078 ideal G=sagbiAlg(I,b); 2079 } 2080 else 2081 { 2082 ideal G=sagbiAlg(I); 2083 } 2084 ideal M=diff(I,t); 2085 ideal K=sagbiMod(M,G); 2086 list L=semiMod(K,G); 2087 intvec v=L[3]; //semi group Gamma 2088 intvec w=L[6]+1; 2089 w=0,w; //semi module Lambda 2090 b=v[size(v)]+1; 2091 I=normalMap(I,b); 2092 int n=ord(I[1]); 2093 int m=ord(I[2]); 2094 poly g; 2095 if(v==w){return(list(ideal(var(1)^n,var(1)^m),v,w,0,0));} 2096 for(i=1;i<=size(w);i++) 2097 { 2098 if(v[i]!=w[i]) 2099 { 2100 l=w[i]-v[2]; //lambda 2101 break; 2102 } 2103 } 2104 if(i==size(w)+1) 2105 { 2106 for(k=i;k<=size(v);k++) 2107 { 2108 if(v[k]!=w[i-1]+k-i+1) 2109 { 2110 l=w[i-1]+k-i+1-v[2]; //lambda 2111 break; 2112 } 2113 } 2114 } 2115 intvec moduli; 2116 for(i=l+1;i<=w[size(w)]-n;i++) 2117 { 2118 if(!ivec(i+n,w)) 2119 { 2120 moduli=moduli,i; //i+n not in Lambda 2121 } 2122 } 2123 if(size(moduli)>1){moduli=moduli[2..size(moduli)];} 2124 int momax=moduli[size(moduli)]; 2125 if(momax==0){momax=l;} 2126 b=momax; 2127 i=1; 2128 while(i<b) 2129 { 2130 i++; 2131 k=ord(I[2][i]); 2132 if(k==-1){break;} 2133 if(k==l){i++;k=ord(I[2][i]);} 2134 if(k>b){return(list(jet(I,b),v,w,l,moduli));} 2135 if(ivec(k,v)) //k is in Gamma 2136 { 2137 I[2]=lead(I[2])+reduc(I[2]-lead(I[2]),G,b); 2138 i--; 2139 } 2140 else 2141 { 2142 if(ivec(k+n-m,v)) //k+n-m is in Gamma 2143 { 2144 phi=R,var(1)-1/number(m)*I[2][i]/var(1)^(m-1); 2145 I=phi(I); 2146 I[1]=lead(I[1])+reduc(I[1]-lead(I[1]),G,b); 2147 I=normalMap(I,b); 2148 i--; 2149 } 2150 else 2151 { 2152 if(ivec(k+n,w)) //k+n is in Lambda 2153 { 2154 g=findTrafo(I,i); 2155 g=jet(g,b-m+1); 2156 phi=R,g; 2157 I=phi(I); 2158 I[1]=lead(I[1])+reduc(I[1]-lead(I[1]),G,b); 2159 I[2]=lead(I[2])+reduc(I[2]-lead(I[2]),G,b); 2160 I=normalMap(I,b); 2161 i--; 2162 } 2163 } 2164 } 2165 G=sagbiAlg(I,b); 2166 } 2167 return(list(I,v,w,l,moduli)); 2168 } 2169 example 2170 { 2171 "EXAMPLE"; echo=2; 2172 ring r=0,t,Ds; 2173 ideal I=t6+3t7,t8+t13+t19; 2174 normalForm(I); 2175 } 2176 2177 static proc findTrafo(ideal I, int i) 2178 { 2179 //I[2][i]=a*t^k, I[1]=x{t}=t^n, I[2]=y(t)=t^m+c*t^lambda+...+a*t^k+... 2180 //find the map to kill the term a*t^k of y(t) for k+n in Lambda 2181 //find g,h such that a*t^k*x'(t)=h(x(t),y(t))*x'(t)-g(x(t),y(t))*y'(t) mod t^(k+n) 2182 //return the map t---> t+g(x(t),y(t))/x'(t) mod t^(k+1) 2183 2184 def R0=basering; 2185 int p=char(R0); 2186 int k=ord(I[2][i]); 2187 int n=ord(I[1]); 2188 int m=ord(I[2]); 2189 poly f=I[2][i]*diff(I[1],var(1)); 2190 ring R=p,var(1),dp; 2191 ideal I=imap(R0,I); 2192 poly f=imap(R0,f); 2193 ideal Q=std(ideal(var(1)*f)); 2194 qring T=Q; 2195 ideal I=imap(R,I); 2196 poly f=imap(R,f); 2197 ring S=p,(@z,@u,@v,@x,@y),(dp(1),dp(2),dp(2)); 2198 setring T; 2199 map psi=S,f,diff(I[1],var(1)),diff(I[2],var(1)),I[1],I[2]; 2200 setring S; 2201 ideal J=kernel(T,psi); 2202 option(redSB); 2203 J=std(J); 2204 //we look for an element @z-@u*h(@x,@y)-@v*g(@x,@y) in J 2205 for(i=1;i<=ncols(J);i++) 2206 { 2207 if((@z*diff(J[i],@z)+@u*diff(J[i],@u)+@v*diff(J[i],@v)==J[i])&&(deg(diff(J[i],@z))==0)) 2208 { 2209 poly f=J[i]/(-diff(J[i],@z)); //the element is in the standard basis 2210 break; 2211 } 2212 } 2213 poly g; 2214 if(i==ncols(J)+1) 2215 { 2216 //the last element in the standard basis is of type @z-@u*h(@x,@y)-@v*g(@x,@y)+k(@x,@y) 2217 //we have to kill k(@x,@y) using the other standard basis elements 2218 poly f=J[i-1]; 2219 ideal K; 2220 for(i=1;i<ncols(J);i++) 2221 { 2222 g=lead(J[i]); 2223 if(((g==diff(g,@u)*@u)&&(diff(g,@v)==0))||((g==diff(g,@v)*@v)&&(diff(g,@u)==0))) 2224 { 2225 K[size(K)+1]=J[i]; 2226 } 2227 } 2228 ring S1=p,(@z,@u,@v,@x,@y),(a(-1,-1,-1,0,0),dp(1),dp(2),dp(2)); 2229 ideal K=imap(S,K); 2230 attrib(K,"isSB",1); 2231 poly f=imap(S,f); 2232 f=reduce(f,K); 2233 setring S; 2234 f=imap(S1,f); 2235 f=f/(-diff(f,@z)); //f=@z-@u*h(@x,@y)-@v*g(@x,@y) 2236 } 2237 matrix M=coef(f,@v); 2238 g=M[2,1]; 2239 setring T; 2240 poly g=psi(g); 2241 setring R0; 2242 poly g=imap(T,g); 2243 g=g/diff(I[1],var(1)); 2244 return(var(1)-g); 2245 } 2246 2247 //============================ Examples======================== 2248 /* 2249 ring r=0,t,(c,ds); 2250 ideal I=t4+t7,t6+t7; 2251 normalForm(I); 2252 2253 ring r=0,t,(c,ds); 2254 ideal I=t4+t7+t9,t6+t11; 2255 normalForm(I); 2256 2257 ring r=0,t,(c,ds); 2258 ideal I=t4+t5,t9+t10; 2259 normalForm(I); 2260 2261 ring r=0,t,Ds; 2262 ideal I=t6+3t7,t8+t13+t19; 2263 normalForm(I); 2264 2265 ring r=32003,t,Ds; 2266 ideal I=t8,t12+3t15+7t19; 2267 normalForm(I); 2268 */ 1923 2269 //////////////////////////////////////////////////////////////////////////////// 1924 2270 /* -
Singular/LIB/surf.lib
r6c086a4 r750069 1 1 //////////////////////////////////////////////////////////////////////////// 2 version="version surf.lib 4.0.3. 2 Jun_2016 "; // $Id$2 version="version surf.lib 4.0.3.3 Sep_2016 "; // $Id$ 3 3 category="Visualization"; 4 4 info=" … … 360 360 + " (The shell returned the error code " + string(i) + "." + newline 361 361 + "But since we are on Mac OS X, let us try to open SURFER.app instead..." + newline 362 + "Appropriate SURFER.app is available for instance at http://www.mathematik.uni-kl.de/~motsak/files/SURFER.dmg";362 + "Appropriate SURFER.app is available for instance at ftp://www.mathematik.uni-kl.de/pub/Math/Singular/utils/SURFER.dmg"; 363 363 364 364 // fallback, will only work if SURFER.app is available (e.g. in /Applications) -
Singular/dyn_modules/syzextra/syzextra.cc
r6c086a4 r750069 166 166 pNext(s) = NULL; 167 167 168 if( !n_IsZero( p _GetCoeff(s, R), R) )168 if( !n_IsZero( pGetCoeff(s), R->cf) ) 169 169 { 170 170 const int i = p_GetComp(s, R) - 1; … … 480 480 481 481 poly m = p_LmInit(p, r); 482 p_SetCoeff0(m, n_Copy(p _GetCoeff(p, r), r), r);482 p_SetCoeff0(m, n_Copy(pGetCoeff(p), r->cf), r); 483 483 484 484 if( bSetZeroComp ) … … 647 647 { 648 648 poly ss = p_LmInit(t, r); 649 p_SetCoeff0(ss, n_Init(1, r ), r); // for delete & printout only!...649 p_SetCoeff0(ss, n_Init(1, r->cf), r); // for delete & printout only!... 650 650 p_SetComp(ss, (*vit)->label() + 1, r); // coeff? 651 651 p_Setm(ss, r); … … 1640 1640 p_Test(multiplier, r); 1641 1641 1642 if( !n_Equal( pGetCoeff(multiplier), pGetCoeff(itr->first), r ) ) // normalize coeffs!?1642 if( !n_Equal( pGetCoeff(multiplier), pGetCoeff(itr->first), r->cf) ) // normalize coeffs!? 1643 1643 { 1644 number n = n_Div( pGetCoeff(multiplier), pGetCoeff(itr->first), r ); // new number1644 number n = n_Div( pGetCoeff(multiplier), pGetCoeff(itr->first), r->cf); // new number 1645 1645 1646 1646 if( UNLIKELY( OPT__TREEOUTPUT ) ) 1647 1647 { 1648 1648 StringSetS(""); 1649 n_Write(n, r );1649 n_Write(n, r->cf); 1650 1650 char* s = StringEndS(); 1651 1651 Print("\"recale\": \"%s\", ", s); … … 1656 1656 1657 1657 p = p_Mult_nn(p, n, r); // ! 1658 n_Delete(&n, r );1658 n_Delete(&n, r->cf); 1659 1659 } else 1660 1660 if( UNLIKELY( OPT__PROT ) ) ++ m_stat[6]; // PrintS("l"); // lookup no rescale … … 2216 2216 // assume ( !n_IsZero( p_GetCoeff(product, r), r ) ); 2217 2217 2218 assume ( !n_IsZero( p _GetCoeff(lt(), r), r) );2218 assume ( !n_IsZero( pGetCoeff(lt()), r->cf ) ); 2219 2219 assume( sev() == p_GetShortExpVector(lt(), r) ); 2220 2220 … … 2238 2238 bool CLeadingTerm::DivisibilityCheck(const poly m, const poly t, const unsigned long not_sev, const ring r) const 2239 2239 { 2240 assume ( !n_IsZero( p _GetCoeff(lt(), r), r) );2240 assume ( !n_IsZero( pGetCoeff(lt()), r->cf ) ); 2241 2241 assume( sev() == p_GetShortExpVector(lt(), r) ); 2242 2242 2243 2243 assume( m != NULL ); 2244 2244 assume( t != NULL ); 2245 assume ( !n_IsZero( p _GetCoeff(m, r), r) );2246 assume ( !n_IsZero( p _GetCoeff(t, r), r) );2245 assume ( !n_IsZero( pGetCoeff(m), r->cf ) ); 2246 assume ( !n_IsZero( pGetCoeff(t), r->cf ) ); 2247 2247 2248 2248 // assume( p_GetComp(m, r) == 0 ); … … 2521 2521 assume( m != NULL ); 2522 2522 assume( t != NULL ); 2523 assume ( !n_IsZero( p _GetCoeff(m, m_rBaseRing), m_rBaseRing) );2524 assume ( !n_IsZero( p _GetCoeff(t, m_rBaseRing), m_rBaseRing) );2523 assume ( !n_IsZero( pGetCoeff(m), m_rBaseRing->cf ) ); 2524 assume ( !n_IsZero( pGetCoeff(t), m_rBaseRing->cf ) ); 2525 2525 2526 2526 p_Test(m, m_rBaseRing); … … 2705 2705 } 2706 2706 2707 number n = n_Mult( p _GetCoeff(multiplier, r), p_GetCoeff(t, r), r);2707 number n = n_Mult( pGetCoeff(multiplier), pGetCoeff(t), r->cf); 2708 2708 2709 2709 #if NODIVISION 2710 2710 // we assume all leading coeffs to be 1! 2711 assume( n_IsOne(p _GetCoeff(p, r), r->cf) );2711 assume( n_IsOne(pGetCoeff(p), r->cf) ); 2712 2712 #else 2713 if( !n_IsOne( p _GetCoeff(p, r), r ) )2714 n = n_Div(n, p _GetCoeff(p, r), r);2715 #endif 2716 2717 p_SetCoeff0(q, n_InpNeg(n, r ), r);2713 if( !n_IsOne( pGetCoeff(p), r ) ) 2714 n = n_Div(n, pGetCoeff(p), r->cf); 2715 #endif 2716 2717 p_SetCoeff0(q, n_InpNeg(n, r->cf), r); 2718 2718 // n_Delete(&n, r); 2719 2719 … … 2921 2921 #if NODIVISION 2922 2922 assume( n_IsOne(p_GetCoeff(p, r), r->cf) ); 2923 p_SetCoeff0(q, n_InpNeg( n_Copy(p _GetCoeff(product, r), r), r), r);2923 p_SetCoeff0(q, n_InpNeg( n_Copy(pGetCoeff(product), r->cf), r->cf), r); 2924 2924 #else 2925 p_SetCoeff0(q, n_InpNeg( n_Div( p _GetCoeff(product, r), p_GetCoeff(p, r), r), r), r);2925 p_SetCoeff0(q, n_InpNeg( n_Div( pGetCoeff(product), p_GetCoeff(p), r->cf), r->cf), r); 2926 2926 #endif 2927 2927 -
Singular/extra.cc
rc4ea0bb r750069 3191 3191 } 3192 3192 else 3193 /*==================== RatSpoly, noncomm rational coeffs =================*/3193 /*==================== RatSpoly, noncomm rational coeffs =================*/ 3194 3194 if (strcmp(sys_cmd, "ratSpoly") == 0) 3195 3195 { … … 3825 3825 } 3826 3826 else 3827 /*========reduce procedure like the global one but with jet bounds=================*/ 3828 if(strcmp(sys_cmd,"reduce_bound")==0) 3829 { 3830 poly p; 3831 ideal pid; 3832 ideal q; 3833 int bound; 3834 int htype; 3835 if(h!= NULL && (h->Typ() == POLY_CMD) || (h->Typ() == VECTOR_CMD) 3836 || (h->Typ() == IDEAL_CMD) || (h->Typ() == MODUL_CMD)) 3837 { 3838 if(h->Typ() == POLY_CMD) 3839 { 3840 p = (poly)h->CopyD(); 3841 htype = POLY_CMD; 3842 } 3843 if(h->Typ() == VECTOR_CMD) 3844 { 3845 p = (poly)h->CopyD(); 3846 htype = VECTOR_CMD; 3847 } 3848 if(h->Typ() == IDEAL_CMD) 3849 { 3850 pid = (ideal)h->CopyD(); 3851 htype = IDEAL_CMD; 3852 } 3853 if(h->Typ() == MODUL_CMD) 3854 { 3855 pid = (ideal)h->CopyD(); 3856 htype = MODUL_CMD; 3857 } 3858 h=h->next; 3859 } 3860 else return TRUE; 3861 if(h!= NULL && (h->Typ() == IDEAL_CMD || h->Typ() == MODUL_CMD) ) 3862 { 3863 q = (ideal)h->CopyD(); 3864 h=h->next; 3865 } 3866 else return TRUE; 3867 if(h!= NULL && h->Typ() == INT_CMD) 3868 { 3869 bound = (long)h->CopyD(); 3870 } 3871 else return TRUE; 3872 res->rtyp = htype; 3873 if(htype == POLY_CMD || htype == VECTOR_CMD) 3874 res->data = (char *)kNFBound(q,currRing->qideal,p,bound); 3875 if(htype == IDEAL_CMD || htype == MODUL_CMD) 3876 res->data = (char *)kNFBound(q,currRing->qideal,pid,bound); 3877 return FALSE; 3878 } 3879 else 3827 3880 /*==================== Error =================*/ 3828 3881 Werror( "(extended) system(\"%s\",...) %s", sys_cmd, feNotImplemented ); -
Singular/iparith.cc
r6c086a4 r750069 27 27 #include <polys/matpol.h> 28 28 #include <polys/monomials/maps.h> 29 #include <polys/coeffrings.h>30 29 #include <polys/sparsmat.h> 31 30 #include <polys/weight.h> … … 3809 3808 { 3810 3809 number n = reinterpret_cast<number>(v->Data()); 3811 res->data = reinterpret_cast<void*>(n_GetDenom(n, currRing ));3810 res->data = reinterpret_cast<void*>(n_GetDenom(n, currRing->cf)); 3812 3811 return FALSE; 3813 3812 } … … 3818 3817 { 3819 3818 number n = reinterpret_cast<number>(v->Data()); 3820 res->data = reinterpret_cast<void*>(n_GetNumerator(n, currRing ));3819 res->data = reinterpret_cast<void*>(n_GetNumerator(n, currRing->cf)); 3821 3820 return FALSE; 3822 3821 } … … 4608 4607 { 4609 4608 number nn=(number)v->Data(); 4610 res->data = (char *)(long)n_ParDeg(nn, currRing );4609 res->data = (char *)(long)n_ParDeg(nn, currRing->cf); 4611 4610 return FALSE; 4612 4611 } -
Singular/ipassign.cc
r6c086a4 r750069 230 230 if (n_IsZero(p, currRing->cf)) 231 231 { 232 n_Delete(&p, currRing );232 n_Delete(&p, currRing->cf); 233 233 if( nCoeff_is_transExt(currRing->cf) ) 234 234 { -
Singular/ipprint.cc
r6c086a4 r750069 204 204 } 205 205 else PrintS("field"); 206 if (r->OrdSgn==1) PrintS(", global"); else PrintS(", local/mixed"); 206 if (r->OrdSgn==1) PrintS(", global"); 207 else if (r->MixedOrder==1) PrintS(", mixed"); 208 else PrintS(", local"); 207 209 PrintS(" ordering\n"); 208 210 rWrite(r, TRUE); -
Singular/links/silink.cc
r6c086a4 r750069 192 192 193 193 //-------------------------------------------------------------------------- 194 BOOLEAN slSetRingDummy(si_link, ring r, BOOLEAN send)194 BOOLEAN slSetRingDummy(si_link, ring r, BOOLEAN) 195 195 { 196 196 if (currRing!=r) rChangeCurrRing(r); -
Singular/maps_ip.cc
r6c086a4 r750069 281 281 memset(v,0,sizeof(sleftv)); 282 282 283 number d = n_GetDenom(p _GetCoeff(p, currRing), currRing);283 number d = n_GetDenom(pGetCoeff(p), currRing->cf); 284 284 p_Test((poly)NUM((fraction)d), R); 285 285 286 286 if ( n_IsOne (d, currRing->cf) ) 287 287 { 288 n_Delete(&d, currRing ); d = NULL;288 n_Delete(&d, currRing->cf); d = NULL; 289 289 } 290 290 else if (!p_IsConstant((poly)NUM((fraction)d), R)) 291 291 { 292 292 WarnS("ignoring denominators of coefficients..."); 293 n_Delete(&d, currRing ); d = NULL;294 } 295 296 number num = n_GetNumerator(p _GetCoeff(p, currRing), currRing);293 n_Delete(&d, currRing->cf); d = NULL; 294 } 295 296 number num = n_GetNumerator(pGetCoeff(p), currRing->cf); 297 297 memset(&tmpW,0,sizeof(sleftv)); 298 298 tmpW.rtyp = POLY_CMD; … … 307 307 v->data=NULL; 308 308 } 309 n_Delete(&num, currRing );309 n_Delete(&num, currRing->cf); 310 310 //TODO check for memory leaks 311 311 poly pp = pHead(p); … … 314 314 { 315 315 pSetCoeff(pp, n_Invers(d, currRing->cf)); 316 n_Delete(&d, currRing ); // d = NULL;316 n_Delete(&d, currRing->cf); // d = NULL; 317 317 } 318 318 else … … 332 332 memset(v,0,sizeof(sleftv)); 333 333 334 number num = n_GetNumerator(p _GetCoeff(p, currRing), currRing);334 number num = n_GetNumerator(pGetCoeff(p), currRing->cf); 335 335 memset(&tmpW,0,sizeof(sleftv)); 336 336 tmpW.rtyp = POLY_CMD; … … 346 346 v->data=NULL; 347 347 } 348 if (num!=(number)R->qideal->m[0]) n_Delete(&num, currRing );348 if (num!=(number)R->qideal->m[0]) n_Delete(&num, currRing->cf); 349 349 //TODO check for memory leaks 350 350 poly pp = pHead(p); 351 351 //PrintS("map:");pWrite(pp); 352 pSetCoeff(pp,n_Init(1,currRing ));352 pSetCoeff(pp,n_Init(1,currRing->cf)); 353 353 //PrintS("cf->");pWrite((poly)(v->data)); 354 354 poly ppp = pMult((poly)(v->data),pp); -
Singular/newstruct.cc
r6c086a4 r750069 638 638 } 639 639 640 BOOLEAN newstruct_deserialize(blackbox ** b, void **d, si_link f)641 { 642 // newstruct is seriali azed as analog to a list,640 BOOLEAN newstruct_deserialize(blackbox **, void **d, si_link f) 641 { 642 // newstruct is serialized as analog to a list, 643 643 // just read a list and take data, 644 644 // rtyp must be set correctly (to the blackbox id) by routine calling -
Singular/singular-libs
r6c086a4 r750069 52 52 schubert.lib tasks.lib tropical.lib hdepth.lib gradedModules.lib \ 53 53 arr.lib brillnoether.lib chern.lib cimonom.lib GND.lib \ 54 graal.lib hess.lib modwalk.lib rwalk.lib swalk.lib 54 graal.lib hess.lib modwalk.lib rwalk.lib swalk.lib \ 55 classifyMapGerms.lib 55 56 56 57 PLIBS = bimodules.lib bfun.lib central.lib dmod.lib dmodapp.lib dmodvar.lib\ -
Singular/subexpr.cc
r6c086a4 r750069 564 564 { 565 565 number n=(number)d; 566 n_Delete(&n,r );566 n_Delete(&n,r->cf); 567 567 break; 568 568 } -
Singular/walk.cc
r6c086a4 r750069 96 96 BOOLEAN Overflow_Error = FALSE; 97 97 98 #ifdef TIME_TEST 98 99 clock_t xtif, xtstd, xtlift, xtred, xtnw; 99 100 clock_t xftostd, xtextra, xftinput, to; 101 #endif 100 102 101 103 /**************************** … … 1620 1622 1621 1623 intvec* result = new intvec(niv); 1622 intvec* result1 = new intvec(niv);1623 1624 BOOLEAN nflow = FALSE; 1624 1625 … … 1767 1768 int nG = IDELEMS(G); 1768 1769 int n = nG-1; 1769 Print("\n// ** Ideal %s besteht aus %d Polynomen mit ", Ch, nG);1770 Print("\n// ** Ideal %s besteht aus %d Polynomen mit ", Ch, nG); 1770 1771 1771 1772 for(i=0; i<nG; i++) … … 1784 1785 } 1785 1786 PrintS(" Monomen.\n"); 1786 Print("// ** %s besitzt %d Monome.", Ch, nmon);1787 Print("// ** %s besitzt %d Monome.", Ch, nmon); 1787 1788 PrintLn(); 1788 1789 } … … 2907 2908 { 2908 2909 ring r = rCopy0(currRing,FALSE,FALSE); 2909 int i,nv = currRing->N;2910 int nv = currRing->N; 2910 2911 2911 2912 int nb = rBlocks(currRing) + 1; … … 2947 2948 static void DefRingPar(intvec* va) 2948 2949 { 2949 int i,nv = currRing->N;2950 int nv = currRing->N; 2950 2951 int nb = rBlocks(currRing) + 1; 2951 2952 … … 2955 2956 res->wvhdl = (int **)omAlloc0(nb * sizeof(int_ptr)); 2956 2957 res->wvhdl[0] = (int*) omAlloc(nv*sizeof(int)); 2957 for(i =0; i<nv; i++)2958 for(int i=0; i<nv; i++) 2958 2959 res->wvhdl[0][i] = (*va)[i]; 2959 2960 … … 2996 2997 static void DefRingParlp(void) 2997 2998 { 2998 int i,nv = currRing->N;2999 int nv = currRing->N; 2999 3000 3000 3001 ring r=rCopy0(currRing,FALSE,FALSE); … … 3032 3033 // r->cf->extRing->names=(char **)omAlloc(l*sizeof(char_ptr)); 3033 3034 // 3034 // for(i =l-1;i>=0;i--)3035 // for(int i=l-1;i>=0;i--) 3035 3036 // { 3036 3037 // rParameter(r)[i]=omStrDup(rParameter(currRing)[i]); … … 3216 3217 nwalk++; 3217 3218 nstep++; 3219 #ifdef TIME_TEST 3218 3220 to=clock(); 3221 #endif 3219 3222 // compute a next weight vector 3220 3223 next_weight = MkInterRedNextWeight(curr_weight,target_weight, G); 3224 #ifdef TIME_TEST 3221 3225 xtnw=xtnw+clock()-to; 3226 #endif 3222 3227 3223 3228 #ifdef PRINT_VECTORS … … 3262 3267 } 3263 3268 oldRing = currRing; 3269 #ifdef TIME_TEST 3264 3270 to=clock(); 3271 #endif 3265 3272 // compute an initial form ideal of <G> w.r.t. "curr_vector" 3266 3273 Gomega = MwalkInitialForm(G, curr_weight); 3274 #ifdef TIME_TEST 3267 3275 xtif=xtif+clock()-to; 3276 #endif 3268 3277 3269 3278 #ifdef ENDWALKS … … 3302 3311 Gomega1 = idrMoveR(Gomega, oldRing,currRing); 3303 3312 3313 #ifdef TIME_TEST 3304 3314 to=clock(); 3315 #endif 3305 3316 /* compute a reduced Groebner basis of <Gomega> w.r.t. "newRing" */ 3306 3317 #ifdef BUCHBERGER_ALG … … 3310 3321 delete hilb_func; 3311 3322 #endif // BUCHBERGER_ALG 3323 #ifdef TIME_TEST 3312 3324 xtstd=xtstd+clock()-to; 3325 #endif 3313 3326 /* change the ring to oldRing */ 3314 3327 rChangeCurrRing(oldRing); … … 3316 3329 Gomega2 = idrMoveR(Gomega1, newRing,currRing); 3317 3330 3331 #ifdef TIME_TEST 3318 3332 to=clock(); 3333 #endif 3319 3334 /* compute a reduced Groebner basis of <G> w.r.t. "newRing" */ 3320 3335 F = MLifttwoIdeal(Gomega2, M1, G); 3336 #ifdef TIME_TEST 3321 3337 xtlift=xtlift+clock()-to; 3338 #endif 3322 3339 3323 3340 idDelete(&M1); … … 3328 3345 F1 = idrMoveR(F, oldRing,currRing); 3329 3346 3347 #ifdef TIME_TEST 3330 3348 to=clock(); 3349 #endif 3331 3350 /* reduce the Groebner basis <G> w.r.t. new ring */ 3332 3351 G = kInterRedCC(F1, NULL); 3352 #ifdef TIME_TEST 3333 3353 xtred=xtred+clock()-to; 3354 #endif 3334 3355 idDelete(&F1); 3335 3356 … … 3926 3947 // BOOLEAN nOverflow_Error = FALSE; 3927 3948 3949 #ifdef TIME_TEST 3928 3950 clock_t tproc=0; 3929 3951 clock_t tinput = clock(); 3952 #endif 3930 3953 3931 3954 int i, nV = currRing->N; … … 4019 4042 goto FIRST_STEP; 4020 4043 } 4044 #ifdef TIME_TEST 4021 4045 to=clock(); 4046 #endif 4022 4047 // compute an initial form ideal of <G> w.r.t. "curr_vector" 4023 4048 Gomega = MwalkInitialForm(G, curr_weight); 4049 #ifdef TIME_TEST 4024 4050 xtif=xtif+clock()-to; 4051 #endif 4025 4052 4026 4053 #ifndef BUCHBERGER_ALG … … 4048 4075 newRing = currRing; 4049 4076 Gomega1 = idrMoveR(Gomega, oldRing,currRing); 4077 #ifdef TIME_TEST 4050 4078 to=clock(); 4079 #endif 4051 4080 // compute a reduced Groebner basis of <Gomega> w.r.t. "newRing" 4052 4081 #ifdef BUCHBERGER_ALG … … 4056 4085 delete hilb_func; 4057 4086 #endif // BUCHBERGER_ALG 4087 #ifdef TIME_TEST 4058 4088 xtstd=xtstd+clock()-to; 4089 #endif 4059 4090 // change the ring to oldRing 4060 4091 rChangeCurrRing(oldRing); … … 4062 4093 Gomega2 = idrMoveR(Gomega1, newRing,currRing); 4063 4094 4095 #ifdef TIME_TEST 4064 4096 to=clock(); 4097 #endif 4065 4098 // compute a reduced Groebner basis of <G> w.r.t. "newRing" by the lifting process 4066 4099 F = MLifttwoIdeal(Gomega2, M1, G); 4100 #ifdef TIME_TEST 4067 4101 xtlift=xtlift+clock()-to; 4102 #endif 4068 4103 idDelete(&M1); 4069 4104 idDelete(&Gomega2); … … 4074 4109 F1 = idrMoveR(F, oldRing,currRing); 4075 4110 4111 #ifdef TIME_TEST 4076 4112 to=clock(); 4113 #endif 4077 4114 // reduce the Groebner basis <G> w.r.t. new ring 4078 4115 G = kInterRedCC(F1, NULL); 4116 #ifdef TIME_TEST 4079 4117 xtred=xtred+clock()-to; 4118 #endif 4080 4119 idDelete(&F1); 4081 4120 … … 4085 4124 } 4086 4125 FIRST_STEP: 4126 #ifdef TIME_TEST 4087 4127 to=clock(); 4128 #endif 4088 4129 Overflow_Error = FALSE; 4089 4130 // compute a next weight vector 4090 4131 next_weight = MkInterRedNextWeight(curr_weight,target_weight, G); 4132 #ifdef TIME_TEST 4091 4133 xtnw=xtnw+clock()-to; 4134 #endif 4092 4135 #ifdef PRINT_VECTORS 4093 4136 MivString(curr_weight, target_weight, next_weight); … … 4126 4169 // REC_LAST_GB_ALT2: 4127 4170 //nOverflow_Error = Overflow_Error; 4171 #ifdef TIME_TEST 4128 4172 tproc=tproc+clock()-tinput; 4173 #endif 4129 4174 4130 4175 /*Print("\n// takes %d steps and calls \"Rec_LastGB\" (%d):", … … 4165 4210 // nOverflow_Error = Overflow_Error; 4166 4211 //Print("\n// takes %d steps and calls \"Rec_LastGB (%d):", tp_deg+1); 4212 #ifdef TIME_TEST 4167 4213 tproc=tproc+clock()-tinput; 4214 #endif 4168 4215 F1 = Rec_LastGB(F1,curr_weight, orig_target_weight, tp_deg+1,nnwinC); 4169 4216 } … … 4198 4245 F1 = G; 4199 4246 } 4247 #ifdef TIME_TEST 4200 4248 to=clock(); 4249 #endif 4201 4250 // Print("\n// apply the Buchberger's alg in ring = %s",rString(currRing)); 4202 4251 // idElements(F1, "F1"); 4203 4252 G = MstdCC(F1); 4253 #ifdef TIME_TEST 4204 4254 xtextra=xtextra+clock()-to; 4255 #endif 4205 4256 4206 4257 … … 4494 4545 intvec* next_weight1 = MkInterRedNextWeight(curr_weight,target_weight,G); 4495 4546 intvec* next_weight2 = new intvec(nV); 4496 intvec* next_weight22 = new intvec(nV);4497 4547 intvec* result = new intvec(nV); 4498 4548 intvec* curr_weight1; … … 4758 4808 } 4759 4809 //Print("\n//REC_GB_Mwalk: Entering the %d-th step in the %d-th recursive:\n",nwalk,tp_deg); 4810 #ifdef TIME_TEST 4760 4811 to = clock(); 4812 #endif 4761 4813 // compute an initial form ideal of <G> w.r.t. "curr_vector" 4762 4814 Gomega = MwalkInitialForm(G, curr_weight); 4815 #ifdef TIME_TEST 4763 4816 xtif = xtif + clock()-to; 4817 #endif 4764 4818 4765 4819 #ifndef BUCHBERGER_ALG … … 4788 4842 Gomega1 = idrMoveR(Gomega, oldRing,currRing); 4789 4843 4844 #ifdef TIME_TEST 4790 4845 to = clock(); 4846 #endif 4791 4847 // compute a reduced Groebner basis of <Gomega> w.r.t. "newRing" 4792 4848 #ifdef BUCHBERGER_ALG … … 4796 4852 delete hilb_func; 4797 4853 #endif 4854 #ifdef TIME_TEST 4798 4855 xtstd = xtstd + clock() - to; 4856 #endif 4799 4857 4800 4858 // change the ring to oldRing … … 4804 4862 Gomega2 = idrMoveR(Gomega1, newRing,currRing); 4805 4863 4864 #ifdef TIME_TEST 4806 4865 to = clock(); 4866 #endif 4807 4867 F = MLifttwoIdeal(Gomega2, M1, G); 4868 #ifdef TIME_TEST 4808 4869 xtlift = xtlift + clock() -to; 4870 #endif 4809 4871 4810 4872 idDelete(&M1); … … 4817 4879 F1 = idrMoveR(F, oldRing,currRing); 4818 4880 4881 #ifdef TIME_TEST 4819 4882 to = clock(); 4883 #endif 4820 4884 // reduce the Groebner basis <G> w.r.t. new ring 4821 4885 G = kInterRedCC(F1, NULL); 4886 #ifdef TIME_TEST 4822 4887 xtred = xtred + clock() -to; 4888 #endif 4823 4889 4824 4890 idDelete(&F1); … … 4829 4895 } 4830 4896 NEXT_STEP: 4897 #ifdef TIME_TEST 4831 4898 to = clock(); 4899 #endif 4832 4900 // compute a next weight vector 4833 4901 intvec* next_weight = MkInterRedNextWeight(curr_weight,target_weight, G); 4834 4902 4835 4903 4904 #ifdef TIME_TEST 4836 4905 xtnw = xtnw + clock() - to; 4906 #endif 4837 4907 4838 4908 #ifdef PRINT_VECTORS … … 4934 5004 F1 = G; 4935 5005 } 5006 #ifdef TIME_TEST 4936 5007 to=clock(); 5008 #endif 4937 5009 // apply Buchberger alg to compute a red. GB of F1 4938 5010 G = MstdCC(F1); 5011 #ifdef TIME_TEST 4939 5012 xtextra=clock()-to; 5013 #endif 4940 5014 idDelete(&F1); 4941 5015 newRing = currRing; … … 4966 5040 //Print("// pSetm_Error = (%d)", ErrorCheck()); 4967 5041 5042 #ifdef TIME_TEST 4968 5043 clock_t tinput, tostd, tif=0, tstd=0, tlift=0, tred=0, tnw=0; 4969 xtif=0; xtstd=0; xtlift=0; xtred=0; xtnw=0;4970 5044 tinput = clock(); 4971 5045 clock_t tim; 5046 xtif=0; xtstd=0; xtlift=0; xtred=0; xtnw=0; 5047 #endif 4972 5048 nstep=0; 4973 5049 int i; … … 4996 5072 ring XXRing = currRing; 4997 5073 5074 #ifdef TIME_TEST 4998 5075 to = clock(); 5076 #endif 4999 5077 // the monomial ordering of this current ring would be "dp" 5000 5078 G = MstdCC(Go); 5079 #ifdef TIME_TEST 5001 5080 tostd = clock()-to; 5081 #endif 5002 5082 5003 5083 if(currRing->order[0] == ringorder_a) … … 5008 5088 nwalk ++; 5009 5089 nstep ++; 5090 #ifdef TIME_TEST 5010 5091 to = clock(); 5092 #endif 5011 5093 // compute an initial form ideal of <G> w.r.t. "curr_vector" 5012 5094 Gomega = MwalkInitialForm(G, curr_weight); 5095 #ifdef TIME_TEST 5013 5096 tif = tif + clock()-to; 5097 #endif 5014 5098 oldRing = currRing; 5015 5099 … … 5018 5102 /* compute a reduced Groebner basis of Gomega w.r.t. >>_cw by 5019 5103 the recursive changed perturbation walk alg. */ 5104 #ifdef TIME_TEST 5020 5105 tim = clock(); 5106 #endif 5021 5107 #ifdef CHECK_IDEAL_MWALK 5022 5108 Print("\n// **** Groebnerwalk took %d steps and ", nwalk); … … 5041 5127 #endif 5042 5128 */ 5129 #ifdef TIME_TEST 5043 5130 to = clock(); 5131 #endif 5044 5132 F = MLifttwoIdeal(Gomega, M, G); 5133 #ifdef TIME_TEST 5045 5134 xtlift = xtlift + clock() - to; 5135 #endif 5046 5136 5047 5137 idDelete(&Gomega); … … 5089 5179 Gomega1 = idrMoveR(Gomega, oldRing,currRing); 5090 5180 5181 #ifdef TIME_TEST 5091 5182 to = clock(); 5183 #endif 5092 5184 // compute a reduced Groebner basis of <Gomega> w.r.t. "newRing" 5093 5185 #ifdef BUCHBERGER_ALG … … 5097 5189 delete hilb_func; 5098 5190 #endif 5191 #ifdef TIME_TEST 5099 5192 tstd = tstd + clock() - to; 5193 #endif 5100 5194 5101 5195 // change the ring to oldRing … … 5104 5198 Gomega2 = idrMoveR(Gomega1, newRing,currRing); 5105 5199 5200 #ifdef TIME_TEST 5106 5201 to = clock(); 5202 #endif 5107 5203 // compute a representation of the generators of submod (M) with respect 5108 5204 // to those of mod (Gomega). 5109 5205 // Gomega is a reduced Groebner basis w.r.t. the current ring. 5110 5206 F = MLifttwoIdeal(Gomega2, M1, G); 5207 #ifdef TIME_TEST 5111 5208 tlift = tlift + clock() - to; 5209 #endif 5112 5210 5113 5211 idDelete(&M1); … … 5120 5218 } 5121 5219 5220 #ifdef TIME_TEST 5122 5221 to = clock(); 5222 #endif 5123 5223 // reduce the Groebner basis <G> w.r.t. new ring 5124 5224 G = kInterRedCC(F1, NULL); 5225 #ifdef TIME_TEST 5125 5226 if(endwalks != 1) 5126 5227 { … … 5131 5232 xtred = xtred + clock() - to; 5132 5233 } 5234 #endif 5133 5235 idDelete(&F1); 5134 5236 if(endwalks == 1) … … 5137 5239 } 5138 5240 NEXT_VECTOR: 5241 #ifdef TIME_TEST 5139 5242 to = clock(); 5243 #endif 5140 5244 // compute a next weight vector 5141 5245 intvec* next_weight = MkInterRedNextWeight(curr_weight,target_weight,G); 5246 #ifdef TIME_TEST 5142 5247 tnw = tnw + clock() - to; 5248 #endif 5143 5249 #ifdef PRINT_VECTORS 5144 5250 MivString(curr_weight, target_weight, next_weight); … … 5516 5622 Set_Error(FALSE); 5517 5623 Overflow_Error = FALSE; 5518 BOOLEAN endwalks = FALSE;5519 5624 #ifdef TIME_TEST 5520 5625 clock_t tinput, tostd, tif=0, tstd=0, tlift=0, tred=0, tnw=0; … … 6075 6180 #endif 6076 6181 #ifdef ENDWALKS 6182 #ifdef TIME_TEST 6077 6183 if(printout > 1) 6078 6184 { … … 6080 6186 ((double) clock())/1000000 -((double)tim) /1000000); 6081 6187 } 6188 #endif 6082 6189 #endif 6083 6190 } … … 6227 6334 } 6228 6335 // LastGB is "better" than the kStd subroutine 6336 #ifdef TIME_TEST 6229 6337 to=clock(); 6338 #endif 6230 6339 ideal eF1; 6231 6340 if(nP == 0 || tp_deg == 1 || MivSame(orig_target, exivlp) != 1){ … … 6241 6350 F2=NULL; 6242 6351 } 6352 #ifdef TIME_TEST 6243 6353 xtextra=clock()-to; 6354 #endif 6244 6355 ring exTargetRing = currRing; 6245 6356 … … 6635 6746 to = clock(); 6636 6747 #endif 6637 next_weight = next_weight =MkInterRedNextWeight(curr_weight,target_weight, G);6748 next_weight = MkInterRedNextWeight(curr_weight,target_weight, G); 6638 6749 #ifdef TIME_TEST 6639 6750 tnw = tnw + clock() - to; … … 6858 6969 ring new_ring, testring; 6859 6970 //ring extoRing; 6860 ideal Gomega, Gomega1, Gomega2, FF, F, F1,Gresult, Gresult1, G1, Gt;6971 ideal Gomega, Gomega1, Gomega2, FF, F, Gresult, Gresult1, G1, Gt; 6861 6972 int nwalks = 0; 6862 6973 intvec* Mwlp; … … 7332 7443 G = idrMoveR(F,oRing,currRing); 7333 7444 /* 7334 F1 = idrMoveR(F, oRing,currRing);7445 ideal F1 = idrMoveR(F, oRing,currRing); 7335 7446 #ifdef TIME_TEST 7336 7447 to=clock(); … … 7358 7469 ring new_ring, testring; 7359 7470 //ring extoRing; 7360 ideal Gomega, Gomega1, Gomega2, F, FF, F1, Gresult, Gresult1, G1, Gt; 7471 ideal Gomega, Gomega1, Gomega2, F, FF, Gresult, Gresult1, G1, Gt; 7472 #ifdef TIME_TEST 7473 ideal F1; 7474 #endif 7361 7475 intvec* Mwlp; 7362 7476 #ifndef BUCHBERGER_ALG … … 8299 8413 //Print("\n// ring ro = %s;", rString(currRing)); 8300 8414 8415 #ifdef TIME_TEST 8301 8416 clock_t tostd, tif=0, tstd=0, tlift=0, tred=0, tnw=0, textra=0; 8302 #ifdef TIME_TEST8303 8417 clock_t tinput = clock(); 8304 8418 #endif … … 8315 8429 //ideal H1; 8316 8430 ideal H2, Glp; 8317 int nGB, endwalks = 0, nwalkpert=0 , npertstep=0;8431 int nGB, endwalks = 0, nwalkpert=0; 8318 8432 intvec* Mlp = MivMatrixOrderlp(nV); 8319 8433 intvec* vector_tmp = new intvec(nV); … … 8335 8449 newRing = currRing; 8336 8450 8451 #ifdef TIME_TEST 8337 8452 to=clock(); 8453 #endif 8338 8454 // compute a red. GB w.r.t. the help ring 8339 8455 if(MivComp(curr_weight, iv_dp) == 1) //rOrdStr(currRing) = "dp" … … 8349 8465 G = MstdCC(G); 8350 8466 } 8467 #ifdef TIME_TEST 8351 8468 tostd=clock()-to; 8469 #endif 8352 8470 8353 8471 #ifdef REPRESENTATION_OF_SIGMA … … 8372 8490 else 8373 8491 rChangeCurrRing(VMrDefault(curr_weight)); 8492 #ifdef TIME_TEST 8374 8493 to=clock(); 8494 #endif 8375 8495 Gw = idrMoveR(G, exring,currRing); 8376 8496 G = MstdCC(Gw); 8377 8497 Gw = NULL; 8498 #ifdef TIME_TEST 8378 8499 tostd=tostd+clock()-to; 8500 #endif 8379 8501 //ivString(curr_weight,"rep. sigma"); 8380 8502 goto COMPUTE_NEW_VECTOR; … … 8388 8510 while(1) 8389 8511 { 8512 #ifdef TIME_TEST 8390 8513 to=clock(); 8514 #endif 8391 8515 /* compute an initial form ideal of <G> w.r.t. "curr_vector" */ 8392 8516 Gomega = MwalkInitialForm(G, curr_weight); 8517 #ifdef TIME_TEST 8393 8518 tif=tif+clock()-to; 8519 #endif 8394 8520 8395 8521 #ifndef BUCHBERGER_ALG … … 8411 8537 Gomega1 = idrMoveR(Gomega, oldRing,currRing); 8412 8538 8539 #ifdef TIME_TEST 8413 8540 to=clock(); 8541 #endif 8414 8542 /* compute a reduced Groebner basis of <Gomega> w.r.t. "newRing" */ 8415 8543 #ifdef BUCHBERGER_ALG … … 8419 8547 delete hilb_func; 8420 8548 #endif // BUCHBERGER_ALG 8549 #ifdef TIME_TEST 8421 8550 tstd=tstd+clock()-to; 8551 #endif 8422 8552 8423 8553 /* change the ring to oldRing */ … … 8426 8556 Gomega2 = idrMoveR(Gomega1, newRing,currRing); 8427 8557 8558 #ifdef TIME_TEST 8428 8559 to=clock(); 8560 #endif 8429 8561 /* compute a representation of the generators of submod (M) 8430 8562 with respect to those of mod (Gomega). 8431 8563 Gomega is a reduced Groebner basis w.r.t. the current ring */ 8432 8564 F = MLifttwoIdeal(Gomega2, M1, G); 8565 #ifdef TIME_TEST 8433 8566 tlift=tlift+clock()-to; 8567 #endif 8434 8568 8435 8569 idDelete(&M1); … … 8441 8575 F1 = idrMoveR(F, oldRing,currRing); 8442 8576 8577 #ifdef TIME_TEST 8443 8578 to=clock(); 8579 #endif 8444 8580 /* reduce the Groebner basis <G> w.r.t. new ring */ 8445 8581 G = kInterRedCC(F1, NULL); 8582 #ifdef TIME_TEST 8446 8583 tred=tred+clock()-to; 8584 #endif 8447 8585 idDelete(&F1); 8448 8586 … … 8452 8590 nwalk++; 8453 8591 nwalkpert++; 8592 #ifdef TIME_TEST 8454 8593 to=clock(); 8594 #endif 8455 8595 // compute a next weight vector 8456 8596 next_weight = MwalkNextWeightCC(curr_weight,target_weight, G); 8597 #ifdef TIME_TEST 8457 8598 tnw=tnw+clock()-to; 8599 #endif 8458 8600 #ifdef PRINT_VECTORS 8459 8601 MivString(curr_weight, target_weight, next_weight); … … 8495 8637 G1 = idrMoveR(G, newRing,currRing); 8496 8638 8639 #ifdef TIME_TEST 8497 8640 to=clock(); 8641 #endif 8498 8642 /*apply kStd or LastGB to compute a lex. red. Groebner basis of <G>*/ 8499 8643 if(nP == 0 || MivSame(target_tmp, iv_lp) == 0){ … … 8511 8655 G = idrMoveR(G, newRing,currRing); 8512 8656 } 8657 #ifdef TIME_TEST 8513 8658 textra=clock()-to; 8659 #endif 8514 8660 npert[endwalks]=nwalk-npert_tmp; 8515 8661 npert_tmp = nwalk; … … 8630 8776 8631 8777 8632 npertstep = nwalk;8633 8778 nwalkpert = 1; 8634 8779 nsteppert ++; … … 8698 8843 //Print("\n// ring ro = %s;", rString(currRing)); 8699 8844 8845 #ifdef TIME_TEST 8700 8846 clock_t tostd, tif=0, tstd=0, tlift=0, tred=0, tnw=0, textra=0; 8701 #ifdef TIME_TEST8702 8847 clock_t tinput = clock(); 8703 8848 #endif … … 8737 8882 newRing = currRing; 8738 8883 8884 #ifdef TIME_TEST 8739 8885 to=clock(); 8886 #endif 8740 8887 // compute a red. GB w.r.t. the help ring 8741 8888 if(MivComp(curr_weight, iv_dp) == 1) … … 8758 8905 G = MstdCC(G); 8759 8906 } 8907 #ifdef TIME_TEST 8760 8908 tostd=clock()-to; 8909 #endif 8761 8910 8762 8911 #ifdef REPRESENTATION_OF_SIGMA … … 8788 8937 rChangeCurrRing(VMrDefault(curr_weight)); 8789 8938 } 8939 #ifdef TIME_TEST 8790 8940 to=clock(); 8941 #endif 8791 8942 Gw = idrMoveR(G, exring,currRing); 8792 8943 G = MstdCC(Gw); 8793 8944 Gw = NULL; 8945 #ifdef TIME_TEST 8794 8946 tostd=tostd+clock()-to; 8947 #endif 8795 8948 //ivString(curr_weight,"rep. sigma"); 8796 8949 goto COMPUTE_NEW_VECTOR; … … 8804 8957 while(1) 8805 8958 { 8959 #ifdef TIME_TEST 8806 8960 to=clock(); 8961 #endif 8807 8962 // compute an initial form ideal of <G> w.r.t. "curr_vector" 8808 8963 Gomega = MwalkInitialForm(G, curr_weight); 8964 #ifdef TIME_TEST 8809 8965 tif=tif+clock()-to; 8966 #endif 8810 8967 8811 8968 #ifndef BUCHBERGER_ALG … … 8834 8991 Gomega1 = idrMoveR(Gomega, oldRing,currRing); 8835 8992 8993 #ifdef TIME_TEST 8836 8994 to=clock(); 8995 #endif 8837 8996 // compute a reduced Groebner basis of <Gomega> w.r.t. "newRing" 8838 8997 #ifdef BUCHBERGER_ALG … … 8842 9001 delete hilb_func; 8843 9002 #endif 9003 #ifdef TIME_TEST 8844 9004 tstd=tstd+clock()-to; 9005 #endif 8845 9006 8846 9007 // change the ring to oldRing … … 8849 9010 Gomega2 = idrMoveR(Gomega1, newRing,currRing); 8850 9011 9012 #ifdef TIME_TEST 8851 9013 to=clock(); 9014 #endif 8852 9015 // compute a representation of the generators of submod (M) with respect to those of mod (Gomega). 8853 9016 // Gomega is a reduced Groebner basis w.r.t. the current ring 8854 9017 F = MLifttwoIdeal(Gomega2, M1, G); 9018 #ifdef TIME_TEST 8855 9019 tlift=tlift+clock()-to; 9020 #endif 8856 9021 8857 9022 idDelete(&M1); … … 8863 9028 F1 = idrMoveR(F, oldRing,currRing); 8864 9029 9030 #ifdef TIME_TEST 8865 9031 to=clock(); 9032 #endif 8866 9033 // reduce the Groebner basis <G> w.r.t. new ring 8867 9034 G = kInterRedCC(F1, NULL); 9035 #ifdef TIME_TEST 8868 9036 tred=tred+clock()-to; 9037 #endif 8869 9038 idDelete(&F1); 8870 9039 … … 8873 9042 nwalk++; 8874 9043 nwalkpert++; 9044 #ifdef TIME_TEST 8875 9045 to=clock(); 9046 #endif 8876 9047 // compute a next weight vector 8877 9048 //next_weight = MwalkNextWeightCC(curr_weight,target_weight, G); … … 8953 9124 }*/ 8954 9125 9126 #ifdef TIME_TEST 8955 9127 tnw=tnw+clock()-to; 9128 #endif 8956 9129 #ifdef PRINT_VECTORS 8957 9130 MivString(curr_weight, target_weight, next_weight); … … 9004 9177 G1 = idrMoveR(G, newRing,currRing); 9005 9178 9179 #ifdef TIME_TEST 9006 9180 to=clock(); 9181 #endif 9007 9182 // apply kStd or LastGB to compute a lex. red. Groebner basis of <G> 9008 9183 if(nP == 0 || MivSame(target_tmp, iv_lp) == 0) … … 9022 9197 G = idrMoveR(G, newRing,currRing); 9023 9198 } 9199 #ifdef TIME_TEST 9024 9200 textra=clock()-to; 9201 #endif 9025 9202 npert[endwalks]=nwalk-npert_tmp; 9026 9203 npert_tmp = nwalk; … … 9211 9388 Overflow_Error = FALSE; 9212 9389 // BOOLEAN nOverflow_Error = FALSE; 9390 #ifdef TIME_TEST 9213 9391 clock_t tproc=0; 9214 9392 clock_t tinput=clock(); 9393 #endif 9215 9394 int i, nV = currRing->N; 9216 9395 … … 9301 9480 goto FIRST_STEP; 9302 9481 } 9482 #ifdef TIME_TEST 9303 9483 to=clock(); 9484 #endif 9304 9485 // compute an initial form ideal of <G> w.r.t. "curr_vector" 9305 9486 Gomega = MwalkInitialForm(G, curr_weight); 9487 #ifdef TIME_TEST 9306 9488 xtif=xtif+clock()-to; 9489 #endif 9307 9490 9308 9491 #ifndef BUCHBERGER_ALG … … 9336 9519 #endif 9337 9520 */ 9521 #ifdef TIME_TEST 9338 9522 to=clock(); 9523 #endif 9339 9524 // compute a reduced Groebner basis of <Gomega> w.r.t. "newRing" 9340 9525 #ifdef BUCHBERGER_ALG … … 9344 9529 delete hilb_func; 9345 9530 #endif // BUCHBERGER_ALG 9531 #ifdef TIME_TEST 9346 9532 xtstd=xtstd+clock()-to; 9533 #endif 9347 9534 9348 9535 // change the ring to oldRing … … 9350 9537 M1 = idrMoveR(M, newRing,currRing); 9351 9538 Gomega2 = idrMoveR(Gomega1, newRing,currRing); 9539 #ifdef TIME_TEST 9352 9540 to=clock(); 9541 #endif 9353 9542 9354 9543 // if(endwalks == 1){PrintS("\n// Lifting is still working:");} … … 9356 9545 // compute a reduced Groebner basis of <G> w.r.t. "newRing" by the lifting process 9357 9546 F = MLifttwoIdeal(Gomega2, M1, G); 9547 #ifdef TIME_TEST 9358 9548 xtlift=xtlift+clock()-to; 9549 #endif 9359 9550 9360 9551 idDelete(&M1); … … 9365 9556 rChangeCurrRing(newRing); 9366 9557 F1 = idrMoveR(F, oldRing,currRing); 9558 #ifdef TIME_TEST 9367 9559 to=clock(); 9560 #endif 9368 9561 //if(endwalks == 1){ PrintS("\n// InterRed is still working:");} 9369 9562 // reduce the Groebner basis <G> w.r.t. the new ring 9370 9563 G = kInterRedCC(F1, NULL); 9564 #ifdef TIME_TEST 9371 9565 xtred=xtred+clock()-to; 9566 #endif 9372 9567 idDelete(&F1); 9373 9568 … … 9377 9572 FIRST_STEP: 9378 9573 Overflow_Error=FALSE; 9574 #ifdef TIME_TEST 9379 9575 to=clock(); 9576 #endif 9380 9577 // compute a next weight vector 9381 9578 next_weight = MkInterRedNextWeight(curr_weight,target_weight, G); 9579 #ifdef TIME_TEST 9382 9580 xtnw=xtnw+clock()-to; 9581 #endif 9383 9582 #ifdef PRINT_VECTORS 9384 9583 MivString(curr_weight, target_weight, next_weight); … … 9390 9589 if(tp_deg > 1){ 9391 9590 //nOverflow_Error = Overflow_Error; 9591 #ifdef TIME_TEST 9392 9592 tproc = tproc+clock()-tinput; 9593 #endif 9393 9594 //Print("\n// A subroutine takes %d steps and calls \"Mpwalk\" (1,%d):", nwalk, tp_deg-1); 9394 9595 G1 = Mpwalk_MAltwalk1(G, curr_weight, tp_deg-1); … … 9439 9640 { 9440 9641 //Print("\n// subroutine takes %d steps and applys \"std\"", nwalk); 9642 #ifdef TIME_TEST 9441 9643 to=clock(); 9644 #endif 9442 9645 ideal G2 = MstdCC(G1); 9646 #ifdef TIME_TEST 9443 9647 xtextra=xtextra+clock()-to; 9648 #endif 9444 9649 idDelete(&G1); 9445 9650 G1 = G2; … … 9449 9654 { 9450 9655 //nOverflow_Error = Overflow_Error; 9656 #ifdef TIME_TEST 9451 9657 tproc = tproc+clock()-tinput; 9658 #endif 9452 9659 // Print("\n// B subroutine takes %d steps and calls \"Mpwalk\" (1,%d) :", nwalk, tp_deg-1); 9453 9660 G1 = Mpwalk_MAltwalk1(G1, curr_weight, tp_deg-1); … … 9481 9688 // Print("// pSetm_Error = (%d)", ErrorCheck()); 9482 9689 9690 #ifdef TIME_TEST 9483 9691 xtif=0; xtstd=0; xtlift=0; xtred=0; xtnw=0; xtextra=0; 9484 9692 xftinput = clock(); 9485 9693 clock_t tostd, tproc; 9694 #endif 9486 9695 9487 9696 nstep = 0; … … 9512 9721 ring XXRing = currRing; 9513 9722 9723 #ifdef TIME_TEST 9514 9724 to=clock(); 9725 #endif 9515 9726 /* compute a pertubed weight vector of the original weight vector. 9516 9727 The perturbation degree is recursive decrease until that vector … … 9569 9780 op_deg --; 9570 9781 } 9782 #ifdef TIME_TEST 9571 9783 tostd=clock()-to; 9784 #endif 9572 9785 9573 9786 if(op_tmp != 1 ) … … 9583 9796 nstep ++; 9584 9797 9798 #ifdef TIME_TEST 9585 9799 to = clock(); 9800 #endif 9586 9801 // compute an initial form ideal of <G> w.r.t. "curr_vector" 9587 9802 Gomega = MwalkInitialForm(G, curr_weight); 9803 #ifdef TIME_TEST 9588 9804 xtif=xtif+clock()-to; 9805 #endif 9589 9806 #if 0 9590 9807 if(Overflow_Error == TRUE) … … 9623 9840 Gomega1 = idrMoveR(Gomega, oldRing,currRing); 9624 9841 9842 #ifdef TIME_TEST 9625 9843 to=clock(); 9844 #endif 9626 9845 // compute a reduced Groebner basis of <Gomega> w.r.t. "newRing" 9627 9846 #ifdef BUCHBERGER_ALG … … 9631 9850 delete hilb_func; 9632 9851 #endif // BUCHBERGER_ALG 9852 #ifdef TIME_TEST 9633 9853 xtstd=xtstd+clock()-to; 9854 #endif 9634 9855 9635 9856 // change the ring to oldRing … … 9638 9859 Gomega2 = idrMoveR(Gomega1, newRing,currRing); 9639 9860 9861 #ifdef TIME_TEST 9640 9862 to=clock(); 9863 #endif 9641 9864 // compute a reduced Groebner basis of <G> w.r.t. "newRing" by the lifting process 9642 9865 F = MLifttwoIdeal(Gomega2, M1, G); 9866 #ifdef TIME_TEST 9643 9867 xtlift=xtlift+clock()-to; 9868 #endif 9644 9869 9645 9870 idDelete(&M1); … … 9653 9878 oldRing=NULL; 9654 9879 9880 #ifdef TIME_TEST 9655 9881 to=clock(); 9882 #endif 9656 9883 // reduce the Groebner basis <G> w.r.t. new ring 9657 9884 G = kInterRedCC(F1, NULL); 9885 #ifdef TIME_TEST 9658 9886 xtred=xtred+clock()-to; 9887 #endif 9659 9888 idDelete(&F1); 9660 9889 … … 9664 9893 } 9665 9894 NEXT_VECTOR: 9895 #ifdef TIME_TEST 9666 9896 to=clock(); 9897 #endif 9667 9898 // compute a next weight vector 9668 9899 next_weight = MkInterRedNextWeight(curr_weight,target_weight, G); 9900 #ifdef TIME_TEST 9669 9901 xtnw=xtnw+clock()-to; 9902 #endif 9670 9903 #ifdef PRINT_VECTORS 9671 9904 MivString(curr_weight, target_weight, next_weight); … … 9708 9941 #ifdef TIME_TEST 9709 9942 nOverflow_Error = Overflow_Error; 9710 #endif9711 9943 tproc = clock()-xftinput; 9944 #endif 9712 9945 9713 9946 //Print("\n// main routine takes %d steps and calls \"Mpwalk\" (1,%d):", nwalk, tp_deg); -
doc/NEWS.texi
r6c086a4 r750069 24 24 New libraries: 25 25 @itemize 26 @item new library: classifyMapGerms.lib: standard basis of the tangent space at the orbit of an algebraic group action (@nref{classifyMapGerms_lib}) 26 27 @item new library: ffmodstd.lib: Groebner bases of ideals in polynomial rings over algebraic function fields(@nref{ffmodstd_lib}) 27 28 @item new library: nfmodsyz.lib: syzygy modules of submodules of free modules … … 31 32 Changed libraries: 32 33 @itemize 34 @item classify_aeq.lib: new procedures (@nref{classify_aeq_lib}) 33 35 @item ncfactor.lib: factorization in some noncommuative algebras (@nref{ncfactor_lib}) with new routine ncfactor (@nref{ncfactor}) 34 36 @item primdec.lib: new option "subsystem" (@nref{primdec_lib}) -
doc/changes_in_singular4.texi
r6c086a4 r750069 183 183 184 184 In particular we have separated everything related to coeffcient rings into a separate library @code{libcoeffs}. 185 Dependency tree between restructured packages is show at @uref{http://www. mathematik.uni-kl.de/~motsak/dox/singular.png}185 Dependency tree between restructured packages is show at @uref{http://www.singular.uni-kl.de/dox/singular.png} 186 186 187 187 In order to use @code{libSingular} as a C++ library, see @ref{libSingular}. -
factory/cfGcdAlgExt.cc
r6c086a4 r750069 953 953 954 954 #ifndef HAVE_NTL 955 staticvoid tryExtgcd( const CanonicalForm & F, const CanonicalForm & G, const CanonicalForm & M, CanonicalForm & result, CanonicalForm & s, CanonicalForm & t, bool & fail )955 void tryExtgcd( const CanonicalForm & F, const CanonicalForm & G, const CanonicalForm & M, CanonicalForm & result, CanonicalForm & s, CanonicalForm & t, bool & fail ) 956 956 { // F, G are univariate polynomials (i.e. they have exactly one polynomial variable) 957 957 // F and G must have the same level AND level > 0 -
kernel/GBEngine/kInline.h
rc4ea0bb r750069 1101 1101 } 1102 1102 1103 KINLINE poly redtailBbaBound (poly p,int pos,kStrategy strat,int bound,BOOLEAN normalize) 1104 { 1105 LObject L(p, currRing, strat->tailRing); 1106 return redtailBbaBound(&L, pos, strat,bound, FALSE, normalize); 1107 } 1108 1103 1109 #ifdef HAVE_RINGS 1104 1110 KINLINE poly redtailBba_Z (poly p,int pos,kStrategy strat) -
kernel/GBEngine/kspoly.cc
rc4ea0bb r750069 137 137 { 138 138 if (coef != NULL) *coef = n_Init(1, tailRing->cf); 139 } 140 141 142 // and finally, 143 PR->Tail_Minus_mm_Mult_qq(lm, t2, pLength(t2) /*PW->GetpLength() - 1*/, spNoether); 144 assume(PW->GetpLength() == pLength(PW->p != NULL ? PW->p : PW->t_p)); 145 PR->LmDeleteAndIter(); 146 147 // the following is commented out: shrinking 148 #ifdef HAVE_SHIFTBBA_NONEXISTENT 149 if ( (currRing->isLPring) && (!strat->homog) ) 150 { 151 // assume? h->p in currRing 152 PR->GetP(); 153 poly qq = p_Shrink(PR->p, currRing->isLPring, currRing); 154 PR->Clear(); // does the right things 155 PR->p = qq; 156 PR->t_p = NULL; 157 PR->SetShortExpVector(); 158 } 159 #endif 160 161 #if defined(KDEBUG) && defined(TEST_OPT_DEBUG_RED) 162 if (TEST_OPT_DEBUG) 163 { 164 Print(" to: "); PR->wrp(); Print("\n"); 165 //printf("\nt^%i ", PR->ecart);pWrite(pHead(PR->p)); 166 } 167 #endif 168 return ret; 169 } 170 171 int ksReducePolyBound(LObject* PR, 172 TObject* PW, 173 int bound, 174 poly spNoether, 175 number *coef, 176 kStrategy strat) 177 { 178 #ifdef KDEBUG 179 red_count++; 180 #ifdef TEST_OPT_DEBUG_RED 181 if (TEST_OPT_DEBUG) 182 { 183 Print("Red %d:", red_count); PR->wrp(); Print(" with:"); 184 PW->wrp(); 185 //printf("\necart(PR)-ecart(PW): %i\n",PR->ecart-PW->ecart); 186 //pWrite(PR->p); 187 } 188 #endif 189 #endif 190 int ret = 0; 191 ring tailRing = PR->tailRing; 192 kTest_L(PR); 193 kTest_T(PW); 194 195 poly p1 = PR->GetLmTailRing(); // p2 | p1 196 poly p2 = PW->GetLmTailRing(); // i.e. will reduce p1 with p2; lm = LT(p1) / LM(p2) 197 poly t2 = pNext(p2), lm = p1; // t2 = p2 - LT(p2); really compute P = LC(p2)*p1 - LT(p1)/LM(p2)*p2 198 assume(p1 != NULL && p2 != NULL);// Attention, we have rings and there LC(p2) and LC(p1) are special 199 p_CheckPolyRing(p1, tailRing); 200 p_CheckPolyRing(p2, tailRing); 201 202 pAssume1(p2 != NULL && p1 != NULL && 203 p_DivisibleBy(p2, p1, tailRing)); 204 205 pAssume1(p_GetComp(p1, tailRing) == p_GetComp(p2, tailRing) || 206 (p_GetComp(p2, tailRing) == 0 && 207 p_MaxComp(pNext(p2),tailRing) == 0)); 208 209 #ifdef HAVE_PLURAL 210 if (rIsPluralRing(currRing)) 211 { 212 // for the time being: we know currRing==strat->tailRing 213 // no exp-bound checking needed 214 // (only needed if exp-bound(tailring)<exp-b(currRing)) 215 if (PR->bucket!=NULL) nc_kBucketPolyRed(PR->bucket, p2,coef); 216 else 217 { 218 poly _p = (PR->t_p != NULL ? PR->t_p : PR->p); 219 assume(_p != NULL); 220 nc_PolyPolyRed(_p, p2,coef, currRing); 221 if (PR->t_p!=NULL) PR->t_p=_p; else PR->p=_p; 222 PR->pLength=0; // usually not used, GetpLength re-computes it if needed 223 } 224 return 0; 225 } 226 #endif 227 228 if (t2==NULL) // Divisor is just one term, therefore it will 229 { // just cancel the leading term 230 PR->LmDeleteAndIter(); 231 if (coef != NULL) *coef = n_Init(1, tailRing); 232 return 0; 233 } 234 235 p_ExpVectorSub(lm, p2, tailRing); // Calculate the Monomial we must multiply to p2 236 237 if (tailRing != currRing) 238 { 239 // check that reduction does not violate exp bound 240 while (PW->max != NULL && !p_LmExpVectorAddIsOk(lm, PW->max, tailRing)) 241 { 242 // undo changes of lm 243 p_ExpVectorAdd(lm, p2, tailRing); 244 if (strat == NULL) return 2; 245 if (! kStratChangeTailRing(strat, PR, PW)) return -1; 246 tailRing = strat->tailRing; 247 p1 = PR->GetLmTailRing(); 248 p2 = PW->GetLmTailRing(); 249 t2 = pNext(p2); 250 lm = p1; 251 p_ExpVectorSub(lm, p2, tailRing); 252 ret = 1; 253 } 254 } 255 256 // take care of coef buisness 257 if (! n_IsOne(pGetCoeff(p2), tailRing)) 258 { 259 number bn = pGetCoeff(lm); 260 number an = pGetCoeff(p2); 261 int ct = ksCheckCoeff(&an, &bn, tailRing->cf); // Calculate special LC 262 p_SetCoeff(lm, bn, tailRing); 263 if ((ct == 0) || (ct == 2)) 264 PR->Tail_Mult_nn(an); 265 if (coef != NULL) *coef = an; 266 else n_Delete(&an, tailRing); 267 } 268 else 269 { 270 if (coef != NULL) *coef = n_Init(1, tailRing); 139 271 } 140 272 … … 806 938 } 807 939 940 int ksReducePolyTailBound(LObject* PR, TObject* PW, int bound, poly Current, poly spNoether) 941 { 942 BOOLEAN ret; 943 number coef; 944 poly Lp = PR->GetLmCurrRing(); 945 poly Save = PW->GetLmCurrRing(); 946 947 kTest_L(PR); 948 kTest_T(PW); 949 pAssume(pIsMonomOf(Lp, Current)); 950 951 assume(Lp != NULL && Current != NULL && pNext(Current) != NULL); 952 assume(PR->bucket == NULL); 953 954 LObject Red(pNext(Current), PR->tailRing); 955 TObject With(PW, Lp == Save); 956 957 pAssume(!pHaveCommonMonoms(Red.p, With.p)); 958 ret = ksReducePolyBound(&Red, &With,bound, spNoether, &coef); 959 960 if (!ret) 961 { 962 if (! n_IsOne(coef, currRing)) 963 { 964 pNext(Current) = NULL; 965 if (Current == PR->p && PR->t_p != NULL) 966 pNext(PR->t_p) = NULL; 967 PR->Mult_nn(coef); 968 } 969 970 n_Delete(&coef, currRing); 971 pNext(Current) = Red.GetLmTailRing(); 972 if (Current == PR->p && PR->t_p != NULL) 973 pNext(PR->t_p) = pNext(Current); 974 } 975 976 if (Lp == Save) 977 With.Delete(); 978 979 // the following is commented out: shrinking 980 #ifdef HAVE_SHIFTBBA_NONEXISTENT 981 if (currRing->isLPring) 982 { 983 // assume? h->p in currRing 984 PR->GetP(); 985 poly qq = p_Shrink(PR->p, currRing->isLPring, currRing); 986 PR->Clear(); // does the right things 987 PR->p = qq; 988 PR->t_p = NULL; 989 PR->SetShortExpVector(); 990 } 991 #endif 992 993 return ret; 994 } 995 808 996 /*************************************************************** 809 997 * -
kernel/GBEngine/kstd1.cc
rc4ea0bb r750069 3015 3015 } 3016 3016 3017 poly kNFBound(ideal F, ideal Q, poly p,int bound,int syzComp, int lazyReduce) 3018 { 3019 if (p==NULL) 3020 return NULL; 3021 3022 poly pp = p; 3023 3024 #ifdef HAVE_PLURAL 3025 if(rIsSCA(currRing)) 3026 { 3027 const unsigned int m_iFirstAltVar = scaFirstAltVar(currRing); 3028 const unsigned int m_iLastAltVar = scaLastAltVar(currRing); 3029 pp = p_KillSquares(pp, m_iFirstAltVar, m_iLastAltVar, currRing); 3030 3031 if(Q == currRing->qideal) 3032 Q = SCAQuotient(currRing); 3033 } 3034 #endif 3035 3036 if ((idIs0(F))&&(Q==NULL)) 3037 { 3038 #ifdef HAVE_PLURAL 3039 if(p != pp) 3040 return pp; 3041 #endif 3042 return pCopy(p); /*F+Q=0*/ 3043 } 3044 3045 kStrategy strat=new skStrategy; 3046 strat->syzComp = syzComp; 3047 strat->ak = si_max(id_RankFreeModule(F,currRing),pMaxComp(p)); 3048 poly res; 3049 res=kNF2Bound(F,Q,pp,bound,strat,lazyReduce); 3050 delete(strat); 3051 3052 #ifdef HAVE_PLURAL 3053 if(pp != p) 3054 p_Delete(&pp, currRing); 3055 #endif 3056 return res; 3057 } 3058 3017 3059 ideal kNF(ideal F, ideal Q, ideal p,int syzComp,int lazyReduce) 3018 3060 { … … 3059 3101 else 3060 3102 res=kNF2(F,Q,pp,strat,lazyReduce); 3103 delete(strat); 3104 3105 #ifdef HAVE_PLURAL 3106 if(pp != p) 3107 id_Delete(&pp, currRing); 3108 #endif 3109 3110 return res; 3111 } 3112 3113 ideal kNFBound(ideal F, ideal Q, ideal p,int bound,int syzComp,int lazyReduce) 3114 { 3115 ideal res; 3116 if (TEST_OPT_PROT) 3117 { 3118 Print("(S:%d)",IDELEMS(p));mflush(); 3119 } 3120 if (idIs0(p)) 3121 return idInit(IDELEMS(p),si_max(p->rank,F->rank)); 3122 3123 ideal pp = p; 3124 #ifdef HAVE_PLURAL 3125 if(rIsSCA(currRing)) 3126 { 3127 const unsigned int m_iFirstAltVar = scaFirstAltVar(currRing); 3128 const unsigned int m_iLastAltVar = scaLastAltVar(currRing); 3129 pp = id_KillSquares(pp, m_iFirstAltVar, m_iLastAltVar, currRing, false); 3130 3131 if(Q == currRing->qideal) 3132 Q = SCAQuotient(currRing); 3133 } 3134 #endif 3135 3136 if ((idIs0(F))&&(Q==NULL)) 3137 { 3138 #ifdef HAVE_PLURAL 3139 if(p != pp) 3140 return pp; 3141 #endif 3142 return idCopy(p); /*F+Q=0*/ 3143 } 3144 3145 kStrategy strat=new skStrategy; 3146 strat->syzComp = syzComp; 3147 strat->ak = si_max(id_RankFreeModule(F,currRing),id_RankFreeModule(p,currRing)); 3148 if (strat->ak>0) // only for module case, see Tst/Short/bug_reduce.tst 3149 { 3150 strat->ak = si_max(strat->ak,(int)F->rank); 3151 } 3152 3153 res=kNF2Bound(F,Q,pp,bound,strat,lazyReduce); 3061 3154 delete(strat); 3062 3155 -
kernel/GBEngine/kstd1.h
rc4ea0bb r750069 27 27 poly kNF (ideal F, ideal Q, poly p,int syzComp=0, int lazyReduce=0); 28 28 ideal kNF(ideal F, ideal Q, ideal p,int syzComp=0, int lazyReduce=0); 29 30 poly kNFBound (ideal F, ideal Q, poly p,int bound,int syzComp=0, int lazyReduce=0); 31 ideal kNFBound (ideal F, ideal Q, ideal p,int bound,int syzComp=0, int lazyReduce=0); 29 32 30 33 /// NOTE: this is just a wrapper which sets currRing for the actual kNF call -
kernel/GBEngine/kstd2.cc
rc4ea0bb r750069 1739 1739 number coef; 1740 1740 coef=kBucketPolyRed(P.bucket,strat->S[j],pLength(strat->S[j]),strat->kNoether); 1741 nDelete(&coef); 1742 } 1743 h = kBucketGetLm(P.bucket); // FRAGE OLIVER 1744 if (h==NULL) 1745 { 1746 kBucketDestroy(&P.bucket); 1747 1748 #ifdef KDEBUG 1749 // if (TEST_OPT_DEBUG) 1750 // { 1751 // PrintS("redNF: starting S:\n"); 1752 // for( j = 0; j <= max_ind; j++ ) 1753 // { 1754 // Print("S[%d] (of size: %d): ", j, pSize(strat->S[j])); 1755 // pWrite(strat->S[j]); 1756 // } 1757 // }; 1758 #endif 1759 1760 return NULL; 1761 } 1762 kbTest(P.bucket); 1763 P.p=h; 1764 P.t_p=NULL; 1765 P.SetShortExpVector(); 1766 #ifdef KDEBUG 1767 if (TEST_OPT_DEBUG) 1768 { 1769 PrintS("\nto:"); 1770 wrp(h); 1771 PrintLn(); 1772 } 1773 #endif 1774 } 1775 else 1776 { 1777 P.p=kBucketClear(P.bucket); 1778 kBucketDestroy(&P.bucket); 1779 pNormalize(P.p); 1780 1781 #ifdef KDEBUG 1782 // if (TEST_OPT_DEBUG) 1783 // { 1784 // PrintS("redNF: starting S:\n"); 1785 // for( j = 0; j <= max_ind; j++ ) 1786 // { 1787 // Print("S[%d] (of size: %d): ", j, pSize(strat->S[j])); 1788 // pWrite(strat->S[j]); 1789 // } 1790 // }; 1791 #endif 1792 1793 return P.p; 1794 } 1795 } 1796 } 1797 1798 /*2 1799 * reduction procedure from global case but with jet bound 1800 */ 1801 1802 poly redNFBound (poly h,int &max_ind,int nonorm,kStrategy strat,int bound) 1803 { 1804 h = pJet(h,bound); 1805 if (h==NULL) return NULL; 1806 int j; 1807 max_ind=strat->sl; 1808 1809 if (0 > strat->sl) 1810 { 1811 return h; 1812 } 1813 LObject P(h); 1814 P.SetShortExpVector(); 1815 P.bucket = kBucketCreate(currRing); 1816 kBucketInit(P.bucket,P.p,pLength(P.p)); 1817 kbTest(P.bucket); 1818 #ifdef HAVE_RINGS 1819 BOOLEAN is_ring = rField_is_Ring(currRing); 1820 #endif 1821 #ifdef KDEBUG 1822 // if (TEST_OPT_DEBUG) 1823 // { 1824 // PrintS("redNF: starting S:\n"); 1825 // for( j = 0; j <= max_ind; j++ ) 1826 // { 1827 // Print("S[%d] (of size: %d): ", j, pSize(strat->S[j])); 1828 // pWrite(strat->S[j]); 1829 // } 1830 // }; 1831 #endif 1832 1833 loop 1834 { 1835 j=kFindDivisibleByInS(strat,&max_ind,&P); 1836 if (j>=0) 1837 { 1838 #ifdef HAVE_RINGS 1839 if (!is_ring) 1840 { 1841 #endif 1842 int sl=pSize(strat->S[j]); 1843 int jj=j; 1844 loop 1845 { 1846 int sll; 1847 jj=kFindNextDivisibleByInS(strat,jj+1,max_ind,&P); 1848 if (jj<0) break; 1849 sll=pSize(strat->S[jj]); 1850 if (sll<sl) 1851 { 1852 #ifdef KDEBUG 1853 if (TEST_OPT_DEBUG) Print("better(S%d:%d -> S%d:%d)\n",j,sl,jj,sll); 1854 #endif 1855 //else if (TEST_OPT_PROT) { PrintS("b"); mflush(); } 1856 j=jj; 1857 sl=sll; 1858 } 1859 } 1860 if ((nonorm==0) && (!nIsOne(pGetCoeff(strat->S[j])))) 1861 { 1862 pNorm(strat->S[j]); 1863 //if (TEST_OPT_PROT) { PrintS("n"); mflush(); } 1864 } 1865 #ifdef HAVE_RINGS 1866 } 1867 #endif 1868 nNormalize(pGetCoeff(P.p)); 1869 #ifdef KDEBUG 1870 if (TEST_OPT_DEBUG) 1871 { 1872 PrintS("red:"); 1873 wrp(h); 1874 PrintS(" with "); 1875 wrp(strat->S[j]); 1876 } 1877 #endif 1878 #ifdef HAVE_PLURAL 1879 if (rIsPluralRing(currRing)) 1880 { 1881 number coef; 1882 nc_kBucketPolyRed(P.bucket,strat->S[j],&coef); 1883 nDelete(&coef); 1884 } 1885 else 1886 #endif 1887 { 1888 number coef; 1889 coef=kBucketPolyRed(P.bucket,strat->S[j],pLength(strat->S[j]),strat->kNoether); 1890 P.p = kBucketClear(P.bucket); 1891 P.p = pJet(P.p,bound); 1892 if(!P.IsNull()) 1893 { 1894 kBucketDestroy(&P.bucket); 1895 P.SetShortExpVector(); 1896 P.bucket = kBucketCreate(currRing); 1897 kBucketInit(P.bucket,P.p,pLength(P.p)); 1898 } 1741 1899 nDelete(&coef); 1742 1900 } … … 3271 3429 } 3272 3430 3431 poly kNF2Bound (ideal F,ideal Q,poly q,int bound,kStrategy strat, int lazyReduce) 3432 { 3433 assume(q!=NULL); 3434 assume(!(idIs0(F)&&(Q==NULL))); // NF(q, std(0) in polynomial ring? 3435 3436 // lazy_reduce flags: can be combined by | 3437 //#define KSTD_NF_LAZY 1 3438 // do only a reduction of the leading term 3439 //#define KSTD_NF_NONORM 4 3440 // only global: avoid normalization, return a multiply of NF 3441 poly p; 3442 3443 //if ((idIs0(F))&&(Q==NULL)) 3444 // return pCopy(q); /*F=0*/ 3445 //strat->ak = idRankFreeModule(F); 3446 /*- creating temp data structures------------------- -*/ 3447 BITSET save1; 3448 SI_SAVE_OPT1(save1); 3449 si_opt_1|=Sy_bit(OPT_REDTAIL); 3450 initBuchMoraCrit(strat); 3451 strat->initEcart = initEcartBBA; 3452 strat->enterS = enterSBba; 3453 #ifndef NO_BUCKETS 3454 strat->use_buckets = (!TEST_OPT_NOT_BUCKETS) && (!rIsPluralRing(currRing)); 3455 #endif 3456 /*- set S -*/ 3457 strat->sl = -1; 3458 /*- init local data struct.---------------------------------------- -*/ 3459 /*Shdl=*/initS(F,Q,strat); 3460 /*- compute------------------------------------------------------- -*/ 3461 //if ((TEST_OPT_INTSTRATEGY)&&(lazyReduce==0)) 3462 //{ 3463 // for (i=strat->sl;i>=0;i--) 3464 // pNorm(strat->S[i]); 3465 //} 3466 kTest(strat); 3467 if (TEST_OPT_PROT) { PrintS("r"); mflush(); } 3468 if (BVERBOSE(23)) kDebugPrint(strat); 3469 int max_ind; 3470 p = redNFBound(pCopy(q),max_ind,lazyReduce & KSTD_NF_NONORM,strat,bound); 3471 if ((p!=NULL)&&((lazyReduce & KSTD_NF_LAZY)==0)) 3472 { 3473 if (TEST_OPT_PROT) { PrintS("t"); mflush(); } 3474 if (rField_is_Ring(currRing)) 3475 { 3476 p = redtailBba_Z(p,max_ind,strat); 3477 } 3478 else 3479 { 3480 si_opt_1 &= ~Sy_bit(OPT_INTSTRATEGY); 3481 p = redtailBbaBound(p,max_ind,strat,bound,(lazyReduce & KSTD_NF_NONORM)==0); 3482 //p = redtailBba(p,max_ind,strat,(lazyReduce & KSTD_NF_NONORM)==0); 3483 } 3484 } 3485 /*- release temp data------------------------------- -*/ 3486 assume(strat->L==NULL); /* strat->L unused */ 3487 assume(strat->B==NULL); /* strat->B unused */ 3488 omFree(strat->sevS); 3489 omFree(strat->ecartS); 3490 assume(strat->T==NULL);//omfree(strat->T); 3491 assume(strat->sevT==NULL);//omfree(strat->sevT); 3492 assume(strat->R==NULL);//omfree(strat->R); 3493 omfree(strat->S_2_R); 3494 omfree(strat->fromQ); 3495 idDelete(&strat->Shdl); 3496 SI_RESTORE_OPT1(save1); 3497 if (TEST_OPT_PROT) PrintLn(); 3498 return p; 3499 } 3500 3273 3501 ideal kNF2 (ideal F,ideal Q,ideal q,kStrategy strat, int lazyReduce) 3274 3502 { … … 3323 3551 { 3324 3552 p = redtailBba(p,max_ind,strat,(lazyReduce & KSTD_NF_NONORM)==0); 3553 } 3554 } 3555 res->m[i]=p; 3556 } 3557 //else 3558 // res->m[i]=NULL; 3559 } 3560 /*- release temp data------------------------------- -*/ 3561 assume(strat->L==NULL); /* strat->L unused */ 3562 assume(strat->B==NULL); /* strat->B unused */ 3563 omFree(strat->sevS); 3564 omFree(strat->ecartS); 3565 assume(strat->T==NULL);//omfree(strat->T); 3566 assume(strat->sevT==NULL);//omfree(strat->sevT); 3567 assume(strat->R==NULL);//omfree(strat->R); 3568 omfree(strat->S_2_R); 3569 omfree(strat->fromQ); 3570 idDelete(&strat->Shdl); 3571 SI_RESTORE_OPT1(save1); 3572 if (TEST_OPT_PROT) PrintLn(); 3573 return res; 3574 } 3575 3576 ideal kNF2Bound (ideal F,ideal Q,ideal q,int bound,kStrategy strat, int lazyReduce) 3577 { 3578 assume(!idIs0(q)); 3579 assume(!(idIs0(F)&&(Q==NULL))); 3580 // lazy_reduce flags: can be combined by | 3581 //#define KSTD_NF_LAZY 1 3582 // do only a reduction of the leading term 3583 //#define KSTD_NF_NONORM 4 3584 // only global: avoid normalization, return a multiply of NF 3585 poly p; 3586 int i; 3587 ideal res; 3588 int max_ind; 3589 3590 //if (idIs0(q)) 3591 // return idInit(IDELEMS(q),si_max(q->rank,F->rank)); 3592 //if ((idIs0(F))&&(Q==NULL)) 3593 // return idCopy(q); /*F=0*/ 3594 //strat->ak = idRankFreeModule(F); 3595 /*- creating temp data structures------------------- -*/ 3596 BITSET save1; 3597 SI_SAVE_OPT1(save1); 3598 si_opt_1|=Sy_bit(OPT_REDTAIL); 3599 initBuchMoraCrit(strat); 3600 strat->initEcart = initEcartBBA; 3601 strat->enterS = enterSBba; 3602 /*- set S -*/ 3603 strat->sl = -1; 3604 #ifndef NO_BUCKETS 3605 strat->use_buckets = (!TEST_OPT_NOT_BUCKETS) && (!rIsPluralRing(currRing)); 3606 #endif 3607 /*- init local data struct.---------------------------------------- -*/ 3608 /*Shdl=*/initS(F,Q,strat); 3609 /*- compute------------------------------------------------------- -*/ 3610 res=idInit(IDELEMS(q),si_max(q->rank,F->rank)); 3611 si_opt_1 &= ~Sy_bit(OPT_INTSTRATEGY); 3612 for (i=IDELEMS(q)-1; i>=0; i--) 3613 { 3614 if (q->m[i]!=NULL) 3615 { 3616 if (TEST_OPT_PROT) { PrintS("r");mflush(); } 3617 p = redNFBound(pCopy(q->m[i]),max_ind,lazyReduce & KSTD_NF_NONORM,strat,bound); 3618 if ((p!=NULL)&&((lazyReduce & KSTD_NF_LAZY)==0)) 3619 { 3620 if (TEST_OPT_PROT) { PrintS("t"); mflush(); } 3621 if (rField_is_Ring(currRing)) 3622 { 3623 p = redtailBba_Z(p,max_ind,strat); 3624 } 3625 else 3626 { 3627 p = redtailBbaBound(p,max_ind,strat,bound,(lazyReduce & KSTD_NF_NONORM)==0); 3325 3628 } 3326 3629 } -
kernel/GBEngine/kutil.cc
rc4ea0bb r750069 7665 7665 } 7666 7666 if (Ln.IsNull()) goto all_done; 7667 if (! withT) With_s.Init(currRing); 7668 } 7669 pNext(h) = Ln.LmExtractAndIter(); 7670 pIter(h); 7671 pNormalize(h); 7672 L->pLength++; 7673 } 7674 7675 all_done: 7676 Ln.Delete(); 7677 if (L->p != NULL) pNext(L->p) = pNext(p); 7678 7679 if (strat->redTailChange) 7680 { 7681 L->length = 0; 7682 L->pLength = 0; 7683 } 7684 7685 //if (TEST_OPT_PROT) { PrintS("N"); mflush(); } 7686 //L->Normalize(); // HANNES: should have a test 7687 kTest_L(L); 7688 return L->GetLmCurrRing(); 7689 } 7690 7691 poly redtailBbaBound (LObject* L, int pos, kStrategy strat, int bound, BOOLEAN withT, BOOLEAN normalize) 7692 { 7693 #define REDTAIL_CANONICALIZE 100 7694 strat->redTailChange=FALSE; 7695 if (strat->noTailReduction) return L->GetLmCurrRing(); 7696 poly h, p; 7697 p = h = L->GetLmTailRing(); 7698 if ((h==NULL) || (pNext(h)==NULL)) 7699 return L->GetLmCurrRing(); 7700 7701 TObject* With; 7702 // placeholder in case strat->tl < 0 7703 TObject With_s(strat->tailRing); 7704 7705 LObject Ln(pNext(h), strat->tailRing); 7706 Ln.pLength = L->GetpLength() - 1; 7707 7708 pNext(h) = NULL; 7709 if (L->p != NULL) pNext(L->p) = NULL; 7710 L->pLength = 1; 7711 7712 Ln.PrepareRed(strat->use_buckets); 7713 7714 int cnt=REDTAIL_CANONICALIZE; 7715 while(!Ln.IsNull()) 7716 { 7717 loop 7718 { 7719 if (TEST_OPT_IDLIFT) 7720 { 7721 if (Ln.p!=NULL) 7722 { 7723 if (p_GetComp(Ln.p,currRing)> strat->syzComp) break; 7724 } 7725 else 7726 { 7727 if (p_GetComp(Ln.t_p,strat->tailRing)> strat->syzComp) break; 7728 } 7729 } 7730 Ln.SetShortExpVector(); 7731 if (withT) 7732 { 7733 int j; 7734 j = kFindDivisibleByInT(strat, &Ln); 7735 if (j < 0) break; 7736 With = &(strat->T[j]); 7737 } 7738 else 7739 { 7740 With = kFindDivisibleByInS(strat, pos, &Ln, &With_s); 7741 if (With == NULL) break; 7742 } 7743 cnt--; 7744 if (cnt==0) 7745 { 7746 cnt=REDTAIL_CANONICALIZE; 7747 /*poly tmp=*/Ln.CanonicalizeP(); 7748 if (normalize) 7749 { 7750 Ln.Normalize(); 7751 //pNormalize(tmp); 7752 //if (TEST_OPT_PROT) { PrintS("n"); mflush(); } 7753 } 7754 } 7755 if (normalize && (!TEST_OPT_INTSTRATEGY) && (!nIsOne(pGetCoeff(With->p)))) 7756 { 7757 With->pNorm(); 7758 } 7759 strat->redTailChange=TRUE; 7760 if (ksReducePolyTail(L, With, &Ln)) 7761 { 7762 // reducing the tail would violate the exp bound 7763 // set a flag and hope for a retry (in bba) 7764 strat->completeReduce_retry=TRUE; 7765 if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL; 7766 do 7767 { 7768 pNext(h) = Ln.LmExtractAndIter(); 7769 pIter(h); 7770 L->pLength++; 7771 } while (!Ln.IsNull()); 7772 goto all_done; 7773 } 7774 if(!Ln.IsNull()) 7775 { 7776 Ln.GetP(); 7777 Ln.p = pJet(Ln.p,bound); 7778 } 7779 if (Ln.IsNull()) 7780 { 7781 goto all_done; 7782 } 7667 7783 if (! withT) With_s.Init(currRing); 7668 7784 } -
kernel/GBEngine/kutil.h
rc4ea0bb r750069 487 487 LObject* L,const kStrategy strat); 488 488 KINLINE poly redtailBba (poly p,int pos,kStrategy strat,BOOLEAN normalize=FALSE); 489 KINLINE poly redtailBbaBound (poly p,int pos,kStrategy strat,int bound,BOOLEAN normalize=FALSE); 489 490 #ifdef HAVE_RINGS 490 491 KINLINE poly redtailBba_Z (poly p,int pos,kStrategy strat); … … 492 493 #endif 493 494 poly redtailBba (LObject *L, int pos,kStrategy strat, 495 BOOLEAN withT = FALSE,BOOLEAN normalize=FALSE); 496 poly redtailBbaBound (LObject *L, int pos,kStrategy strat,int bound, 494 497 BOOLEAN withT = FALSE,BOOLEAN normalize=FALSE); 495 498 poly redtailSba (LObject *L, int pos,kStrategy strat, … … 667 670 poly kNF2 (ideal F, ideal Q, poly q, kStrategy strat, int lazyReduce); 668 671 ideal kNF2 (ideal F,ideal Q,ideal q, kStrategy strat, int lazyReduce); 672 poly kNF2Bound (ideal F, ideal Q, poly q,int bound, kStrategy strat, int lazyReduce); 673 ideal kNF2Bound (ideal F,ideal Q,ideal q,int bound, kStrategy strat, int lazyReduce); 669 674 void initBba(kStrategy strat); 670 675 void initSba(ideal F,kStrategy strat); … … 696 701 number *coef = NULL, 697 702 kStrategy strat = NULL); 703 704 int ksReducePolyBound(LObject* PR, 705 TObject* PW, 706 int bound, 707 poly spNoether = NULL, 708 number *coef = NULL, 709 kStrategy strat = NULL); 698 710 699 711 // Reduces PR with PW -
kernel/GBEngine/tgb.cc
r6c086a4 r750069 83 83 else 84 84 { 85 return n_Size (n, r );85 return n_Size (n, r->cf); 86 86 } 87 87 } … … 143 143 { 144 144 poly rc = p_Init_Special (r); 145 pSetCoeff0 (rc, n_Init (1, r ));145 pSetCoeff0 (rc, n_Init (1, r->cf)); 146 146 return rc; 147 147 } -
kernel/GBEngine/tgbgauss.cc
r6c086a4 r750069 510 510 { 511 511 StringSetS(""); 512 n_Write(n[i][j],currRing );512 n_Write(n[i][j],currRing->cf); 513 513 char *s=StringEndS(); 514 514 PrintS(s); … … 711 711 StringSetS(""); 712 712 number n=get(i,j); 713 n_Write(n,currRing );713 n_Write(n,currRing->cf); 714 714 char *s=StringEndS(); 715 715 PrintS(s); … … 842 842 if (currRing==r) {nTest(m->coef);} 843 843 #endif 844 n_Normalize(m->coef,r );844 n_Normalize(m->coef,r->cf); 845 845 m=m->next; 846 846 } -
kernel/combinatorics/hilb.cc
r6c086a4 r750069 229 229 //!!!!!!!!!!!!!!!!!!!!! Just for Monomial Ideals !!!!!!!!!!!!!!!!!!!!!!!!!!!! 230 230 231 //returns the degree of the monomial232 static int DegMon(poly p)233 {234 #if 1235 int i,deg;236 deg = 0;237 for(i=1;i<=currRing->N;i++)238 {239 deg = deg + p_GetExp(p, i, currRing);240 }241 return(deg);242 #else243 return(p_Deg(p, currRing));244 #endif245 }246 247 231 //Tests if the ideal is sorted by degree 248 232 static bool idDegSortTest(ideal I) … … 254 238 for(int i = 0; i<IDELEMS(I)-1; i++) 255 239 { 256 if( DegMon(I->m[i])>DegMon(I->m[i+1]))240 if(p_Totaldegree(I->m[i],currRing)>p_Totaldegree(I->m[i+1],currRing)) 257 241 { 258 242 idPrint(I); … … 277 261 idSkipZeroes(I); 278 262 #if 1 279 for(i = 0; (i<IDELEMS(I)) && ( DegMon(I->m[i])<=DegMon(p)); i++)263 for(i = 0; (i<IDELEMS(I)) && (p_Totaldegree(I->m[i],currRing)<=p_Totaldegree(p,currRing)); i++) 280 264 { 281 265 if(p_DivisibleBy( I->m[i],p, currRing)) … … 284 268 } 285 269 } 286 for(i = IDELEMS(I)-1; (i>=0) && ( DegMon(I->m[i])>=DegMon(p)); i--)270 for(i = IDELEMS(I)-1; (i>=0) && (p_Totaldegree(I->m[i],currRing)>=p_Totaldegree(p,currRing)); i--) 287 271 { 288 272 if(p_DivisibleBy(p,I->m[i], currRing)) … … 300 284 idSkipZeroes(I); 301 285 //First I take the case when all generators have the same degree 302 if( DegMon(I->m[0]) == DegMon(I->m[IDELEMS(I)-1]))303 { 304 if( DegMon(p)<DegMon(I->m[0]))286 if(p_Totaldegree(I->m[0],currRing) == p_Totaldegree(I->m[IDELEMS(I)-1],currRing)) 287 { 288 if(p_Totaldegree(p,currRing)<p_Totaldegree(I->m[0],currRing)) 305 289 { 306 290 idInsertPoly(I,p); … … 313 297 return(I); 314 298 } 315 if( DegMon(p)>=DegMon(I->m[IDELEMS(I)-1]))299 if(p_Totaldegree(p,currRing)>=p_Totaldegree(I->m[IDELEMS(I)-1],currRing)) 316 300 { 317 301 idInsertPoly(I,p); … … 320 304 } 321 305 } 322 if( DegMon(p)<=DegMon(I->m[0]))306 if(p_Totaldegree(p,currRing)<=p_Totaldegree(I->m[0],currRing)) 323 307 { 324 308 idInsertPoly(I,p); … … 331 315 return(I); 332 316 } 333 if( DegMon(p)>=DegMon(I->m[IDELEMS(I)-1]))317 if(p_Totaldegree(p,currRing)>=p_Totaldegree(I->m[IDELEMS(I)-1],currRing)) 334 318 { 335 319 idInsertPoly(I,p); … … 339 323 for(i = IDELEMS(I)-2; ;) 340 324 { 341 if( DegMon(p)==DegMon(I->m[i]))325 if(p_Totaldegree(p,currRing)==p_Totaldegree(I->m[i],currRing)) 342 326 { 343 327 idInsertPoly(I,p); … … 350 334 return(I); 351 335 } 352 if( DegMon(p)>DegMon(I->m[i]))336 if(p_Totaldegree(p,currRing)>p_Totaldegree(I->m[i],currRing)) 353 337 { 354 338 idInsertPoly(I,p); … … 424 408 } 425 409 p_Setm(res->m[i], currRing); 426 if( DegMon(res->m[i]) == DegMon(I->m[i]))410 if(p_Totaldegree(res->m[i],currRing) == p_Totaldegree(I->m[i],currRing)) 427 411 { 428 412 res->m[i] = NULL; // pDelete … … 749 733 int i,j,exp; 750 734 poly res; 751 if( DegMon(I->m[IDELEMS(I)-1])<=1)735 if(p_Totaldegree(I->m[IDELEMS(I)-1],currRing)<=1) 752 736 { 753 737 res = ChoosePVar(I); … … 793 777 return(TRUE); 794 778 #else 795 if( DegMon(I->m[IDELEMS(I)-1])>1)779 if(p_Totaldegree(I->m[IDELEMS(I)-1],currRing)>1) 796 780 { 797 781 return(FALSE); … … 849 833 bool flag=TRUE; 850 834 poly notsqrfree = NULL; 851 if( DegMon(I->m[IDELEMS(I)-1])<=1)835 if(p_Totaldegree(I->m[IDELEMS(I)-1],currRing)<=1) 852 836 { 853 837 return(notsqrfree); … … 1043 1027 mpz_set( &hilbertcoef[NNN], ec); 1044 1028 mpz_clear(ec); 1045 hilbpower[NNN] = DegMon(q);1029 hilbpower[NNN] = p_Totaldegree(q,currRing); 1046 1030 NNN++; 1047 1031 } … … 1049 1033 { 1050 1034 //I look if the power appears already 1051 for(i = 0;(i<NNN)&&(flag == FALSE)&&( DegMon(q)>=hilbpower[i]);i++)1052 { 1053 if((hilbpower[i]) == ( DegMon(q)))1035 for(i = 0;(i<NNN)&&(flag == FALSE)&&(p_Totaldegree(q,currRing)>=hilbpower[i]);i++) 1036 { 1037 if((hilbpower[i]) == (p_Totaldegree(q,currRing))) 1054 1038 { 1055 1039 flag = TRUE; … … 1069 1053 mpz_set( &hilbertcoef[i], ec); 1070 1054 mpz_clear(ec); 1071 hilbpower[i] = DegMon(q);1055 hilbpower[i] = p_Totaldegree(q,currRing); 1072 1056 NNN++; 1073 1057 } -
kernel/fglm/fglmcomb.cc
r6c086a4 r750069 114 114 115 115 number temp = nDiv( n1, n2 ); 116 n_Normalize( temp, currRing );116 n_Normalize( temp, currRing->cf ); 117 117 nDelete( & n1 ); 118 118 n1= temp; -
kernel/fglm/fglmzero.cc
r6c086a4 r750069 154 154 maFindPerm( source->names, source->N, NULL, 0, currRing->names, 155 155 currRing->N, NULL, 0, perm, NULL , currRing->cf->type); 156 nMapFunc nMap=n_SetMap( source , currRing);156 nMapFunc nMap=n_SetMap( source->cf, currRing->cf); 157 157 158 158 matHeader ** temp = (matHeader **)omAlloc( _nfunc*sizeof( matHeader * )); -
kernel/linear_algebra/linear_algebra.dox
r6c086a4 r750069 2 2 3 3 This sub-package of kernel (\ref kernel_page) contains 4 Lin ar algebra related algorithms.4 Linear algebra related algorithms. 5 5 6 6 TODO: list those algorithms... and corresponding interpreter functions...? -
kernel/maps/find_perm.cc
r6c086a4 r750069 27 27 { 28 28 if((pNext(image->m[i])==NULL) 29 && (n_IsOne(pGetCoeff(image->m[i]),image_r )))29 && (n_IsOne(pGetCoeff(image->m[i]),image_r->cf))) 30 30 { 31 31 int v=p_IsUnivariate(image->m[i],image_r); -
kernel/maps/gen_maps.cc
r6c086a4 r750069 25 25 { 26 26 if ((pNext(image->m[i])==NULL) 27 && (n_IsOne(pGetCoeff(image->m[i]),image_r )))27 && (n_IsOne(pGetCoeff(image->m[i]),image_r->cf))) 28 28 { 29 29 v=p_IsUnivariate(image->m[i],image_r); -
libpolys/coeffs/gnumpfl.cc
r6c086a4 r750069 438 438 } 439 439 440 static char* ngfCoeffName(const coeffs r) 441 { 442 static char ngfCoeffName_buf[27]; 443 #ifdef SINGULAR_4_1 444 snprintf(ngfCoeffName_buf,27,"real,%d,%d",r->float_len,r->float_len2); 445 #else 446 snprintf(ngfCoeffName_buf,27,"RR(%d,%d)",r->float_len,r->float_len2); 447 #endif 448 return ngfCoeffName_buf; 449 } 450 440 451 BOOLEAN ngfInitChar(coeffs n, void *parameter) 441 452 { … … 451 462 n->ch = 0; 452 463 n->cfCoeffString=ngfCoeffString; 464 n->cfCoeffName=ngfCoeffName; 453 465 454 466 n->cfDelete = ngfDelete; -
libpolys/coeffs/longrat.cc
r6c086a4 r750069 468 468 dest = res->z; 469 469 470 void* (*allocfunc) (size_t); 471 mp_get_memory_functions (&allocfunc,NULL, NULL); 470 472 if (e<0) 471 473 { 472 474 al = dest->_mp_size = size; 473 475 if (al<2) al = 2; 474 dd = (mp_ptr) omAlloc(sizeof(mp_limb_t)*al);476 dd = (mp_ptr)allocfunc(sizeof(mp_limb_t)*al); 475 477 for (i=0;i<size;i++) dd[i] = qp[i]; 476 478 bl = 1-e; 477 nn = (mp_ptr) omAlloc0(sizeof(mp_limb_t)*bl);479 nn = (mp_ptr)allocfunc(sizeof(mp_limb_t)*bl); 478 480 nn[bl-1] = 1; 479 481 ndest = res->n; … … 486 488 al = dest->_mp_size = size+e; 487 489 if (al<2) al = 2; 488 dd = (mp_ptr) omAlloc(sizeof(mp_limb_t)*al);490 dd = (mp_ptr)allocfunc(sizeof(mp_limb_t)*al); 489 491 for (i=0;i<size;i++) dd[i+e] = qp[i]; 490 492 for (i=0;i<e;i++) dd[i] = 0; -
libpolys/coeffs/mpr_complex.cc
r6c086a4 r750069 453 453 else 454 454 { 455 if ( num->s == 0)455 if ( num->s != 3 ) 456 456 { 457 nlNormalize( num, src ); // FIXME? TODO? // extern void nlNormalize(number &x, const coeffs r); // FIXME 458 } 459 if (SR_HDL(num) & SR_INT) 460 { 461 r = gmp_float(SR_TO_INT(num)); 457 r= gmp_float(num->z); 458 r/= gmp_float(num->n); 462 459 } 463 460 else 464 461 { 465 if ( num->s != 3 ) 466 { 467 r= num->z; 468 r/= (gmp_float)num->n; 469 } 470 else 471 { 472 r= num->z; 473 } 462 r= num->z; 474 463 } 475 464 } -
libpolys/polys/ext_fields/algext.cc
r6c086a4 r750069 1508 1508 #ifndef SINGULAR_4_1 1509 1509 BOOLEAN n2pInitChar(coeffs cf, void * infoStruct) 1510 { }1510 { return 1; } 1511 1511 #endif 1512 1512 #ifdef SINGULAR_4_1 -
libpolys/polys/ext_fields/algext.h
r6c086a4 r750069 65 65 66 66 char* naCoeffString(const coeffs r); // will be reused in tranext.cc... 67 char* naCoeffName(const coeffs r); 67 68 #endif 68 69 /* ALGEXT_H */ -
libpolys/polys/ext_fields/transext.cc
r6c086a4 r750069 2565 2565 2566 2566 cf->cfCoeffString = naCoeffString; // FIXME? TODO? // extern char* naCoeffString(const coeffs r); 2567 cf->cfCoeffName = naCoeffName; // FIXME? TODO? // extern char* naCoeffString(const coeffs r); 2567 2568 2568 2569 cf->cfGreaterZero = ntGreaterZero; -
libpolys/polys/matpol.cc
r6c086a4 r750069 32 32 #include "monomials/p_polys.h" 33 33 34 #include "coeffrings.h"35 34 #include "simpleideals.h" 36 35 #include "matpol.h" -
libpolys/polys/monomials/p_polys.cc
r6c086a4 r750069 52 52 #endif 53 53 54 #include "coeffrings.h"55 54 #include "clapsing.h" 56 55 … … 124 123 } 125 124 else 126 x[j]=n_Init(0, R );125 x[j]=n_Init(0, R->cf); 127 126 } 128 127 number n=n_ChineseRemainderSym(x,q,rl,TRUE,inv_cache,R->cf); … … 131 130 x[j]=NULL; // n_Init(0...) takes no memory 132 131 } 133 if (n_IsZero(n,R )) p_Delete(&h,R);132 if (n_IsZero(n,R->cf)) p_Delete(&h,R); 134 133 else 135 134 { … … 2541 2540 } 2542 2541 else 2543 s=n_Size(d,r );2542 s=n_Size(d,r->cf); 2544 2543 number d2=d; 2545 2544 loop … … 2571 2570 else 2572 2571 { 2573 int ns=n_Size(pGetCoeff(ph),r );2572 int ns=n_Size(pGetCoeff(ph),r->cf); 2574 2573 if (ns<=3) 2575 2574 { … … 4399 4398 if (rField_is_Ring(r)) 4400 4399 { 4401 if (!n_DivBy(p _GetCoeff(p1, r), p_GetCoeff(p2, r), r)) return FALSE;4400 if (!n_DivBy(pGetCoeff(p1), pGetCoeff(p2), r->cf)) return FALSE; 4402 4401 } 4403 4402 #endif 4404 n=n_Div(p _GetCoeff(p1,r),p_GetCoeff(p2,r),r);4403 n=n_Div(pGetCoeff(p1),pGetCoeff(p2),r->cf); 4405 4404 while ((p1 != NULL) /*&& (p2 != NULL)*/) 4406 4405 { 4407 4406 if ( ! p_LmEqual(p1, p2,r)) 4408 4407 { 4409 n_Delete(&n, r );4408 n_Delete(&n, r->cf); 4410 4409 return FALSE; 4411 4410 } 4412 if (!n_Equal(p _GetCoeff(p1, r), nn = n_Mult(p_GetCoeff(p2, r),n, r->cf), r->cf))4413 { 4414 n_Delete(&n, r );4415 n_Delete(&nn, r );4411 if (!n_Equal(pGetCoeff(p1), nn = n_Mult(pGetCoeff(p2),n, r->cf), r->cf)) 4412 { 4413 n_Delete(&n, r->cf); 4414 n_Delete(&nn, r->cf); 4416 4415 return FALSE; 4417 4416 } 4418 n_Delete(&nn, r );4417 n_Delete(&nn, r->cf); 4419 4418 pIter(p1); 4420 4419 pIter(p2); 4421 4420 } 4422 n_Delete(&n, r );4421 n_Delete(&n, r->cf); 4423 4422 return TRUE; 4424 4423 } -
libpolys/polys/monomials/p_polys.h
r6c086a4 r750069 1273 1273 pAssume1(d_r->N <= s_r->N); 1274 1274 poly d_p = p_Init(d_r, d_bin); 1275 for ( int i=d_r->N; i>0; i--)1275 for (unsigned i=d_r->N; i!=0; i--) 1276 1276 { 1277 1277 p_SetExp(d_p, i, p_GetExp(s_p, i,s_r), d_r); … … 1415 1415 p_LmCheckPolyRing1(p2, r); 1416 1416 1417 inti = r->ExpL_Size;1417 unsigned i = r->ExpL_Size; 1418 1418 unsigned long *ep = p1->exp; 1419 1419 unsigned long *eq = p2->exp; … … 1424 1424 if (ep[i] != eq[i]) return FALSE; 1425 1425 } 1426 while (i );1426 while (i!=0); 1427 1427 return TRUE; 1428 1428 } … … 1434 1434 r, 1435 1435 r->ExpPerLong); 1436 for ( int i=r->VarL_Size-1; i>0; i--)1436 for (unsigned i=r->VarL_Size-1; i!=0; i--) 1437 1437 { 1438 1438 s += p_GetTotalDegree(p->exp[r->VarL_Offset[i]], r,r->ExpPerLong); … … 1444 1444 { 1445 1445 p_LmCheckPolyRing1(p, r); 1446 for ( int j = r->N; j; j--)1446 for (unsigned j = r->N; j!=0; j--) 1447 1447 ev[j] = p_GetExp(p, j, r); 1448 1448 … … 1452 1452 { 1453 1453 p_LmCheckPolyRing1(p, r); 1454 for ( int j = r->N; j; j--)1454 for (unsigned j = r->N; j!=0; j--) 1455 1455 p_SetExp(p, j, ev[j], r); 1456 1456 -
libpolys/polys/monomials/ring.cc
r6c086a4 r750069 1342 1342 1343 1343 res->N=rVar(r); /* number of vars */ 1344 res->OrdSgn=r->OrdSgn; /* 1 for polynomial rings, -1 otherwise */1344 //res->OrdSgn=r->OrdSgn; /* 1 for polynomial rings, -1 otherwise */ 1345 1345 1346 1346 res->firstBlockEnds=r->firstBlockEnds; … … 1357 1357 res->ShortOut=r->ShortOut; 1358 1358 res->CanShortOut=r->CanShortOut; 1359 res->LexOrder=r->LexOrder; // TRUE if the monomial ordering has polynomial and power series blocks1360 res->MixedOrder=r->MixedOrder; // TRUE for mixed (global/local) ordering, FALSE otherwise,1361 1359 // 2 for diffenerent signs within one block 1362 1360 res->ComponentOrder=r->ComponentOrder; … … 1400 1398 if (copy_ordering == TRUE) 1401 1399 { 1400 res->LexOrder=r->LexOrder; // TRUE if the monomial ordering has polynomial and power series blocks 1401 res->MixedOrder=r->MixedOrder; // TRUE for mixed (global/local) ordering, FALSE otherwise, 1402 1402 i=rBlocks(r); 1403 1403 res->wvhdl = (int **)omAlloc(i * sizeof(int *)); … … 1465 1465 if (r == NULL) return NULL; 1466 1466 int i,j; 1467 ring res=(ring)omAllocBin(sip_sring_bin); 1468 memset(res,0,sizeof(ip_sring)); 1467 ring res=(ring)omAlloc0Bin(sip_sring_bin); 1469 1468 //memcpy(res,r,sizeof(ip_sring)); 1470 1469 //memset: res->idroot=NULL; /* local objects */ … … 1484 1483 1485 1484 res->N=rVar(r); /* number of vars */ 1486 res->OrdSgn=r->OrdSgn; /* 1 for polynomial rings, -1 otherwise */1485 //res->OrdSgn=r->OrdSgn; /* 1 for polynomial rings, -1 otherwise */ 1487 1486 1488 1487 res->firstBlockEnds=r->firstBlockEnds; -
libpolys/polys/nc/ncSACache.cc
r6c086a4 r750069 37 37 38 38 #include <coeffs/numbers.h> 39 #include "coeffrings.h"40 39 41 40 #include "nc/ncSACache.h" // for CCacheHash etc classes -
libpolys/polys/nc/ncSAFormula.cc
r6c086a4 r750069 36 36 37 37 #include <coeffs/numbers.h> 38 #include "coeffrings.h"39 38 40 39 #include "nc/ncSAFormula.h" … … 117 116 const number q = p_GetCoeff(GetC(r, i, j), r); 118 117 119 if( !n_IsOne(q, r ) )118 if( !n_IsOne(q, r->cf) ) 120 119 return FALSE; 121 120 } … … 146 145 147 146 const poly c = GetC(r, i, j); 148 const number q = p _GetCoeff(c, r);147 const number q = pGetCoeff(c); 149 148 const poly d = GetD(r, i, j); 150 149 … … 159 158 { 160 159 161 if( n_IsOne(q, r ) ) // commutative160 if( n_IsOne(q, r->cf) ) // commutative 162 161 return _ncSA_1xy0x0y0; 163 162 164 if( n_IsMOne(q, r ) ) // anti-commutative163 if( n_IsMOne(q, r->cf) ) // anti-commutative 165 164 return _ncSA_Mxy0x0y0; 166 165 … … 168 167 } else 169 168 { 170 if( n_IsOne(q, r ) ) // "Lie" case169 if( n_IsOne(q, r->cf) ) // "Lie" case 171 170 { 172 171 if( pNext(d) == NULL ) // Our Main Special Case: d is only a term! … … 194 193 if (AreCommutingVariables(r, k, i/*, &qi*/) && AreCommutingVariables(r, k, j/*, &qj*/) ) // [x, t] = [Dx, t] = 0? 195 194 { 196 const number g = p _GetCoeff(d, r);197 198 if (n_IsOne(g, r ))195 const number g = pGetCoeff(d); 196 197 if (n_IsOne(g, r->cf)) 199 198 return _ncSA_1xy0x0yT2; // save k!?, G = LC(d) == qi == qj == 1!!! 200 199 } … … 306 305 min = n; 307 306 max = m; 308 } else 307 } 308 else 309 309 { 310 310 min = m; … … 315 315 316 316 if( max == 1 ) 317 qN = n_Copy(m_q, r );317 qN = n_Copy(m_q, r->cf); 318 318 else 319 319 { 320 320 number t; 321 n_Power(m_q, max, &t, r );321 n_Power(m_q, max, &t, r->cf); 322 322 323 323 if( min > 1 ) 324 324 { 325 n_Power(t, min, &qN, r );326 n_Delete(&t, r );325 n_Power(t, min, &qN, r->cf); 326 n_Delete(&t, r->cf); 327 327 } 328 328 else … … 346 346 #if OUTPUT 347 347 Print("ncSA_1xy0x0yG(var(%d)^{%d}, var(%d)^{%d}, G, r)!\n", j, m, i, n); 348 number t = n_Copy(m_g, r );349 PrintS("Parameter G: "); n_Write(t, r );350 n_Delete(&t, r );348 number t = n_Copy(m_g, r->cf); 349 PrintS("Parameter G: "); n_Write(t, r->cf); 350 n_Delete(&t, r->cf); 351 351 #endif 352 352 … … 354 354 int km = m; 355 355 356 number c = n_Init(1, r );356 number c = n_Init(1, r->cf); 357 357 358 358 poly p = p_One( r); … … 373 373 for(; k < min; k++ ) 374 374 { 375 number t = n_Init(km + 1, r );376 n_InpMult(t, m_g, r ); // t = ((m - k) + 1) * gamma377 n_InpMult(c, t, r ); // c = c'* ((m - k) + 1) * gamma378 n_Delete(&t, r );379 380 t = n_Init(kn + 1, r );381 n_InpMult(c, t, r ); // c = (c'* ((m - k) + 1) * gamma) * ((n - k) + 1)382 n_Delete(&t, r );383 384 t = n_Init(k, r );385 c = n_Div(c, t, r );386 n_Delete(&t, r );387 388 // n_Normalize(c, r );389 390 t = n_Copy(c, r ); // not the last!375 number t = n_Init(km + 1, r->cf); 376 n_InpMult(t, m_g, r->cf); // t = ((m - k) + 1) * gamma 377 n_InpMult(c, t, r->cf); // c = c'* ((m - k) + 1) * gamma 378 n_Delete(&t, r->cf); 379 380 t = n_Init(kn + 1, r->cf); 381 n_InpMult(c, t, r->cf); // c = (c'* ((m - k) + 1) * gamma) * ((n - k) + 1) 382 n_Delete(&t, r->cf); 383 384 t = n_Init(k, r->cf); 385 c = n_Div(c, t, r->cf); 386 n_Delete(&t, r->cf); 387 388 // n_Normalize(c, r->cf); 389 390 t = n_Copy(c, r->cf); // not the last! 391 391 392 392 p = p_NSet(t, r); … … 405 405 406 406 { 407 n_InpMult(c, m_g, r ); // c = c'* gamma407 n_InpMult(c, m_g, r->cf); // c = c'* gamma 408 408 409 409 if( km > 0 ) 410 410 { 411 number t = n_Init(km + 1, r );412 n_InpMult(c, t, r ); // c = (c'* gamma) * (m - k + 1)413 n_Delete(&t, r );411 number t = n_Init(km + 1, r->cf); 412 n_InpMult(c, t, r->cf); // c = (c'* gamma) * (m - k + 1) 413 n_Delete(&t, r->cf); 414 414 } 415 415 416 416 if( kn > 0 ) 417 417 { 418 number t = n_Init(kn + 1, r );419 n_InpMult(c, t, r ); // c = (c'* gamma) * (n - k + 1)420 n_Delete(&t, r );418 number t = n_Init(kn + 1, r->cf); 419 n_InpMult(c, t, r->cf); // c = (c'* gamma) * (n - k + 1) 420 n_Delete(&t, r->cf); 421 421 } 422 422 423 number t = n_Init(k, r ); // c = ((c'* gamma) * ((n - k + 1) * (m - k + 1))) / k;424 c = n_Div(c, t, r );425 n_Delete(&t, r );423 number t = n_Init(k, r->cf); // c = ((c'* gamma) * ((n - k + 1) * (m - k + 1))) / k; 424 c = n_Div(c, t, r->cf); 425 n_Delete(&t, r->cf); 426 426 } 427 427 … … 451 451 452 452 // k == 0! 453 number c = n_Init(1, r );453 number c = n_Init(1, r->cf); 454 454 455 455 poly p = p_One( r ); … … 471 471 for(; k < min; k++ ) 472 472 { 473 number t = n_Init(km + 1, r );474 // n_InpMult(t, m_g, r ); // t = ((m - k) + 1) * gamma475 n_InpMult(c, t, r ); // c = c'* ((m - k) + 1) * gamma476 n_Delete(&t, r );477 478 t = n_Init(kn + 1, r );479 n_InpMult(c, t, r ); // c = (c'* ((m - k) + 1) * gamma) * ((n - k) + 1)480 n_Delete(&t, r );481 482 t = n_Init(k, r );483 c = n_Div(c, t, r );484 n_Delete(&t, r );473 number t = n_Init(km + 1, r->cf); 474 // n_InpMult(t, m_g, r->cf); // t = ((m - k) + 1) * gamma 475 n_InpMult(c, t, r->cf); // c = c'* ((m - k) + 1) * gamma 476 n_Delete(&t, r->cf); 477 478 t = n_Init(kn + 1, r->cf); 479 n_InpMult(c, t, r->cf); // c = (c'* ((m - k) + 1) * gamma) * ((n - k) + 1) 480 n_Delete(&t, r->cf); 481 482 t = n_Init(k, r->cf); 483 c = n_Div(c, t, r->cf); 484 n_Delete(&t, r->cf); 485 485 486 486 // // n_Normalize(c, r); 487 487 488 t = n_Copy(c, r ); // not the last!488 t = n_Copy(c, r->cf); // not the last! 489 489 490 490 p = p_NSet(t, r); … … 509 509 if( km > 0 ) 510 510 { 511 number t = n_Init(km + 1, r );512 n_InpMult(c, t, r ); // c = (c'* gamma) * (m - k + 1)513 n_Delete(&t, r );511 number t = n_Init(km + 1, r->cf); 512 n_InpMult(c, t, r->cf); // c = (c'* gamma) * (m - k + 1) 513 n_Delete(&t, r->cf); 514 514 } 515 515 516 516 if( kn > 0 ) 517 517 { 518 number t = n_Init(kn + 1, r );519 n_InpMult(c, t, r ); // c = (c'* gamma) * (n - k + 1)520 n_Delete(&t, r );518 number t = n_Init(kn + 1, r->cf); 519 n_InpMult(c, t, r->cf); // c = (c'* gamma) * (n - k + 1) 520 n_Delete(&t, r->cf); 521 521 } 522 522 523 number t = n_Init(k, r ); // c = ((c'* gamma) * ((n - k + 1) * (m - k + 1))) / k;524 c = n_Div(c, t, r );525 n_Delete(&t, r );523 number t = n_Init(k, r->cf); // c = ((c'* gamma) * ((n - k + 1) * (m - k + 1))) / k; 524 c = n_Div(c, t, r->cf); 525 n_Delete(&t, r->cf); 526 526 } 527 527 … … 552 552 int k = m; // to 0 553 553 554 number c = n_Init(1, r ); // k = m, C_k = 1554 number c = n_Init(1, r->cf); // k = m, C_k = 1 555 555 poly p = p_One( r); 556 556 … … 564 564 poly pLast = p; 565 565 566 number nn = n_Init(n, r ); // number(n)!567 n_InpMult(nn, m_shiftCoef, r ); // nn = (alpha*n)566 number nn = n_Init(n, r->cf); // number(n)! 567 n_InpMult(nn, m_shiftCoef, r->cf); // nn = (alpha*n) 568 568 569 569 --k; … … 573 573 for(; k > 0; k-- ) 574 574 { 575 number t = n_Init(k + 1, r ); // t = k+1576 n_InpMult(c, t, r ); // c = c' * (k+1)577 n_InpMult(c, nn, r ); // c = (c' * (k+1)) * (alpha * n)578 579 n_Delete(&t, r );580 t = n_Init(mk++, r );581 c = n_Div(c, t, r ); // c = ((c' * (k+1)) * (alpha * n)) / (m-k);582 n_Delete(&t, r );583 584 // n_Normalize(c, r );585 586 t = n_Copy(c, r ); // not the last!575 number t = n_Init(k + 1, r->cf); // t = k+1 576 n_InpMult(c, t, r->cf); // c = c' * (k+1) 577 n_InpMult(c, nn, r->cf); // c = (c' * (k+1)) * (alpha * n) 578 579 n_Delete(&t, r->cf); 580 t = n_Init(mk++, r->cf); 581 c = n_Div(c, t, r->cf); // c = ((c' * (k+1)) * (alpha * n)) / (m-k); 582 n_Delete(&t, r->cf); 583 584 // n_Normalize(c, r->cf); 585 586 t = n_Copy(c, r->cf); // not the last! 587 587 588 588 p = p_NSet(t, r); … … 600 600 601 601 { 602 n_InpMult(c, nn, r ); // c = (c' * (0+1)) * (alpha * n)603 604 number t = n_Init(m, r );605 c = n_Div(c, t, r ); // c = ((c' * (0+1)) * (alpha * n)) / (m-0);606 n_Delete(&t, r );607 } 608 609 n_Delete(&nn, r );602 n_InpMult(c, nn, r->cf); // c = (c' * (0+1)) * (alpha * n) 603 604 number t = n_Init(m, r->cf); 605 c = n_Div(c, t, r->cf); // c = ((c' * (0+1)) * (alpha * n)) / (m-0); 606 n_Delete(&t, r->cf); 607 } 608 609 n_Delete(&nn, r->cf); 610 610 611 611 p = p_NSet(c, r); -
libpolys/polys/nc/ncSAMult.cc
r6c086a4 r750069 38 38 #include <misc/options.h> 39 39 #include <coeffs/numbers.h> 40 #include "coeffrings.h"41 40 42 41 -
libpolys/polys/nc/ncSAMult.h
r6c086a4 r750069 16 16 #include <polys/operations/p_Mult_q.h> 17 17 18 #include <polys/coeffrings.h>19 20 18 //#include <polys/nc/ncSACache.h> // for CCacheHash etc classes 21 19 #include <polys/nc/ncSAFormula.h> // for CFormulaPowerMultiplier and enum Enum_ncSAType … … 45 43 { 46 44 poly pMonom = p_LmInit(pTerm, r); 47 pSetCoeff0(pMonom, n_Init(i, r ));45 pSetCoeff0(pMonom, n_Init(i, r->cf)); 48 46 return pMonom; 49 47 } -
libpolys/polys/nc/old.gring.cc
r6c086a4 r750069 32 32 33 33 #include <coeffs/numbers.h> 34 #include <polys/coeffrings.h>35 34 36 35 // #include <polys/febase.h> … … 63 62 // #endif 64 63 65 static poly NF_Proc_Dummy(ideal, ideal, poly, int, int, const ring _currRing)64 static poly NF_Proc_Dummy(ideal, ideal, poly, int, int, const ring) 66 65 { WerrorS("nc_NF not defined"); return NULL; } 67 static ideal BBA_Proc_Dummy (const ideal, const ideal, const intvec *, const intvec *, kStrategy strat, const ring)66 static ideal BBA_Proc_Dummy (const ideal, const ideal, const intvec *, const intvec *, kStrategy, const ring) 68 67 { WerrorS("nc_NF not defined"); return NULL; } 69 68 … … 424 423 } 425 424 p_GetExpV(p,P,r); 426 cP=p _GetCoeff(p,r);427 cOut=n_Mult(cP,cM,r );425 cP=pGetCoeff(p); 426 cOut=n_Mult(cP,cM,r->cf); 428 427 if (side==1) 429 428 { … … 435 434 } 436 435 v = p_Mult_nn(v,cOut,r); 437 n_Delete(&cOut,r );436 n_Delete(&cOut,r->cf); 438 437 p_SetCompP(v,expOut,r); 439 438 … … 518 517 } 519 518 520 number cff=n_Init(1,r );519 number cff=n_Init(1,r->cf); 521 520 number tmp_num=NULL; 522 521 int cpower=0; … … 540 539 } 541 540 } 542 cff = n_Copy(p _GetCoeff(MATELEM(r->GetNC()->COM,1,2),r),r);543 n_Power(cff,tpower,&tmp_num, r );544 n_Delete(&cff,r );541 cff = n_Copy(pGetCoeff(MATELEM(r->GetNC()->COM,1,2)),r->cf); 542 n_Power(cff,tpower,&tmp_num, r->cf); 543 n_Delete(&cff,r->cf); 545 544 cff = tmp_num; 546 545 } 547 546 else /* skew commutative with nonequal coeffs */ 548 547 { 549 number totcff=n_Init(1,r );548 number totcff=n_Init(1,r->cf); 550 549 for(j=jG; j<=iG; j++) 551 550 { … … 558 557 { 559 558 cpower = F[i]*G[j]; // bug! overflow danger!!! 560 cff = n_Copy(p _GetCoeff(MATELEM(r->GetNC()->COM,j,i),r),r);561 n_Power(cff,cpower,&tmp_num, r );562 cff = n_Mult(totcff,tmp_num, r );563 n_Delete(&totcff, r );564 n_Delete(&tmp_num, r );565 totcff = n_Copy(cff,r );566 n_Delete(&cff,r );559 cff = n_Copy(pGetCoeff(MATELEM(r->GetNC()->COM,j,i)),r->cf); 560 n_Power(cff,cpower,&tmp_num, r->cf); 561 cff = n_Mult(totcff,tmp_num, r->cf); 562 n_Delete(&totcff, r->cf); 563 n_Delete(&tmp_num, r->cf); 564 totcff = n_Copy(cff,r->cf); 565 n_Delete(&cff,r->cf); 567 566 } 568 567 } /* end 2nd for */ … … 633 632 poly Rout=NULL; 634 633 number *c=(number *)omAlloc0((rN+1)*sizeof(number)); 635 c[0]=n_Init(1,r );634 c[0]=n_Init(1,r->cf); 636 635 637 636 int *Op=Nxt; … … 654 653 655 654 w=gnc_mm_Mult_uu(Op,t,On[t],r); 656 c[cnt]=n_Mult(c[cnt-1],p _GetCoeff(w,r),r);655 c[cnt]=n_Mult(c[cnt-1],pGetCoeff(w),r->cf); 657 656 D = pNext(w); /* getting coef and rest D */ 658 657 p_LmDelete(&w,r); … … 869 868 poly Rout=NULL; 870 869 number *c=(number *)omAlloc0((cnt+2)*sizeof(number)); 871 c[cnt+1]=n_Init(1,r );870 c[cnt+1]=n_Init(1,r->cf); 872 871 i=cnt+2; /* later in freeN */ 873 872 int *Op=Nxt; … … 898 897 899 898 poly w=gnc_uu_Mult_ww(t,Op[t],jG,bG,r); 900 c[cnt]=n_Copy(p _GetCoeff(w,r),r);899 c[cnt]=n_Copy(pGetCoeff(w),r->cf); 901 900 D = pNext(w); /* getting coef and rest D */ 902 901 p_LmDelete(&w,r); … … 943 942 #endif 944 943 p_Delete(&Pp,r); 945 num=n_Mult(c[cnt+1],c[cnt],r );946 n_Delete(&c[cnt],r );944 num=n_Mult(c[cnt+1],c[cnt],r->cf); 945 n_Delete(&c[cnt],r->cf); 947 946 c[cnt]=num; 948 947 Rout=p_Mult_nn(Rout,c[cnt+1],r); /* Rest is ready */ … … 1119 1118 p_AddExp(out,j,b,r); 1120 1119 p_Setm(out,r); 1121 if (n_IsOne(p _GetCoeff(MATELEM(r->GetNC()->COM,j,i),r),r)) /* commutative case */1120 if (n_IsOne(pGetCoeff(MATELEM(r->GetNC()->COM,j,i)),r->cf)) /* commutative case */ 1122 1121 { 1123 1122 return(out); … … 1125 1124 else 1126 1125 { 1127 number tmp_number=p _GetCoeff(MATELEM(r->GetNC()->COM,j,i),r); /* quasicommutative case */1128 n_Power(tmp_number,a*b,&tmp_number, r ); // BUG! ;-(1126 number tmp_number=pGetCoeff(MATELEM(r->GetNC()->COM,j,i)); /* quasicommutative case */ 1127 n_Power(tmp_number,a*b,&tmp_number, r->cf); // BUG! ;-( 1129 1128 p_SetCoeff(out,tmp_number,r); 1130 1129 return(out); … … 1424 1423 /* GCD stuff */ 1425 1424 number cG = n_SubringGcd(C, cF, r->cf); 1426 if ( !n_IsOne(cG,r ) )1427 { 1428 cF = n_Div(cF, cG, r ); n_Normalize(cF, r);1429 C = n_Div(C, cG, r ); n_Normalize(C, r);1425 if ( !n_IsOne(cG,r->cf) ) 1426 { 1427 cF = n_Div(cF, cG, r->cf); n_Normalize(cF, r->cf); 1428 C = n_Div(C, cG, r->cf); n_Normalize(C, r->cf); 1430 1429 } 1431 1430 else 1432 1431 { 1433 cF = n_Copy(cF, r );1434 C = n_Copy(C, r );1435 } 1436 n_Delete(&cG,r );1432 cF = n_Copy(cF, r->cf); 1433 C = n_Copy(C, r->cf); 1434 } 1435 n_Delete(&cG,r->cf); 1437 1436 p2 = p_Mult_nn(p2, C, r); 1438 1437 poly out = nc_mm_Mult_pp(m, pNext(p1), r); … … 1440 1439 p_Test(p2,r); 1441 1440 p_Test(N,r); 1442 if (!n_IsMOne(cF,r ))1443 { 1444 cF = n_InpNeg(cF,r );1441 if (!n_IsMOne(cF,r->cf)) 1442 { 1443 cF = n_InpNeg(cF,r->cf); 1445 1444 N = p_Mult_nn(N, cF, r); 1446 1445 p_Test(N,r); … … 1450 1449 if ( out!=NULL ) p_Content(out,r); 1451 1450 p_Delete(&m,r); 1452 n_Delete(&cF,r );1453 n_Delete(&C,r );1451 n_Delete(&cF,r->cf); 1452 n_Delete(&C,r->cf); 1454 1453 return(out); 1455 1454 } … … 1486 1485 number cG = n_SubringGcd(C, cF, r->cf); 1487 1486 1488 if (!n_IsOne(cG, r ))1489 { 1490 cF = n_Div(cF, cG, r ); n_Normalize(cF, r);1491 C = n_Div(C, cG, r ); n_Normalize(C, r);1487 if (!n_IsOne(cG, r->cf)) 1488 { 1489 cF = n_Div(cF, cG, r->cf); n_Normalize(cF, r->cf); 1490 C = n_Div(C, cG, r->cf); n_Normalize(C, r->cf); 1492 1491 } 1493 1492 else 1494 1493 { 1495 cF = n_Copy(cF, r );1496 C = n_Copy(C, r );1497 } 1498 n_Delete(&cG,r );1494 cF = n_Copy(cF, r->cf); 1495 C = n_Copy(C, r->cf); 1496 } 1497 n_Delete(&cG,r->cf); 1499 1498 1500 1499 p2 = p_Mult_nn(p2, C, r); // p2 !!! 1501 1500 p_Test(p2,r); 1502 n_Delete(&C,r );1503 n_Delete(&cG,r );1501 n_Delete(&C,r->cf); 1502 n_Delete(&cG,r->cf); 1504 1503 1505 1504 poly out = nc_mm_Mult_pp(m, pNext(p1), r); … … 1509 1508 p_Test(N,r); 1510 1509 1511 if (!n_IsMOne(cF,r )) // ???1512 { 1513 cF = n_InpNeg(cF,r );1510 if (!n_IsMOne(cF,r->cf)) // ??? 1511 { 1512 cF = n_InpNeg(cF,r->cf); 1514 1513 N = p_Mult_nn(N, cF, r); 1515 1514 p_Test(N,r); 1516 1515 } 1517 n_Delete(&cF,r );1516 n_Delete(&cF,r->cf); 1518 1517 1519 1518 out = p_Add_q(p2,N,r); // delete N, p2 … … 1571 1570 /* GCD stuff */ 1572 1571 number C = n_SubringGcd(C1,C2,r->cf); 1573 if (!n_IsOne(C,r ))1574 { 1575 C1=n_Div(C1,C, r );n_Normalize(C1,r);1576 C2=n_Div(C2,C, r );n_Normalize(C2,r);1572 if (!n_IsOne(C,r->cf)) 1573 { 1574 C1=n_Div(C1,C, r->cf);n_Normalize(C1,r->cf); 1575 C2=n_Div(C2,C, r->cf);n_Normalize(C2,r->cf); 1577 1576 } 1578 1577 else 1579 1578 { 1580 C1=n_Copy(C1, r );1581 C2=n_Copy(C2, r );1582 } 1583 n_Delete(&C,r );1579 C1=n_Copy(C1, r->cf); 1580 C2=n_Copy(C2, r->cf); 1581 } 1582 n_Delete(&C,r->cf); 1584 1583 M1=p_Mult_nn(M1,C2,r); 1585 1584 p_SetCoeff(m1,C2,r); 1586 if (n_IsMOne(C1,r ))1585 if (n_IsMOne(C1,r->cf)) 1587 1586 { 1588 1587 M2=p_Add_q(M1,M2,r); … … 1590 1589 else 1591 1590 { 1592 C1=n_InpNeg(C1,r );1591 C1=n_InpNeg(C1,r->cf); 1593 1592 M2=p_Mult_nn(M2,C1,r); 1594 1593 M2=p_Add_q(M1,M2,r); … … 1754 1753 number C = n_SubringGcd(C1, C2, r->cf); // C = gcd(C1, C2) 1755 1754 1756 if (!n_IsOne(C, r )) // if C != 11757 { 1758 C1=n_Div(C1, C, r );n_Normalize(C1,r); // C1 = C1 / C1759 C2=n_Div(C2, C, r );n_Normalize(C2,r); // C2 = C2 / C1755 if (!n_IsOne(C, r->cf)) // if C != 1 1756 { 1757 C1=n_Div(C1, C, r->cf);n_Normalize(C1,r->cf); // C1 = C1 / C 1758 C2=n_Div(C2, C, r->cf);n_Normalize(C2,r->cf); // C2 = C2 / C 1760 1759 } 1761 1760 else 1762 1761 { 1763 C1=n_Copy(C1,r );1764 C2=n_Copy(C2,r );1765 } 1766 1767 n_Delete(&C,r ); // destroy the number C1768 1769 C1=n_InpNeg(C1,r );1762 C1=n_Copy(C1,r->cf); 1763 C2=n_Copy(C2,r->cf); 1764 } 1765 1766 n_Delete(&C,r->cf); // destroy the number C 1767 1768 C1=n_InpNeg(C1,r->cf); 1770 1769 1771 1770 // number MinusOne=n_Init(-1,r); … … 1915 1914 M=p_Add_q(M,nc_mm_Mult_p(m,p_LmDeleteAndNext(p_Copy(p1,r),r),r),r); // _pp? 1916 1915 q=p_Mult_nn(q,C,r); 1917 number MinusOne=n_Init(-1,r );1918 if (!n_Equal(cQ,MinusOne,r ))1916 number MinusOne=n_Init(-1,r->cf); 1917 if (!n_Equal(cQ,MinusOne,r->cf)) 1919 1918 { 1920 1919 cQ=nInpNeg(cQ); … … 1925 1924 1926 1925 p_Delete(&m,r); 1927 n_Delete(&C,r );1928 n_Delete(&cQ,r );1929 n_Delete(&MinusOne,r );1926 n_Delete(&C,r->cf); 1927 n_Delete(&cQ,r->cf); 1928 n_Delete(&MinusOne,r->cf); 1930 1929 /* return(q); */ 1931 1930 } … … 1968 1967 } 1969 1968 1970 // n_Delete(&p_GetCoeff(m, r), r );1969 // n_Delete(&p_GetCoeff(m, r), r->cf); 1971 1970 // pSetCoeff0(m, NULL); 1972 1971 … … 1983 1982 // b will not be multiplied by any constant in this impl. 1984 1983 // ==> *c=1 1985 if (c!=NULL) *c=n_Init(1, r );1984 if (c!=NULL) *c=n_Init(1, r->cf); 1986 1985 poly m=p_One(r); 1987 1986 p_ExpVectorDiff(m,kBucketGetLm(b),p, r); … … 1993 1992 assume(pp!=NULL); 1994 1993 p_Delete(&m, r); 1995 number n=p _GetCoeff(pp, r);1994 number n=pGetCoeff(pp); 1996 1995 number nn; 1997 if (!n_IsMOne(n, r ))1998 { 1999 nn=n_InpNeg(n_Invers(n, r ), r);2000 n= n_Mult(nn,p _GetCoeff(kBucketGetLm(b), r), r);2001 n_Delete(&nn, r );1996 if (!n_IsMOne(n, r->cf)) 1997 { 1998 nn=n_InpNeg(n_Invers(n, r->cf), r->cf); 1999 n= n_Mult(nn,pGetCoeff(kBucketGetLm(b)), r->cf); 2000 n_Delete(&nn, r->cf); 2002 2001 pp=p_Mult_nn(pp,n,r); 2003 n_Delete(&n, r );2002 n_Delete(&n, r->cf); 2004 2003 } 2005 2004 else … … 2031 2030 // b will not be multiplied by any constant in this impl. 2032 2031 // ==> *c=1 2033 if (c!=NULL) *c=n_Init(1, r );2032 if (c!=NULL) *c=n_Init(1, r->cf); 2034 2033 poly m = p_One(r); 2035 2034 const poly pLmB = kBucketGetLm(b); // no new copy! … … 2059 2058 2060 2059 assume( pp != NULL ); 2061 const number n = p _GetCoeff(pp, r); // bug!2062 2063 if (!n_IsMOne(n, r ) ) // does this improve performance??!? also see below... // TODO: check later on.2060 const number n = pGetCoeff(pp); // bug! 2061 2062 if (!n_IsMOne(n, r->cf) ) // does this improve performance??!? also see below... // TODO: check later on. 2064 2063 // if n == -1 => nn = 1 and -1/n 2065 2064 { 2066 number nn=n_InpNeg(n_Invers(n, r ), r);2067 number t = n_Mult(nn,p _GetCoeff(pLmB, r), r);2068 n_Delete(&nn, r );2065 number nn=n_InpNeg(n_Invers(n, r->cf), r->cf); 2066 number t = n_Mult(nn,pGetCoeff(pLmB), r->cf); 2067 n_Delete(&nn, r->cf); 2069 2068 pp = p_Mult_nn(pp,t,r); 2070 n_Delete(&t, r );2069 n_Delete(&t, r->cf); 2071 2070 } 2072 2071 else … … 2116 2115 //cc=*c; 2117 2116 //*c=nMult(*c,c2); 2118 n_Delete(&c2, r );2117 n_Delete(&c2, r->cf); 2119 2118 //nDelete(&cc); 2120 2119 p_Delete(&pp, r); 2121 2120 } 2122 2121 if (c!=NULL) *c=ctmp; 2123 else n_Delete(&ctmp, r );2122 else n_Delete(&ctmp, r->cf); 2124 2123 } 2125 2124 … … 2150 2149 //cc=*c; 2151 2150 //*c=nMult(*c,c2); 2152 n_Delete(&c2, r );2151 n_Delete(&c2, r->cf); 2153 2152 //nDelete(&cc); 2154 2153 p_Delete(&pp, r); 2155 2154 } 2156 2155 if (c!=NULL) *c=ctmp; 2157 else n_Delete(&ctmp, r );2156 else n_Delete(&ctmp, r->cf); 2158 2157 } 2159 2158 … … 2164 2163 // b will not by multiplied by any constant in this impl. 2165 2164 // ==> *c=1 2166 if (c!=NULL) *c=n_Init(1, r );2165 if (c!=NULL) *c=n_Init(1, r->cf); 2167 2166 poly m=p_One(r); 2168 2167 p_ExpVectorDiff(m,p_Head(b, r),p, r); … … 2175 2174 2176 2175 p_Delete(&m, r); 2177 number n=p _GetCoeff(pp, r);2176 number n=pGetCoeff(pp); 2178 2177 number nn; 2179 if (!n_IsMOne(n, r ))2180 { 2181 nn=n_InpNeg(n_Invers(n, r ), r);2182 n =n_Mult(nn,p _GetCoeff(b, r), r);2183 n_Delete(&nn, r );2178 if (!n_IsMOne(n, r->cf)) 2179 { 2180 nn=n_InpNeg(n_Invers(n, r->cf), r->cf); 2181 n =n_Mult(nn,pGetCoeff(b), r->cf); 2182 n_Delete(&nn, r->cf); 2184 2183 pp=p_Mult_nn(pp,n,r); 2185 n_Delete(&n, r );2184 n_Delete(&n, r->cf); 2186 2185 } 2187 2186 else … … 2211 2210 // b will not by multiplied by any constant in this impl. 2212 2211 // ==> *c=1 2213 if (c!=NULL) *c=n_Init(1, r );2212 if (c!=NULL) *c=n_Init(1, r->cf); 2214 2213 2215 2214 poly pp = NULL; … … 2271 2270 assume(pp != NULL); 2272 2271 2273 const number n = p _GetCoeff(pp, r); // no new copy2272 const number n = pGetCoeff(pp); // no new copy 2274 2273 2275 2274 number nn; 2276 2275 2277 if (!n_IsMOne(n, r )) // TODO: as above.2278 { 2279 nn=n_InpNeg(n_Invers(n, r ), r);2280 number t = n_Mult(nn, p _GetCoeff(b, r), r);2281 n_Delete(&nn, r );2276 if (!n_IsMOne(n, r->cf)) // TODO: as above. 2277 { 2278 nn=n_InpNeg(n_Invers(n, r->cf), r->cf); 2279 number t = n_Mult(nn, pGetCoeff(b), r->cf); 2280 n_Delete(&nn, r->cf); 2282 2281 pp=p_Mult_nn(pp, t, r); 2283 n_Delete(&t, r );2282 n_Delete(&t, r->cf); 2284 2283 } 2285 2284 else … … 2332 2331 if (pres!=NULL) 2333 2332 { 2334 coef = n_Mult(p _GetCoeff(p, r),p_GetCoeff(Q, r), r);2333 coef = n_Mult(pGetCoeff(p),pGetCoeff(Q), r->cf); 2335 2334 pres = p_Mult_nn(pres,coef,r); 2336 2335 2337 2336 sum += pres; 2338 n_Delete(&coef, r );2337 n_Delete(&coef, r->cf); 2339 2338 } 2340 2339 pIter(Q); … … 2378 2377 /* compute [ x_j^M1[j],x_i^M2[i] ] */ 2379 2378 if (i<j) {nMax=j; nMin=i;} else {nMax=i; nMin=j;} 2380 if ( (i==j) || ((MATELEM(r->GetNC()->COM,nMin,nMax)!=NULL) && n_IsOne(p _GetCoeff(MATELEM(r->GetNC()->C,nMin,nMax), r), r) )) /* not (the same exp. or commuting exps)*/2379 if ( (i==j) || ((MATELEM(r->GetNC()->COM,nMin,nMax)!=NULL) && n_IsOne(pGetCoeff(MATELEM(r->GetNC()->C,nMin,nMax)), r->cf) )) /* not (the same exp. or commuting exps)*/ 2381 2380 { bres=NULL; } 2382 2381 else … … 2384 2383 if (i<j) { bres=gnc_uu_Mult_ww(j,M1[j],i,M2[i], r); } 2385 2384 else bres=gnc_uu_Mult_ww(i,M2[i],j,M1[j], r); 2386 if (n_IsOne(p _GetCoeff(bres, r), r))2385 if (n_IsOne(pGetCoeff(bres), r->cf)) 2387 2386 { 2388 2387 bres=p_LmDeleteAndNext(bres, r); … … 2390 2389 else 2391 2390 { 2392 nTmp=n_Sub(p _GetCoeff(bres, r),n_Init(1, r), r);2391 nTmp=n_Sub(pGetCoeff(bres),n_Init(1, r->cf), r->cf); 2393 2392 p_SetCoeff(bres,nTmp, r); /* only lc ! */ 2394 2393 } … … 2511 2510 pIter(p); 2512 2511 } 2513 number ntd = n_Init(totdeg, r );2514 number nln = n_Init(length, r );2515 number nres= n_Div(ntd,nln, r );2516 n_Delete(&ntd, r );2517 n_Delete(&nln, r );2512 number ntd = n_Init(totdeg, r->cf); 2513 number nln = n_Init(length, r->cf); 2514 number nres= n_Div(ntd,nln, r->cf); 2515 n_Delete(&ntd, r->cf); 2516 n_Delete(&nln, r->cf); 2518 2517 MATELEM(res,s,t)=p_NSet(nres,r); 2519 2518 } … … 2884 2883 assume(p_IsConstant(CN,curr)); 2885 2884 2886 nN = p _GetCoeff(CN, curr);2887 if (n_IsZero(nN, curr ))2885 nN = pGetCoeff(CN); 2886 if (n_IsZero(nN, curr->cf)) 2888 2887 { 2889 2888 WerrorS("Incorrect input : zero coefficients are not allowed"); … … 2894 2893 } 2895 2894 2896 if (n_IsOne(nN, curr ))2895 if (n_IsOne(nN, curr->cf)) 2897 2896 nctype = nc_lie; 2898 2897 else … … 2968 2967 IsSkewConstant = tmpIsSkewConstant; 2969 2968 2970 if ( tmpIsSkewConstant && n_IsOne(pN, curr ) )2969 if ( tmpIsSkewConstant && n_IsOne(pN, curr->cf) ) 2971 2970 nctype = nc_lie; 2972 2971 else … … 3154 3153 p = p_One(r); 3155 3154 if (MATELEM(r->GetNC()->C,i,j)!=NULL) 3156 p_SetCoeff(p,n_Copy(pGetCoeff(MATELEM(r->GetNC()->C,i,j)),r ),r);3155 p_SetCoeff(p,n_Copy(pGetCoeff(MATELEM(r->GetNC()->C,i,j)),r->cf),r); 3157 3156 p_SetExp(p,i,1,r); 3158 3157 p_SetExp(p,j,1,r); -
libpolys/polys/nc/sca.cc
r6c086a4 r750069 36 36 37 37 #include <coeffs/numbers.h> 38 #include <polys/coeffrings.h>39 40 38 41 39 // #include <polys/febase.h> … … 186 184 187 185 if( (tpower) != 0 ) // degree is odd => negate coeff. 188 nCoeffM = n_InpNeg(nCoeffM, rRing ); // negate nCoeff (will destroy the original number)186 nCoeffM = n_InpNeg(nCoeffM, rRing->cf); // negate nCoeff (will destroy the original number) 189 187 190 188 const number nCoeffMM = p_GetCoeff(pMonomMM, rRing); // no new copy! 191 189 192 number nCoeff = n_Mult(nCoeffM, nCoeffMM, rRing ); // new number!190 number nCoeff = n_Mult(nCoeffM, nCoeffMM, rRing->cf); // new number! 193 191 194 192 p_SetCoeff(pMonomM, nCoeff, rRing); // delete lc(pMonomM) and set lc(pMonomM) = nCoeff … … 250 248 251 249 if( (tpower) != 0 ) // degree is odd => negate coeff. 252 nCoeffM = n_InpNeg(nCoeffM, rRing ); // negate nCoeff (will destroy the original number), creates new number!250 nCoeffM = n_InpNeg(nCoeffM, rRing->cf); // negate nCoeff (will destroy the original number), creates new number! 253 251 254 252 const number nCoeffMM = p_GetCoeff(pMonomMM, rRing); // no new copy! 255 253 256 number nCoeff = n_Mult(nCoeffM, nCoeffMM, rRing ); // new number!254 number nCoeff = n_Mult(nCoeffM, nCoeffMM, rRing->cf); // new number! 257 255 258 256 p_SetCoeff(pMonomM, nCoeff, rRing); // delete lc(pMonomM) and set lc(pMonomM) = nCoeff … … 318 316 const number nCoeff2 = p_GetCoeff(pMonom2, rRing); // no new copy! 319 317 320 number nCoeff = n_Mult(nCoeff1, nCoeff2, rRing ); // new number!318 number nCoeff = n_Mult(nCoeff1, nCoeff2, rRing->cf); // new number! 321 319 322 320 if( (tpower) != 0 ) // degree is odd => negate coeff. 323 nCoeff = n_InpNeg(nCoeff, rRing ); // negate nCoeff (will destroy the original number)321 nCoeff = n_InpNeg(nCoeff, rRing->cf); // negate nCoeff (will destroy the original number) 324 322 325 323 p_SetCoeff0(pResult, nCoeff, rRing); // set lc(pResult) = nCoeff, no destruction! … … 363 361 p_Setm(pResult, rRing); // addjust degree after previous step! 364 362 365 number nCoeff = n_Copy(p _GetCoeff(pMonom, rRing), rRing); // new number!363 number nCoeff = n_Copy(pGetCoeff(pMonom), rRing->cf); // new number! 366 364 367 365 if( cpower != 0 ) // degree is odd => negate coeff. 368 nCoeff = n_InpNeg(nCoeff, rRing ); // negate nCoeff (will destroy the original number)366 nCoeff = n_InpNeg(nCoeff, rRing->cf); // negate nCoeff (will destroy the original number) 369 367 370 368 p_SetCoeff0(pResult, nCoeff, rRing); // set lc(pResult) = nCoeff, no destruction! … … 791 789 p_Delete(&pL,r); 792 790 793 number C1 = n_Copy(p _GetCoeff(p1,r),r); // C1 = lc(p1)794 number C2 = n_Copy(p _GetCoeff(p2,r),r); // C2 = lc(p2)795 796 number C = n_Gcd(C1,C2,r ); // C = gcd(C1, C2)797 798 if (!n_IsOne(C, r )) // if C != 1799 { 800 C1=n_Div(C1, C, r ); // C1 = C1 / C801 C2=n_Div(C2, C, r ); // C2 = C2 / C802 } 803 804 n_Delete(&C,r ); // destroy the number C791 number C1 = n_Copy(pGetCoeff(p1),r->cf); // C1 = lc(p1) 792 number C2 = n_Copy(pGetCoeff(p2),r->cf); // C2 = lc(p2) 793 794 number C = n_Gcd(C1,C2,r->cf); // C = gcd(C1, C2) 795 796 if (!n_IsOne(C, r->cf)) // if C != 1 797 { 798 C1=n_Div(C1, C, r->cf); // C1 = C1 / C 799 C2=n_Div(C2, C, r->cf); // C2 = C2 / C 800 } 801 802 n_Delete(&C,r->cf); // destroy the number C 805 803 806 804 const int iSignSum = sca_Sign_mm_Mult_mm (m1, p1, r) + sca_Sign_mm_Mult_mm (m2, p2, r); … … 810 808 811 809 if( iSignSum != 0 ) // the same sign! 812 C2=n_InpNeg (C2, r );810 C2=n_InpNeg (C2, r->cf); 813 811 814 812 p_SetCoeff(m1, C2, r); // lc(m1) = C2!!! … … 865 863 #endif 866 864 867 number C1 = n_Copy( p _GetCoeff(p1, r), r);868 number C2 = n_Copy( p _GetCoeff(p2, r), r);865 number C1 = n_Copy( pGetCoeff(p1), r->cf); 866 number C2 = n_Copy( pGetCoeff(p2), r->cf); 869 867 870 868 /* GCD stuff */ 871 number C = n_Gcd(C1, C2, r );872 873 if (!n_IsOne(C, r ))874 { 875 C1 = n_Div(C1, C, r );876 C2 = n_Div(C2, C, r );877 } 878 n_Delete(&C,r );869 number C = n_Gcd(C1, C2, r->cf); 870 871 if (!n_IsOne(C, r->cf)) 872 { 873 C1 = n_Div(C1, C, r->cf); 874 C2 = n_Div(C2, C, r->cf); 875 } 876 n_Delete(&C,r->cf); 879 877 880 878 const int iSign = sca_Sign_mm_Mult_mm( m, p1, r ); 881 879 882 880 if(iSign == 1) 883 C2 = n_InpNeg(C2,r );881 C2 = n_InpNeg(C2,r->cf); 884 882 885 883 p_SetCoeff(m, C2, r); … … 892 890 893 891 p2 = p_Mult_nn(p2, C1, r); // p2 !!! 894 n_Delete(&C1,r );892 n_Delete(&C1,r->cf); 895 893 896 894 poly T = nc_mm_Mult_pp(m, pNext(p1), r); … … 1007 1005 number c = p_GetCoeff(MATELEM(C,i,j), rBase); 1008 1006 1009 if( n_IsMOne(c, rBase ) ) // !!!???1007 if( n_IsMOne(c, rBase->cf) ) // !!!??? 1010 1008 { 1011 1009 if( i < iAltVarStart) … … 1016 1014 } else 1017 1015 { 1018 if( !n_IsOne(c, rBase ) )1016 if( !n_IsOne(c, rBase->cf) ) 1019 1017 { 1020 1018 #if ((defined(PDEBUG) && OUTPUT) || MYTEST) … … 1045 1043 if( (iAltVarStart <= i) && (j <= iAltVarEnd) ) // S <= i < j <= E 1046 1044 { // anticommutative part 1047 if( !n_IsMOne(c, rBase ) )1045 if( !n_IsMOne(c, rBase->cf) ) 1048 1046 { 1049 1047 #if ((defined(PDEBUG) && OUTPUT) || MYTEST) … … 1052 1050 return false; 1053 1051 } 1054 } else 1052 } 1053 else 1055 1054 { // should commute 1056 if( !n_IsOne(c, rBase ) )1055 if( !n_IsOne(c, rBase->cf) ) 1057 1056 { 1058 1057 #if ((defined(PDEBUG) && OUTPUT) || MYTEST) -
libpolys/polys/sparsmat.cc
r6c086a4 r750069 21 21 22 22 #include <coeffs/numbers.h> 23 #include "coeffrings.h"24 23 25 24 #include "monomials/ring.h" … … 2751 2750 { 2752 2751 ap->n = a->n; 2753 a->m = n_InpNeg(a->m,_R );2752 a->m = n_InpNeg(a->m,_R->cf); 2754 2753 b = b->n = a; 2755 2754 b->pos = i; … … 2761 2760 { 2762 2761 m_act[i] = a->n; 2763 a->m = n_InpNeg(a->m,_R );2762 a->m = n_InpNeg(a->m,_R->cf); 2764 2763 b = b->n = a; 2765 2764 b->pos = i; -
omalloc/omAllocDecl.h
r6c086a4 r750069 111 111 112 112 #if !defined(OM_T_FREE2) 113 #define omFreeSize(addr,size) _omDebugFree(addr,(void*)( size),OM_FSIZE|_OM_FKEEP,OM_CFL)114 #define omfreeSize(addr,size) _omDebugFree(addr,(void*)( size),OM_FSIZE|OM_FSLOPPY|_OM_FKEEP,OM_CFL)113 #define omFreeSize(addr,size) _omDebugFree(addr,(void*)(long)(size),OM_FSIZE|_OM_FKEEP,OM_CFL) 114 #define omfreeSize(addr,size) _omDebugFree(addr,(void*)(long)(size),OM_FSIZE|OM_FSLOPPY|_OM_FKEEP,OM_CFL) 115 115 #else 116 116 #define omFreeSize(addr,size) __omFreeSize(addr,size) -
omalloc/omBinPage.c
r6c086a4 r750069 348 348 { 349 349 unsigned long index_diff = high_index - low_index; 350 long i;351 350 omAssume(low_index <= high_index && 352 351 (high_index > om_MaxBinPageIndex || low_index < om_MinBinPageIndex)); … … 354 353 if (om_BinPageIndicies == NULL) 355 354 { 355 unsigned long i; 356 356 om_BinPageIndicies = (unsigned long*) omAllocFromSystem((index_diff + 1)*SIZEOF_LONG); 357 357 om_Info.InternalUsedBytesMalloc+=(index_diff + 1)*SIZEOF_LONG; … … 371 371 if (low_index < om_MinBinPageIndex) 372 372 { 373 long i; 373 374 unsigned long offset = new_length - old_length; 374 375 for (i=old_length - 1; i >= 0; i--) om_BinPageIndicies[i+offset] = om_BinPageIndicies[i]; 375 for (i= 0; i<offset; i++) om_BinPageIndicies[i] = 0;376 for (i=offset-1; i>=0; i--) om_BinPageIndicies[i] = 0; 376 377 om_MinBinPageIndex = low_index; 377 378 } 378 379 else 379 380 { 381 unsigned long i; 380 382 for (i=old_length; i<new_length; i++) om_BinPageIndicies[i] = 0; 381 383 om_MaxBinPageIndex = high_index;
Note: See TracChangeset
for help on using the changeset viewer.