Changeset 3d6c38 in git for kernel/clapconv.cc
- Timestamp:
- Aug 5, 2009, 7:29:44 PM (14 years ago)
- Branches:
- (u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
- Children:
- f60485dae160ea69a455571578bb2877fbc73226
- Parents:
- 91d0e6160c27d70513b2d48ed1829a64a7f84780
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/clapconv.cc
r91d0e6 r3d6c38 3 3 * Computer Algebra System SINGULAR * 4 4 ****************************************/ 5 // $Id: clapconv.cc,v 1.1 2 2008-12-17 15:07:46 Singular Exp $5 // $Id: clapconv.cc,v 1.13 2009-08-05 17:28:16 Singular Exp $ 6 6 /* 7 7 * ABSTRACT: convert data between Singular and factory … … 227 227 { 228 228 CanonicalForm result = 0; 229 int e, n = napVariables;229 int e, n = rPar(currRing); 230 230 231 231 while ( p!=NULL) … … 235 235 if ( getCharacteristic() != 0 ) 236 236 { 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 ) ); 243 243 else 244 244 { 245 if ( napGetCoeff( p )->s == 3 )245 if ( pGetCoeff( p )->s == 3 ) 246 246 { 247 247 MP_INT dummy; 248 mpz_init_set( &dummy, &( napGetCoeff( p )->z) );248 mpz_init_set( &dummy, &(pGetCoeff( p )->z) ); 249 249 term = make_cf( dummy ); 250 250 } … … 254 254 MP_INT num, den; 255 255 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 )); 259 259 } 260 260 } … … 262 262 for ( int i = n; i >0; i-- ) 263 263 { 264 if ( (e = napGetExp( p, i)) != 0 )264 if ( (e = p_GetExp( p, i, currRing->algring )) != 0 ) 265 265 term *= power( Variable( i ), e ); 266 266 } 267 267 result += term; 268 p = napNext( p );268 pIter( p ); 269 269 } 270 270 return result; … … 274 274 { 275 275 // 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" ); */ 278 278 int * exp = (int *)omAlloc0(n*sizeof(int)); 279 279 napoly result = NULL; … … 301 301 napoly term = napNew(); 302 302 // 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); 305 306 if ( f.isImm() ) 306 napGetCoeff( term ) = nacInit( f.intval());307 pGetCoeff( term ) = n_Init( f.intval(), currRing->algring ); 307 308 else 308 309 { … … 327 328 { 328 329 z->s = 0; 329 n acNormalize(z);330 } 331 } 332 napGetCoeff( term ) = z;333 } 334 if (n acIsZero(pGetCoeff(term)))330 n_Normalize(z,currRing->algring); 331 } 332 } 333 pGetCoeff( term ) = z; 334 } 335 if (n_IsZero(pGetCoeff(term),currRing->algring)) 335 336 { 336 337 napDelete(&term); … … 474 475 { 475 476 if ( f.isImm() ) 476 return n acInit( f.intval());477 return n_Init( f.intval(), currRing->algring ); 477 478 else 478 479 { … … 508 509 // napNext( t ) = NULL; //already done by napNew 509 510 napGetCoeff(t)=convFactoryNSingAN( i.coeff() ); 510 if (n acIsZero(napGetCoeff(t)))511 if (n_IsZero(napGetCoeff(t),currRing->algring)) 511 512 { 512 513 napDelete(&t);
Note: See TracChangeset
for help on using the changeset viewer.