Changeset 1a5daea in git


Ignore:
Timestamp:
Sep 18, 1997, 4:08:22 PM (27 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', '4a9821a93ffdc22a6696668bd4f6b8c9de3e6c5f')
Children:
ca53ce549faa21140de4aa45f553d081e6888163
Parents:
5dc4ea4d2e5e725fea3a3273f88c1e2d6ac1b22a
Message:
* hannes: bug fixes to naNormalize/pContent/pCleardenom
  (clapconv.cc clapsing.cc clapsing.h longalg.cc longrat.cc polys1.cc)


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

Legend:

Unmodified
Added
Removed
  • Singular/clapconv.cc

    r5dc4ea r1a5daea  
    33*  Computer Algebra System SINGULAR     *
    44****************************************/
    5 // $Id: clapconv.cc,v 1.7 1997-09-16 13:45:28 Singular Exp $
     5// $Id: clapconv.cc,v 1.8 1997-09-18 14:08:17 Singular Exp $
    66/*
    77* ABSTRACT: convert data between Singular and factory
     
    191191          MP_INT num, den;
    192192          On(SW_RATIONAL);
    193           Print("switch to rational\n");
     193          #ifdef LDEBUG
     194            PrintS("switch to rational\n");
     195          #endif
    194196          mpz_init_set( &num, &(napGetCoeff( p )->z) );
    195197          mpz_init_set( &den, &(napGetCoeff( p )->n) );
     
    200202          MP_INT num, den;
    201203          On(SW_RATIONAL);
    202           Print("switch to rational ?1\n");
     204          #ifdef LDEBUG
     205            PrintS("switch to rational ?1\n");
     206          #endif
    203207          mpz_init_set( &num, &(napGetCoeff( p )->z) );
    204208          mpz_init_set( &den, &(napGetCoeff( p )->n) );
     
    394398          MP_INT num, den;
    395399          On(SW_RATIONAL);
    396           Print("switch to rational\n");
     400          #ifdef LDEBUG
     401            PrintS("switch to rational\n");
     402          #endif 
    397403          mpz_init_set( &num, &(napGetCoeff( p )->z) );
    398404          mpz_init_set( &den, &(napGetCoeff( p )->n) );
     
    403409          MP_INT num, den;
    404410          On(SW_RATIONAL);
    405           Print("switch to rational ?2\n");
     411          #ifdef LDEBUG
     412            PrintS("switch to rational ?2\n");
     413          #endif 
    406414          mpz_init_set( &num, &(napGetCoeff( p )->z) );
    407415          mpz_init_set( &den, &(napGetCoeff( p )->n) );
     
    433441      z->s = 0;
    434442    }
     443    #ifdef LDEBUG
     444    z->debug=123456;
     445    nlDBTest(z,__FILE__,__LINE__);
     446    #endif
    435447    return z;
    436448  }
     
    467479  while ( p!=NULL )
    468480  {
    469     nNormalize(&pGetCoeff(p));
     481    nNormalize(pGetCoeff(p));
    470482    CanonicalForm term=convSingTrClapP(((lnumber)pGetCoeff(p))->z);
    471483    for ( int i = 1; i <= n; i++ )
  • Singular/clapsing.cc

    r5dc4ea r1a5daea  
    33*  Computer Algebra System SINGULAR     *
    44****************************************/
    5 // $Id: clapsing.cc,v 1.13 1997-09-16 13:45:29 Singular Exp $
     5// $Id: clapsing.cc,v 1.14 1997-09-18 14:08:18 Singular Exp $
    66/*
    77* ABSTRACT: interface between Singular and factory
     
    857857 return res;
    858858}
     859
     860void singclap_algdividecontent ( alg f, alg g, alg &ff, alg &gg )
     861{
     862  // over Q(a) / Fp(a)
     863 if (nGetChar()==1) setCharacteristic( 0 );
     864 else               setCharacteristic( -nGetChar() );
     865 ff=gg=NULL;
     866 if (currRing->minpoly!=NULL)
     867 {
     868   CanonicalForm mipo=convSingTrClapP(((lnumber)currRing->minpoly)->z);
     869   Variable a=rootOf(mipo);
     870   CanonicalForm F( convSingAClapA( f,a ) ), G( convSingAClapA( g,a ) );
     871   CanonicalForm GCD=gcd( F, G );
     872   if (GCD!=1)
     873   {
     874     ff= convClapASingA( F/ GCD );
     875     gg= convClapASingA( G/ GCD );
     876   } 
     877 }
     878 else
     879 {
     880   CanonicalForm F( convSingTrClapP( f ) ), G( convSingTrClapP( g ) );
     881   CanonicalForm GCD=gcd( F, G );
     882   if (GCD!=1)
     883   {
     884     ff= convClapPSingTr( F/ GCD );
     885     gg= convClapPSingTr( G/ GCD );
     886   } 
     887 }
     888 Off(SW_RATIONAL);
     889}
    859890#endif
  • Singular/clapsing.h

    r5dc4ea r1a5daea  
    33*  Computer Algebra System SINGULAR     *
    44****************************************/
    5 // $Id: clapsing.h,v 1.3 1997-09-16 13:45:30 Singular Exp $
     5// $Id: clapsing.h,v 1.4 1997-09-18 14:08:19 Singular Exp $
    66/*
    77* ABSTRACT: interface between Singular and factory
     
    2222poly singclap_gcd ( poly f, poly g );
    2323alg singclap_alglcm ( alg f, alg g );
     24void singclap_algdividecontent ( alg f, alg g, alg &ff, alg &gg );
    2425
    2526poly singclap_resultant ( poly f, poly g , poly x);
  • Singular/longalg.cc

    r5dc4ea r1a5daea  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: longalg.cc,v 1.12 1997-09-18 09:58:20 Singular Exp $ */
     4/* $Id: longalg.cc,v 1.13 1997-09-18 14:08:19 Singular Exp $ */
    55/*
    66* ABSTRACT:   algebraic numbers
     
    335335      a = a->ne = a1;
    336336      a1 = a1->ne;
    337       if (!a1)
     337      if (a1==NULL)
    338338      {
    339339        a->ne= a2;
     
    346346      a = a->ne = a2;
    347347      a2 = a2->ne;
    348       if (!a2)
     348      if (a2==NULL)
    349349      {
    350350        a->ne = a1;
     
    20032003  else
    20042004  {
    2005     alg l=singclap_alglcm(x,y);
    2006     if (napDeg(l)>0)
    2007     {
    2008       alg h,r;
    2009       napDivMod(x,l,&h,&r);
    2010       if (r!=NULL)
    2011       {
    2012         WerrorS("internal error (1) while normalizing");
    2013         p->z=h;
    2014       }
    2015       napDivMod(y,l,&h,&r);
    2016       if (r!=NULL)
    2017       {
    2018         WerrorS("internal error (2) while normalizing");
    2019         p->n=h;
    2020       }
    2021     }
    2022     napDelete(&l);
     2005    alg xx,yy;
     2006    singclap_algdividecontent(x,y,xx,yy);
     2007    if (xx!=NULL)
     2008    {
     2009      p->z=xx;
     2010      p->n=yy;
     2011      napDelete(&x);
     2012      napDelete(&y);
     2013    } 
    20232014  }
    20242015#endif
  • Singular/longrat.cc

    r5dc4ea r1a5daea  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: longrat.cc,v 1.12 1997-08-14 13:10:45 Singular Exp $ */
     4/* $Id: longrat.cc,v 1.13 1997-09-18 14:08:20 Singular Exp $ */
    55/*
    66* ABSTRACT: computation with long rational numbers (Hubert Grassmann)
     
    145145#ifdef MDEBUG
    146146  mmDBTestBlock(a,sizeof(*a),f,l);
    147 #else
     147#endif
    148148  if (a->debug!=123456)
    149149  {
     
    152152    return FALSE;
    153153  }
    154 #endif
    155154  if ((a->s<0)||(a->s>4))
    156155  {
    157     Print(" !!longrat:s=%d in %s:%d\n",a->s,f,l);
     156    Print("!!longrat:s=%d in %s:%d\n",a->s,f,l);
    158157    return FALSE;
    159158  }
     
    161160#ifdef HAVE_LIBGMP2
    162161  mmDBTestBlock(a->z._mp_d,a->z._mp_alloc*BYTES_PER_MP_LIMB,f,l);
     162  if (a->z._mp_alloc==0)
    163163#else
    164164  mmDBTestBlock(a->z.d,a->z.alloc*BYTES_PER_MP_LIMB,f,l);
    165 #endif
     165  if(a->z.alloc==0)
     166#endif
     167    Print("!!longrat:z->alloc=0 in %s:%l\n",f,l);
    166168#endif
    167169  if (a->s<2)
     
    170172#ifdef HAVE_LIBGMP2
    171173    mmDBTestBlock(a->n._mp_d,a->n._mp_alloc*BYTES_PER_MP_LIMB,f,-l);
     174    if (a->z._mp_alloc==0)
    172175#else
    173176    mmDBTestBlock(a->n.d,a->n.alloc*BYTES_PER_MP_LIMB,f,-l);
    174 #endif
     177    if(a->z.alloc==0)
     178#endif
     179      Print("!!longrat:n->alloc=0 in %s:%l\n",f,l);
    175180#endif
    176181    if (mpz_cmp_si(&a->n,(long)1)==0)
  • Singular/polys1.cc

    r5dc4ea r1a5daea  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: polys1.cc,v 1.5 1997-04-25 15:04:07 obachman Exp $ */
     4/* $Id: polys1.cc,v 1.6 1997-09-18 14:08:22 Singular Exp $ */
    55
    66/*
     
    906906      }
    907907      nDelete(&h);
     908      if (nGetChar()==1)
     909      {
     910        h = nInit(1);
     911        p=ph;
     912        while (p!=NULL)
     913        {
     914          d=nLcm(h,pGetCoeff(p));
     915          nDelete(&h);
     916          h=d;
     917          pIter(p);
     918        }
     919        /* contains the 1/lcm of all denominators */
     920        if(!nIsOne(h))
     921        {
     922          p = ph;
     923          while (p!=NULL)
     924          {
     925            /* should be:
     926            * number hh;
     927            * nGetDenom(p->coef,&hh);
     928            * nMult(&h,&hh,&d);
     929            * nNormalize(d);
     930            * nDelete(&hh);
     931            * nMult(d,p->coef,&hh);
     932            * nDelete(&d);
     933            * nDelete(&(p->coef));
     934            * p->coef =hh;
     935            */
     936            d=nMult(h,pGetCoeff(p));
     937            nNormalize(d);
     938            pSetCoeff(p,d);
     939            pIter(p);
     940          }
     941          nDelete(&h);
     942        }
     943      }
    908944    }
    909945    pContent(ph);
Note: See TracChangeset for help on using the changeset viewer.