Changeset 38cfbb in git


Ignore:
Timestamp:
Jan 12, 1998, 6:32:50 PM (26 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', '5b153614cbc72bfa198d75b1e9e33dab2645d9fe')
Children:
47faf56bd0bcff347db95df89b7ca4f50b53e9af
Parents:
85734a4179c98e94173e3d6556a8c74b4b2c8d19
Message:
* hannes: some changes for factory 1.3


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

Legend:

Unmodified
Added
Removed
  • Singular/clapconv.cc

    r85734a r38cfbb  
    33*  Computer Algebra System SINGULAR     *
    44****************************************/
    5 // $Id: clapconv.cc,v 1.12 1997-12-03 16:58:30 obachman Exp $
     5// $Id: clapconv.cc,v 1.13 1998-01-12 17:32:44 Singular Exp $
    66/*
    77* ABSTRACT: convert data between Singular and factory
     
    280280            mpz_clear(&z->n);
    281281            z->s=3;
    282             if (mpz_size1(&z->z)<=MP_SMALL)
    283             {
    284               int ui=(int)mpz_get_si(&z->z);
    285               if ((((ui<<3)>>3)==ui)
    286               && (mpz_cmp_si(&z->z,(long)ui)==0))
    287               {
    288                 mpz_clear(&z->z);
    289                 Free((ADDRESS)z,sizeof(rnumber));
    290                 z=INT_TO_SR(ui);
    291               }
    292             }
    293282          }
    294283          else
  • Singular/clapsing.cc

    r85734a r38cfbb  
    33*  Computer Algebra System SINGULAR     *
    44****************************************/
    5 // $Id: clapsing.cc,v 1.20 1997-12-16 11:40:27 Singular Exp $
     5// $Id: clapsing.cc,v 1.21 1998-01-12 17:32:46 Singular Exp $
    66/*
    77* ABSTRACT: interface between Singular and factory
     
    2828  poly res=NULL;
    2929
    30   pCleardenom(f);
    31   pCleardenom(g);
    3230  // for now there is only the possibility to handle polynomials over
    3331  // Q and Fp ...
     
    6159  else
    6260    WerrorS( "not implemented" );
    63   pDelete(&f);
    64   pDelete(&g);
    6561  return res;
    6662}
    6763
     64poly singclap_resultant ( poly f, poly g , poly x)
     65{
     66  int i=pIsPurePower(x);
     67  if (i==0)
     68  {
     69    WerrorS("3rd argument must be a ring variable");
     70    return NULL;
     71  }
     72  Variable X(i);
     73  // for now there is only the possibility to handle polynomials over
     74  // Q and Fp ...
     75  if ( nGetChar() == 0 || nGetChar() > 1 )
     76  {
     77    setCharacteristic( nGetChar() );
     78    CanonicalForm F( convSingPClapP( f ) ), G( convSingPClapP( g ) );
     79    poly res=convClapPSingP( resultant( F, G, X ) );
     80    Off(SW_RATIONAL);
     81    return res;
     82  }
     83  // and over Q(a) / Fp(a)
     84  else if (( nGetChar()==1 ) /* Q(a) */
     85  || (nGetChar() <-1))       /* Fp(a) */
     86  {
     87    if (nGetChar()==1) setCharacteristic( 0 );
     88    else               setCharacteristic( -nGetChar() );
     89    poly res;
     90    if (currRing->minpoly!=NULL)
     91    {
     92      CanonicalForm mipo=convSingTrClapP(((lnumber)currRing->minpoly)->z);
     93      Variable a=rootOf(mipo);
     94      CanonicalForm F( convSingAPClapAP( f,a ) ), G( convSingAPClapAP( g,a ) );
     95      res= convClapAPSingAP( resultant( F, G, X ) );
     96    }
     97    else
     98    {
     99      CanonicalForm F( convSingTrPClapP( f ) ), G( convSingTrPClapP( g ) );
     100      res= convClapPSingTrP( resultant( F, G, X ) );
     101    }
     102    Off(SW_RATIONAL);
     103    return res;
     104  }
     105  else
     106    WerrorS( "not implemented" );
     107  return NULL;
     108}
    68109//poly singclap_resultant ( poly f, poly g , poly x)
    69110//{
    70 //  int i=pIsPurePower(x);
     111//  int i=pVar(x);
    71112//  if (i==0)
    72113//  {
    73 //    WerrorS("3rd argument must be a ring variable");
     114//    WerrorS("ringvar expected");
    74115//    return NULL;
    75116//  }
    76 //  Variable X(i);
    77 //  // for now there is only the possibility to handle polynomials over
    78 //  // Q and Fp ...
    79 //  if ( nGetChar() == 0 || nGetChar() > 1 )
     117//  ideal I=idInit(1,1);
     118//
     119//  // get the coeffs von f wrt. x:
     120//  I->m[0]=pCopy(f);
     121//  matrix ffi=mpCoeffs(I,i);
     122//  ffi->rank=1;
     123//  ffi->ncols=ffi->nrows;
     124//  ffi->nrows=1;
     125//  ideal fi=(ideal)ffi;
     126//
     127//  // get the coeffs von g wrt. x:
     128//  I->m[0]=pCopy(g);
     129//  matrix ggi=mpCoeffs(I,i);
     130//  ggi->rank=1;
     131//  ggi->ncols=ggi->nrows;
     132//  ggi->nrows=1;
     133//  ideal gi=(ideal)ggi;
     134//
     135//  // contruct the matrix:
     136//  int fn=IDELEMS(fi); //= deg(f,x)+1
     137//  int gn=IDELEMS(gi); //= deg(g,x)+1
     138//  matrix m=mpNew(fn+gn-2,fn+gn-2);
     139//  if(m==NULL)
    80140//  {
    81 //    setCharacteristic( nGetChar() );
    82 //    CanonicalForm F( convSingPClapP( f ) ), G( convSingPClapP( g ) );
    83 //    poly res=convClapPSingP( resultant( F, G, X ) );
    84 //    Off(SW_RATIONAL);
    85 //    return res;
     141//    return NULL;
    86142//  }
    87 //  // and over Q(a) / Fp(a)
    88 //  else if (( nGetChar()==1 ) /* Q(a) */
    89 //  || (nGetChar() <-1))       /* Fp(a) */
     143//
     144//  // enter the coeffs into m:
     145//  int j;
     146//  for(i=0;i<gn-1;i++)
    90147//  {
    91 //    if (nGetChar()==1) setCharacteristic( 0 );
    92 //    else               setCharacteristic( -nGetChar() );
    93 //    poly res;
    94 //    if (currRing->minpoly!=NULL)
     148//    for(j=0;j<fn;j++)
    95149//    {
    96 //      CanonicalForm mipo=convSingTrClapP(((lnumber)currRing->minpoly)->z);
    97 //      Variable a=rootOf(mipo);
    98 //      CanonicalForm F( convSingAPClapAP( f,a ) ), G( convSingAPClapAP( g,a ) );
    99 //      res= convClapAPSingAP( resultant( F, G, X ) );
     150//      MATELEM(m,i+1,fn-j+i)=pCopy(fi->m[j]);
    100151//    }
    101 //    else
     152//  }
     153//  for(i=0;i<fn-1;i++)
     154//  {
     155//    for(j=0;j<gn;j++)
    102156//    {
    103 //      CanonicalForm F( convSingTrPClapP( f ) ), G( convSingTrPClapP( g ) );
    104 //      res= convClapPSingTrP( resultant( F, G, X ) );
     157//      MATELEM(m,gn+i,gn-j+i)=pCopy(gi->m[j]);
    105158//    }
    106 //    Off(SW_RATIONAL);
    107 //    return res;
    108159//  }
    109 //  else
    110 //    WerrorS( "not implemented" );
    111 //  return NULL;
     160//
     161//  poly r=mpDet(m);
     162//
     163//  idDelete(&fi);
     164//  idDelete(&gi);
     165//  idDelete((ideal *)&m);
     166//  return r;
    112167//}
    113 poly singclap_resultant ( poly f, poly g , poly x)
    114 {
    115   int i=pVar(x);
    116   if (i==0)
    117   {
    118     WerrorS("ringvar expected");
    119     return NULL;
    120   }
    121   ideal I=idInit(1,1);
    122 
    123   // get the coeffs von f wrt. x:
    124   I->m[0]=pCopy(f);
    125   matrix ffi=mpCoeffs(I,i);
    126   ffi->rank=1;
    127   ffi->ncols=ffi->nrows;
    128   ffi->nrows=1;
    129   ideal fi=(ideal)ffi;
    130 
    131   // get the coeffs von g wrt. x:
    132   I->m[0]=pCopy(g);
    133   matrix ggi=mpCoeffs(I,i);
    134   ggi->rank=1;
    135   ggi->ncols=ggi->nrows;
    136   ggi->nrows=1;
    137   ideal gi=(ideal)ggi;
    138 
    139   // contruct the matrix:
    140   int fn=IDELEMS(fi); //= deg(f,x)+1
    141   int gn=IDELEMS(gi); //= deg(g,x)+1
    142   matrix m=mpNew(fn+gn-2,fn+gn-2);
    143   if(m==NULL)
    144   {
    145     return NULL;
    146   }
    147 
    148   // enter the coeffs into m:
    149   int j;
    150   for(i=0;i<gn-1;i++)
    151   {
    152     for(j=0;j<fn;j++)
    153     {
    154       MATELEM(m,i+1,fn-j+i)=pCopy(fi->m[j]);
    155     }
    156   }
    157   for(i=0;i<fn-1;i++)
    158   {
    159     for(j=0;j<gn;j++)
    160     {
    161       MATELEM(m,gn+i,gn-j+i)=pCopy(gi->m[j]);
    162     }
    163   }
    164 
    165   poly r=mpDet(m);
    166 
    167   idDelete(&fi);
    168   idDelete(&gi);
    169   idDelete((ideal *)&m);
    170   return r;
    171 }
    172168
    173169lists singclap_extgcd ( poly f, poly g )
     
    787783BOOLEAN jjGCD_P(leftv res, leftv u, leftv v)
    788784{
    789   res->data=(void *)singclap_gcd((poly)(u->CopyD()),((poly)v->CopyD()));
     785  res->data=(void *)singclap_gcd((poly)(u->Data()),((poly)v->Data()));
    790786  return FALSE;
    791787}
  • Singular/extra.cc

    r85734a r38cfbb  
    22*  Computer Algebra System SINGULAR      *
    33*****************************************/
    4 /* $Id: extra.cc,v 1.25 1997-12-18 14:26:32 Singular Exp $ */
     4/* $Id: extra.cc,v 1.26 1998-01-12 17:32:46 Singular Exp $ */
    55/*
    66* ABSTRACT: general interface to internals of Singular ("system" command)
     
    169169        #ifdef SRING
    170170          TEST_FOR("SRING")
     171        #endif
     172        #ifdef TEST_MAC_ORDER
     173          TEST_FOR("MAC_ORDER");
    171174        #endif
    172175          ;
  • Singular/longrat.cc

    r85734a r38cfbb  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: longrat.cc,v 1.14 1997-11-27 08:36:06 Singular Exp $ */
     4/* $Id: longrat.cc,v 1.15 1998-01-12 17:32:47 Singular Exp $ */
    55/*
    66* ABSTRACT: computation with long rational numbers (Hubert Grassmann)
     
    215215void nlNew (number * r)
    216216{
    217   //*r=INT_TO_SR(0);
    218217  *r=NULL;
    219218}
     
    272271int nlSize(number a)
    273272{
    274   if ((int)a==1)
     273  if (a==INT_TO_SR(0))
    275274     return 0; /* rational 0*/
    276   if ((((int)a)&3)==1)
     275  if (SR_HDL(a) & SR_INT)
    277276     return 1; /* immidiate int */
    278277#ifdef HAVE_LIBGMP2
     
    11521151          mpz_mul_ui(&u->z,&b->z,(unsigned long)-SR_TO_INT(a));
    11531152          mpz_neg(&u->z,&u->z);
    1154         } 
     1153        }
    11551154      }
    11561155      nlGmpSimple(&u->z);
     
    19441943  if ((SR_HDL(x) & SR_INT) ||(x==NULL))
    19451944    return;
     1945  if (x->s==3)
     1946  {
     1947    if (mpz_cmp_ui(&x->z,(long)0)==0)
     1948    {
     1949      nlDelete(&x);
     1950      x=nlInit(0);
     1951      return;
     1952    }
     1953    if (mpz_size1(&x->z)<=MP_SMALL)
     1954    {
     1955      int ui=(int)mpz_get_si(&x->z);
     1956      if ((((ui<<3)>>3)==ui)
     1957      && (mpz_cmp_si(&x->z,(long)ui)==0))
     1958      {
     1959        mpz_clear(&x->z);
     1960        Free((ADDRESS)x,sizeof(rnumber));
     1961        x=INT_TO_SR(ui);
     1962        return;
     1963      }
     1964    }
     1965  }
    19461966  if (x->s!=1) nlGmpSimple(&x->z);
    19471967  if (x->s==0)
  • Singular/matpol.cc

    r85734a r38cfbb  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: matpol.cc,v 1.7 1997-12-15 22:46:32 obachman Exp $ */
     4/* $Id: matpol.cc,v 1.8 1998-01-12 17:32:48 Singular Exp $ */
    55
    66/*
     
    447447    ma[i]=mpMult(ma[i-1], ma[1]);
    448448    MATELEM(s,1,i) = mpTrace(ma[i]);
     449    pTest(MATELEM(s,1,i));
    449450  }
    450451  for (i=k+1; i<=n; i++)
     452  {
    451453    MATELEM(s,1,i) = TraceOfProd(ma[i / 2], ma[(i+1) / 2], n);
     454    pTest(MATELEM(s,1,i));
     455  }
    452456  for (i=1; i<=k; i++)
    453457    idDelete((ideal *)&(ma[i]));
     
    459463  {
    460464    p = pCopy(MATELEM(s,1,i));
     465    pTest(p);
    461466    for (j=i-1; j>=1; j--)
    462467    {
    463468      q = pMult(pCopy(MATELEM(s,1,j)), pCopy(MATELEM(a,1,i-j)));
     469      pTest(q);
    464470      p = pAdd(p,q);
    465471    }
     
    470476
    471477    pMultN(p, c);
     478    pTest(p);
    472479    MATELEM(a,1,i) = p;
    473480    nDelete(&c);
  • Singular/misc.cc

    r85734a r38cfbb  
    647647char * versionString()
    648648{
    649   StringSet("");
     649  StringSet("\t");
    650650#ifdef HAVE_FACTORY
    651               StringAppend("\tfactory (%s),\n", factoryVersion);
     651              StringAppend("factory (%s),", factoryVersion);
    652652#endif
    653653#ifdef HAVE_LIBFAC_P
    654               StringAppend("\tlibfac(%s,%s),\n",libfac_version,libfac_date);
    655 #endif
    656 #ifdef SRING
    657               StringAppend("\tsuper algebra,\n");
    658 #endif
    659 #ifdef DRING
    660               StringAppend("\tWeyl algebra,\n");
     654              StringAppend("libfac(%s,%s),\n\t",libfac_version,libfac_date);
    661655#endif
    662656#ifdef HAVE_GMP
    663657#if defined (__GNU_MP_VERSION) && defined (__GNU_MP_VERSION_MINOR)
    664               StringAppend("\tGMP(%d.%d),\n",__GNU_MP_VERSION,__GNU_MP_VERSION_MINOR);
     658              StringAppend("GMP(%d.%d),",__GNU_MP_VERSION,__GNU_MP_VERSION_MINOR);
    665659#elif defined (HAVE_SMALLGMP)
    666               StringAppend("\tSmallGMP(2.0.2.0),\n");
     660              StringAppendS("SmallGMP(2.0.2.0),");
    667661#else
    668               StringAppend("\tGMP(1.3),\n");
    669 #endif
     662              StringAppendS("GMP(1.3),");
     663#endif
     664#endif
     665#ifdef HAVE_MPSR
     666              StringAppend("MP(%s),\n\t",MP_VERSION);
     667#endif
     668#if defined(HAVE_READLINE) && !defined(FEREAD)
     669              StringAppendS("libreadline,\n\t");
     670#endif
     671#ifdef HAVE_FEREAD
     672              StringAppendS("emulated libreadline,\n");
     673#endif
     674#ifdef SRING
     675              StringAppendS("super algebra,");
     676#endif
     677#ifdef DRING
     678              StringAppendS("Weyl algebra,");
    670679#endif
    671680#ifdef HAVE_DBM
    672               StringAppend("\tDBM,\n");
    673 #endif
    674 #ifdef HAVE_MPSR
    675               StringAppend("\tMP(%s),\n",MP_VERSION);
    676 #endif
    677 #if defined(HAVE_READLINE) && !defined(FEREAD)
    678               StringAppend("\tlibreadline,\n");
    679 #endif
    680 #ifdef HAVE_FEREAD
    681               StringAppend("\temulated libreadline,\n");
     681              StringAppendS("DBM,");
    682682#endif
    683683#ifdef HAVE_INFO
    684               StringAppend("\tinfo,\n");
    685 #else
    686               StringAppend("\twithout info,\n");
     684              StringAppendS("info,");
    687685#endif
    688686#ifdef TEST
    689               StringAppend("\tTESTs,\n");
     687              StringAppendS("TESTs,");
    690688#endif
    691689#if YYDEBUG
    692               StringAppend("\tYYDEBUG=1,\n");
     690              StringAppendS("YYDEBUG=1,");
    693691#endif
    694692#ifdef MDEBUG
    695               StringAppend("\tMDEBUG=%d,\n",MDEBUG);
     693              StringAppend("MDEBUG=%d,",MDEBUG);
     694#endif
     695#ifdef TEST_MAC_ORDER
     696              StringAppendS("mac_order,");
    696697#endif
    697698#ifndef __OPTIMIZE__
    698               StringAppend("\t-g,\n");
    699 #endif
    700               StringAppend("\trandom=%d\n",siRandomStart);
     699              StringAppend("-g,");
     700#endif
     701              StringAppend("random=%d\n",siRandomStart);
    701702#ifdef MSDOS
    702703              char *p=getenv("SPATH");
  • Singular/subexpr.cc

    r85734a r38cfbb  
    653653  if (e==NULL)
    654654  {
    655     switch (rtyp & 1023)
     655    switch (rtyp)
    656656    {
    657657      case IDHDL:
Note: See TracChangeset for help on using the changeset viewer.