Changeset 0635d51 in git for libpolys/polys/ext_fields/transext.cc
- Timestamp:
- Aug 22, 2013, 2:53:44 PM (10 years ago)
- Branches:
- (u'spielwiese', '0d6b7fcd9813a1ca1ed4220cfa2b104b97a0a003')
- Children:
- 14a0ca748a86d906ecfcc3974abcd59a741ad988
- Parents:
- f30df9db738239b192f944fedcdb9cc8322795e1
- git-author:
- Martin Lee <martinlee84@web.de>2013-08-22 14:53:44+02:00
- git-committer:
- Martin Lee <martinlee84@web.de>2013-08-23 13:38:20+02:00
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libpolys/polys/ext_fields/transext.cc
rf30df9 r0635d51 1400 1400 poly pb = p_Copy(DEN(fb), ntRing); 1401 1401 1402 poly pGcd; 1403 if (nCoeff_is_Q(ntCoeffs)) 1404 { 1405 if (p_IsConstant(pa,ntRing) && p_IsConstant(pb,ntRing)) 1406 { 1407 pGcd = pa; 1408 p_SetCoeff (pGcd, n_Gcd (pGetCoeff(pGcd), pGetCoeff(pb), ntCoeffs), ntRing); 1409 } 1410 else 1411 { 1412 number contentpa, contentpb, tmp; 1413 1414 contentpb= p_GetCoeff(pb, ntRing); 1415 pIter(pb); 1416 while (pb != NULL) 1417 { 1418 tmp = n_Gcd(contentpb, p_GetCoeff(pb, ntRing) , ntCoeffs); 1419 n_Delete(&contentpb, ntCoeffs); 1420 contentpb = tmp; 1421 pIter(pb); 1422 } 1423 1424 contentpa= p_GetCoeff(pa, ntRing); 1425 pIter(pa); 1426 while (pa != NULL) 1427 { 1428 tmp = n_Gcd(contentpa, p_GetCoeff(pa, ntRing), ntCoeffs); 1429 n_Delete(&contentpa, ntCoeffs); 1430 contentpa = tmp; 1431 pIter(pa); 1432 } 1433 1434 tmp= n_Gcd (contentpb, contentpa, ntCoeffs); 1435 n_Delete(&contentpa, ntCoeffs); 1436 n_Delete(&contentpb, ntCoeffs); 1437 contentpa= tmp; 1438 p_Delete(&pb, ntRing); 1439 p_Delete(&pa, ntRing); 1440 1441 /* singclap_gcd destroys its arguments; we hence need copies: */ 1442 pGcd = singclap_gcd(p_Copy(NUM(fa),ntRing), p_Copy(DEN(fb),ntRing), ntRing); 1443 pGcd= p_Mult_nn (pGcd, contentpa, ntRing); 1444 n_Delete(&contentpa, ntCoeffs); 1445 } 1446 } 1447 else 1448 pGcd = singclap_gcd(pa, pb, cf->extRing); 1449 1402 1450 /* Note that, over Q, singclap_gcd will remove the denominators in all 1403 1451 rational coefficients of pa and pb, before starting to compute 1404 1452 the gcd. Thus, we do not need to ensure that the coefficients of 1405 1453 pa and pb live in Z; they may well be elements of Q\Z. */ 1406 poly pGcd = singclap_gcd(pa, pb, ntRing); 1454 1407 1455 if (p_IsConstant(pGcd, ntRing) && 1408 1456 n_IsOne(p_GetCoeff(pGcd, ntRing), ntCoeffs)) … … 1442 1490 fraction fa = (fraction)a; 1443 1491 fraction fb = (fraction)b; 1444 /* singclap_gcd destroys its arguments; we hence need copies: */ 1492 1445 1493 poly pa = p_Copy(NUM(fa), ntRing); 1446 1494 poly pb = p_Copy(NUM(fb), ntRing); 1447 1495 1496 poly pGcd; 1497 if (nCoeff_is_Q(ntCoeffs)) 1498 { 1499 if (p_IsConstant(pa,ntRing) && p_IsConstant(pb,ntRing)) 1500 { 1501 pGcd = pa; 1502 p_SetCoeff (pGcd, n_Gcd (pGetCoeff(pGcd), pGetCoeff(pb), ntCoeffs), ntRing); 1503 } 1504 else 1505 { 1506 number contentpa, contentpb, tmp; 1507 1508 contentpb= p_GetCoeff(pb, ntRing); 1509 pIter(pb); 1510 while (pb != NULL) 1511 { 1512 tmp = n_Gcd(contentpb, p_GetCoeff(pb, ntRing) , ntCoeffs); 1513 n_Delete(&contentpb, ntCoeffs); 1514 contentpb = tmp; 1515 pIter(pb); 1516 } 1517 1518 contentpa= p_GetCoeff(pa, ntRing); 1519 pIter(pa); 1520 while (pa != NULL) 1521 { 1522 tmp = n_Gcd(contentpa, p_GetCoeff(pa, ntRing), ntCoeffs); 1523 n_Delete(&contentpa, ntCoeffs); 1524 contentpa = tmp; 1525 pIter(pa); 1526 } 1527 1528 tmp= n_Gcd (contentpb, contentpa, ntCoeffs); 1529 n_Delete(&contentpa, ntCoeffs); 1530 n_Delete(&contentpb, ntCoeffs); 1531 contentpa= tmp; 1532 p_Delete(&pb, ntRing); 1533 p_Delete(&pa, ntRing); 1534 1535 /* singclap_gcd destroys its arguments; we hence need copies: */ 1536 pGcd = singclap_gcd(p_Copy(NUM(fa),ntRing), p_Copy(NUM(fb),ntRing), ntRing); 1537 pGcd= p_Mult_nn (pGcd, contentpa, ntRing); 1538 n_Delete(&contentpa, ntCoeffs); 1539 } 1540 } 1541 else 1542 pGcd = singclap_gcd(pa, pb, cf->extRing); 1448 1543 /* Note that, over Q, singclap_gcd will remove the denominators in all 1449 1544 rational coefficients of pa and pb, before starting to compute 1450 1545 the gcd. Thus, we do not need to ensure that the coefficients of 1451 1546 pa and pb live in Z; they may well be elements of Q\Z. */ 1452 poly pGcd = singclap_gcd(pa, pb, cf->extRing); 1547 1453 1548 fraction result = (fraction)omAlloc0Bin(fractionObjectBin); 1454 1549 NUM(result) = pGcd;
Note: See TracChangeset
for help on using the changeset viewer.