Changeset 51c163 in git for Singular/polys1.cc


Ignore:
Timestamp:
Dec 3, 1997, 5:59:09 PM (26 years ago)
Author:
Olaf Bachmann <obachman@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
60b6009c05103f2e0954313a9eaf4212fbfb177c
Parents:
97eb91d6ede7d98085ea363e0cde94fa6a6913be
Message:
Wed Dec  3 16:14:51 1997  Olaf Bachmann
<obachman@mathematik.uni-kl.de>

	* Many changes to prepare for implementation of fast comparison
		  schemes: Here are only a few:
	- added file polys-impl.h which implements low-level poly stuff
	- removed file polys2.cc, added polys-impl.cc
	- added Singularp target to Make
	- prepared configure for setting of exponent type
	- got rid of as many direct p->exp[..] accesses as possible
	- added file spSpolyLoop.cc spSpolyLoop.h polys-comp.h
	* polys-impl.h: if you defined COMP_FAST, then fast polynomial
		  comparsions are eanbled (still needs a lot of debugging)


git-svn-id: file:///usr/local/Singular/svn/trunk@941 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/polys1.cc

    r97eb91 r51c163  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: polys1.cc,v 1.7 1997-10-20 10:52:03 Singular Exp $ */
     4/* $Id: polys1.cc,v 1.8 1997-12-03 16:59:00 obachman Exp $ */
    55
    66/*
     
    3535  int i;
    3636
    37   for (i=pVariables;i>=0;i--)
     37  for (i=pVariables;i;i--)
    3838  {
    3939    if (pGetExp(p,i)!=0) return FALSE;
    4040  }
     41  if (pGetComp(p)) return FALSE;
    4142  return TRUE;
    4243}
     
    8384  p->coef = nInit(1);
    8485  return p;
    85 }
    86 
    87 /*2
    88 * creates a copy of p
    89 */
    90 #ifdef MDEBUG
    91 poly pDBCopy(poly p,char *f,int l)
    92 #else
    93 poly pCopy(poly p)
    94 #endif
    95 {
    96   poly w, a;
    97 
    98   if (p==NULL) return NULL;
    99   pDBTest(p,f,l);
    100 #ifdef MDEBUG
    101   w = a = pDBNew(f,l);
    102 #else
    103   w = a = pNew();
    104 #endif
    105   memcpy(w,p,pMonomSize);
    106   w->coef=nCopy(p->coef);
    107   if (pNext(p)!=NULL)
    108   {
    109     pIter(p);
    110     do
    111     {
    112 #ifdef MDEBUG
    113       a = pNext(a) = pDBNew(f,l);
    114 #else
    115       a = pNext(a) = pNew();
    116 #endif
    117       memcpy(a,p,pMonomSize);
    118       a->coef=nCopy(p->coef);
    119       pIter(p);
    120     }
    121     while (p!=NULL);
    122   }
    123   pNext(a) = NULL;
    124   return w;
    12586}
    12687
     
    319280  for (i=pVariables; i!=0; i--)
    320281  {
    321     pGetExp(p,i) *= exp;
     282    pMultExp(p,i, exp);
    322283  }
    323284  p->Order *= exp;
     
    340301  for (i=pVariables; i!=0; i--)
    341302  {
    342     pGetExp(p,i) += pGetExp(q,i);
     303    pAddExp(p,i, pGetExp(q,i));
    343304  }
    344305  p->Order += q->Order;
     
    357318  x = nMult(pGetCoeff(p),pGetCoeff(q));
    358319  pSetCoeff0(r,x);
    359   pGetComp(r) = pGetComp(p);
     320  pSetComp(r, pGetComp(p));
    360321  for (i=pVariables; i!=0; i--)
    361322  {
    362     pGetExp(r,i) = pGetExp(p,i) + pGetExp(q,i);
     323    pSetExp(r,i, pGetExp(p,i) + pGetExp(q,i));
    363324  }
    364325  r->Order = p->Order + q->Order;
     
    494455              for(j=1;j<=pdK;j++)
    495456              {
    496                 if(p->exp[pdY(j)]!=0)
     457                if(pGetExp(p,pdY(j))!=0)
    497458                {
    498459                  pDelete(&rc);
     
    502463              for(j=1;j<=pdN;j++)
    503464              {
    504                 t=p->exp[pdX(j)];
    505                 p->exp[pdX(j)]=p->exp[pdIX(j)];
    506                 p->exp[pdIX(j)]=t;
     465                t=pGetExp(p,pdX(j));
     466                pGetExp(p,pdX(j)]=pGetExp(p,pdIX(j));
     467                pGetExp(p,pdIX(j))=t;
    507468              }
    508469              pIter(p);
     
    559520    {
    560521      f = pNew();
     522      pCopy2(f,a);
    561523      pNext(f)=NULL;
    562524      t = nInit(pGetExp(a,k));
     
    567529      else
    568530      {
    569         memcpy4(f->exp,a->exp,(pVariables + 1) * sizeof(short));
    570         f->exp[k]--;
     531        pDecrExp(f,k);
    571532        pSetm(f);
    572533        if (res==NULL)
     
    662623
    663624/*2
    664 * returns (a copy of) the head term of a
    665 */
    666 #ifdef MDEBUG
    667 poly pDBHead(poly p,char *f, int l)
    668 #else
    669 poly pHead(poly p)
    670 #endif
    671 {
    672   poly w=NULL;
    673 
    674   if (p!=NULL)
    675   {
    676 #ifdef MDEBUG
    677     w = pDBNew(f,l);
    678 #else
    679     w = pNew();
    680 #endif
    681     memcpy4(w,p,pMonomSize);
    682     pSetCoeff0(w,nCopy(pGetCoeff(p)));
    683     pNext(w) = NULL;
    684   }
    685   return w;
    686 }
    687 
    688 /*2
    689 * returns (a copy of) the head term of a without the coef
    690 */
    691 #ifdef MDEBUG
    692 poly pDBHead0(poly p,char *f, int l)
    693 #else
    694 poly pHead0(poly p)
    695 #endif
    696 {
    697   poly w=NULL;
    698 
    699   if (p!=NULL)
    700   {
    701 #ifdef MDEBUG
    702     w = pDBNew(f,l);
    703 #else
    704     w = pNew();
    705 #endif
    706     memcpy4(w,p,pMonomSize);
    707     pSetCoeff0(w,NULL);
    708     pNext(w) = NULL;
    709   }
    710   return w;
    711 }
    712 
    713 /*2
    714625* returns maximal column number in the modul element a (or 0)
    715626*/
     
    757668    do
    758669    {
    759       pSetComp(p, (short)i);
     670      pSetComp(p, (Exponent_t)i);
    760671      pIter(p);
    761672    } while (p!=NULL);
     
    1007918      pTest(aq);
    1008919    }
    1009     qq->exp[0]=p->exp[0];
     920    pSetComp(qq, pGetComp(p));
    1010921    if (nIsZero(pGetCoeff(qq)))
    1011922    {
     
    1016927      for(i=1; i<=OldpVariables; i++)
    1017928      {
    1018         if (p->exp[i]!=0)
     929        if (pGetExp(p,i)!=0)
    1019930        {
    1020931          if (perm==NULL)
    1021932          {
    1022             qq->exp[i]=p->exp[i];
     933            pSetExp(qq,i, pGetExp(p,i));
    1023934          }
    1024935          else if (perm[i]>0)
    1025             qq->exp[perm[i]]+=p->exp[i];
     936            pAddExp(qq,perm[i], pGetExp(p,i));
    1026937          else if (perm[i]<0)
    1027938          {
    1028939            lnumber c=(lnumber)pGetCoeff(qq);
    1029             c->z->e[-perm[i]-1]+=p->exp[i];
     940            c->z->e[-perm[i]-1]+=pGetExp(p,i);
    1030941          }
    1031942          else
     
    13071218  while ((p1 != NULL) /*&& (p2 != NULL)*/)
    13081219  {
    1309     for (i=0; i<=pVariables; i++)
     1220    for (i=1; i<=pVariables; i++)
    13101221    {
    13111222      if (pGetExp(p1,i)!=pGetExp(p2,i))
     
    13141225        return FALSE;
    13151226      }
     1227    }
     1228    if (pGetComp(p1) != pGetComp(p2))
     1229    {
     1230      nDelete(&n);
     1231      return FALSE;
    13161232    }
    13171233    if (!nEqual(pGetCoeff(p1),nn=nMult(pGetCoeff(p2),n)))
Note: See TracChangeset for help on using the changeset viewer.