Changeset 8c676a in git


Ignore:
Timestamp:
Dec 7, 2012, 2:10:10 PM (11 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'b4f17ed1d25f93d46dbe29e4b499baecc2fd51bb')
Children:
6554ca42ebe1277c9afe7990970390905a6e1cf0
Parents:
7d62506924687f1914af2e044e72b7886ce66aa39f4478c6aeef3d7c745ba2ee7f65f37f65b2ade5
Message:
Merge pull request #221 from mmklee/sw_normalize_fix

Sw normalize fix
Location:
libpolys
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • libpolys/coeffs/longrat.cc

    r7d6250 r8c676a  
    25452545    if (mpz_cmp(tmp,P)<0)
    25462546    {
    2547        // return N/B
    2548        z=ALLOC_RNUMBER();
    2549        #ifdef LDEBUG
    2550        z->debug=123456;
    2551        #endif
    25522547       if (mpz_isNeg(B))
    25532548       {
     
    25552550         mpz_neg(N,N);
    25562551       }
    2557        mpz_init_set(z->z,N);
    2558        mpz_init_set(z->n,B);
    2559        z->s = 0;
    2560        nlNormalize(z,r);
     2552       // check for gcd(N,B)==1
     2553       mpz_gcd(tmp,N,B);
     2554       if (mpz_cmp_ui(tmp,1)==0)
     2555       {
     2556         // return N/B
     2557         z=ALLOC_RNUMBER();
     2558         #ifdef LDEBUG
     2559         z->debug=123456;
     2560         #endif
     2561         mpz_init_set(z->z,N);
     2562         mpz_init_set(z->n,B);
     2563         z->s = 0;
     2564         nlNormalize(z,r);
     2565       }
     2566       else
     2567       {
     2568         // return nN (the input) instead of "fail"
     2569         z=nlCopy(nN,r);
     2570       }
    25612571       break;
    25622572    }
  • libpolys/polys/ext_fields/transext.cc

    r7d6250 r8c676a  
    12391239void ntNormalize (number &a, const coeffs cf)
    12401240{
    1241   if ((a!=NULL)&&(DEN(a)!=NULL))
     1241  if ((a!=NULL))
    12421242  {
    12431243    definiteGcdCancellation(a, cf, FALSE);
     
    18621862    ntNormalize(n, cf);
    18631863
    1864     fraction f = (fraction)n;
     1864    fraction f = (fraction)ntGetDenom (n, cf);
    18651865
    18661866    assume( f != NULL );
    18671867
    1868     const poly den = DEN(f);
     1868    const poly den = NUM(f);
    18691869
    18701870    if( den == NULL ) // ?? / 1 ?
     
    18791879      // TODO: move the following to factory?
    18801880      poly gcd = singclap_gcd(p_Copy(cand, R), p_Copy(den, R), R); // gcd(cand, den) is monic no mater leading coeffs! :((((
     1881      if (nCoeff_is_Q (Q))
     1882      {
     1883        number LcGcd= n_Gcd (p_GetCoeff (cand, R), p_GetCoeff(den, R), Q);
     1884        gcd = p_Mult_nn(gcd, LcGcd, R);
     1885      }
    18811886//      assume( n_IsOne(pGetCoeff(gcd), Q) ); // TODO: this may be wrong...
    18821887      cand = p_Mult_q(cand, p_Copy(den, R), R); // cand *= den
  • libpolys/polys/monomials/p_polys.cc

    r7d6250 r8c676a  
    19081908static number p_InitContent(poly ph, const ring r);
    19091909
    1910 #define CLEARENUMERATORS 0
     1910#define CLEARENUMERATORS 1
    19111911
    19121912void p_Content(poly ph, const ring r)
Note: See TracChangeset for help on using the changeset viewer.