Changeset f7951d in git
- Timestamp:
- Mar 10, 2021, 3:49:00 PM (3 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- 24457e03b41762fa464203e9f37e01f02fce24683648b2bef793a083d375af65419598beca5015cd77054fb78f4461a6ea2947231805a4b0df8a2bf2e116149bc2442a2ba73ebb392585573a36abcafd
- Parents:
- 2fef40de8fd04416484636ccf6b77fe2038041f4
- Location:
- Singular
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/fglm.cc
r2fef40 rf7951d 348 348 } 349 349 350 ideal fglmQuot( ideal first, poly second ) 351 { 352 FglmState state = FglmOk; 353 354 ideal sourceIdeal = first; 355 poly quot = second; 356 ideal destIdeal = NULL; 357 358 state = fglmIdealcheck( sourceIdeal ); 359 if ( state == FglmOk ) 360 { 361 if ( quot == NULL ) state= FglmPolyIsZero; 362 else if ( pIsConstant( quot ) ) state= FglmPolyIsOne; 363 } 364 365 if ( state == FglmOk ) 366 { 367 if ( fglmquot( sourceIdeal, quot, destIdeal ) == FALSE ) 368 state= FglmNotReduced; 369 } 370 371 switch (state) 372 { 373 case FglmOk: 374 break; 375 case FglmHasOne: 376 destIdeal= idInit(1,1); 377 (destIdeal->m)[0]= pOne(); 378 state= FglmOk; 379 break; 380 case FglmNotZeroDim: 381 WerrorS( "The ideal has to be 0-dimensional" ); 382 destIdeal= idInit(1,1); 383 break; 384 case FglmNotReduced: 385 WerrorS( "The poly has to be reduced" ); 386 destIdeal= idInit(1,1); 387 break; 388 case FglmPolyIsOne: 389 int k; 390 destIdeal= idInit( IDELEMS(sourceIdeal), 1 ); 391 for ( k= IDELEMS( sourceIdeal )-1; k >=0; k-- ) 392 (destIdeal->m)[k]= pCopy( (sourceIdeal->m)[k] ); 393 state= FglmOk; 394 break; 395 case FglmPolyIsZero: 396 destIdeal= idInit(1,1); 397 (destIdeal->m)[0]= pOne(); 398 state= FglmOk; 399 break; 400 default: 401 destIdeal= idInit(1,1); 402 } 403 404 return destIdeal; 405 } 406 350 407 // fglmQuotProc: Calculate I:f with FGLM methods. 351 408 // Checks the input-data, and calls fglmquot (see fglmzero.cc). … … 415 472 } // fglmQuotProt 416 473 417 // The main function for finduni(). 418 // Checks the input-data, and calls FindUnivariateWrapper (see fglmzero.cc). 419 // Returns an ideal containing the univariate Polynomials or 0 if an error 420 // has occoured. 421 BOOLEAN 422 findUniProc( leftv result, leftv first ) 474 ideal findUni( ideal first ) 423 475 { 424 476 ideal sourceIdeal; … … 426 478 FglmState state; 427 479 428 sourceIdeal = (ideal)first->Data(); 429 430 assumeStdFlag( first ); 480 sourceIdeal = first; 481 431 482 state= fglmIdealcheck( sourceIdeal ); 432 483 if ( state == FglmOk ) … … 470 521 break; 471 522 case FglmNotZeroDim: 523 WerrorS( "The ideal has to be 0-dimensional" ); 524 destIdeal= idInit(1,1); 525 break; 526 case FglmNotReduced: 527 Werror( "The ideal has to be reduced" ); 528 destIdeal= idInit(1,1); 529 break; 530 default: 531 destIdeal= idInit(1,1); 532 } 533 534 return destIdeal; 535 } 536 // The main function for finduni(). 537 // Checks the input-data, and calls FindUnivariateWrapper (see fglmzero.cc). 538 // Returns an ideal containing the univariate Polynomials or 0 if an error 539 // has occoured. 540 BOOLEAN 541 findUniProc( leftv result, leftv first ) 542 { 543 ideal sourceIdeal; 544 ideal destIdeal = NULL; 545 FglmState state; 546 547 sourceIdeal = (ideal)first->Data(); 548 549 assumeStdFlag( first ); 550 state= fglmIdealcheck( sourceIdeal ); 551 if ( state == FglmOk ) 552 { 553 // check for special cases: if the input contains 554 // univariate polys, try to reduce the problem 555 int i,k; 556 int count=0; 557 BOOLEAN * purePowers = (BOOLEAN *)omAlloc0( currRing->N*sizeof( BOOLEAN ) ); 558 for ( k= IDELEMS( sourceIdeal ) - 1; k >= 0; k-- ) 559 { 560 if((i=pIsUnivariate(sourceIdeal->m[k]))>0) 561 { 562 if (purePowers[i-1]==0) 563 { 564 purePowers[i-1]=k; 565 count++; 566 if (count==currRing->N) break; 567 } 568 } 569 } 570 if (count==currRing->N) 571 { 572 destIdeal=idInit(currRing->N,1); 573 for(k=currRing->N-1; k>=0; k--) destIdeal->m[k]=pCopy(sourceIdeal->m[purePowers[k]]); 574 } 575 omFreeSize((ADDRESS)purePowers, currRing->N*sizeof( BOOLEAN ) ); 576 if (destIdeal!=NULL) 577 state = FglmOk; 578 else if ( FindUnivariateWrapper( sourceIdeal, destIdeal ) == FALSE ) 579 state = FglmNotReduced; 580 } 581 switch (state) 582 { 583 case FglmOk: 584 break; 585 case FglmHasOne: 586 destIdeal= idInit(1,1); 587 (destIdeal->m)[0]= pOne(); 588 state= FglmOk; 589 break; 590 case FglmNotZeroDim: 472 591 Werror( "The ideal %s has to be 0-dimensional", first->Name() ); 473 592 destIdeal= NULL; -
Singular/fglm.h
r2fef40 rf7951d 24 24 // Returns TRUE if an error occoured. 25 25 BOOLEAN fglmQuotProc( leftv result, leftv first, leftv second ); 26 ideal fglmQuot( ideal first, poly second ); 26 27 27 28 // FindUnivariatePolys (test) … … 30 31 // wrapper for FindUnivariatePolys (test) 31 32 BOOLEAN findUniProc( leftv result, leftv first); 33 ideal findUni( ideal first ); 32 34 33 35 // homogeneous FGLM
Note: See TracChangeset
for help on using the changeset viewer.