Changeset 05c60b2 in git for libpolys


Ignore:
Timestamp:
May 30, 2014, 3:42:06 PM (10 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'b4f17ed1d25f93d46dbe29e4b499baecc2fd51bb')
Children:
75424e3a56f41323abd6d3f9936e00e102ff6a6d
Parents:
d9dfcea84bd0d2eb3427c96d4f714a02c904ad87
Message:
toward poly as number
Location:
libpolys
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • libpolys/coeffs/numbers.cc

    rd9dfce r05c60b2  
    413413    assume(n->cfInpNeg!=NULL);
    414414    assume(n->cfCopy!=NULL);
    415     assume(n->cfRePart!=NULL);
    416     assume(n->cfImPart!=NULL);
    417415
    418416    assume(n->cfWriteLong!=NULL);
  • libpolys/polys/ext_fields/algext.cc

    rd9dfce r05c60b2  
    9898void     naWriteLong(number &a, const coeffs cf);
    9999void     naWriteShort(number &a, const coeffs cf);
    100 number   naRePart(number a, const coeffs cf);
    101 number   naImPart(number a, const coeffs cf);
    102100number   naGetDenom(number &a, const coeffs cf);
    103101number   naGetNumerator(number &a, const coeffs cf);
     
    248246BOOLEAN naDBTest(number a, const char *f, const int l, const coeffs cf)
    249247{
    250   assume(getCoeffType(cf) == ID);
    251248  if (a == NULL) return TRUE;
    252249  p_Test((poly)a, naRing);
    253   if((((poly)a)!=naMinpoly)
    254   && p_Totaldegree((poly)a, naRing) >= p_Totaldegree(naMinpoly, naRing)
    255   && (p_Totaldegree((poly)a, naRing)> 1)) // allow to output par(1)
    256   {
    257     dReportError("deg >= deg(minpoly) in %s:%d\n",f,l);
    258     return FALSE;
     250  if (getCoeffType(cf)==n_algExt)
     251  {
     252    if((((poly)a)!=naMinpoly)
     253    && p_Totaldegree((poly)a, naRing) >= p_Totaldegree(naMinpoly, naRing)
     254    && (p_Totaldegree((poly)a, naRing)> 1)) // allow to output par(1)
     255    {
     256      dReportError("deg >= deg(minpoly) in %s:%d\n",f,l);
     257      return FALSE;
     258    }
    259259  }
    260260  return TRUE;
     
    348348  if (a != NULL) a = (number)p_Neg((poly)a, naRing);
    349349  return a;
    350 }
    351 
    352 number naImPart(number a, const coeffs cf)
    353 {
    354   naTest(a);
    355   return NULL;
    356350}
    357351
     
    486480  poly aPlusB = p_Add_q(p_Copy((poly)a, naRing),
    487481                        p_Copy((poly)b, naRing), naRing);
    488   definiteReduce(aPlusB, naMinpoly, cf);
     482  //definiteReduce(aPlusB, naMinpoly, cf);
    489483  return (number)aPlusB;
    490484}
     
    497491  if (a == NULL) return (number)minusB;
    498492  poly aMinusB = p_Add_q(p_Copy((poly)a, naRing), minusB, naRing);
    499   definiteReduce(aMinusB, naMinpoly, cf);
     493  //definiteReduce(aMinusB, naMinpoly, cf);
    500494  return (number)aMinusB;
    501495}
     
    724718static BOOLEAN naCoeffIsEqual(const coeffs cf, n_coeffType n, void * param)
    725719{
    726   if (ID != n) return FALSE;
     720  if (n_algExt != n) return FALSE;
    727721  AlgExtInfo *e = (AlgExtInfo *)param;
    728722  /* for extension coefficient fields we expect the underlying
     
    14211415  e->r->ref ++; // increase the ref.counter for the ground poly. ring!
    14221416  const ring R = e->r; // no copy!
    1423   assume( R->qideal == e->r->qideal );
    14241417  cf->extRing  = R;
    14251418
     
    14451438  cf->cfChineseRemainder= naChineseRemainder;
    14461439  cf->cfInt          = naInt;
    1447   cf->cfInpNeg          = naNeg;
     1440  cf->cfInpNeg       = naNeg;
    14481441  cf->cfAdd          = naAdd;
    14491442  cf->cfSub          = naSub;
     
    14671460  cf->cfGetNumerator = naGetNumerator;
    14681461  cf->cfRePart       = naCopy;
    1469   cf->cfImPart       = naImPart;
    14701462  cf->cfCoeffWrite   = naCoeffWrite;
    14711463  cf->cfNormalize    = naNormalize;
     
    15031495template class IAccessor<snumber*>;
    15041496
     1497/* --------------------------------------------------------------------*/
     1498#if 0
     1499void npolyCoeffWrite(const coeffs cf, BOOLEAN details)
     1500{
     1501  assume( cf != NULL );
     1502
     1503  const ring A = cf->extRing;
     1504
     1505  assume( A != NULL );
     1506  Print("// polynomial ring as coefficient ring :\n");
     1507  rWrite(A);
     1508  PrintLn();
     1509}
     1510number npolyMult(number a, number b, const coeffs cf)
     1511{
     1512  naTest(a); naTest(b);
     1513  if ((a == NULL)||(b == NULL)) return NULL;
     1514  poly aTimesB = p_Mult_q(p_Copy((poly)a, naRing),
     1515                          p_Copy((poly)b, naRing), naRing);
     1516  return (number)aTimesB;
     1517}
     1518
     1519number npolyDiv(number a, number b, const coeffs cf)
     1520{
     1521  naTest(a); naTest(b);
     1522  if (b == NULL) WerrorS(nDivBy0);
     1523  if (a == NULL) return NULL;
     1524  poly p=singclap_pdivide((poly)a,(poly)b,naRing);
     1525  return (number)p;
     1526}
     1527
     1528
     1529BOOLEAN npolyInitChar(coeffs cf, void * infoStruct)
     1530{
     1531  assume( infoStruct != NULL );
     1532
     1533  AlgExtInfo *e = (AlgExtInfo *)infoStruct;
     1534  /// first check whether cf->extRing != NULL and delete old ring???
     1535
     1536  assume(e->r                     != NULL);      // extRing;
     1537  assume(e->r->cf                 != NULL);      // extRing->cf;
     1538
     1539  assume( cf != NULL );
     1540
     1541  e->r->ref ++; // increase the ref.counter for the ground poly. ring!
     1542  const ring R = e->r; // no copy!
     1543  cf->extRing  = R;
     1544
     1545  /* propagate characteristic up so that it becomes
     1546     directly accessible in cf: */
     1547  cf->ch = R->cf->ch;
     1548
     1549  cf->cfCoeffString = naCoeffString;
     1550
     1551  cf->cfGreaterZero  = naGreaterZero;
     1552  cf->cfGreater      = naGreater;
     1553  cf->cfEqual        = naEqual;
     1554  cf->cfIsZero       = naIsZero;
     1555  cf->cfIsOne        = naIsOne;
     1556  cf->cfIsMOne       = naIsMOne;
     1557  cf->cfInit         = naInit;
     1558  cf->cfInit_bigint  = naInit_bigint;
     1559  cf->cfFarey        = naFarey;
     1560  cf->cfChineseRemainder= naChineseRemainder;
     1561  cf->cfInt          = naInt;
     1562  cf->cfInpNeg       = naNeg;
     1563  cf->cfAdd          = naAdd;
     1564  cf->cfSub          = naSub;
     1565  cf->cfMult         = npolyMult;
     1566  cf->cfDiv          = npolyDiv;
     1567  cf->cfPower        = naPower;
     1568  cf->cfCopy         = naCopy;
     1569
     1570  cf->cfWriteLong        = naWriteLong;
     1571
     1572  if( rCanShortOut(naRing) )
     1573    cf->cfWriteShort = naWriteShort;
     1574  else
     1575    cf->cfWriteShort = naWriteLong;
     1576
     1577  cf->cfRead         = naRead;
     1578  cf->cfDelete       = naDelete;
     1579  cf->cfSetMap       = naSetMap;
     1580  cf->cfGetDenom     = naGetDenom;
     1581  cf->cfGetNumerator = naGetNumerator;
     1582  cf->cfRePart       = naCopy;
     1583  cf->cfCoeffWrite   = npolyCoeffWrite;
     1584  cf->cfNormalize    = npolyNormalize;
     1585  cf->cfKillChar     = naKillChar;
     1586#ifdef LDEBUG
     1587  cf->cfDBTest       = naDBTest;
     1588#endif
     1589  cf->cfGcd          = naGcd;
     1590  cf->cfLcm          = naLcmContent;
     1591  cf->cfSize         = naSize;
     1592  cf->nCoeffIsEqual  = naCoeffIsEqual;
     1593  cf->cfInvers       = npolyInvers;
     1594  cf->cfIntDiv       = npolyDiv;
     1595  cf->convFactoryNSingN=naConvFactoryNSingN;
     1596  cf->convSingNFactoryN=naConvSingNFactoryN;
     1597  cf->cfParDeg = naParDeg;
     1598
     1599  cf->iNumberOfParameters = rVar(R);
     1600  cf->pParameterNames = (const char**)R->names;
     1601  cf->cfParameter = naParameter;
     1602  cf->has_simple_Inverse=FALSE;
     1603  /* cf->has_simple_Alloc= FALSE; */
     1604
     1605  if( nCoeff_is_Q(R->cf) )
     1606  {
     1607    cf->cfClearContent = naClearContent;
     1608    cf->cfClearDenominators = naClearDenominators;
     1609  }
     1610
     1611  return FALSE;
     1612}
     1613#endif
Note: See TracChangeset for help on using the changeset viewer.