Changeset cf5fc11 in git


Ignore:
Timestamp:
Jan 27, 2005, 5:44:13 PM (18 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', '00e2e9c41af3fde1273eb3633f4c0c7c3db2579d')
Children:
e21afbaa54be68a2741df57da6a4156aba4b81d7
Parents:
c95632f6751087d2f62be544ec7e07d86913a78a
Message:
*hannes: pCleardenom_n


git-svn-id: file:///usr/local/Singular/svn/trunk@7694 2c84dea3-7e68-4137-9b89-c4e89433aadc
Location:
kernel
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • kernel/polys.h

    rc95632f rcf5fc11  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: polys.h,v 1.2 2004-04-23 13:56:40 Singular Exp $ */
     6/* $Id: polys.h,v 1.3 2005-01-27 16:42:15 Singular Exp $ */
    77/*
    88* ABSTRACT - all basic methods to manipulate polynomials of the
     
    360360void      pSimpleContent(poly p, int s);
    361361void      pCleardenom(poly p);
     362void      pCleardenom_n(poly p,number &c);
    362363void      p_Normalize(poly p, ring r);
    363364#define   pNormalize(p) p_Normalize(p,currRing)
  • kernel/polys1.cc

    rc95632f rcf5fc11  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: polys1.cc,v 1.6 2004-08-27 12:22:34 Singular Exp $ */
     4/* $Id: polys1.cc,v 1.7 2005-01-27 16:44:13 Singular Exp $ */
    55
    66/*
     
    921921}
    922922
     923void pCleardenom_n(poly ph,number &c)
     924{
     925  number d, h;
     926  poly p;
     927
     928  p = ph;
     929  if(pNext(p)==NULL)
     930  {
     931    c=nInvers(pGetCoeff(p));
     932    pSetCoeff(p,nInit(1));
     933  }
     934  else
     935  {
     936    h = nInit(1);
     937    while (p!=NULL)
     938    {
     939      nNormalize(pGetCoeff(p));
     940      d=nLcm(h,pGetCoeff(p),currRing);
     941      nDelete(&h);
     942      h=d;
     943      pIter(p);
     944    }
     945    c=h;
     946    /* contains the 1/lcm of all denominators */
     947    if(!nIsOne(h))
     948    {
     949      p = ph;
     950      while (p!=NULL)
     951      {
     952        /* should be:
     953        * number hh;
     954        * nGetDenom(p->coef,&hh);
     955        * nMult(&h,&hh,&d);
     956        * nNormalize(d);
     957        * nDelete(&hh);
     958        * nMult(d,p->coef,&hh);
     959        * nDelete(&d);
     960        * nDelete(&(p->coef));
     961        * p->coef =hh;
     962        */
     963        d=nMult(h,pGetCoeff(p));
     964        nNormalize(d);
     965        pSetCoeff(p,d);
     966        pIter(p);
     967      }
     968      if (nGetChar()==1)
     969      {
     970        loop
     971        {
     972          h = nInit(1);
     973          p=ph;
     974          while (p!=NULL)
     975          {
     976            d=nLcm(h,pGetCoeff(p),currRing);
     977            nDelete(&h);
     978            h=d;
     979            pIter(p);
     980          }
     981          /* contains the 1/lcm of all denominators */
     982          if(!nIsOne(h))
     983          {
     984            p = ph;
     985            while (p!=NULL)
     986            {
     987              /* should be:
     988              * number hh;
     989              * nGetDenom(p->coef,&hh);
     990              * nMult(&h,&hh,&d);
     991              * nNormalize(d);
     992              * nDelete(&hh);
     993              * nMult(d,p->coef,&hh);
     994              * nDelete(&d);
     995              * nDelete(&(p->coef));
     996              * p->coef =hh;
     997              */
     998              d=nMult(h,pGetCoeff(p));
     999              nNormalize(d);
     1000              pSetCoeff(p,d);
     1001              pIter(p);
     1002            }
     1003            number t=nMult(c,h);
     1004            nDelete(&c);
     1005            c=t;
     1006          }
     1007          else
     1008          {
     1009            break;
     1010          }
     1011          nDelete(&h);
     1012        }
     1013      }
     1014    }
     1015  }
     1016}
     1017
    9231018/*2
    9241019*tests if p is homogeneous with respect to the actual weigths
Note: See TracChangeset for help on using the changeset viewer.