Changeset 1389a4 in git


Ignore:
Timestamp:
Jan 18, 2011, 2:05:53 PM (13 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
c7afe579b577656daa841b5239a13f9ac087990f
Parents:
7eb7b589b58bd7d0f3394de9432ef2b9a9d03d57
git-author:
Hans Schoenemann <hannes@mathematik.uni-kl.de>2011-01-18 14:05:53+01:00
git-committer:
Mohamed Barakat <mohamed.barakat@rwth-aachen.de>2011-11-09 11:59:26+01:00
Message:
syntax fixes for libpoly, part 8: map stuff
Location:
libpolys
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • libpolys/coeffs/coeffs.h

    r7eb7b5 r1389a4  
    266266/// return a copy of a
    267267static inline number n_Copy(number n,    const coeffs r)
    268 { return (r)->cfCopy(n, r); }
     268{ return r->cfCopy(n, r); }
    269269static inline void   n_Delete(number* p, const coeffs r)
    270 { return (r)->cfDelete(p, r); }
     270{ return r->cfDelete(p, r); }
    271271
    272272static inline BOOLEAN n_Equal(number a, number b, const coeffs r)
    273 { return (r)->cfEqual(a, b, r); }
     273{ return r->cfEqual(a, b, r); }
    274274static inline BOOLEAN n_IsZero(number n, const coeffs r)
    275 { return (r)->cfIsZero(n,r); }
     275{ return r->cfIsZero(n,r); }
    276276static inline BOOLEAN n_IsOne(number n,  const coeffs r)
    277 { return (r)->cfIsOne(n,r); }
     277{ return r->cfIsOne(n,r); }
    278278static inline BOOLEAN n_IsMOne(number n, const coeffs r)
    279 { return (r)->cfIsMOne(n,r); }
     279{ return r->cfIsMOne(n,r); }
    280280static inline BOOLEAN n_GreaterZero(number n, const coeffs r)
    281 { return (r)->cfGreaterZero(n,r); }
     281{ return r->cfGreaterZero(n,r); }
    282282// cfGreater?
    283283#ifdef HAVE_RINGS
     
    292292/// init with an integer
    293293static inline number n_Init(int i,       const coeffs r)
    294 { return (r)->cfInit(i,r); }
     294{ return r->cfInit(i,r); }
    295295
    296296/// changes argument  inline: a:= -a
    297297static inline number n_Neg(number n,     const coeffs r)
    298 { return (r)->cfNeg(n,r); }
     298{ return r->cfNeg(n,r); }
    299299
    300300/// return 1/a
    301301static inline number n_Invers(number a,  const coeffs r)
    302 { return (r)->cfInvers(a,r); }
     302{ return r->cfInvers(a,r); }
    303303
    304304/// use for pivot strategies, (0) => 0, otherwise positive
    305305static inline int    n_Size(number n,    const coeffs r)
    306 { return (r)->cfSize(n,r); }
     306{ return r->cfSize(n,r); }
    307307
    308308/// normalize the number. i.e. go to some canonnical representation (inplace)
    309309static inline void   n_Normalize(number& n, const coeffs r)
    310 { return (r)->cfNormalize(n,r); }
     310{ return r->cfNormalize(n,r); }
    311311
    312312/// Normalize and Write to the output buffer of reporter
    313313static inline void   n_Write(number& n,  const coeffs r)
    314 { return (r)->cfWrite(n,r); }
     314{ return r->cfWrite(n,r); }
    315315
    316316/// Normalize and get denomerator
    317317static inline number n_GetDenom(number& n, const coeffs r)
    318 { return (r)->cfGetDenom(n, r); }
     318{ return r->cfGetDenom(n, r); }
    319319
    320320/// Normalize and get numerator
    321321static inline number n_GetNumerator(number& n, const coeffs r)
    322 { return (r)->cfGetNumerator(n, r); }
     322{ return r->cfGetNumerator(n, r); }
    323323
    324324static inline void   n_Power(number a, int b, number *res, const coeffs r)
    325 { return (r)->cfPower(a,b,res,r); }
     325{ return r->cfPower(a,b,res,r); }
    326326
    327327static inline number n_Mult(number a, number b, const coeffs r)
    328 { return (r)->cfMult(a, b, r); }
     328{ return r->cfMult(a, b, r); }
    329329
    330330/// Inplace multiplication: a := a * b
    331331static inline void n_InpMult(number &a, number b, const coeffs r)
    332 { return (r)->cfInpMult(a,b,r); }
     332{ return r->cfInpMult(a,b,r); }
    333333
    334334static inline number n_Sub(number a, number b, const coeffs r)
    335 { return (r)->cfSub(a, b, r); }
     335{ return r->cfSub(a, b, r); }
    336336
    337337static inline number n_Add(number a, number b, const coeffs r)
    338 { return (r)->cfAdd(a, b, r); }
     338{ return r->cfAdd(a, b, r); }
    339339
    340340static inline number n_Div(number a, number b, const coeffs r)
    341 { return (r)->cfDiv(a,b,r); }
     341{ return r->cfDiv(a,b,r); }
    342342
    343343static inline number n_IntDiv(number a, number b, const coeffs r)
    344 { return (r)->cfIntDiv(a,b,r); }
     344{ return r->cfIntDiv(a,b,r); }
    345345
    346346static inline number n_ExactDiv(number a, number b, const coeffs r)
    347 { return (r)->cfExactDiv(a,b,r); }
     347{ return r->cfExactDiv(a,b,r); }
    348348
    349349static inline number n_Gcd(number a, number b, const coeffs r)
    350 { return (r)->cfGcd(a,b,r); }
     350{ return r->cfGcd(a,b,r); }
    351351
    352352static inline number n_Lcm(number a, number b, const coeffs r)
    353 { return (r)->cfLcm(a,b,r); }
     353{ return r->cfLcm(a,b,r); }
     354
     355static inline nMapFunc n_SetMap(const coeffs src, const coeffs dst)
     356{ return dst->cfSetMap(src,dst); }
     357
     358static inline int n_ParDeg(number n, const coeffs r)
     359{ return r->cfParDeg(n,r); }
    354360
    355361/// Tests whether n is a correct number: only used if LDEBUG is defined
     
    367373
    368374// Missing wrappers for:
    369 // cfIntMod, cfPar, cfParDeg, cfInt, cfRePart, cfImPart, cfRead, cfSetMap, cfName, cfInit_bigint
     375// cfIntMod, cfPar, cfParDeg, cfInt, cfRePart, cfImPart, cfRead, cfName, cfInit_bigint
    370376// HAVE_RINGS: cfDivComp, cfExtGcd... cfDivBy
    371377
  • libpolys/polys/monomials/p_polys.cc

    r7eb7b5 r1389a4  
    15861586}
    15871587
     1588static void pnFreeBin(number *bin, int exp,const coeffs r)
     1589{
     1590  int e, h = (exp >> 1) + 1;
     1591
     1592  if (bin[1] != NULL)
     1593  {
     1594    for (e=1; e<h; e++)
     1595      n_Delete(&(bin[e]),r);
     1596  }
     1597  omFreeSize((ADDRESS)bin, h*sizeof(number));
     1598}
     1599
    15881600/*
    15891601*  compute for a poly p = head+tail, tail is monomial
     
    16431655  res = a[exp];
    16441656  omFreeSize((ADDRESS)a, al);
    1645   pnFreeBin(bin, exp);
     1657  pnFreeBin(bin, exp, r->cf);
    16461658//  tail=res;
    16471659// while((tail!=NULL)&&(pNext(tail)!=NULL))
     
    20712083{
    20722084  number d=pGetCoeff(ph);
    2073   int s=naParDeg(d);
    2074   if (s /* naParDeg(d)*/ <=1) return n_Copy(d,r->cf);
     2085  int s=n_ParDeg(d,r->cf);
     2086  if (s /* n_ParDeg(d)*/ <=1) return n_Copy(d,r->cf);
    20752087  int s2=-1;
    20762088  number d2;
     
    20812093    if(ph==NULL)
    20822094    {
    2083       if (s2==-1) return naCopy(d);
     2095      if (s2==-1) return n_Copy(d,r->cf);
    20842096      break;
    20852097    }
    2086     if ((ss=naParDeg(pGetCoeff(ph)))<s)
     2098    if ((ss=n_ParDeg(pGetCoeff(ph),r->cf))<s)
    20872099    {
    20882100      s2=s;
     
    20932105    }
    20942106  }
    2095   return naGcd(d,d2,r->cf);
     2107  return n_Gcd(d,d2,r->cf);
    20962108}
    20972109
     
    29372949            {
    29382950              number c=pGetCoeff(qq);
    2939               number ee=nfPar(1);
    2940               number eee;nfPower(ee,e,&eee); //nfDelete(ee,dst);
    2941               ee=nfMult(c,eee);
     2951              number ee=n_Par(1,dst->cf);
     2952              number eee;n_Power(ee,e,&eee,dst->cf); //nfDelete(ee,dst);
     2953              ee=n_Mult(c,eee,dst->cf);
    29422954              //nfDelete(c,dst);nfDelete(eee,dst);
    29432955              pSetCoeff0(qq,ee);
     
    29532965                p_SetExp(mmc->z,-perm[i],e/*p_GetExp( p,i,oldRing)*/,dst->algring);
    29542966                p_Setm(mmc->z,dst->algring->cf);
    2955                 pGetCoeff(qq)=naMult((number)c,(number)mmc);
     2967                pGetCoeff(qq)=n_Mult((number)c,(number)mmc,dst->cf);
    29562968                n_Delete((number *)&c,dst->cf);
    29572969                n_Delete((number *)&mmc,dst->cf);
  • libpolys/polys/monomials/ring.cc

    r7eb7b5 r1389a4  
    310310        StringSetS(""); n_Write(r->minpoly,r->cf); PrintS(StringAppendS("\n"));
    311311      }
    312       if (r->minideal!=NULL)
    313       {
    314         iiWriteMatrix((matrix)r->minideal,"//   minpolys",1,0);
    315         PrintLn();
    316       }
     312      //if (r->minideal!=NULL)
     313      //{
     314      //  iiWriteMatrix((matrix)r->minideal,"//   minpolys",1,0);
     315      //  PrintLn();
     316      //}
    317317    }
    318318  }
     
    430430  }
    431431#endif
    432   if (r->qideal!=NULL)
    433   {
    434     PrintS("\n// quotient ring from ideal\n");
    435     iiWriteMatrix((matrix)r->qideal,"_",1);
    436   }
     432  //if (r->qideal!=NULL)
     433  //{
     434  //  PrintS("\n// quotient ring from ideal\n");
     435  //  iiWriteMatrix((matrix)r->qideal,"_",1);
     436  //}
    437437}
    438438
     
    13901390      idTest((ideal)C);
    13911391
    1392       nMapFunc nMap1 = nSetMap(R1); /* can change something global: not usable
    1393                                        after the next nSetMap call :( */
     1392      nMapFunc nMap1 = n_SetMap(R1,sum); /* can change something global: not usable
     1393                                            after the next nSetMap call :( */
    13941394      // Create blocked C and D matrices:
    13951395      for (i=1; i<= rVar(R1); i++)
     
    14071407
    14081408
    1409       nMapFunc nMap2 = nSetMap(R2); /* can change something global: not usable
    1410                                        after the next nSetMap call :( */
     1409      nMapFunc nMap2 = n_SetMap(R2,sum); /* can change something global: not usable
     1410                                            after the next nSetMap call :( */
    14111411      for (i=1; i<= rVar(R2); i++)
    14121412        for (j=i+1; j<=rVar(R2); j++)
     
    14741474               sum->names, rVar(sum), sum->parameter, rPar(sum),
    14751475               perm1, par_perm1, sum->ch);
    1476     nMapFunc nMap1 = nSetMap(r1);
     1476    nMapFunc nMap1 = n_SetMap(r1,sum);
    14771477    Q1 = idInit(IDELEMS(r1->qideal),1);
    14781478    for (int for_i=0;for_i<IDELEMS(r1->qideal);for_i++)
    1479       Q1->m[for_i] = pPermPoly(r1->qideal->m[for_i],perm1,r1,nMap1,par_perm1,rPar(r1));
     1479      Q1->m[for_i] = p_PermPoly(r1->qideal->m[for_i],perm1,r1,nMap1,par_perm1,rPar(r1),sum);
    14801480    omFree((ADDRESS)perm1);
    14811481  }
     
    14911491               sum->names, rVar(sum), sum->parameter, rPar(sum),
    14921492               perm2, par_perm2, sum->ch);
    1493     nMapFunc nMap2 = nSetMap(r2);
     1493    nMapFunc nMap2 = n_SetMap(r2,sum);
    14941494    Q2 = idInit(IDELEMS(r2->qideal),1);
    14951495    for (int for_i=0;for_i<IDELEMS(r2->qideal);for_i++)
     
    32243224static void rOptimizeLDeg(ring r)
    32253225{
    3226   if (r->pFDeg == pDeg)
     3226  if (r->pFDeg == p_Deg)
    32273227  {
    32283228    if (r->pLDeg == pLDeg1)
     
    50375037
    50385038// return the max-comonent wchich has syzIndex i
    5039 int rGetMaxSyzComp(int i)
    5040 {
    5041   if ((currRing->typ!=NULL) && (currRing->typ[0].ord_typ==ro_syz) &&
    5042       currRing->typ[0].data.syz.limit > 0 && i > 0)
    5043   {
    5044     assume(i <= currRing->typ[0].data.syz.limit);
     5039int rGetMaxSyzComp(int i, const ring r)
     5040{
     5041  if ((r->typ!=NULL) && (r->typ[0].ord_typ==ro_syz) &&
     5042      r->typ[0].data.syz.limit > 0 && i > 0)
     5043  {
     5044    assume(i <= r->typ[0].data.syz.limit);
    50455045    int j;
    5046     for (j=0; j<currRing->typ[0].data.syz.limit; j++)
    5047     {
    5048       if (currRing->typ[0].data.syz.syz_index[j] == i  &&
    5049           currRing->typ[0].data.syz.syz_index[j+1] != i)
    5050       {
    5051         assume(currRing->typ[0].data.syz.syz_index[j+1] == i+1);
     5046    for (j=0; j<r->typ[0].data.syz.limit; j++)
     5047    {
     5048      if (r->typ[0].data.syz.syz_index[j] == i  &&
     5049          r->typ[0].data.syz.syz_index[j+1] != i)
     5050      {
     5051        assume(r->typ[0].data.syz.syz_index[j+1] == i+1);
    50525052        return j;
    50535053      }
    50545054    }
    5055     return currRing->typ[0].data.syz.limit;
     5055    return r->typ[0].data.syz.limit;
    50565056  }
    50575057  else
     
    51765176#endif
    51775177
    5178   ring save = currRing;
    5179   rChangeCurrRing(src);
     5178  //rChangeCurrRing(src);
    51805179
    51815180#ifdef RDEBUG
     
    51865185
    51875186
    5188 //  ring r = rCopy0(src,TRUE); /* TRUE for copy the qideal: Why??? */
    51895187  ring r = rCopy0(src,FALSE); /* qideal will be deleted later on!!! */
    51905188
    5191   /*  rChangeCurrRing(r); */
    51925189  // change vars v1..vN -> vN..v1
    51935190  int i;
     
    54045401#endif
    54055402
    5406   rChangeCurrRing(r);
     5403  //rChangeCurrRing(r);
    54075404
    54085405#ifdef RDEBUG
     
    54215418    int *perm       = (int *)omAlloc0((rVar(r)+1)*sizeof(int));
    54225419    int *par_perm   = NULL;
    5423     nMapFunc nMap   = nSetMap(src);
     5420    nMapFunc nMap   = n_SetMap(src,r);
    54245421    int ni,nj;
    54255422    for(i=1; i<=r->N; i++)
     
    54725469    r->qideal = idOppose(src, src->qideal); // into the currRing: r
    54735470#else
    5474     r->qideal = id_Copy(src->qideal, currRing); // ?
     5471    r->qideal = id_Copy(src->qideal, r); // ?
    54755472#endif
    54765473
     
    54935490  rTest(r);
    54945491
    5495   rChangeCurrRing(save);
    54965492  return r;
    54975493}
     
    55395535  const ring srcBase = src;
    55405536
    5541   assume( nSetMap(srcBase) == nSetMap(currRing) ); // currRing is important here!
     5537  assume( n_SetMap(srcBase,dest) == n_SetMap(dest,dest) ); // currRing is important here!
    55425538
    55435539  matrix C = mpNew(N,N); // ring independent
  • libpolys/polys/monomials/ring.h

    r7eb7b5 r1389a4  
    580580/// return the max-comonent wchich has syzIndex i
    581581/// Assume: i<= syzIndex_limit
    582 int rGetMaxSyzComp(int i);
     582int rGetMaxSyzComp(int i, const ring r);
    583583
    584584BOOLEAN rHasSimpleOrder(const ring r);
  • libpolys/polys/polys1.cc

    r7eb7b5 r1389a4  
    3333
    3434
    35 static void pnFreeBin(number *bin, int exp)
    36 {
    37   int e, h = (exp >> 1) + 1;
    38 
    39   if (bin[1] != NULL)
    40   {
    41     for (e=1; e<h; e++)
    42       nDelete(&(bin[e]));
    43   }
    44   omFreeSize((ADDRESS)bin, h*sizeof(number));
    45 }
    46 
    4735/*2
    4836* handle memory request for sets of polynomials (ideals)
Note: See TracChangeset for help on using the changeset viewer.