Changeset 0635d51 in git


Ignore:
Timestamp:
Aug 22, 2013, 2:53:44 PM (10 years ago)
Author:
Martin Lee <martinlee84@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'f875bbaccd0831e36aaed09ff6adeb3eb45aeb94')
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
Message:
fix: missing content over Z in ntLcm, ntGcd
Location:
libpolys/polys
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • libpolys/polys/clapconv.cc

    rf30df9 r0635d51  
    323323
    324324    // test if denominator is constant
    325     if (!p_IsConstantPoly(DEN (p_GetCoeff (p,r)),r) && !errorreported)
     325    if (!p_IsConstantPoly(DEN (p_GetCoeff (p,r)),r->cf->extRing) && !errorreported)
    326326      WerrorS("conversion error: denominator!= 1");
    327327
  • libpolys/polys/ext_fields/transext.cc

    rf30df9 r0635d51  
    14001400  poly pb = p_Copy(DEN(fb), ntRing);
    14011401
     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
    14021450  /* Note that, over Q, singclap_gcd will remove the denominators in all
    14031451     rational coefficients of pa and pb, before starting to compute
    14041452     the gcd. Thus, we do not need to ensure that the coefficients of
    14051453     pa and pb live in Z; they may well be elements of Q\Z. */
    1406   poly pGcd = singclap_gcd(pa, pb, ntRing);
     1454
    14071455  if (p_IsConstant(pGcd, ntRing) &&
    14081456      n_IsOne(p_GetCoeff(pGcd, ntRing), ntCoeffs))
     
    14421490  fraction fa = (fraction)a;
    14431491  fraction fb = (fraction)b;
    1444   /* singclap_gcd destroys its arguments; we hence need copies: */
     1492
    14451493  poly pa = p_Copy(NUM(fa), ntRing);
    14461494  poly pb = p_Copy(NUM(fb), ntRing);
    14471495
     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);
    14481543  /* Note that, over Q, singclap_gcd will remove the denominators in all
    14491544     rational coefficients of pa and pb, before starting to compute
    14501545     the gcd. Thus, we do not need to ensure that the coefficients of
    14511546     pa and pb live in Z; they may well be elements of Q\Z. */
    1452   poly pGcd = singclap_gcd(pa, pb, cf->extRing);
     1547
    14531548  fraction result = (fraction)omAlloc0Bin(fractionObjectBin);
    14541549  NUM(result) = pGcd;
Note: See TracChangeset for help on using the changeset viewer.