Ignore:
Timestamp:
Mar 5, 2013, 4:43:58 PM (10 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', '1d362c315e551a5b527ab0759f8839cf0e94f3a5')
Children:
803cb2d20d4037b513adf020767d48f6893fc9a2
Parents:
161e20729b9213f0aaa51ebeacdbd63260916ff6
Message:
fix: normalization for trans. ext.
File:
1 edited

Legend:

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

    r161e20 re5c9e5  
    152152    assume( _p_Test(den, ntRing,1) );
    153153
    154     if(p_IsConstant(den, ntRing) && (n_IsOne(pGetCoeff(den), ntRing->cf)))
     154    if(p_IsConstant(den, ntRing) && (n_IsOne(pGetCoeff(den), ntCoeffs)))
    155155    {
    156156      Print("?/1 in %s:%d\n",f,l);
     
    158158    }
    159159
    160     if( !n_GreaterZero(pGetCoeff(den), ntRing->cf) )
     160    if( !n_GreaterZero(pGetCoeff(den), ntCoeffs) )
    161161    {
    162162      Print("negative sign of DEN. of a fraction in %s:%d\n",f,l);
     
    300300
    301301
    302     n_ClearDenominators(itr, g, ntRing->cf);
    303 
    304     if( !n_GreaterZero(g, ntRing->cf) )
     302    n_ClearDenominators(itr, g, ntCoeffs);
     303
     304    if( !n_GreaterZero(g, ntCoeffs) )
    305305    {
    306306      NUM (f) = p_Neg(NUM (f), ntRing); // Ugly :(((
    307       g = n_Neg(g, ntRing->cf);
     307      g = n_Neg(g, ntCoeffs);
    308308    }
    309309
    310310    // g should be a positive integer now!
    311     assume( n_GreaterZero(g, ntRing->cf) );
    312 
    313     if( !n_IsOne(g, ntRing->cf) )
     311    assume( n_GreaterZero(g, ntCoeffs) );
     312
     313    if( !n_IsOne(g, ntCoeffs) )
    314314    {
    315315      DEN (f) = p_NSet(g, ntRing); // update COM(f)???
     
    318318    }
    319319    else
    320       n_Delete(&g, ntRing->cf);
     320      n_Delete(&g, ntCoeffs);
    321321
    322322    ntTest(a);
     
    386386  CPolyCoeffsEnumerator itr(NUM(f));
    387387
    388   n_ClearDenominators(itr, g, ntRing->cf); // may return -1 :(((
    389 
    390   if( !n_GreaterZero(g, ntRing->cf) )
     388  n_ClearDenominators(itr, g, ntCoeffs); // may return -1 :(((
     389
     390  if( !n_GreaterZero(g, ntCoeffs) )
    391391  {
    392392//     NUM (f) = p_Neg(NUM (f), ntRing); // Ugly :(((
    393 //     g = n_Neg(g, ntRing->cf);
     393//     g = n_Neg(g, ntCoeffs);
    394394    NUM (f) = p_Neg(NUM (f), ntRing); // Ugly :(((
    395     g = n_Neg(g, ntRing->cf);
     395    g = n_Neg(g, ntCoeffs);
    396396  }
    397397
    398398  // g should be a positive integer now!
    399   assume( n_GreaterZero(g, ntRing->cf) );
    400 
    401   if( !n_IsOne(g, ntRing->cf) )
    402   {
    403     assume( n_GreaterZero(g, ntRing->cf) );
    404     assume( !n_IsOne(g, ntRing->cf) );
     399  assume( n_GreaterZero(g, ntCoeffs) );
     400
     401  if( !n_IsOne(g, ntCoeffs) )
     402  {
     403    assume( n_GreaterZero(g, ntCoeffs) );
     404    assume( !n_IsOne(g, ntCoeffs) );
    405405
    406406    DEN (f) = p_NSet(g, ntRing); // update COM(f)???
     
    413413  { // common denom == 1?
    414414    NUM (result)= p_NSet(g, ntRing); // p_Copy (DEN (f), ntRing);
    415 //  n_Delete(&g, ntRing->cf);
     415//  n_Delete(&g, ntCoeffs);
    416416  }
    417417
     
    419419//    else
    420420//      g= p_GetAllDenom (num, ntRing);
    421 //    result= (fraction) ntSetMap (ntRing->cf, cf) (g, ntRing->cf, cf);
     421//    result= (fraction) ntSetMap (ntCoeffs, cf) (g, ntCoeffs, cf);
    422422
    423423  ntTest((number)result);
     
    533533  if (p == NULL) return NULL;
    534534
     535  fraction f = (fraction)omAlloc0Bin(fractionObjectBin);
     536
     537  if (nCoeff_is_Q(ntCoeffs))
     538  {
    535539    number g;
    536540    // TODO/NOTE: the following should not be necessary (due to
    537541    // Hannes!) as NUM (f) should be over Z!!!
     542    // but it is not: normalize it
    538543    CPolyCoeffsEnumerator itr(p);
    539544
    540     n_ClearDenominators(itr, g, ntRing->cf);
    541 
    542     if( !n_GreaterZero(g, ntRing->cf) )
    543     {
    544       p = p_Neg(p, ntRing); // Ugly :(((
    545       g = n_Neg(g, ntRing->cf);
     545    n_ClearDenominators(itr, g, ntCoeffs);
     546
     547    if( !n_GreaterZero(g, ntCoeffs) )
     548    {
     549      p = p_Neg(p, ntRing);
     550      g = n_Neg(g, ntCoeffs);
    546551    }
    547552
    548553    // g should be a positive integer now!
    549     assume( n_GreaterZero(g, ntRing->cf) );
    550 
    551     fraction f = (fraction)omAlloc0Bin(fractionObjectBin);
    552 
    553     if( !n_IsOne(g, ntRing->cf) )
     554    assume( n_GreaterZero(g, ntCoeffs) );
     555
     556    if( !n_IsOne(g, ntCoeffs) )
    554557    {
    555558      DEN (f) = p_NSet(g, ntRing);
    556 //      COM (f) ++; // update COM(f)???
    557559      assume( DEN (f) != NULL );
    558560    }
    559561    else
    560562    {
    561       DEN(f) = NULL;
    562       n_Delete(&g, ntRing->cf);
    563     }
    564 
    565     NUM(f) = p;
    566     COM(f) = 0;
    567 
    568     ntTest((number)f);
    569     return (number)f;
     563      //DEN(f) = NULL; // done by omAlloc0
     564      n_Delete(&g, ntCoeffs);
     565    }
     566  }
     567
     568  NUM(f) = p;
     569  COM(f) = 0;
     570
     571  ntTest((number)f);
     572  return (number)f;
    570573}
    571574
     
    633636  number aa;
    634637  number bb;
    635   if (bDenCoeff==NULL) aa=n_Copy(aNumCoeff,ntRing->cf);
    636   else                 aa=n_Mult(aNumCoeff,bDenCoeff,ntRing->cf);
    637   if (aDenCoeff==NULL) bb=n_Copy(bNumCoeff,ntRing->cf);
    638   else                 bb=n_Mult(bNumCoeff,aDenCoeff,ntRing->cf);
     638  if (bDenCoeff==NULL) aa=n_Copy(aNumCoeff,ntCoeffs);
     639  else                 aa=n_Mult(aNumCoeff,bDenCoeff,ntCoeffs);
     640  if (aDenCoeff==NULL) bb=n_Copy(bNumCoeff,ntCoeffs);
     641  else                 bb=n_Mult(bNumCoeff,aDenCoeff,ntCoeffs);
    639642  BOOLEAN rr= n_Greater(aa, bb, ntCoeffs);
    640   n_Delete(&aa,ntRing->cf);
    641   n_Delete(&bb,ntRing->cf);
     643  n_Delete(&aa,ntCoeffs);
     644  n_Delete(&bb,ntCoeffs);
    642645  return rr;
    643646}
     
    849852  fraction result = (fraction)omAlloc0Bin(fractionObjectBin);
    850853  NUM(result) = g;
    851   if (!n_GreaterZero(pGetCoeff(f),ntRing->cf))
     854  if (!n_GreaterZero(pGetCoeff(f),ntCoeffs))
    852855  {
    853856    g=p_Neg(g,ntRing);
     
    855858    NUM(result) = g;
    856859  }
    857   if (!p_IsConstant(f,ntRing) || !n_IsOne(pGetCoeff(f),ntRing->cf))
     860  if (!p_IsConstant(f,ntRing) || !n_IsOne(pGetCoeff(f),ntCoeffs))
    858861  {
    859862    DEN(result) = f;
     
    12821285    definiteGcdCancellation(a, cf, FALSE);
    12831286    if ((DEN(a)!=NULL)
    1284     &&(!n_GreaterZero(pGetCoeff(DEN(a)),ntRing->cf)))
     1287    &&(!n_GreaterZero(pGetCoeff(DEN(a)),ntCoeffs)))
    12851288    {
    12861289      NUM(a)=p_Neg(NUM(a),ntRing);
     
    14501453  {
    14511454    poly num_f=NUM(f);
    1452     BOOLEAN neg= !n_GreaterZero(pGetCoeff(num_f),ntRing->cf);
     1455    BOOLEAN neg= !n_GreaterZero(pGetCoeff(num_f),ntCoeffs);
    14531456    if (neg)
    14541457    {
Note: See TracChangeset for help on using the changeset viewer.