Changeset aa98be in git
- Timestamp:
- Sep 28, 2011, 3:14:16 PM (12 years ago)
- Branches:
- (u'spielwiese', '828514cf6e480e4bafc26df99217bf2a1ed1ef45')
- Children:
- 32cc7e437ee85bf7d555756eb824eadce50d50c7
- Parents:
- f3fb4d02b80a3234382e5318316d68fb66cc1f08
- git-author:
- Hans Schoenemann <hannes@mathematik.uni-kl.de>2011-09-28 15:14:16+02:00
- git-committer:
- Mohamed Barakat <mohamed.barakat@rwth-aachen.de>2011-11-09 16:13:41+01:00
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libpolys/polys/monomials/p_polys.cc
rf3fb4d raa98be 1958 1958 1959 1959 static number p_InitContent(poly ph, const ring r); 1960 static number p_InitContent_a(poly ph, const ring r);1961 1960 1962 1961 void p_Content(poly ph, const ring r) … … 2001 2000 { 2002 2001 h=p_InitContent(ph,r); 2003 p=ph;2004 }2005 else if (rField_is_Extension(r)2006 &&2007 (2008 (rPar(r)>1) || rMinpolyIsNULL(r)2009 )2010 )2011 {2012 h=p_InitContent_a(ph,r);2013 2002 p=ph; 2014 2003 } … … 2052 2041 n_Delete(&h,r->cf); 2053 2042 #ifdef HAVE_FACTORY 2054 if ( (n_GetChar(r) == 1) || (n_GetChar(r) < 0) ) /* Q[a],Q(a),Zp[a],Z/p(a) */2055 {2056 singclap_divide_content(ph, r);2057 if(!n_GreaterZero(pGetCoeff(ph),r->cf)) ph = p_Neg(ph,r);2058 }2043 // if ( (n_GetChar(r) == 1) || (n_GetChar(r) < 0) ) /* Q[a],Q(a),Zp[a],Z/p(a) */ 2044 // { 2045 // singclap_divide_content(ph, r); 2046 // if(!n_GreaterZero(pGetCoeff(ph),r->cf)) ph = p_Neg(ph,r); 2047 // } 2059 2048 #endif 2060 2049 if (rField_is_Q_a(r)) 2061 2050 { 2062 //number hzz = nlInit(1, r->cf); 2063 h = nlInit(1, r->cf); 2064 p=ph; 2065 Werror("longalg missing 1"); 2066 #if 0 2067 while (p!=NULL) 2068 { // each monom: coeff in Q_a 2069 lnumber c_n_n=(lnumber)pGetCoeff(p); 2070 poly c_n=c_n_n->z; 2071 while (c_n!=NULL) 2072 { // each monom: coeff in Q 2073 d=nlLcm(hzz,pGetCoeff(c_n),r->extRing->cf); 2074 n_Delete(&hzz,r->extRing->cf); 2075 hzz=d; 2076 pIter(c_n); 2077 } 2078 c_n=c_n_n->n; 2079 while (c_n!=NULL) 2080 { // each monom: coeff in Q 2081 d=nlLcm(h,pGetCoeff(c_n),r->extRing->cf); 2082 n_Delete(&h,r->extRing->cf); 2083 h=d; 2084 pIter(c_n); 2085 } 2086 pIter(p); 2087 } 2088 /* hzz contains the 1/lcm of all denominators in c_n_n->z*/ 2089 /* h contains the 1/lcm of all denominators in c_n_n->n*/ 2090 number htmp=nlInvers(h,r->extRing->cf); 2091 number hzztmp=nlInvers(hzz,r->extRing->cf); 2092 number hh=nlMult(hzz,h,r->extRing->cf); 2093 nlDelete(&hzz,r->extRing->cf); 2094 nlDelete(&h,r->extRing->cf); 2095 number hg=nlGcd(hzztmp,htmp,r->extRing->cf); 2096 nlDelete(&hzztmp,r->extRing->cf); 2097 nlDelete(&htmp,r->extRing->cf); 2098 h=nlMult(hh,hg,r->extRing->cf); 2099 nlDelete(&hg,r->extRing->cf); 2100 nlDelete(&hh,r->extRing->cf); 2101 nlNormalize(h,r->extRing->cf); 2102 if(!nlIsOne(h,r->extRing->cf)) 2103 { 2051 // we only need special handling for alg. ext. 2052 if (getCoeffType(r->cf)==n_algExt) 2053 { 2054 number hzz = n_Init(1, r->cf->extRing->cf); 2104 2055 p=ph; 2105 2056 while (p!=NULL) 2106 2057 { // each monom: coeff in Q_a 2107 lnumber c_n_n=(lnumber)pGetCoeff(p);2108 poly c_n=c_n_n ->z;2058 poly c_n_n=(poly)pGetCoeff(p); 2059 poly c_n=c_n_n; 2109 2060 while (c_n!=NULL) 2110 2061 { // each monom: coeff in Q 2111 d=nlMult(h,pGetCoeff(c_n),r->extRing->cf); 2112 nlNormalize(d,r->extRing->cf); 2113 nlDelete(&pGetCoeff(c_n),r->extRing->cf); 2114 pGetCoeff(c_n)=d; 2062 d=n_Lcm(hzz,pGetCoeff(c_n),r->cf->extRing->cf); 2063 n_Delete(&hzz,r->cf->extRing->cf); 2064 hzz=d; 2115 2065 pIter(c_n); 2116 2066 } 2117 c_n=c_n_n->n; 2118 while (c_n!=NULL) 2119 { // each monom: coeff in Q 2120 d=nlMult(h,pGetCoeff(c_n),r->extRing->cf); 2121 nlNormalize(d,r->extRing->cf); 2122 nlDelete(&pGetCoeff(c_n),r->extRing->cf); 2123 pGetCoeff(c_n)=d; 2124 pIter(c_n); 2067 } 2068 pIter(p); 2069 /* hzz contains the 1/lcm of all denominators in c_n_n*/ 2070 h=n_Invers(hzz,r->cf->extRing->cf); 2071 n_Delete(&hzz,r->cf->extRing->cf); 2072 n_Normalize(h,r->cf->extRing->cf); 2073 if(!n_IsOne(h,r->cf->extRing->cf)) 2074 { 2075 p=ph; 2076 while (p!=NULL) 2077 { // each monom: coeff in Q_a 2078 poly c_n=(poly)pGetCoeff(p); 2079 while (c_n!=NULL) 2080 { // each monom: coeff in Q 2081 d=n_Mult(h,pGetCoeff(c_n),r->cf->extRing->cf); 2082 n_Normalize(d,r->cf->extRing->cf); 2083 n_Delete(&pGetCoeff(c_n),r->cf->extRing->cf); 2084 pGetCoeff(c_n)=d; 2085 pIter(c_n); 2086 } 2087 pIter(p); 2125 2088 } 2126 pIter(p);2127 2089 } 2128 } 2129 nlDelete(&h,r->extRing->cf); 2130 #endif 2090 n_Delete(&h,r->cf->extRing->cf); 2091 } 2131 2092 } 2132 2093 } … … 2277 2238 } 2278 2239 #endif 2279 2280 number p_InitContent_a(poly ph, const ring r)2281 // only for coefficients in K(a)/<minpoly(a)> and K(t_1, t_2, ..., t_n)2282 {2283 number d=pGetCoeff(ph);2284 /* old: int s=n_ParDeg(d,r->cf); new: */2285 int s = p_Totaldegree((poly)d, r->cf->extRing);2286 if (s <=1) return n_Copy(d,r->cf);2287 int s2=-1;2288 number d2;2289 int ss;2290 loop2291 {2292 pIter(ph);2293 if(ph==NULL)2294 {2295 if (s2==-1) return n_Copy(d,r->cf);2296 break;2297 }2298 /* old: if ((ss=n_ParDeg(pGetCoeff(ph),r->cf))<s) new: */2299 if ((ss = p_Totaldegree((poly)pGetCoeff(ph), r->cf->extRing)) < s)2300 {2301 s2=s;2302 d2=d;2303 s=ss;2304 d=pGetCoeff(ph);2305 if (s2<=1) break;2306 }2307 }2308 return n_Gcd(d,d2,r->cf);2309 }2310 2311 2240 2312 2241 //void pContent(poly ph)
Note: See TracChangeset
for help on using the changeset viewer.