Ignore:
Timestamp:
May 20, 2011, 1:07:49 PM (13 years ago)
Author:
Frank Seelisch <seelisch@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'd25190065115c859833252500a64cfb7b11e3a50')
Children:
502f5f6f3100e91a41cf8b3762727582bcdcc2fa
Parents:
09ed7738e7d4dd96c01950a6f0736d8581f333d2
git-author:
Frank Seelisch <seelisch@mathematik.uni-kl.de>2011-05-20 13:07:49+02:00
git-committer:
Mohamed Barakat <mohamed.barakat@rwth-aachen.de>2011-11-09 12:36:13+01:00
Message:
ending tests for alg field ext impl (all tests ok)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libpolys/polys/monomials/p_polys.cc

    r09ed77 rcfb500  
    14451445poly p_PolyDiv(poly &p, poly divisor, BOOLEAN needResult, ring r)
    14461446{
    1447 //printf("p_PolyDiv:\n");
    14481447  assume(divisor != NULL);
    14491448  if (p == NULL) return NULL;
     
    14521451  number divisorLC = p_GetCoeff(divisor, r);
    14531452  int divisorLE = p_GetExp(divisor, 1, r);
    1454 //p_Write(p, r); p_Write(divisor, r);
    14551453  while ((p != NULL) && (p_Deg(p, r) >= p_Deg(divisor, r)))
    14561454  {
     
    14621460    p_SetExp(t, 1, e, r);
    14631461    p_Setm(t, r);
    1464 //printf("t\n");
    1465 //p_Write(t, r);
    14661462    if (needResult) result = p_Add_q(result, p_Copy(t, r), r);
    14671463    p = p_Add_q(p, p_Neg(p_Mult_q(t, p_Copy(divisor, r), r), r), r);
    1468 //printf("p\n");
    1469 //p_Write(p, r);
    14701464  }
    14711465  return result;
     
    14831477  number lc = p_GetCoeff(p, r);
    14841478  if (n_IsOne(lc, r->cf)) return;
    1485 
    1486   if( pNext(p) == NULL )
    1487   {
    1488      p_SetCoeff(p, n_Init(1, r->cf), r); // will delete the leading coeff 1st!
    1489      return;
    1490   }
    1491    
    1492   // TODO: consider unsing 1xn_Inverse + n_Mult instead of multiple n_Div
    1493   p_SetCoeff0(p, n_Init(1, r->cf), r); // no coeff destruction!
    1494    
     1479  number lcInverse = n_Invers(lc, r->cf);
     1480  number n = n_Init(1, r->cf);
     1481  p_SetCoeff(p, n, r);   // destroys old leading coefficient!
    14951482  p = pIter(p);
    1496    
    14971483  while (p != NULL)
    14981484  {
    1499     number c = p_GetCoeff(p, r);
    1500     number n = n_Div(c, lc, r->cf);
    1501     n_Delete(&c, r->cf);
    1502     p_SetCoeff(p, n, r);
     1485    number n = n_Mult(p_GetCoeff(p, r), lcInverse, r->cf);
     1486    p_SetCoeff(p, n, r);   // destroys old leading coefficient!
    15031487    p = pIter(p);
    15041488  }
    1505   n_Delete(&lc, r->cf);
     1489  n_Delete(&lcInverse, r->cf);
    15061490  p = pp;
    15071491}
     
    15521536    qFactor = NULL;
    15531537    pFactor = p_ISet(1, r);
    1554     number n = p_GetCoeff(pFactor, r);
    1555 //printf("p_ExtGcdHelper0:\n");
    1556 //p_Write(p, r);
    15571538    p_SetCoeff(pFactor, n_Invers(p_GetCoeff(p, r), r->cf), r);
    1558     n_Delete(&n, r->cf);
    15591539    p_Monic(p, r);
    15601540    return p;
     
    15621542  else
    15631543  {
    1564 //printf("p_ExtGcdHelper1:\n");
    1565 //p_Write(p, r); p_Write(q, r);
    15661544    poly pDivQ = p_PolyDiv(p, q, TRUE, r);
    15671545    poly ppFactor = NULL; poly qqFactor = NULL;
    1568 //printf("p_ExtGcdHelper2:\n");
    1569 //p_Write(p, r); p_Write(ppFactor, r);
    1570 //p_Write(q, r); p_Write(qqFactor, r);
    15711546    poly theGcd = p_ExtGcdHelper(q, qqFactor, p, ppFactor, r);
    1572 //printf("p_ExtGcdHelper3:\n");
    1573 //p_Write(q, r); p_Write(qqFactor, r);
    1574 //p_Write(p, r); p_Write(ppFactor, r);
    1575 //p_Write(theGcd, r);
    15761547    pFactor = ppFactor;
    15771548    qFactor = p_Add_q(qqFactor,
    15781549                      p_Neg(p_Mult_q(pDivQ, p_Copy(ppFactor, r), r), r),
    15791550                      r);
    1580 //printf("p_ExtGcdHelper4:\n");
    1581 //p_Write(pFactor, r); p_Write(qFactor, r);
    15821551    return theGcd;
    15831552  }
     
    15941563poly p_ExtGcd(poly p, poly &pFactor, poly q, poly &qFactor, ring r)
    15951564{
    1596 //printf("p_ExtGcd1:\n");
    1597 //p_Write(p, r); p_Write(q, r);
    15981565  assume((p != NULL) || (q != NULL)); 
    15991566  poly a = p; poly b = q; BOOLEAN aCorrespondsToP = TRUE;
Note: See TracChangeset for help on using the changeset viewer.