Changeset be56124 in git


Ignore:
Timestamp:
Aug 28, 2013, 12:36:11 PM (11 years ago)
Author:
Oleksandr Motsak <motsak@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'b21a664aa22dc6e196223af8a74ad4885e83547c')
Children:
8f761ae82f2bae65cb1dee517949807fa5bea8bb
Parents:
fa601bae3b282a1d9ecb0b4cd31ebb37b467e9a42e416bb313f3d70371bd9a38ab5c86e29244f713
Message:
Merge pull request #347 from mmklee/finduni

Finduni
Files:
3 added
1 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • Tst/New.lst

    rfa601b rbe56124  
    11New/algext_numbers.tst
    22New/bigints.tst
     3New/finduni.tst
    34New/gf_coeff_short.tst
    45New/gf_fetch.tst
  • libpolys/coeffs/shortfl.cc

    rfa601b rbe56124  
    441441  mpf_init(e);
    442442  mpf_set_z(e,z);
     443  int sign= mpf_sgn(e);
     444  mpf_abs (e, e);
    443445
    444446  /* if number was an integer, we are done*/
     
    453455    signed long int exp;
    454456    basis = mpf_get_d_2exp(&exp, e);
    455     float f= mpf_sgn(e)*ldexp(basis,exp);
     457    float f= sign*ldexp(basis,exp);
    456458    mpf_clear(e);
    457459    return nf(f).N();
     
    479481  signed long int exp;
    480482  basis = mpf_get_d_2exp(&exp, q);
    481   float f = mpf_sgn(e)*ldexp(basis,exp);
     483  float f = sign*ldexp(basis,exp);
    482484  mpf_clear(e);
    483485  mpf_clear(d);
  • libpolys/polys/clapconv.cc

    rfa601b rbe56124  
    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

    rfa601b rbe56124  
    11561156
    11571157  if (IS0(a)) return;
     1158  if (NUM(f)!=NULL) p_Normalize(NUM(f), ntRing);
     1159  if (DEN(f)!=NULL) p_Normalize(DEN(f), ntRing);
    11581160  if (!simpleTestsHaveAlreadyBeenPerformed)
    11591161  {
    1160     p_Normalize(NUM(f), ntRing);
    1161     if (DEN(f)!=NULL) p_Normalize(DEN(f), ntRing);
     1162    //p_Normalize(NUM(f), ntRing);
     1163    //if (DEN(f)!=NULL) p_Normalize(DEN(f), ntRing);
    11621164    if (DENIS1(f) || NUMIS1(f)) { COM(f) = 0; return; }
    11631165
     
    11721174    }
    11731175  }
    1174   if (rField_is_Q(ntRing))
     1176  /*if (rField_is_Q(ntRing))
    11751177  {
    11761178    number c=n_Copy(pGetCoeff(NUM(f)),ntCoeffs);
     
    12241226      }
    12251227    }
    1226   }
     1228  }*/
    12271229
    12281230#ifdef HAVE_FACTORY
     
    12311233    pGcd = singclap_gcd_r(NUM(f), DEN(f), ntRing);
    12321234  if (p_IsConstant(pGcd, ntRing)
    1233   //&& n_IsOne(p_GetCoeff(pGcd, ntRing), ntCoeffs)
     1235  && n_IsOne(p_GetCoeff(pGcd, ntRing), ntCoeffs)
    12341236  )
    12351237  { /* gcd = 1; nothing to cancel;
     
    14001402  poly pb = p_Copy(DEN(fb), ntRing);
    14011403
     1404  poly pGcd;
     1405  if (nCoeff_is_Q(ntCoeffs))
     1406  {
     1407    if (p_IsConstant(pa,ntRing) && p_IsConstant(pb,ntRing))
     1408    {
     1409      pGcd = pa;
     1410      p_SetCoeff (pGcd, n_Gcd (pGetCoeff(pGcd), pGetCoeff(pb), ntCoeffs), ntRing);
     1411    }
     1412    else
     1413    {
     1414      number contentpa, contentpb, tmp;
     1415
     1416      contentpb= p_GetCoeff(pb, ntRing);
     1417      pIter(pb);
     1418      while (pb != NULL)
     1419      {
     1420        tmp = n_Gcd(contentpb, p_GetCoeff(pb, ntRing) , ntCoeffs);
     1421        n_Delete(&contentpb, ntCoeffs);
     1422        contentpb = tmp;
     1423        pIter(pb);
     1424      }
     1425
     1426      contentpa= p_GetCoeff(pa, ntRing);
     1427      pIter(pa);
     1428      while (pa != NULL)
     1429      {
     1430        tmp = n_Gcd(contentpa, p_GetCoeff(pa, ntRing), ntCoeffs);
     1431        n_Delete(&contentpa, ntCoeffs);
     1432        contentpa = tmp;
     1433        pIter(pa);
     1434      }
     1435
     1436      tmp= n_Gcd (contentpb, contentpa, ntCoeffs);
     1437      n_Delete(&contentpa, ntCoeffs);
     1438      n_Delete(&contentpb, ntCoeffs);
     1439      contentpa= tmp;
     1440      p_Delete(&pb, ntRing);
     1441      p_Delete(&pa, ntRing);
     1442
     1443      /* singclap_gcd destroys its arguments; we hence need copies: */
     1444      pGcd = singclap_gcd(p_Copy(NUM(fa),ntRing), p_Copy(DEN(fb),ntRing), ntRing);
     1445      pGcd= p_Mult_nn (pGcd, contentpa, ntRing);
     1446      n_Delete(&contentpa, ntCoeffs);
     1447    }
     1448  }
     1449  else
     1450    pGcd = singclap_gcd(pa, pb, cf->extRing);
     1451
    14021452  /* Note that, over Q, singclap_gcd will remove the denominators in all
    14031453     rational coefficients of pa and pb, before starting to compute
    14041454     the gcd. Thus, we do not need to ensure that the coefficients of
    14051455     pa and pb live in Z; they may well be elements of Q\Z. */
    1406   poly pGcd = singclap_gcd(pa, pb, ntRing);
     1456
    14071457  if (p_IsConstant(pGcd, ntRing) &&
    14081458      n_IsOne(p_GetCoeff(pGcd, ntRing), ntCoeffs))
     
    14421492  fraction fa = (fraction)a;
    14431493  fraction fb = (fraction)b;
    1444   /* singclap_gcd destroys its arguments; we hence need copies: */
     1494
    14451495  poly pa = p_Copy(NUM(fa), ntRing);
    14461496  poly pb = p_Copy(NUM(fb), ntRing);
    14471497
     1498  poly pGcd;
     1499  if (nCoeff_is_Q(ntCoeffs))
     1500  {
     1501    if (p_IsConstant(pa,ntRing) && p_IsConstant(pb,ntRing))
     1502    {
     1503      pGcd = pa;
     1504      p_SetCoeff (pGcd, n_Gcd (pGetCoeff(pGcd), pGetCoeff(pb), ntCoeffs), ntRing);
     1505    }
     1506    else
     1507    {
     1508      number contentpa, contentpb, tmp;
     1509
     1510      contentpb= p_GetCoeff(pb, ntRing);
     1511      pIter(pb);
     1512      while (pb != NULL)
     1513      {
     1514        tmp = n_Gcd(contentpb, p_GetCoeff(pb, ntRing) , ntCoeffs);
     1515        n_Delete(&contentpb, ntCoeffs);
     1516        contentpb = tmp;
     1517        pIter(pb);
     1518      }
     1519
     1520      contentpa= p_GetCoeff(pa, ntRing);
     1521      pIter(pa);
     1522      while (pa != NULL)
     1523      {
     1524        tmp = n_Gcd(contentpa, p_GetCoeff(pa, ntRing), ntCoeffs);
     1525        n_Delete(&contentpa, ntCoeffs);
     1526        contentpa = tmp;
     1527        pIter(pa);
     1528      }
     1529
     1530      tmp= n_Gcd (contentpb, contentpa, ntCoeffs);
     1531      n_Delete(&contentpa, ntCoeffs);
     1532      n_Delete(&contentpb, ntCoeffs);
     1533      contentpa= tmp;
     1534      p_Delete(&pb, ntRing);
     1535      p_Delete(&pa, ntRing);
     1536
     1537      /* singclap_gcd destroys its arguments; we hence need copies: */
     1538      pGcd = singclap_gcd(p_Copy(NUM(fa),ntRing), p_Copy(NUM(fb),ntRing), ntRing);
     1539      pGcd= p_Mult_nn (pGcd, contentpa, ntRing);
     1540      n_Delete(&contentpa, ntCoeffs);
     1541    }
     1542  }
     1543  else
     1544    pGcd = singclap_gcd(pa, pb, cf->extRing);
    14481545  /* Note that, over Q, singclap_gcd will remove the denominators in all
    14491546     rational coefficients of pa and pb, before starting to compute
    14501547     the gcd. Thus, we do not need to ensure that the coefficients of
    14511548     pa and pb live in Z; they may well be elements of Q\Z. */
    1452   poly pGcd = singclap_gcd(pa, pb, cf->extRing);
     1549
    14531550  fraction result = (fraction)omAlloc0Bin(fractionObjectBin);
    14541551  NUM(result) = pGcd;
  • libpolys/polys/monomials/p_polys.cc

    rfa601b rbe56124  
    21722172        n_Delete(&h,r->cf->extRing->cf);
    21732173      }
    2174       else
     2174      /*else
    21752175      {
    21762176      // special handling for rat. functions.:
     
    21962196        }
    21972197        /* hzz contains the gcd of all numerators in f*/
    2198         h=n_Invers(hzz,r->cf->extRing->cf);
     2198        /*h=n_Invers(hzz,r->cf->extRing->cf);
    21992199        n_Delete(&hzz,r->cf->extRing->cf);
    22002200        n_Normalize(h,r->cf->extRing->cf);
     
    22112211        }
    22122212        n_Delete(&h,r->cf->extRing->cf);
    2213       }
     2213      }*/
    22142214    }
    22152215  }
Note: See TracChangeset for help on using the changeset viewer.