Changeset be56124 in git for libpolys/polys/ext_fields/transext.cc
- Timestamp:
- Aug 28, 2013, 12:36:11 PM (11 years ago)
- Branches:
- (u'spielwiese', '5b153614cbc72bfa198d75b1e9e33dab2645d9fe')
- Children:
- 8f761ae82f2bae65cb1dee517949807fa5bea8bb
- Parents:
- fa601bae3b282a1d9ecb0b4cd31ebb37b467e9a42e416bb313f3d70371bd9a38ab5c86e29244f713
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libpolys/polys/ext_fields/transext.cc
rfa601b rbe56124 1156 1156 1157 1157 if (IS0(a)) return; 1158 if (NUM(f)!=NULL) p_Normalize(NUM(f), ntRing); 1159 if (DEN(f)!=NULL) p_Normalize(DEN(f), ntRing); 1158 1160 if (!simpleTestsHaveAlreadyBeenPerformed) 1159 1161 { 1160 p_Normalize(NUM(f), ntRing);1161 if (DEN(f)!=NULL) p_Normalize(DEN(f), ntRing);1162 //p_Normalize(NUM(f), ntRing); 1163 //if (DEN(f)!=NULL) p_Normalize(DEN(f), ntRing); 1162 1164 if (DENIS1(f) || NUMIS1(f)) { COM(f) = 0; return; } 1163 1165 … … 1172 1174 } 1173 1175 } 1174 if (rField_is_Q(ntRing))1176 /*if (rField_is_Q(ntRing)) 1175 1177 { 1176 1178 number c=n_Copy(pGetCoeff(NUM(f)),ntCoeffs); … … 1224 1226 } 1225 1227 } 1226 } 1228 }*/ 1227 1229 1228 1230 #ifdef HAVE_FACTORY … … 1231 1233 pGcd = singclap_gcd_r(NUM(f), DEN(f), ntRing); 1232 1234 if (p_IsConstant(pGcd, ntRing) 1233 //&& n_IsOne(p_GetCoeff(pGcd, ntRing), ntCoeffs)1235 && n_IsOne(p_GetCoeff(pGcd, ntRing), ntCoeffs) 1234 1236 ) 1235 1237 { /* gcd = 1; nothing to cancel; … … 1400 1402 poly pb = p_Copy(DEN(fb), ntRing); 1401 1403 1404 poly pGcd; 1405 if (nCoeff_is_Q(ntCoeffs)) 1406 { 1407 if (p_IsConstant(pa,ntRing) && p_IsConstant(pb,ntRing)) 1408 { 1409 pGcd = pa; 1410 p_SetCoeff (pGcd, n_Gcd (pGetCoeff(pGcd), pGetCoeff(pb), ntCoeffs), ntRing); 1411 } 1412 else 1413 { 1414 number contentpa, contentpb, tmp; 1415 1416 contentpb= p_GetCoeff(pb, ntRing); 1417 pIter(pb); 1418 while (pb != NULL) 1419 { 1420 tmp = n_Gcd(contentpb, p_GetCoeff(pb, ntRing) , ntCoeffs); 1421 n_Delete(&contentpb, ntCoeffs); 1422 contentpb = tmp; 1423 pIter(pb); 1424 } 1425 1426 contentpa= p_GetCoeff(pa, ntRing); 1427 pIter(pa); 1428 while (pa != NULL) 1429 { 1430 tmp = n_Gcd(contentpa, p_GetCoeff(pa, ntRing), ntCoeffs); 1431 n_Delete(&contentpa, ntCoeffs); 1432 contentpa = tmp; 1433 pIter(pa); 1434 } 1435 1436 tmp= n_Gcd (contentpb, contentpa, ntCoeffs); 1437 n_Delete(&contentpa, ntCoeffs); 1438 n_Delete(&contentpb, ntCoeffs); 1439 contentpa= tmp; 1440 p_Delete(&pb, ntRing); 1441 p_Delete(&pa, ntRing); 1442 1443 /* singclap_gcd destroys its arguments; we hence need copies: */ 1444 pGcd = singclap_gcd(p_Copy(NUM(fa),ntRing), p_Copy(DEN(fb),ntRing), ntRing); 1445 pGcd= p_Mult_nn (pGcd, contentpa, ntRing); 1446 n_Delete(&contentpa, ntCoeffs); 1447 } 1448 } 1449 else 1450 pGcd = singclap_gcd(pa, pb, cf->extRing); 1451 1402 1452 /* Note that, over Q, singclap_gcd will remove the denominators in all 1403 1453 rational coefficients of pa and pb, before starting to compute 1404 1454 the gcd. Thus, we do not need to ensure that the coefficients of 1405 1455 pa and pb live in Z; they may well be elements of Q\Z. */ 1406 poly pGcd = singclap_gcd(pa, pb, ntRing); 1456 1407 1457 if (p_IsConstant(pGcd, ntRing) && 1408 1458 n_IsOne(p_GetCoeff(pGcd, ntRing), ntCoeffs)) … … 1442 1492 fraction fa = (fraction)a; 1443 1493 fraction fb = (fraction)b; 1444 /* singclap_gcd destroys its arguments; we hence need copies: */ 1494 1445 1495 poly pa = p_Copy(NUM(fa), ntRing); 1446 1496 poly pb = p_Copy(NUM(fb), ntRing); 1447 1497 1498 poly pGcd; 1499 if (nCoeff_is_Q(ntCoeffs)) 1500 { 1501 if (p_IsConstant(pa,ntRing) && p_IsConstant(pb,ntRing)) 1502 { 1503 pGcd = pa; 1504 p_SetCoeff (pGcd, n_Gcd (pGetCoeff(pGcd), pGetCoeff(pb), ntCoeffs), ntRing); 1505 } 1506 else 1507 { 1508 number contentpa, contentpb, tmp; 1509 1510 contentpb= p_GetCoeff(pb, ntRing); 1511 pIter(pb); 1512 while (pb != NULL) 1513 { 1514 tmp = n_Gcd(contentpb, p_GetCoeff(pb, ntRing) , ntCoeffs); 1515 n_Delete(&contentpb, ntCoeffs); 1516 contentpb = tmp; 1517 pIter(pb); 1518 } 1519 1520 contentpa= p_GetCoeff(pa, ntRing); 1521 pIter(pa); 1522 while (pa != NULL) 1523 { 1524 tmp = n_Gcd(contentpa, p_GetCoeff(pa, ntRing), ntCoeffs); 1525 n_Delete(&contentpa, ntCoeffs); 1526 contentpa = tmp; 1527 pIter(pa); 1528 } 1529 1530 tmp= n_Gcd (contentpb, contentpa, ntCoeffs); 1531 n_Delete(&contentpa, ntCoeffs); 1532 n_Delete(&contentpb, ntCoeffs); 1533 contentpa= tmp; 1534 p_Delete(&pb, ntRing); 1535 p_Delete(&pa, ntRing); 1536 1537 /* singclap_gcd destroys its arguments; we hence need copies: */ 1538 pGcd = singclap_gcd(p_Copy(NUM(fa),ntRing), p_Copy(NUM(fb),ntRing), ntRing); 1539 pGcd= p_Mult_nn (pGcd, contentpa, ntRing); 1540 n_Delete(&contentpa, ntCoeffs); 1541 } 1542 } 1543 else 1544 pGcd = singclap_gcd(pa, pb, cf->extRing); 1448 1545 /* Note that, over Q, singclap_gcd will remove the denominators in all 1449 1546 rational coefficients of pa and pb, before starting to compute 1450 1547 the gcd. Thus, we do not need to ensure that the coefficients of 1451 1548 pa and pb live in Z; they may well be elements of Q\Z. */ 1452 poly pGcd = singclap_gcd(pa, pb, cf->extRing); 1549 1453 1550 fraction result = (fraction)omAlloc0Bin(fractionObjectBin); 1454 1551 NUM(result) = pGcd;
Note: See TracChangeset
for help on using the changeset viewer.