Changeset 2de7b0 in git for libpolys/polys
- Timestamp:
- Sep 13, 2013, 10:38:22 AM (11 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- 57f6787143191ee820fea3fb30b759d7708dc7fc
- Parents:
- 7627f67da8dc2c135f659c4e3f2ef25e3de4f00e
- Location:
- libpolys/polys
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
libpolys/polys/clapsing.cc
r7627f6 r2de7b0 147 147 } 148 148 149 voidsingclap_gcd_and_divide ( poly& f, poly& g, const ring r)149 poly singclap_gcd_and_divide ( poly& f, poly& g, const ring r) 150 150 { 151 151 poly res=NULL; 152 152 153 if (f!=NULL) p_Cleardenom(f, r); 154 if (g!=NULL) p_Cleardenom(g, r); 155 else return; // g==0 => but do a p_Cleardenom(f) 156 if (f==NULL) return; // f==0 => but do a p_Cleardenom(g) 153 if (g == NULL) 154 { 155 res= p_Copy (f,r); 156 p_Delete (&f, r); 157 f=p_One (r); 158 return res; 159 } 160 if (f==NULL) 161 { 162 res= p_Copy (g,r); 163 p_Delete (&g, r); 164 g=p_One (r); 165 return res; 166 } 157 167 158 168 Off(SW_RATIONAL); … … 169 179 p_Delete(&f,r); 170 180 p_Delete(&g,r); 181 if (getCharacteristic() == 0) 182 On (SW_RATIONAL); 171 183 f=convFactoryPSingP( F/GCD, r); 172 184 g=convFactoryPSingP( G/GCD, r); 173 185 } 186 res=convFactoryPSingP( GCD , r); 174 187 if (!b1) Off (SW_USE_EZGCD_P); 175 188 } … … 193 206 p_Delete(&f,r); 194 207 p_Delete(&g,r); 208 if (getCharacteristic() == 0) 209 On (SW_RATIONAL); 195 210 f= convFactoryAPSingAP( F/GCD,r ); 196 211 g= convFactoryAPSingAP( G/GCD,r ); 197 212 } 213 res= convFactoryAPSingAP( GCD,r ); 198 214 if (!b1) Off(SW_USE_QGCD); 199 215 } … … 207 223 p_Delete(&f,r); 208 224 p_Delete(&g,r); 225 if (getCharacteristic() == 0) 226 On (SW_RATIONAL); 209 227 f= convFactoryPSingTrP( F/GCD,r ); 210 228 g= convFactoryPSingTrP( G/GCD,r ); 211 229 } 230 res= convFactoryPSingTrP( GCD,r ); 212 231 } 213 232 } … … 215 234 WerrorS( feNotImplemented ); 216 235 Off(SW_RATIONAL); 236 return res; 217 237 } 218 238 -
libpolys/polys/clapsing.h
r7627f6 r2de7b0 33 33 34 34 /// clears denominators of f and g, divides by gcd(f,g) 35 voidsingclap_gcd_and_divide ( poly& f, poly& g, const ring r);35 poly singclap_gcd_and_divide ( poly& f, poly& g, const ring r); 36 36 37 37 // commented out! -
libpolys/polys/ext_fields/transext.cc
r7627f6 r2de7b0 1377 1377 1378 1378 #ifdef HAVE_FACTORY 1379 poly pGcd;1380 1379 /* here we assume: NUM(f), DEN(f) !=NULL, in Z_a reqp. Z/p_a */ 1381 pGcd = singclap_gcd_r(NUM(f), DEN(f), ntRing);1380 poly pGcd = singclap_gcd_and_divide(NUM(f), DEN(f), ntRing); 1382 1381 if (p_IsConstant(pGcd, ntRing) 1383 1382 && n_IsOne(p_GetCoeff(pGcd, ntRing), ntCoeffs) … … 1391 1390 { 1392 1391 NUM (f) = p_Div_nn (NUM (f), p_GetCoeff (DEN(f),ntRing), ntRing); 1393 //poly newNum= singclap_pdivide (NUM(f), DEN (f), ntRing);1394 //p_Delete(&NUM (f), ntRing);1395 //NUM (f)= newNum;1396 1392 p_Delete(&DEN (f), ntRing); 1397 1393 DEN (f) = NULL; … … 1402 1398 { /* We divide both NUM(f) and DEN(f) by the gcd which is known 1403 1399 to be != 1. */ 1404 poly newNum = singclap_pdivide(NUM(f), pGcd, ntRing);1405 p_Delete(&NUM(f), ntRing);1406 NUM(f) = newNum;1407 poly newDen = singclap_pdivide(DEN(f), pGcd, ntRing);1408 p_Delete(&DEN(f), ntRing);1409 DEN(f) = newDen;1410 1400 if (p_IsConstant(DEN(f), ntRing) && 1411 1401 n_IsOne(p_GetCoeff(DEN(f), ntRing), ntCoeffs)) … … 1413 1403 /* DEN(f) = 1 needs to be represented by NULL! */ 1414 1404 p_Delete(&DEN(f), ntRing); 1415 newDen= NULL;1405 DEN(f) = NULL; 1416 1406 } 1417 1407 else … … 1420 1410 call will remove those nested fractions, in case there are 1421 1411 any. */ 1422 if (nCoeff_is_Q(ntCoeffs)) handleNestedFractionsOverQ(f, cf); 1412 if (nCoeff_is_Zp(ntCoeffs) && p_IsConstant (DEN (f), ntRing)) 1413 { 1414 NUM (f) = p_Div_nn (NUM (f), p_GetCoeff (DEN(f),ntRing), ntRing); 1415 p_Delete(&DEN (f), ntRing); 1416 DEN (f) = NULL; 1417 COM (f) = 0; 1418 } else if (nCoeff_is_Q(ntCoeffs)) handleNestedFractionsOverQ(f, cf); 1423 1419 } 1424 1420 }
Note: See TracChangeset
for help on using the changeset viewer.