Changeset d268a9 in git


Ignore:
Timestamp:
Dec 8, 2000, 6:26:23 PM (23 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
4e461ff1df145d7679c725489c921162884348f8
Parents:
b989766c9307859dd7f91bf01c25470f338005bb
Message:
*hannes: conv_ClapPSingP


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

Legend:

Unmodified
Added
Removed
  • Singular/clapconv.cc

    rb98976 rd268a9  
    33*  Computer Algebra System SINGULAR     *
    44****************************************/
    5 // $Id: clapconv.cc,v 1.31 2000-12-08 13:42:08 Singular Exp $
     5// $Id: clapconv.cc,v 1.32 2000-12-08 17:26:22 Singular Exp $
    66/*
    77* ABSTRACT: convert data between Singular and factory
     
    2828
    2929static void convRecPP ( const CanonicalForm & f, int * exp, poly & result );
     30static void conv_RecPP ( const CanonicalForm & f, int * exp, poly & result, ring r );
    3031
    3132static void convRecPTr ( const CanonicalForm & f, int * exp, napoly & result );
     
    106107}
    107108
    108 CanonicalForm
    109 convSingPClapP( poly p )
     109CanonicalForm conv_SingPClapP( poly p, ring r )
    110110{
    111111  CanonicalForm result = 0;
    112   int e, n = pVariables;
    113   assume( rPar(currRing)==0);
     112  int e, n = r->N;
     113  assume( rPar(r)==0);
    114114
    115115  while ( p != NULL )
     
    155155    for ( int i = 1; i <= n; i++ )
    156156    {
    157       if ( (e = pGetExp( p, i )) != 0 )
     157      if ( (e = p_GetExp( p, i, r )) != 0 )
    158158         term *= power( Variable( i ), e );
    159159    }
     
    164164}
    165165
    166 poly
    167 convClapPSingP ( const CanonicalForm & f )
     166poly convClapPSingP ( const CanonicalForm & f )
    168167{
    169168//    cerr << " f = " << f << endl;
     
    179178}
    180179
    181 static void
    182 convRecPP ( const CanonicalForm & f, int * exp, poly & result )
     180static void convRecPP ( const CanonicalForm & f, int * exp, poly & result )
    183181{
    184182  if (f == 0)
     
    234232    {
    235233      result = pAdd( result, term );
     234    }
     235  }
     236}
     237
     238poly conv_ClapPSingP ( const CanonicalForm & f, ring r )
     239{
     240//    cerr << " f = " << f << endl;
     241  int n = r->N+1;
     242  /* ASSERT( level( f ) <= pVariables, "illegal number of variables" ); */
     243  int * exp = new int[n];
     244  //for ( int i = 0; i < n; i++ ) exp[i] = 0;
     245  memset(exp,0,n*sizeof(int));
     246  poly result = NULL;
     247  conv_RecPP( f, exp, result, r );
     248  delete [] exp;
     249  return result;
     250}
     251
     252static void
     253conv_RecPP ( const CanonicalForm & f, int * exp, poly & result, ring r )
     254{
     255  if (f == 0)
     256    return;
     257  if ( ! f.inCoeffDomain() )
     258  {
     259    int l = f.level();
     260    for ( CFIterator i = f; i.hasTerms(); i++ )
     261    {
     262      exp[l] = i.exp();
     263      conv_RecPP( i.coeff(), exp, result, r );
     264    }
     265    exp[l] = 0;
     266  }
     267  else
     268  {
     269    poly term = p_Init(r);
     270    pNext( term ) = NULL;
     271    for ( int i = 1; i <= r->N; i++ )
     272      p_SetExp( term, i, exp[i], r);
     273    if (rRing_has_Comp(r)) p_SetComp(term, 0, r);
     274    if ( getCharacteristic() != 0 )
     275    {
     276      pGetCoeff( term ) = n_Init( f.intval(), r );
     277    }
     278    else
     279    {
     280      if ( f.isImm() )
     281        pGetCoeff( term ) = n_Init( f.intval(), r );
     282      else
     283      {
     284        number z=(number)omAllocBin(rnumber_bin);
     285#if defined(LDEBUG)
     286        z->debug=123456;
     287#endif
     288        z->z = gmp_numerator( f );
     289        if ( f.den() == 1 )
     290          z->s = 3;
     291        else
     292        {
     293          z->n = gmp_denominator( f );
     294          z->s = 0;
     295        }
     296        pGetCoeff( term ) = z;
     297      }
     298    }
     299    p_Setm( term, r );
     300    if ( n_IsZero(pGetCoeff(term), r) )
     301    {
     302      p_Delete(&term,r);
     303    }
     304    else
     305    {
     306      result = p_Add_q( result, term, r );
    236307    }
    237308  }
  • Singular/clapconv.h

    rb98976 rd268a9  
    33*  Computer Algebra System SINGULAR     *
    44****************************************/
    5 // $Id: clapconv.h,v 1.10 2000-12-07 12:04:56 Singular Exp $
     5// $Id: clapconv.h,v 1.11 2000-12-08 17:26:23 Singular Exp $
    66/*
    77* ABSTRACT: convert data between Singular and factory
     
    2020
    2121poly convClapPSingP ( const CanonicalForm & f );
    22 CanonicalForm convSingPClapP( poly p );
     22#define  convSingPClapP(p) conv_SingPClapP(p,currRing)
     23
     24poly conv_ClapPSingP ( const CanonicalForm & f, ring r );
     25CanonicalForm conv_SingPClapP( poly p, ring r );
    2326
    2427CanonicalForm convSingAPClapAP ( poly p , const Variable & a );
Note: See TracChangeset for help on using the changeset viewer.