Changeset 28216f in git


Ignore:
Timestamp:
Mar 14, 2012, 11:19:32 AM (12 years ago)
Author:
Martin Lee <martinlee84@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'd08f5f0bb3329b8ca19f23b74cb1473686415c3a')
Children:
6621678a043e06f4fb93c00a54b03b07aa6bfe29
Parents:
90f57ed16ec2e3fabfc8a64db7f2a9cb9bc85330
git-author:
Martin Lee <martinlee84@web.de>2012-03-14 11:19:32+01:00
git-committer:
Martin Lee <martinlee84@web.de>2012-03-14 14:53:43+01:00
Message:
fix: ntGetDenom & ntGetNumerator
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libpolys/polys/ext_fields/transext.cc

    r90f57e r28216f  
    247247  if (IS0(a)) return NULL;
    248248  fraction f = (fraction)a;
    249   poly g = p_Copy(NUM(f), ntRing);
    250249  fraction result = (fraction)omAlloc0Bin(fractionObjectBin);
    251   NUM(result) = g;
    252   DEN(result) = NULL;
    253   COM(result) = 0;
     250  BOOLEAN denis1= DENIS1 (f);
     251  if (getCoeffType (ntCoeffs) == n_Q && !denis1)
     252    handleNestedFractionsOverQ (f, cf);
     253  NUM (result)= p_Copy (NUM (f), ntRing);
     254  DEN (result) = NULL;
     255  COM (result) = 0;
     256  if (getCoeffType (ntCoeffs) == n_Q && denis1)
     257  {
     258    if (!p_IsConstant (NUM (result), ntRing) && pNext (NUM(result)) != NULL)
     259      p_Cleardenom (NUM(result), ntRing);
     260    else
     261    {
     262      number g= p_GetAllDenom (NUM (result), ntRing);
     263      NUM (result)= p_Mult_nn (NUM (result), g, ntRing);
     264    }
     265  }
    254266  return (number)result;
    255267}
     
    260272  definiteGcdCancellation(a, cf, FALSE);
    261273  fraction f = (fraction)a;
    262   poly g;
    263   if (IS0(f) || DENIS1(f)) g = p_One(ntRing);
    264   else g = p_Copy(DEN(f), ntRing);
    265274  fraction result = (fraction)omAlloc0Bin(fractionObjectBin);
    266   NUM(result) = g;
    267   DEN(result) = NULL;
    268   COM(result) = 0;
     275  number g;
     276  if (IS0(f) || (DENIS1 (f) && getCoeffType (ntCoeffs) != n_Q))
     277  {
     278    NUM (result)= p_One(ntRing);
     279    DEN (result)= NULL;
     280    COM (result)= 0;
     281  }
     282  else if (DENIS1 (f))
     283  {
     284    poly num= p_Copy (NUM (f), ntRing);
     285    if (!p_IsConstant (num, ntRing) && pNext(num) != NULL)
     286      p_Cleardenom_n (num, ntRing, g);
     287    else
     288      g= p_GetAllDenom (num, ntRing);
     289    result= (fraction) ntSetMap (ntRing->cf, cf) (g, ntRing->cf, cf);
     290  }
     291  else
     292  {
     293    if (getCoeffType (ntCoeffs) == n_Q)
     294      handleNestedFractionsOverQ (f, cf);
     295    NUM (result)= p_Copy (DEN (f), ntRing);
     296    DEN (result) = NULL;
     297    COM (result) = 0;
     298  }
    269299  return (number)result;
    270300}
     
    10491079  if (n_IsZero(a, src)) return NULL;
    10501080  assume(src == dst->extRing->cf);
    1051   poly p = p_One(dst->extRing);
     1081  poly p = p_Init(dst->extRing);
    10521082  number na=n_Copy(a, src);
    10531083  n_Normalize(na, src);
    1054   p_SetCoeff(p, na, dst->extRing);
     1084  p_SetCoeff0(p, na, dst->extRing);
    10551085  fraction f = (fraction)omAlloc0Bin(fractionObjectBin);
    10561086  NUM(f) = p; DEN(f) = NULL; COM(f) = 0;
Note: See TracChangeset for help on using the changeset viewer.