Changeset b938f4 in git for kernel/npolygon.cc
- Timestamp:
- Jul 19, 2011, 12:55:56 PM (12 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
- Children:
- 22a09d7b2686f280e5afec3b39bd5e02739c9a40
- Parents:
- ed47edfe6cd330b5befd43ea05889c3359a9d64a
- git-author:
- mlee <martinlee84@web.de>2011-07-19 12:55:56+02:00
- git-committer:
- Mohamed Barakat <mohamed.barakat@rwth-aachen.de>2011-11-09 12:39:57+01:00
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/npolygon.cc
red47edf rb938f4 19 19 #endif 20 20 21 #include <polys/polys.h> 21 //#include <polys/polys.h> 22 #include <polys/monomials/p_polys.h> 23 #include <polys/monomials/ring.h> 24 22 25 #include <kernel/GMPrat.h> 23 26 #include <kernel/kmatrix.h> 24 27 #include <kernel/npolygon.h> 28 #include <kernel/structs.h> 25 29 26 30 // ---------------------------------------------------------------------------- … … 181 185 // ---------------------------------------------------------------------------- 182 186 183 Rational linearForm::weight( poly m ) const187 Rational linearForm::weight( poly m, const ring r ) const 184 188 { 185 189 Rational ret=(Rational)0; … … 187 191 for( int i=0,j=1; i<N; i++,j++ ) 188 192 { 189 ret += c[i]*(Rational)p GetExp( m,j);193 ret += c[i]*(Rational)p_GetExp( m,j,r ); 190 194 } 191 195 … … 197 201 // ---------------------------------------------------------------------------- 198 202 199 Rational linearForm::pweight( poly m ) const203 Rational linearForm::pweight( poly m, const ring r ) const 200 204 { 201 205 if( m==(poly)NULL ) 202 206 return (Rational)0; 203 207 204 Rational ret = weight( m );208 Rational ret = weight( m, r ); 205 209 Rational tmp; 206 210 207 211 for( m=pNext(m); m!=(poly)NULL; pIter(m) ) 208 212 { 209 tmp = weight( m );213 tmp = weight( m, r ); 210 214 if( tmp<ret ) 211 215 { … … 221 225 // ---------------------------------------------------------------------------- 222 226 223 Rational linearForm::weight_shift( poly m ) const227 Rational linearForm::weight_shift( poly m, const ring r ) const 224 228 { 225 229 Rational ret=(Rational)0; … … 227 231 for( int i=0,j=1; i<N; i++,j++ ) 228 232 { 229 ret += c[i]*(Rational)( p GetExp( m,j) + 1 );233 ret += c[i]*(Rational)( p_GetExp( m,j,r ) + 1 ); 230 234 } 231 235 … … 237 241 // ---------------------------------------------------------------------------- 238 242 239 Rational linearForm::weight1( poly m ) const243 Rational linearForm::weight1( poly m, const ring r ) const 240 244 { 241 245 Rational ret=(Rational)0; … … 243 247 for( int i=0,j=2; i<N; i++,j++ ) 244 248 { 245 ret += c[i]*(Rational)p GetExp( m,j);249 ret += c[i]*(Rational)p_GetExp( m,j,r ); 246 250 } 247 251 … … 254 258 // ---------------------------------------------------------------------------- 255 259 256 Rational linearForm::weight_shift1( poly m ) const260 Rational linearForm::weight_shift1( poly m, const ring r ) const 257 261 { 258 262 Rational ret=(Rational)0; … … 260 264 for( int i=0,j=2; i<N; i++,j++ ) 261 265 { 262 ret += c[i]*(Rational)( p GetExp( m,j) + 1 );266 ret += c[i]*(Rational)( p_GetExp( m,j,r ) + 1 ); 263 267 } 264 268 … … 389 393 // ---------------------------------------------------------------------------- 390 394 391 newtonPolygon::newtonPolygon( poly f )395 newtonPolygon::newtonPolygon( poly f, const ring s ) 392 396 { 393 397 copy_zero( ); 394 398 395 int *r=new int[ pVariables];396 poly *m=new poly[ pVariables];397 398 399 KMatrix<Rational> mat( pVariables,pVariables+1 );399 int *r=new int[s->N]; 400 poly *m=new poly[s->N]; 401 402 403 KMatrix<Rational> mat(s->N,s->N+1 ); 400 404 401 405 int i,j,stop=FALSE; … … 406 410 // --------------- 407 411 408 for( i=0; i< pVariables; i++ )412 for( i=0; i<s->N; i++ ) 409 413 { 410 414 r[i] = i; … … 413 417 m[0] = f; 414 418 415 for( i=1; i< pVariables; i++ )419 for( i=1; i<s->N; i++ ) 416 420 { 417 421 m[i] = pNext(m[i-1]); … … 429 433 // --------------------------------------------------- 430 434 431 for( i=0; i< pVariables; i++ )432 { 433 for( j=0; j< pVariables; j++ )435 for( i=0; i<s->N; i++ ) 436 { 437 for( j=0; j<s->N; j++ ) 434 438 { 435 439 // mat.set( i,j,pGetExp( m[r[i]],j+1 ) ); 436 mat.set( i,j,p GetExp( m[i],j+1) );440 mat.set( i,j,p_GetExp( m[i],j+1,s ) ); 437 441 } 438 442 mat.set( i,j,1 ); 439 443 } 440 444 441 if( mat.solve( &(sol.c),&(sol.N) ) == pVariables)445 if( mat.solve( &(sol.c),&(sol.N) ) == s->N ) 442 446 { 443 447 // --------------------------------- … … 446 450 // --------------------------------- 447 451 448 if( sol.positive( ) && sol.pweight( f ) >= (Rational)1 )452 if( sol.positive( ) && sol.pweight( f,s ) >= (Rational)1 ) 449 453 { 450 454 // ---------------------------------- … … 462 466 // -------------------- 463 467 464 for( i=1; r[i-1] + 1 == r[i] && i < pVariables; i++ );468 for( i=1; r[i-1] + 1 == r[i] && i < s->N; i++ ); 465 469 466 470 for( j=0; j<i-1; j++ ) … … 480 484 m[i-1]=pNext(m[i-1]); 481 485 482 if( m[ pVariables-1] == (poly)NULL )486 if( m[s->N-1] == (poly)NULL ) 483 487 { 484 488 stop = TRUE; … … 556 560 // ---------------------------------------------------------------------------- 557 561 558 Rational newtonPolygon::weight( poly m ) const559 { 560 Rational ret = l[0].weight( m );562 Rational newtonPolygon::weight( poly m, const ring r ) const 563 { 564 Rational ret = l[0].weight( m,r ); 561 565 Rational tmp; 562 566 563 567 for( int i=1; i<N; i++ ) 564 568 { 565 tmp = l[i].weight( m );569 tmp = l[i].weight( m,r ); 566 570 567 571 if( tmp < ret ) … … 577 581 // ---------------------------------------------------------------------------- 578 582 579 Rational newtonPolygon::weight_shift( poly m ) const580 { 581 Rational ret = l[0].weight_shift( m );583 Rational newtonPolygon::weight_shift( poly m, const ring r ) const 584 { 585 Rational ret = l[0].weight_shift( m, r ); 582 586 Rational tmp; 583 587 584 588 for( int i=1; i<N; i++ ) 585 589 { 586 tmp = l[i].weight_shift( m );590 tmp = l[i].weight_shift( m, r ); 587 591 588 592 if( tmp < ret ) … … 598 602 // ---------------------------------------------------------------------------- 599 603 600 Rational newtonPolygon::weight1( poly m ) const601 { 602 Rational ret = l[0].weight1( m );604 Rational newtonPolygon::weight1( poly m, const ring r ) const 605 { 606 Rational ret = l[0].weight1( m, r ); 603 607 Rational tmp; 604 608 605 609 for( int i=1; i<N; i++ ) 606 610 { 607 tmp = l[i].weight1( m );611 tmp = l[i].weight1( m, r ); 608 612 609 613 if( tmp < ret ) … … 620 624 // ---------------------------------------------------------------------------- 621 625 622 Rational newtonPolygon::weight_shift1( poly m ) const623 { 624 Rational ret = l[0].weight_shift1( m );626 Rational newtonPolygon::weight_shift1( poly m, const ring r ) const 627 { 628 Rational ret = l[0].weight_shift1( m, r ); 625 629 Rational tmp; 626 630 627 631 for( int i=1; i<N; i++ ) 628 632 { 629 tmp = l[i].weight_shift1( m );633 tmp = l[i].weight_shift1( m, r ); 630 634 631 635 if( tmp < ret )
Note: See TracChangeset
for help on using the changeset viewer.