Changeset 3d6c38 in git for kernel/clapconv.cc


Ignore:
Timestamp:
Aug 5, 2009, 7:29:44 PM (14 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
Children:
f60485dae160ea69a455571578bb2877fbc73226
Parents:
91d0e6160c27d70513b2d48ed1829a64a7f84780
Message:
*hannes: code cleanup (longalg.h)


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

Legend:

Unmodified
Added
Removed
  • kernel/clapconv.cc

    r91d0e6 r3d6c38  
    33*  Computer Algebra System SINGULAR     *
    44****************************************/
    5 // $Id: clapconv.cc,v 1.12 2008-12-17 15:07:46 Singular Exp $
     5// $Id: clapconv.cc,v 1.13 2009-08-05 17:28:16 Singular Exp $
    66/*
    77* ABSTRACT: convert data between Singular and factory
     
    227227{
    228228  CanonicalForm result = 0;
    229   int e, n = napVariables;
     229  int e, n = rPar(currRing);
    230230
    231231  while ( p!=NULL)
     
    235235    if ( getCharacteristic() != 0 )
    236236    {
    237       term = npInt( napGetCoeff( p ) );
    238     }
    239     else
    240     {
    241       if ( SR_HDL(napGetCoeff( p )) & SR_INT )
    242         term = SR_TO_INT( napGetCoeff( p ) );
     237      term = npInt( pGetCoeff( p ) );
     238    }
     239    else
     240    {
     241      if ( SR_HDL(pGetCoeff( p )) & SR_INT )
     242        term = SR_TO_INT( pGetCoeff( p ) );
    243243      else
    244244      {
    245         if ( napGetCoeff( p )->s == 3 )
     245        if ( pGetCoeff( p )->s == 3 )
    246246        {
    247247          MP_INT dummy;
    248           mpz_init_set( &dummy, &(napGetCoeff( p )->z) );
     248          mpz_init_set( &dummy, &(pGetCoeff( p )->z) );
    249249          term = make_cf( dummy );
    250250        }
     
    254254          MP_INT num, den;
    255255          On(SW_RATIONAL);
    256           mpz_init_set( &num, &(napGetCoeff( p )->z) );
    257           mpz_init_set( &den, &(napGetCoeff( p )->n) );
    258           term = make_cf( num, den, ( napGetCoeff( p )->s != 1 ));
     256          mpz_init_set( &num, &(pGetCoeff( p )->z) );
     257          mpz_init_set( &den, &(pGetCoeff( p )->n) );
     258          term = make_cf( num, den, ( pGetCoeff( p )->s != 1 ));
    259259        }
    260260      }
     
    262262    for ( int i = n; i >0; i-- )
    263263    {
    264       if ( (e = napGetExp( p, i )) != 0 )
     264      if ( (e = p_GetExp( p, i, currRing->algring )) != 0 )
    265265        term *= power( Variable( i ), e );
    266266    }
    267267    result += term;
    268     p = napNext( p );
     268    pIter( p );
    269269  }
    270270  return result;
     
    274274{
    275275//    cerr << " f = " << f << endl;
    276   int n = napVariables+1;
    277   /* ASSERT( level( f ) <= napVariables, "illegal number of variables" ); */
     276  int n = rPar(currRing)+1;
     277  /* ASSERT( level( f ) <= rPar(currRing), "illegal number of variables" ); */
    278278  int * exp = (int *)omAlloc0(n*sizeof(int));
    279279  napoly result = NULL;
     
    301301    napoly term = napNew();
    302302    // napNext( term ) = NULL; //already done by napNew
    303     for ( int i = 1; i <= napVariables; i++ )
    304       napSetExp( term, i , exp[i]);
     303    for ( int i = rPar(currRing); i>=1; i-- )
     304      p_SetExp( term, i , exp[i],currRing->algring);
     305    p_Setm(term, currRing->algring);
    305306    if ( f.isImm() )
    306       napGetCoeff( term ) = nacInit( f.intval() );
     307      pGetCoeff( term ) = n_Init( f.intval(), currRing->algring );
    307308    else
    308309    {
     
    327328        {
    328329          z->s = 0;
    329           nacNormalize(z);
    330         }
    331       }
    332       napGetCoeff( term ) = z;
    333     }
    334     if (nacIsZero(pGetCoeff(term)))
     330          n_Normalize(z,currRing->algring);
     331        }
     332      }
     333      pGetCoeff( term ) = z;
     334    }
     335    if (n_IsZero(pGetCoeff(term),currRing->algring))
    335336    {
    336337      napDelete(&term);
     
    474475{
    475476  if ( f.isImm() )
    476     return nacInit( f.intval() );
     477    return n_Init( f.intval(), currRing->algring );
    477478  else
    478479  {
     
    508509    // napNext( t ) = NULL; //already done by napNew
    509510    napGetCoeff(t)=convFactoryNSingAN( i.coeff() );
    510     if (nacIsZero(napGetCoeff(t)))
     511    if (n_IsZero(napGetCoeff(t),currRing->algring))
    511512    {
    512513      napDelete(&t);
Note: See TracChangeset for help on using the changeset viewer.