Changeset 46f6af6 in git


Ignore:
Timestamp:
Jan 7, 2008, 2:36:16 PM (16 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', '0bc2210f8055033868008a3836878db65ec6f89e')
Children:
addc4c2c08713a1b97f0be5fda4a5d67a440eba9
Parents:
aa7480c120ef293aaf5a185ec38a2440c23fc879
Message:
*hannes: buckte for conversions


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

Legend:

Unmodified
Added
Removed
  • kernel/clapconv.cc

    raa7480c r46f6af6  
    33*  Computer Algebra System SINGULAR     *
    44****************************************/
    5 // $Id: clapconv.cc,v 1.9 2007-05-03 13:27:45 Singular Exp $
     5// $Id: clapconv.cc,v 1.10 2008-01-07 13:36:16 Singular Exp $
    66/*
    77* ABSTRACT: convert data between Singular and factory
     
    2121#include "febase.h"
    2222#include "ring.h"
     23#include "sbuckets.h"
    2324
    2425static void convRec( const CanonicalForm & f, int * exp, poly & result );
     
    2627static void convRecAlg( const CanonicalForm & f, int * exp, napoly & result );
    2728
    28 static void convRecPP ( const CanonicalForm & f, int * exp, poly & result );
    29 static void conv_RecPP ( const CanonicalForm & f, int * exp, poly & result, ring r );
     29static void conv_RecPP ( const CanonicalForm & f, int * exp, sBucket_pt result, ring r );
    3030
    3131static void convRecPTr ( const CanonicalForm & f, int * exp, napoly & result );
     
    3535static void convRecGFGF ( const CanonicalForm & f, int * exp, poly & result );
    3636
    37 static number convClapNSingAN( const CanonicalForm &f);
    38 
    39 CanonicalForm
    40 convSingNClapN( number n )
     37static number convFactoryNSingAN( const CanonicalForm &f);
     38
     39CanonicalForm convSingNFactoryN( number n )
    4140{
    4241  CanonicalForm term;
     
    4847  else
    4948  {
    50     if ( ((long)n) & 1L )
    51     {
    52       term = ((long)n) >>2;
     49    if ( SR_HDL(n) & SR_INT )
     50    {
     51      term = SR_TO_INT(n);
    5352    }
    5453    else
     
    6059        term = make_cf( dummy );
    6160      }
    62       else  if ( n->s == 1 )
    63       {
     61      else
     62      {
     63        // assume s==0 or s==1
    6464        MP_INT num, den;
    6565        On(SW_RATIONAL);
    6666        mpz_init_set( &num, &(n->z) );
    6767        mpz_init_set( &den, &(n->n) );
    68         term = make_cf( num, den, false );
    69       }
    70       else
    71       { // assume s == 0
    72         MP_INT num, den;
    73         mpz_init_set( &num, &(n->z) );
    74         mpz_init_set( &den, &(n->n) );
    75         term = make_cf( num, den, true );
     68        term = make_cf( num, den, ( n->s != 1 ));
    7669      }
    7770    }
     
    8073}
    8174
    82 number
    83 convClapNSingN( const CanonicalForm & n)
     75number convFactoryNSingN( const CanonicalForm & n)
    8476{
    8577  if (n.isImm())
     
    9284#endif
    9385    z->z = gmp_numerator( n );
    94     if ( n.den() == 1 )
     86    if ( n.den().isOne() )
    9587      z->s = 3;
    9688    else
     
    10395}
    10496
    105 CanonicalForm conv_SingPClapP( poly p, ring r )
     97CanonicalForm conv_SingPFactoryP( poly p, ring r )
    10698{
    10799  CanonicalForm result = 0;
     
    109101  assume( rPar(r)==0);
    110102
    111   while ( p != NULL )
    112   {
    113     CanonicalForm term;
    114     /* does only work for finite fields */
    115     if ( getCharacteristic() != 0 )
    116     {
    117       term = npInt( pGetCoeff( p ) );
    118     }
    119     else
    120     {
    121       if ( (long)(pGetCoeff( p )) & 1 )
    122       {
    123         term = ((long)( pGetCoeff( p ) )>>2);
     103  if ( getCharacteristic() != 0 )
     104  {
     105    /* does only work for finite fields Z/p*/
     106    while ( p != NULL )
     107    {
     108      CanonicalForm term = npInt( pGetCoeff( p ) );
     109      for ( int i = n; i >0; i-- )
     110      {
     111        if ( (e = p_GetExp( p, i, r )) != 0 )
     112           term *= power( Variable( i ), e );
     113      }
     114      result += term;
     115      pIter( p );
     116    }
     117  }
     118  else
     119  {
     120    while ( p != NULL )
     121    {
     122      CanonicalForm term;
     123      if ( SR_HDL(pGetCoeff( p )) & SR_INT )
     124      {
     125        term = SR_TO_INT( pGetCoeff( p ) );
    124126      }
    125127      else
     
    131133          term = make_cf( dummy );
    132134        }
    133         else  if ( pGetCoeff( p )->s == 1 )
    134         {
     135        else
     136        {
     137          // assume s==1 or s==0
    135138          MP_INT num, den;
    136139          On(SW_RATIONAL);
    137140          mpz_init_set( &num, &(pGetCoeff( p )->z) );
    138141          mpz_init_set( &den, &(pGetCoeff( p )->n) );
    139           term = make_cf( num, den, false );
    140         }
    141         else
    142         { // assume s == 0
    143           MP_INT num, den;
    144           mpz_init_set( &num, &(pGetCoeff( p )->z) );
    145           mpz_init_set( &den, &(pGetCoeff( p )->n) );
    146           term = make_cf( num, den, true );
    147         }
    148       }
    149     }
    150     for ( int i = 1; i <= n; i++ )
    151     {
    152       if ( (e = p_GetExp( p, i, r )) != 0 )
    153          term *= power( Variable( i ), e );
    154     }
    155     result += term;
    156     p = pNext( p );
    157   }
    158   return result;
    159 }
    160 
    161 poly convClapPSingP ( const CanonicalForm & f )
    162 {
    163 //    cerr << " f = " << f << endl;
    164   int n = pVariables+1;
    165   /* ASSERT( level( f ) <= pVariables, "illegal number of variables" ); */
    166   int * exp = new int[n];
    167   //for ( int i = 0; i < n; i++ ) exp[i] = 0;
    168   memset(exp,0,n*sizeof(int));
    169   poly result = NULL;
    170   convRecPP( f, exp, result );
    171   delete [] exp;
    172   return result;
    173 }
    174 
    175 static void convRecPP ( const CanonicalForm & f, int * exp, poly & result )
    176 {
    177   if (f == 0)
    178     return;
    179   if ( ! f.inCoeffDomain() )
    180   {
    181     int l = f.level();
    182     for ( CFIterator i = f; i.hasTerms(); i++ )
    183     {
    184       exp[l] = i.exp();
    185       convRecPP( i.coeff(), exp, result );
    186     }
    187     exp[l] = 0;
    188   }
    189   else
    190   {
    191     poly term = pInit();
    192     pNext( term ) = NULL;
    193     for ( int i = 1; i <= pVariables; i++ )
    194       pSetExp( term, i, exp[i]);
    195     pSetComp(term, 0);
    196     if ( getCharacteristic() != 0 )
    197     {
    198       pGetCoeff( term ) = nInit( f.intval() );
    199     }
    200     else
    201     {
    202       if ( f.isImm() )
    203         pGetCoeff( term ) = nInit( f.intval() );
    204       else
    205       {
    206         number z=(number)omAllocBin(rnumber_bin);
    207 #if defined(LDEBUG)
    208         z->debug=123456;
    209 #endif
    210         z->z = gmp_numerator( f );
    211         if ( f.den() == 1 )
    212           z->s = 3;
    213         else
    214         {
    215           z->n = gmp_denominator( f );
    216           z->s = 0;
    217         }
    218         nlNormalize(z);
    219         pGetCoeff( term ) = z;
    220       }
    221     }
    222     pSetm( term );
    223     if ( nIsZero(pGetCoeff(term)) )
    224     {
    225       pDelete(&term);
    226     }
    227     else
    228     {
    229       result = pAdd( result, term );
    230     }
    231   }
    232 }
    233 
    234 poly conv_ClapPSingP ( const CanonicalForm & f, ring r )
     142          term = make_cf( num, den, ( pGetCoeff( p )->s != 1 ));
     143        }
     144      }
     145      for ( int i = n; i >0; i-- )
     146      {
     147        if ( (e = p_GetExp( p, i, r )) != 0 )
     148           term *= power( Variable( i ), e );
     149      }
     150      result += term;
     151      pIter( p );
     152    }
     153  }
     154  return result;
     155}
     156
     157poly conv_FactoryPSingP ( const CanonicalForm & f, ring r )
    235158{
    236159//    cerr << " f = " << f << endl;
    237160  int n = r->N+1;
    238161  /* ASSERT( level( f ) <= pVariables, "illegal number of variables" ); */
    239   int * exp = new int[n];
    240   //for ( int i = 0; i < n; i++ ) exp[i] = 0;
    241   memset(exp,0,n*sizeof(int));
    242   poly result = NULL;
    243   conv_RecPP( f, exp, result, r );
    244   delete [] exp;
    245   return result;
    246 }
    247 
    248 static void
    249 conv_RecPP ( const CanonicalForm & f, int * exp, poly & result, ring r )
    250 {
    251   if (f == 0)
     162  int * exp = (int*)omAlloc0(n*sizeof(int));
     163  sBucket_pt result_bucket=sBucketCreate(r);
     164  conv_RecPP( f, exp, result_bucket, r );
     165  poly result; int dummy;
     166  sBucketDestroyMerge(result_bucket,&result,&dummy);
     167  omFreeSize((ADDRESS)exp,n*sizeof(int));
     168  return result;
     169}
     170
     171static void conv_RecPP ( const CanonicalForm & f, int * exp, sBucket_pt result, ring r )
     172{
     173  if (f.isZero())
    252174    return;
    253175  if ( ! f.inCoeffDomain() )
     
    268190      p_SetExp( term, i, exp[i], r);
    269191    if (rRing_has_Comp(r)) p_SetComp(term, 0, r);
    270     if ( getCharacteristic() != 0 )
    271     {
     192    if ( f.isImm() )
    272193      pGetCoeff( term ) = n_Init( f.intval(), r );
    273     }
    274     else
    275     {
    276       if ( f.isImm() )
    277         pGetCoeff( term ) = n_Init( f.intval(), r );
     194    else
     195    {
     196      number z=(number)omAllocBin(rnumber_bin);
     197#if defined(LDEBUG)
     198      z->debug=123456;
     199#endif
     200      z->z = gmp_numerator( f );
     201      if ( f.den().isOne() )
     202        z->s = 3;
    278203      else
    279204      {
    280         number z=(number)omAllocBin(rnumber_bin);
    281 #if defined(LDEBUG)
    282         z->debug=123456;
    283 #endif
    284         z->z = gmp_numerator( f );
    285         if ( f.den() == 1 )
    286           z->s = 3;
    287         else
    288         {
    289           z->n = gmp_denominator( f );
    290           z->s = 0;
    291         }
    292         pGetCoeff( term ) = z;
     205        z->n = gmp_denominator( f );
     206        z->s = 0;
    293207        nlNormalize(z);
    294208      }
     209      pGetCoeff( term ) = z;
    295210    }
    296211    p_Setm( term, r );
     
    301216    else
    302217    {
    303       result = p_Add_q( result, term, r );
    304     }
    305   }
    306 }
    307 
    308 
    309 CanonicalForm
    310 convSingTrClapP( napoly p )
     218      sBucket_Merge_p(result,term,1);
     219    }
     220  }
     221}
     222
     223
     224CanonicalForm convSingTrFactoryP( napoly p )
    311225{
    312226  CanonicalForm result = 0;
     
    323237    else
    324238    {
    325       //if ( (!(int)(napGetCoeff( p )) & 1 )
    326       //&&  ( napGetCoeff( p )->s == 0))
    327       //  naNormalize( naGetCoeff( p ) );
    328       if ( (long)(napGetCoeff( p )) & 1L )
    329         term = nlInt( napGetCoeff( p ) );
     239      if ( SR_HDL(napGetCoeff( p )) & SR_INT )
     240        term = SR_TO_INT( napGetCoeff( p ) );
    330241      else
    331242      {
     
    336247          term = make_cf( dummy );
    337248        }
    338         else  if ( napGetCoeff( p )->s == 1 )
    339         {
     249        else
     250        {
     251          // assume s==0 or s==1
    340252          MP_INT num, den;
    341253          On(SW_RATIONAL);
    342254          mpz_init_set( &num, &(napGetCoeff( p )->z) );
    343255          mpz_init_set( &den, &(napGetCoeff( p )->n) );
    344           term = make_cf( num, den, false );
    345         }
    346         else
    347         { // assume s == 0
    348           MP_INT num, den;
    349           On(SW_RATIONAL);
    350           mpz_init_set( &num, &(napGetCoeff( p )->z) );
    351           mpz_init_set( &den, &(napGetCoeff( p )->n) );
    352           term = make_cf( num, den, true );
    353         }
    354       }
    355     }
    356     for ( int i = 1; i <= n; i++ )
     256          term = make_cf( num, den, ( napGetCoeff( p )->s != 1 ));
     257        }
     258      }
     259    }
     260    for ( int i = n; i >0; i-- )
    357261    {
    358262      if ( (e = napGetExp( p, i )) != 0 )
     
    365269}
    366270
    367 napoly
    368 convClapPSingTr ( const CanonicalForm & f )
     271napoly convFactoryPSingTr ( const CanonicalForm & f )
    369272{
    370273//    cerr << " f = " << f << endl;
    371274  int n = napVariables+1;
    372275  /* ASSERT( level( f ) <= napVariables, "illegal number of variables" ); */
    373   int * exp = new int[n];
    374   // for ( int i = 0; i < n; i++ ) exp[i] = 0;
    375   memset(exp,0,n*sizeof(int));
     276  int * exp = (int *)omAlloc0(n*sizeof(int));
    376277  napoly result = NULL;
    377278  convRecPTr( f, exp, result );
    378   delete [] exp;
    379   return result;
    380 }
    381 
    382 static void
    383 convRecPTr ( const CanonicalForm & f, int * exp, napoly & result )
    384 {
    385   if (f == 0)
     279  omFreeSize((ADDRESS)exp,n*sizeof(int));
     280  return result;
     281}
     282
     283static void convRecPTr ( const CanonicalForm & f, int * exp, napoly & result )
     284{
     285  if (f.isZero())
    386286    return;
    387287  if ( ! f.inCoeffDomain() )
     
    401301    for ( int i = 1; i <= napVariables; i++ )
    402302      napSetExp( term, i , exp[i]);
    403     if ( getCharacteristic() != 0 )
    404     {
    405       napGetCoeff( term ) = npInit( f.intval() );
    406     }
    407     else
    408     {
    409       if ( f.isImm() )
    410         napGetCoeff( term ) = nlInit( f.intval() );
     303    if ( f.isImm() )
     304      napGetCoeff( term ) = nacInit( f.intval() );
     305    else
     306    {
     307      number z=(number)omAllocBin(rnumber_bin);
     308#if defined(LDEBUG)
     309      z->debug=123456;
     310#endif
     311      z->z = gmp_numerator( f );
     312      if ( f.den().isOne() )
     313      {
     314        z->s = 3;
     315      }
    411316      else
    412317      {
    413         number z=(number)omAllocBin(rnumber_bin);
    414 #if defined(LDEBUG)
    415         z->debug=123456;
    416 #endif
    417         z->z = gmp_numerator( f );
    418         if ( f.den() == 1 )
    419         {
    420           z->s = 3;
     318        z->n = gmp_denominator( f );
     319        if (mpz_cmp_si(&z->n,(long)1)==0)
     320        {
     321          mpz_clear(&z->n);
     322          z->s=3;
    421323        }
    422324        else
    423325        {
    424           z->n = gmp_denominator( f );
    425           if (mpz_cmp_si(&z->n,(long)1)==0)
    426           {
    427             mpz_clear(&z->n);
    428             z->s=3;
    429           }
    430           else
    431           {
    432             z->s = 0;
    433           }
     326          z->s = 0;
    434327          nacNormalize(z);
    435328        }
    436         napGetCoeff( term ) = z;
    437       }
     329      }
     330      napGetCoeff( term ) = z;
    438331    }
    439332    if (nacIsZero(pGetCoeff(term)))
     
    448341}
    449342
    450 CanonicalForm convSingAPClapAP ( poly p , const Variable & a)
     343CanonicalForm convSingAPFactoryAP ( poly p , const Variable & a)
    451344{
    452345  CanonicalForm result = 0;
     
    457350  while ( p!=NULL)
    458351  {
    459     CanonicalForm term=convSingAClapA(((lnumber)pGetCoeff(p))->z,a);
     352    CanonicalForm term=convSingAFactoryA(((lnumber)pGetCoeff(p))->z,a);
    460353    for ( int i = 1; i <= n; i++ )
    461354    {
     
    464357    }
    465358    result += term;
    466     p = pNext( p );
     359    pIter( p );
    467360  }
    468361  return result;
     
    472365convRecAP_R ( const CanonicalForm & f, int * exp, poly & result, int par_start, int var_start) ;
    473366
    474 poly convClapAPSingAP_R ( const CanonicalForm & f, int par_start, int var_start )
     367poly convFactoryAPSingAP_R ( const CanonicalForm & f, int par_start, int var_start )
    475368{
    476369  int n = pVariables+1+rPar(currRing);
    477   int * exp = new int[n];
    478   // for ( int i = 0; i < n; i++ ) exp[i] = 0;
    479   memset(exp,0,n*sizeof(int));
     370  int * exp = (int *)omAlloc0(n*sizeof(int));
    480371  poly result = NULL;
    481372  convRecAP_R( f, exp, result,par_start, var_start );
    482   delete [] exp;
    483   return result;
    484 }
    485 poly convClapAPSingAP ( const CanonicalForm & f )
    486 {
    487   return convClapAPSingAP_R(f,0,rPar(currRing));
    488 }
    489 
    490 static void
    491 convRecAP_R ( const CanonicalForm & f, int * exp, poly & result, int par_start, int var_start )
    492 {
    493   if (f == 0)
     373  omFreeSize((ADDRESS)exp,n*sizeof(int));
     374  return result;
     375}
     376
     377poly convFactoryAPSingAP ( const CanonicalForm & f )
     378{
     379  return convFactoryAPSingAP_R(f,0,rPar(currRing));
     380}
     381
     382static void convRecAP_R ( const CanonicalForm & f, int * exp, poly & result, int par_start, int var_start )
     383{
     384  if (f.isZero())
    494385    return;
    495386  if ( ! f.inCoeffDomain() )
     
    505396  else
    506397  {
    507     napoly z=(napoly)convClapASingA( f );
     398    napoly z=(napoly)convFactoryASingA( f );
    508399    if (z!=NULL)
    509400    {
     
    513404      for ( i = 1; i <= pVariables; i++ )
    514405        pSetExp( term, i , exp[i+var_start]);
    515       pSetComp(term, 0);
     406      if (rRing_has_Comp(currRing->algring))
     407        p_SetComp(term, 0, currRing->algring);
    516408      if (par_start==0)
    517409      {
     
    534426}
    535427
    536 CanonicalForm convSingAClapA ( napoly p , const Variable & a )
     428CanonicalForm convSingAFactoryA ( napoly p , const Variable & a )
    537429{
    538430  CanonicalForm result = 0;
     
    549441    else
    550442    {
    551       //if ( (!(int)(napGetCoeff( p )) & 1 )
    552       //&&  ( napGetCoeff( p )->s == 0))
    553       //  naNormalize( naGetCoeff( p ) );
    554       if ( (long)(napGetCoeff( p )) & SR_INT )
    555         term = nlInt( napGetCoeff( p ) );
    556         //term = SR_TO_INT(napGetCoeff( p )) ;
     443      if ( SR_HDL(napGetCoeff( p )) & SR_INT )
     444        term = SR_TO_INT(napGetCoeff( p )) ;
    557445      else
    558446      {
     
    563451          term = make_cf( dummy );
    564452        }
    565         else  if ( napGetCoeff( p )->s == 1 )
    566         {
     453        else
     454        {
     455          // assume s==0 or s==1
    567456          MP_INT num, den;
    568457          On(SW_RATIONAL);
    569458          mpz_init_set( &num, &(napGetCoeff( p )->z) );
    570459          mpz_init_set( &den, &(napGetCoeff( p )->n) );
    571           term = make_cf( num, den, false );
    572         }
    573         else
    574         { // assume s == 0
    575           MP_INT num, den;
    576           On(SW_RATIONAL);
    577           mpz_init_set( &num, &(napGetCoeff( p )->z) );
    578           mpz_init_set( &den, &(napGetCoeff( p )->n) );
    579           term = make_cf( num, den, true );
     460          term = make_cf( num, den, ( napGetCoeff( p )->s != 1 ));
    580461        }
    581462      }
     
    589470}
    590471
    591 static number convClapNSingAN( const CanonicalForm &f)
    592 {
    593   if ((getCharacteristic() != 0) || ( f.isImm() ))
     472static number convFactoryNSingAN( const CanonicalForm &f)
     473{
     474  if ( f.isImm() )
    594475    return nacInit( f.intval() );
    595476  else
     
    600481#endif
    601482    z->z = gmp_numerator( f );
    602     if ( f.den() == 1 )
     483    if ( f.den().isOne() )
    603484    {
    604485      z->s = 3;
     
    608489      z->n = gmp_denominator( f );
    609490      z->s = 0;
    610     }
    611     nlNormalize(z);
     491      nlNormalize(z);
     492    }
    612493    #ifdef LDEBUG
    613494    nlDBTest(z,__FILE__,__LINE__);
     
    617498}
    618499
    619 napoly convClapASingA ( const CanonicalForm & f )
     500napoly convFactoryASingA ( const CanonicalForm & f )
    620501{
    621502  napoly a=NULL;
     
    625506    t=napNew();
    626507    // napNext( t ) = NULL; //already done by napNew
    627     napGetCoeff(t)=convClapNSingAN( i.coeff() );
     508    napGetCoeff(t)=convFactoryNSingAN( i.coeff() );
    628509    if (nacIsZero(napGetCoeff(t)))
    629510    {
     
    647528}
    648529
    649 CanonicalForm convSingTrPClapP ( poly p )
     530CanonicalForm convSingTrPFactoryP ( poly p )
    650531{
    651532  CanonicalForm result = 0;
     
    656537  {
    657538    nNormalize(pGetCoeff(p));
    658     CanonicalForm term=convSingTrClapP(((lnumber)pGetCoeff(p))->z);
     539    CanonicalForm term=convSingTrFactoryP(((lnumber)pGetCoeff(p))->z);
    659540
    660541    if ((((lnumber)pGetCoeff(p))->n!=NULL)
     
    664545    }
    665546
    666     for ( int i = 1; i <= n; i++ )
     547    for ( int i = n; i > 0; i-- )
    667548    {
    668549      if ( (e = pGetExp( p, i )) != 0 )
     
    675556}
    676557
    677 poly convClapPSingTrP ( const CanonicalForm & f )
     558poly convFactoryPSingTrP ( const CanonicalForm & f )
    678559{
    679560  int n = pVariables+1;
    680   int * exp = new int[n];
    681   // for ( int i = 0; i < n; i++ ) exp[i] = 0;
    682   memset(exp,0,n*sizeof(int));
     561  int * exp = (int*)omAlloc0(n*sizeof(int));
    683562  poly result = NULL;
    684563  convRecTrP( f, exp, result , rPar(currRing) );
    685   delete [] exp;
     564  omFreeSize((ADDRESS)exp,n*sizeof(int));
    686565  return result;
    687566}
     
    690569convRecTrP ( const CanonicalForm & f, int * exp, poly & result , int offs)
    691570{
    692   if (f == 0)
     571  if (f.isZero())
    693572    return;
    694573  if ( f.level() > offs )
     
    708587    for ( int i = 1; i <= pVariables; i++ )
    709588      pSetExp( term, i ,exp[i]);
    710     pSetComp(term, 0);
     589    if (rRing_has_Comp(currRing))
     590        p_SetComp(term, 0, currRing);
    711591    pGetCoeff(term)=(number)omAlloc0Bin(rnumber_bin);
    712     ((lnumber)pGetCoeff(term))->z=convClapPSingTr( f );
     592    ((lnumber)pGetCoeff(term))->z=convFactoryPSingTr( f );
    713593    pSetm( term );
    714594    result = pAdd( result, term );
     
    729609  CanonicalForm xnew,qnew;
    730610  chineseRemainder(X,Q,xnew,qnew);
    731   number n=convClapNSingN(xnew);
    732   number p=convClapNSingN(qnew);
     611  number n=convFactoryNSingN(xnew);
     612  number p=convFactoryNSingN(qnew);
    733613  number p2=nlIntDiv(p,nlInit(2));
    734614  if (nlGreater(n,p2))
     
    749629#if 0
    750630CanonicalForm
    751 convSingGFClapGF( poly p )
     631convSingGFFactoryGF( poly p )
    752632{
    753633  CanonicalForm result = 0;
     
    770650
    771651poly
    772 convClapGFSingGF ( const CanonicalForm & f )
     652convFactoryGFSingGF ( const CanonicalForm & f )
    773653{
    774654//    cerr << " f = " << f << endl;
    775655  int n = pVariables+1;
    776656  /* ASSERT( level( f ) <= pVariables, "illegal number of variables" ); */
    777   int * exp = new int[n];
    778   //for ( int i = 0; i < n; i++ ) exp[i] = 0;
    779   memset(exp,0,n*sizeof(int));
     657  int * exp = (int*)omAlloc0(n*sizeof(int));
    780658  poly result = NULL;
    781659  convRecGFGF( f, exp, result );
    782   delete [] exp;
     660  omFreeSize((ADDRESS)exp,n*sizeof(int));
    783661  return result;
    784662}
     
    787665convRecGFGF ( const CanonicalForm & f, int * exp, poly & result )
    788666{
    789   if (f == 0)
     667  if (f.isZero())
    790668    return;
    791669  if ( ! f.inCoeffDomain() )
     
    805683    for ( int i = 1; i <= pVariables; i++ )
    806684      pSetExp( term, i, exp[i]);
    807     pSetComp(term, 0);
     685    if (rRing_has_Comp(currRing))
     686        p_SetComp(term, 0, currRing);
    808687    pGetCoeff( term ) = (number) gf_value (f);
    809688    pSetm( term );
     
    813692#endif
    814693
    815 int convClapISingI( const CanonicalForm & f)
     694int convFactoryISingI( const CanonicalForm & f)
    816695{
    817696  if (!f.isImm()) WerrorS("int overflow in det");
  • kernel/clapconv.h

    raa7480c r46f6af6  
    33*  Computer Algebra System SINGULAR     *
    44****************************************/
    5 // $Id: clapconv.h,v 1.2 2005-06-13 16:23:30 Singular Exp $
     5// $Id: clapconv.h,v 1.3 2008-01-07 13:36:16 Singular Exp $
    66/*
    77* ABSTRACT: convert data between Singular and factory
     
    1616#include <factory.h>
    1717
    18 napoly convClapPSingTr ( const CanonicalForm & f );
    19 CanonicalForm convSingTrClapP( napoly p );
     18napoly convFactoryPSingTr ( const CanonicalForm & f );
     19CanonicalForm convSingTrFactoryP( napoly p );
    2020
    21 poly convClapPSingP ( const CanonicalForm & f );
    22 #define  convSingPClapP(p) conv_SingPClapP(p,currRing)
     21#define  convSingPFactoryP(p) conv_SingPFactoryP(p,currRing)
    2322
    24 poly conv_ClapPSingP ( const CanonicalForm & f, ring r );
    25 CanonicalForm conv_SingPClapP( poly p, ring r );
     23poly conv_FactoryPSingP ( const CanonicalForm & f, ring r );
     24CanonicalForm conv_SingPFactoryP( poly p, ring r );
    2625
    27 CanonicalForm convSingAPClapAP ( poly p , const Variable & a );
    28 poly convClapAPSingAP ( const CanonicalForm & f );
    29 poly convClapAPSingAP_R ( const CanonicalForm & f, int par_start, int var_start );
     26#define  convFactoryPSingP(p) conv_FactoryPSingP(p,currRing)
    3027
    31 CanonicalForm convSingGFClapGF ( poly p );
    32 poly convClapGFSingGF ( const CanonicalForm & f );
     28CanonicalForm convSingAPFactoryAP ( poly p , const Variable & a );
     29poly convFactoryAPSingAP ( const CanonicalForm & f );
     30poly convFactoryAPSingAP_R ( const CanonicalForm & f, int par_start, int var_start );
    3331
    34 CanonicalForm convSingAClapA ( napoly p , const Variable & a );
    35 napoly convClapASingA ( const CanonicalForm & f );
     32CanonicalForm convSingGFFactoryGF ( poly p );
     33poly convFactoryGFSingGF ( const CanonicalForm & f );
    3634
    37 CanonicalForm convSingTrPClapP ( poly p );
    38 poly convClapPSingTrP ( const CanonicalForm & f );
     35CanonicalForm convSingAFactoryA ( napoly p , const Variable & a );
     36napoly convFactoryASingA ( const CanonicalForm & f );
    3937
    40 CanonicalForm convSingNClapN( number n );
    41 number convClapNSingN( const CanonicalForm & n);
     38CanonicalForm convSingTrPFactoryP ( poly p );
     39poly convFactoryPSingTrP ( const CanonicalForm & f );
     40
     41CanonicalForm convSingNFactoryN( number n );
     42number convFactoryNSingN( const CanonicalForm & n);
    4243
    4344
    44 // CanonicalForm convSingIClapI( int i);a <- by constructor of CanonicalForm
    45 int convClapISingI( const CanonicalForm & f);
     45// CanonicalForm convSingIFactoryI( int i);a <- by constructor of CanonicalForm
     46int convFactoryISingI( const CanonicalForm & f);
    4647#endif /* INCL_SINGCONV_H */
  • kernel/clapsing.cc

    raa7480c r46f6af6  
    33*  Computer Algebra System SINGULAR     *
    44****************************************/
    5 // $Id: clapsing.cc,v 1.23 2007-11-07 17:11:53 Singular Exp $
     5// $Id: clapsing.cc,v 1.24 2008-01-07 13:36:16 Singular Exp $
    66/*
    77* ABSTRACT: interface between Singular and factory
     
    138138#define FACTORY_CFTROUT_POLY( tag, f ) \
    139139  { \
    140     napoly F=convClapPSingTr( f ); \
     140    napoly F=convFactoryPSingTr( f ); \
    141141    StringSetS( tag ); \
    142142    napWrite( F ); \
     
    147147#define FACTORY_CFAOUT_POLY( tag, f ) \
    148148  { \
    149     napoly F=convClapASingA( f ); \
     149    napoly F=convFactoryASingA( f ); \
    150150    StringSetS( tag ); \
    151151    napWrite( F ); \
     
    164164  if (currRing->minpoly!=NULL) \
    165165  { \
    166     CanonicalForm mipo=convSingTrClapP(((lnumber)currRing->minpoly)->z); \
     166    CanonicalForm mipo=convSingTrFactoryP(((lnumber)currRing->minpoly)->z); \
    167167    Variable a=rootOf(mipo); \
    168     printPolyPattern( tag, convSingAClapA( f,a ), rPar( currRing ) ); \
     168    printPolyPattern( tag, convSingAFactoryA( f,a ), rPar( currRing ) ); \
    169169  } \
    170170  else \
    171171  { \
    172     printPolyPattern( tag, convSingTrClapP( f ), rPar( currRing ) ); \
     172    printPolyPattern( tag, convSingTrFactoryP( f ), rPar( currRing ) ); \
    173173  }
    174174// CanonicalForm f, represents transcendent extension
     
    216216    CanonicalForm newGCD(const CanonicalForm & A, const CanonicalForm & B);
    217217    setCharacteristic( nGetChar() );
    218     CanonicalForm F( convSingPClapP( f ) ), G( convSingPClapP( g ) );
     218    CanonicalForm F( convSingPFactoryP( f ) ), G( convSingPFactoryP( g ) );
    219219    //if (nGetChar() > 1 )
    220220    //{
    221     //  res=convClapPSingP( newGCD( F,G ));
     221    //  res=convFactoryPSingP( newGCD( F,G ));
    222222    //  if (!nGreaterZero(pGetCoeff(res))) res=pNeg(res);
    223223    //}
    224224    //else
    225       res=convClapPSingP( gcd( F, G ) );
     225      res=convFactoryPSingP( gcd( F, G ) );
    226226  }
    227227  // and over Q(a) / Fp(a)
     
    237237      {
    238238      //  WerrorS( feNotImplemented );
    239         CanonicalForm mipo=convSingTrClapP(((lnumber)currRing->minpoly)->z);
     239        CanonicalForm mipo=convSingTrFactoryP(((lnumber)currRing->minpoly)->z);
    240240        //Varlist ord;
    241241        //ord.append(mipo.mvar());
    242242        CFList as(mipo);
    243243        Variable a=rootOf(mipo);
    244         //CanonicalForm F( convSingAPClapAP( f,a ) ), G( convSingAPClapAP( g,a ) );
    245         CanonicalForm F( convSingTrPClapP(f) ), G( convSingTrPClapP(g) );
    246         //res= convClapAPSingAP( algcd( F, G, as, ord) );
    247         //res= convClapAPSingAP( alg_gcd( F, G, as) );
    248         res= convClapAPSingAP( alg_gcd( F, G, as) );
     244        //CanonicalForm F( convSingAPFactoryAP( f,a ) ), G( convSingAPFactoryAP( g,a ) );
     245        CanonicalForm F( convSingTrPFactoryP(f) ), G( convSingTrPFactoryP(g) );
     246        //res= convFactoryAPSingAP( algcd( F, G, as, ord) );
     247        //res= convFactoryAPSingAP( alg_gcd( F, G, as) );
     248        res= convFactoryAPSingAP( alg_gcd( F, G, as) );
    249249      }
    250250      else
    251251      #endif
    252252      {
    253         CanonicalForm mipo=convSingTrClapP(((lnumber)currRing->minpoly)->z);
     253        CanonicalForm mipo=convSingTrFactoryP(((lnumber)currRing->minpoly)->z);
    254254        Variable a=rootOf(mipo);
    255         CanonicalForm F( convSingAPClapAP( f,a ) ), G( convSingAPClapAP( g,a ) );
    256         res= convClapAPSingAP( gcd( F, G ) );
     255        CanonicalForm F( convSingAPFactoryAP( f,a ) ), G( convSingAPFactoryAP( g,a ) );
     256        res= convFactoryAPSingAP( gcd( F, G ) );
    257257      }
    258258    }
    259259    else
    260260    {
    261       CanonicalForm F( convSingTrPClapP( f ) ), G( convSingTrPClapP( g ) );
    262       res= convClapPSingTrP( gcd( F, G ) );
     261      CanonicalForm F( convSingTrPFactoryP( f ) ), G( convSingTrPFactoryP( g ) );
     262      res= convFactoryPSingTrP( gcd( F, G ) );
    263263    }
    264264  }
     
    271271    while (t!=nChar) { t*=p;n++; }
    272272    setCharacteristic(p,n,'a');
    273     CanonicalForm F( convSingGFClapGF( f ) ), G( convSingGFClapGF( g ) );
    274     res= convClapGFSingGF( gcd( F, G ) );
     273    CanonicalForm F( convSingGFFactoryGF( f ) ), G( convSingGFFactoryGF( g ) );
     274    res= convFactoryGFSingGF( gcd( F, G ) );
    275275  }
    276276  #endif
     
    316316    Variable X(i);
    317317    setCharacteristic( nGetChar() );
    318     CanonicalForm F( convSingPClapP( f ) ), G( convSingPClapP( g ) );
    319     poly res=convClapPSingP( resultant( F, G, X ) );
     318    CanonicalForm F( convSingPFactoryP( f ) ), G( convSingPFactoryP( g ) );
     319    poly res=convFactoryPSingP( resultant( F, G, X ) );
    320320    Off(SW_RATIONAL);
    321321    return res;
     
    332332    {
    333333      //Variable X(i);
    334       CanonicalForm mipo=convSingTrClapP(((lnumber)currRing->minpoly)->z);
     334      CanonicalForm mipo=convSingTrFactoryP(((lnumber)currRing->minpoly)->z);
    335335      Variable a=rootOf(mipo);
    336       CanonicalForm F( convSingAPClapAP( f,a ) ), G( convSingAPClapAP( g,a ) );
    337       res= convClapAPSingAP( resultant( F, G, X ) );
     336      CanonicalForm F( convSingAPFactoryAP( f,a ) ), G( convSingAPFactoryAP( g,a ) );
     337      res= convFactoryAPSingAP( resultant( F, G, X ) );
    338338    }
    339339    else
     
    345345      ef=pGetExp_Var(f,i);
    346346      eg=pGetExp_Var(g,i);
    347       CanonicalForm F( convSingTrPClapP( f ) ), G( convSingTrPClapP( g ) );
    348       res= convClapPSingTrP( resultant( F, G, X ) );
     347      CanonicalForm F( convSingTrPFactoryP( f ) ), G( convSingTrPFactoryP( g ) );
     348      res= convFactoryPSingTrP( resultant( F, G, X ) );
    349349      if ((nf!=NULL)&&(!nIsOne(nf))&&(!nIsZero(nf)))
    350350      {
     
    448448  {
    449449    setCharacteristic( nGetChar() );
    450     CanonicalForm F( convSingPClapP( f ) ), G( convSingPClapP( g ) );
     450    CanonicalForm F( convSingPFactoryP( f ) ), G( convSingPFactoryP( g ) );
    451451    CanonicalForm FpG=F+G;
    452452    if (!(FpG.isUnivariate()|| FpG.inCoeffDomain()))
     
    459459    CanonicalForm Fa,Gb;
    460460    On(SW_RATIONAL);
    461     res=convClapPSingP( extgcd( F, G, Fa, Gb ) );
    462     pa=convClapPSingP(Fa);
    463     pb=convClapPSingP(Gb);
     461    res=convFactoryPSingP( extgcd( F, G, Fa, Gb ) );
     462    pa=convFactoryPSingP(Fa);
     463    pb=convFactoryPSingP(Gb);
    464464    Off(SW_RATIONAL);
    465465  }
     
    473473    if (currRing->minpoly!=NULL)
    474474    {
    475       CanonicalForm mipo=convSingTrClapP(((lnumber)currRing->minpoly)->z);
     475      CanonicalForm mipo=convSingTrFactoryP(((lnumber)currRing->minpoly)->z);
    476476      Variable a=rootOf(mipo);
    477       CanonicalForm F( convSingAPClapAP( f,a ) ), G( convSingAPClapAP( g,a ) );
     477      CanonicalForm F( convSingAPFactoryAP( f,a ) ), G( convSingAPFactoryAP( g,a ) );
    478478      CanonicalForm FpG=F+G;
    479479      if (!(FpG.isUnivariate()|| FpG.inCoeffDomain()))
     
    483483        return TRUE;
    484484      }
    485       res= convClapAPSingAP( extgcd( F, G, Fa, Gb ) );
    486       pa=convClapAPSingAP(Fa);
    487       pb=convClapAPSingAP(Gb);
     485      res= convFactoryAPSingAP( extgcd( F, G, Fa, Gb ) );
     486      pa=convFactoryAPSingAP(Fa);
     487      pb=convFactoryAPSingAP(Gb);
    488488    }
    489489    else
    490490    {
    491       CanonicalForm F( convSingTrPClapP( f ) ), G( convSingTrPClapP( g ) );
     491      CanonicalForm F( convSingTrPFactoryP( f ) ), G( convSingTrPFactoryP( g ) );
    492492      CanonicalForm FpG=F+G;
    493493      if (!(FpG.isUnivariate()|| FpG.inCoeffDomain()))
     
    498498        return TRUE;
    499499      }
    500       res= convClapPSingTrP( extgcd( F, G, Fa, Gb ) );
    501       pa=convClapPSingTrP(Fa);
    502       pb=convClapPSingTrP(Gb);
     500      res= convFactoryPSingTrP( extgcd( F, G, Fa, Gb ) );
     501      pa=convFactoryPSingTrP(Fa);
     502      pb=convFactoryPSingTrP(Gb);
    503503    }
    504504    Off(SW_RATIONAL);
     
    522522  {
    523523    setCharacteristic( nGetChar() );
    524     CanonicalForm F( convSingPClapP( f ) ), G( convSingPClapP( g ) );
    525     res = convClapPSingP( F / G );
     524    CanonicalForm F( convSingPFactoryP( f ) ), G( convSingPFactoryP( g ) );
     525    res = convFactoryPSingP( F / G );
    526526  }
    527527  // and over Q(a) / Fp(a)
     
    533533    if (currRing->minpoly!=NULL)
    534534    {
    535       CanonicalForm mipo=convSingTrClapP(((lnumber)currRing->minpoly)->z);
     535      CanonicalForm mipo=convSingTrFactoryP(((lnumber)currRing->minpoly)->z);
    536536      Variable a=rootOf(mipo);
    537       CanonicalForm F( convSingAPClapAP( f,a ) ), G( convSingAPClapAP( g,a ) );
    538       res= convClapAPSingAP(  F / G  );
     537      CanonicalForm F( convSingAPFactoryAP( f,a ) ), G( convSingAPFactoryAP( g,a ) );
     538      res= convFactoryAPSingAP(  F / G  );
    539539    }
    540540    else
    541541    {
    542       CanonicalForm F( convSingTrPClapP( f ) ), G( convSingTrPClapP( g ) );
    543       res= convClapPSingTrP(  F / G  );
     542      CanonicalForm F( convSingTrPFactoryP( f ) ), G( convSingTrPFactoryP( g ) );
     543      res= convFactoryPSingTrP(  F / G  );
    544544    }
    545545  }
     
    612612    }
    613613    FACTORY_ALGOUT( "G", ((lnumber)g1)->z );
    614     g = convSingTrClapP( ((lnumber)g1)->z );
    615     g = gcd( g, convSingTrClapP( ((lnumber)g2)->z ));
     614    g = convSingTrFactoryP( ((lnumber)g1)->z );
     615    g = gcd( g, convSingTrFactoryP( ((lnumber)g2)->z ));
    616616
    617617    // second run: gcd's
     
    622622    {
    623623      FACTORY_ALGOUT( "h", (((lnumber)pGetCoeff(p))->z) );
    624       h = convSingTrClapP( ((lnumber)pGetCoeff(p))->z );
     624      h = convSingTrFactoryP( ((lnumber)pGetCoeff(p))->z );
    625625      pIter( p );
    626626#ifdef FACTORY_GCD_STAT
     
    653653        lnumber c=(lnumber)pGetCoeff(p);
    654654        napDelete(&c->z);
    655         c->z=convClapPSingTr( i.getItem() / g );
     655        c->z=convFactoryPSingTr( i.getItem() / g );
    656656        //nTest((number)c);
    657657        //#ifdef LDEBUG
     
    691691    && (currRing->parameter==NULL))
    692692    {
    693       F=convSingPClapP( f );
    694       FAC=convSingPClapP( fac );
     693      F=convSingPFactoryP( f );
     694      FAC=convSingPFactoryP( fac );
    695695    }
    696696    // and over Q(a) / Fp(a)
     
    700700      if (currRing->minpoly!=NULL)
    701701      {
    702         CanonicalForm mipo=convSingTrClapP(((lnumber)currRing->minpoly)->z);
     702        CanonicalForm mipo=convSingTrFactoryP(((lnumber)currRing->minpoly)->z);
    703703        a=rootOf(mipo);
    704         F=convSingAPClapAP( f,a );
    705         FAC=convSingAPClapAP( fac,a );
     704        F=convSingAPFactoryAP( f,a );
     705        FAC=convSingAPFactoryAP( fac,a );
    706706      }
    707707      else
    708708      {
    709         F=convSingTrPClapP( f );
    710         FAC=convSingTrPClapP( fac );
     709        F=convSingTrPFactoryP( f );
     710        FAC=convSingTrPFactoryP( fac );
    711711      }
    712712    }
     
    727727        && (currRing->parameter==NULL))
    728728        {
    729           q = convClapPSingP( Q );
     729          q = convFactoryPSingP( Q );
    730730        }
    731731        else if (( nGetChar()==1 ) /* Q(a) */
     
    734734          if (currRing->minpoly!=NULL)
    735735          {
    736             q= convClapAPSingAP(  Q  );
     736            q= convFactoryAPSingAP(  Q  );
    737737          }
    738738          else
    739739          {
    740             q= convClapPSingTrP(  Q  );
     740            q= convFactoryPSingTrP(  Q  );
    741741          }
    742742        }
     
    887887  {
    888888    setCharacteristic( nGetChar() );
    889     CanonicalForm F( convSingPClapP( f ) );
     889    CanonicalForm F( convSingPFactoryP( f ) );
    890890    if (nGetChar()==0) /* Q */
    891891    {
     
    911911    int c=rChar(currRing);
    912912    setCharacteristic( c, primepower(c) );
    913     CanonicalForm F( convSingGFClapGF( f ) );
     913    CanonicalForm F( convSingGFFactoryGF( f ) );
    914914    if (F.isUnivariate())
    915915    {
     
    929929    if (currRing->minpoly!=NULL)
    930930    {
    931       CanonicalForm mipo=convSingTrClapP(((lnumber)currRing->minpoly)->z);
     931      CanonicalForm mipo=convSingTrFactoryP(((lnumber)currRing->minpoly)->z);
    932932      Variable a=rootOf(mipo);
    933       CanonicalForm F( convSingAPClapAP( f,a ) );
     933      CanonicalForm F( convSingAPFactoryAP( f,a ) );
    934934      L.insert(F);
    935935      if (rField_is_Zp_a() && F.isUnivariate())
     
    939939      else
    940940      {
    941         CanonicalForm G( convSingTrPClapP( f ) );
     941        CanonicalForm G( convSingTrPFactoryP( f ) );
    942942#ifdef HAVE_LIBFAC_P
    943943        //  over Q(a) / multivariate over Fp(a)
     
    969969    else
    970970    {
    971       CanonicalForm F( convSingTrPClapP( f ) );
     971      CanonicalForm F( convSingTrPFactoryP( f ) );
    972972      if (rField_is_Q_a())
    973973      {
     
    10121012      if (with_exps!=1) (**v)[j] = J.getItem().exp();
    10131013      if (rField_is_Zp() || rField_is_Q())           /* Q, Fp */
    1014         //count_Factors(res,*v,f, j, convClapPSingP( J.getItem().factor() );
    1015         res->m[j] = convClapPSingP( J.getItem().factor() );
     1014        //count_Factors(res,*v,f, j, convFactoryPSingP( J.getItem().factor() );
     1015        res->m[j] = convFactoryPSingP( J.getItem().factor() );
    10161016      #if 0
    10171017      else if (rField_is_GF())
    1018         res->m[j] = convClapGFSingGF( J.getItem().factor() );
     1018        res->m[j] = convFactoryGFSingGF( J.getItem().factor() );
    10191019      #endif
    10201020      else if (rField_is_Extension())     /* Q(a), Fp(a) */
     
    10231023        if (v!=NULL) w=*v;
    10241024        if (currRing->minpoly==NULL)
    1025           count_Factors(res,w,j,ff,convClapPSingTrP( J.getItem().factor() ));
     1025          count_Factors(res,w,j,ff,convFactoryPSingTrP( J.getItem().factor() ));
    10261026        else
    1027           count_Factors(res,w,j,ff,convClapAPSingAP( J.getItem().factor() ));
     1027          count_Factors(res,w,j,ff,convFactoryAPSingAP( J.getItem().factor() ));
    10281028      }
    10291029    }
     
    11861186        p=pCopy(p);
    11871187        pCleardenom(p);
    1188         L.append(convSingPClapP(p));
     1188        L.append(convSingPFactoryP(p));
    11891189      }
    11901190    }
     
    12031203        p=pCopy(p);
    12041204        pCleardenom(p);
    1205         L.append(convSingTrPClapP(p));
     1205        L.append(convSingTrPFactoryP(p));
    12061206      }
    12071207    }
     
    12461246    {
    12471247      if ( (nGetChar() == 0) || (nGetChar() > 1) )
    1248         MATELEM(res,m,n)=convClapPSingP(Li.getItem());
     1248        MATELEM(res,m,n)=convFactoryPSingP(Li.getItem());
    12491249      else
    1250         MATELEM(res,m,n)=convClapPSingTrP(Li.getItem());
     1250        MATELEM(res,m,n)=convFactoryPSingTrP(Li.getItem());
    12511251    }
    12521252  }
     
    12711271    for(i=0;i<IDELEMS(I);i++)
    12721272    {
    1273       L.append(convSingPClapP(I->m[i]));
     1273      L.append(convSingPFactoryP(I->m[i]));
    12741274    }
    12751275  }
     
    12821282    for(i=0;i<IDELEMS(I);i++)
    12831283    {
    1284       L.append(convSingTrPClapP(I->m[i]));
     1284      L.append(convSingTrPFactoryP(I->m[i]));
    12851285    }
    12861286  }
     
    13541354  {
    13551355    setCharacteristic( nGetChar() );
    1356     CanonicalForm F( convSingPClapP( f ) );
     1356    CanonicalForm F( convSingPFactoryP( f ) );
    13571357    if((nGetChar()>1)&&(!F.isUnivariate()))
    13581358      goto err;
     
    13671367    //if (currRing->minpoly!=NULL)
    13681368    //{
    1369     //  CanonicalForm mipo=convSingTrClapP(((lnumber)currRing->minpoly)->z);
     1369    //  CanonicalForm mipo=convSingTrFactoryP(((lnumber)currRing->minpoly)->z);
    13701370    //  Variable a=rootOf(mipo);
    1371     //  CanonicalForm F( convSingAPClapAP( f,a ) );
     1371    //  CanonicalForm F( convSingAPFactoryAP( f,a ) );
    13721372    //  ...
    13731373    //}
    13741374    //else
    13751375    {
    1376       CanonicalForm F( convSingTrPClapP( f ) );
     1376      CanonicalForm F( convSingTrPFactoryP( f ) );
    13771377      b=(BOOLEAN)isSqrFree(F);
    13781378    }
     
    14061406      for(j=r;j>0;j--)
    14071407      {
    1408         M(i,j)=convSingPClapP(MATELEM(m,i,j));
    1409       }
    1410     }
    1411     res= convClapPSingP( determinant(M,r) ) ;
     1408        M(i,j)=convSingPFactoryP(MATELEM(m,i,j));
     1409      }
     1410    }
     1411    res= convFactoryPSingP( determinant(M,r) ) ;
    14121412  }
    14131413  // and over Q(a) / Fp(a)
     
    14211421    if (currRing->minpoly!=NULL)
    14221422    {
    1423       CanonicalForm mipo=convSingTrClapP(((lnumber)currRing->minpoly)->z);
     1423      CanonicalForm mipo=convSingTrFactoryP(((lnumber)currRing->minpoly)->z);
    14241424      Variable a=rootOf(mipo);
    14251425      int i,j;
     
    14281428        for(j=r;j>0;j--)
    14291429        {
    1430           M(i,j)=convSingAPClapAP(MATELEM(m,i,j),a);
     1430          M(i,j)=convSingAPFactoryAP(MATELEM(m,i,j),a);
    14311431        }
    14321432      }
    1433       res= convClapAPSingAP( determinant(M,r) ) ;
     1433      res= convFactoryAPSingAP( determinant(M,r) ) ;
    14341434    }
    14351435    else
     
    14401440        for(j=r;j>0;j--)
    14411441        {
    1442           M(i,j)=convSingTrPClapP(MATELEM(m,i,j));
     1442          M(i,j)=convSingTrPFactoryP(MATELEM(m,i,j));
    14431443        }
    14441444      }
    1445       res= convClapPSingTrP( determinant(M,r) );
     1445      res= convFactoryPSingTrP( determinant(M,r) );
    14461446    }
    14471447  }
     
    14641464    }
    14651465  }
    1466   int res= convClapISingI( determinant(M,m->rows())) ;
     1466  int res= convFactoryISingI( determinant(M,m->rows())) ;
    14671467  Off(SW_RATIONAL);
    14681468  return res;
     
    14801480 if (currRing->minpoly!=NULL)
    14811481 {
    1482    CanonicalForm mipo=convSingTrClapP(((lnumber)currRing->minpoly)->z);
     1482   CanonicalForm mipo=convSingTrFactoryP(((lnumber)currRing->minpoly)->z);
    14831483   Variable a=rootOf(mipo);
    1484    CanonicalForm F( convSingAClapA( f,a ) ), G( convSingAClapA( g,a ) );
     1484   CanonicalForm F( convSingAFactoryA( f,a ) ), G( convSingAFactoryA( g,a ) );
    14851485   CanonicalForm GCD;
    14861486
     
    14981498
    14991499   // calculate lcm
    1500    res= convClapASingA( (F/GCD)*G );
     1500   res= convFactoryASingA( (F/GCD)*G );
    15011501 }
    15021502 else
    15031503 {
    1504    CanonicalForm F( convSingTrClapP( f ) ), G( convSingTrClapP( g ) );
     1504   CanonicalForm F( convSingTrFactoryP( f ) ), G( convSingTrFactoryP( g ) );
    15051505   CanonicalForm GCD;
    15061506   TIMING_START( algLcmTimer );
     
    15171517
    15181518   // calculate lcm
    1519    res= convClapPSingTr( (F/GCD)*G );
     1519   res= convFactoryPSingTr( (F/GCD)*G );
    15201520 }
    15211521
     
    15371537 if (currRing->minpoly!=NULL)
    15381538 {
    1539    CanonicalForm mipo=convSingTrClapP(((lnumber)currRing->minpoly)->z);
     1539   CanonicalForm mipo=convSingTrFactoryP(((lnumber)currRing->minpoly)->z);
    15401540   Variable a=rootOf(mipo);
    1541    CanonicalForm F( convSingAClapA( f,a ) ), G( convSingAClapA( g,a ) );
     1541   CanonicalForm F( convSingAFactoryA( f,a ) ), G( convSingAFactoryA( g,a ) );
    15421542   CanonicalForm GCD;
    15431543
     
    15551555   if ((GCD!=1) && (GCD!=0))
    15561556   {
    1557      ff= convClapASingA( F/ GCD );
    1558      gg= convClapASingA( G/ GCD );
     1557     ff= convFactoryASingA( F/ GCD );
     1558     gg= convFactoryASingA( G/ GCD );
    15591559   }
    15601560 }
    15611561 else
    15621562 {
    1563    CanonicalForm F( convSingTrClapP( f ) ), G( convSingTrClapP( g ) );
     1563   CanonicalForm F( convSingTrFactoryP( f ) ), G( convSingTrFactoryP( g ) );
    15641564   CanonicalForm GCD;
    15651565
     
    15771577   if ((GCD!=1) && (GCD!=0))
    15781578   {
    1579      ff= convClapPSingTr( F/ GCD );
    1580      gg= convClapPSingTr( G/ GCD );
     1579     ff= convFactoryPSingTr( F/ GCD );
     1580     gg= convFactoryPSingTr( G/ GCD );
    15811581   }
    15821582 }
     
    16081608    {
    16091609      number N=(number)x->m[i-1].Data();
    1610       X[i]=convSingNClapN(N);
     1610      X[i]=convSingNFactoryN(N);
    16111611    }
    16121612    else
     
    16231623    {
    16241624      number N=(number)x->m[i-1].Data();
    1625       Q[i]=convSingNClapN(N);
     1625      Q[i]=convSingNFactoryN(N);
    16261626    }
    16271627    else
     
    16371637  res->m[0].rtyp=NUMBER_CMD;
    16381638  res->m[1].rtyp=NUMBER_CMD;
    1639   res->m[0].data=(char *)convClapNSingN( r );
    1640   res->m[1].data=(char *)convClapNSingN( prod );
     1639  res->m[0].data=(char *)convFactoryNSingN( r );
     1640  res->m[1].data=(char *)convFactoryNSingN( prod );
    16411641  return res;
    16421642}
  • kernel/longalg.cc

    raa7480c r46f6af6  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: longalg.cc,v 1.30 2007-07-24 16:55:07 Singular Exp $ */
     4/* $Id: longalg.cc,v 1.31 2008-01-07 13:36:16 Singular Exp $ */
    55/*
    66* ABSTRACT:   algebraic numbers
     
    16791679    napoly rz=napGcd(x->z, y->z);
    16801680    CanonicalForm F, G, R;
    1681     R=convSingTrClapP(rz);
     1681    R=convSingTrFactoryP(rz);
    16821682    napNormalize(x->z);
    1683     F=convSingTrClapP(x->z)/R;
     1683    F=convSingTrFactoryP(x->z)/R;
    16841684    napNormalize(y->z);
    1685     G=convSingTrClapP(y->z)/R;
     1685    G=convSingTrFactoryP(y->z)/R;
    16861686    F = gcd( F, G );
    16871687    if (F.isOne())
     
    16901690    {
    16911691      napDelete(&rz);
    1692       result->z=convClapPSingTr( F*R );
     1692      result->z=convFactoryPSingTr( F*R );
    16931693      napNormalize(result->z);
    16941694    }
  • kernel/longrat.cc

    raa7480c r46f6af6  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: longrat.cc,v 1.25 2007-09-13 14:27:50 Singular Exp $ */
     4/* $Id: longrat.cc,v 1.26 2008-01-07 13:36:16 Singular Exp $ */
    55/*
    66* ABSTRACT: computation with long rational numbers (Hubert Grassmann)
     
    6464*/
    6565#define SR_HDL(A) ((long)(A))
    66 /*#define SR_INT    1*/
     66/*#define SR_INT    1L*/
    6767/*#define INT_TO_SR(INT)  ((number) (((long)INT << 2) + SR_INT))*/
    6868// #define SR_TO_INT(SR)   (((long)SR) >> 2)
Note: See TracChangeset for help on using the changeset viewer.