Changeset 7b7c2c in git for dyn_modules/syzextra/mod_main.cc
- Timestamp:
- May 21, 2012, 6:00:06 PM (12 years ago)
- Branches:
- (u'spielwiese', '17f1d200f27c5bd38f5dfc6e8a0879242279d1d8')
- Children:
- 8b78ee10b628bc9fde6d3e7d8eb3c4e311dc9600
- Parents:
- a01c174aaad1f7a02f14200b04b5a3d7202edbf3
- git-author:
- Oleksandr Motsak <motsak@mathematik.uni-kl.de>2012-05-21 18:00:06+02:00
- git-committer:
- Oleksandr Motsak <motsak@mathematik.uni-kl.de>2014-05-07 04:41:43+02:00
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
dyn_modules/syzextra/mod_main.cc
ra01c17 r7b7c2c 517 517 return TRUE; 518 518 } 519 520 521 static BOOLEAN ComputeLeadingSyzygyTerms(leftv res, leftv h) 522 { 523 const ring r = currRing; 524 NoReturn(res); 525 526 if( h == NULL ) 527 { 528 WarnS("ComputeLeadingSyzygyTerms needs an argument..."); 529 return TRUE; 530 } 531 532 assume( h != NULL ); 533 534 #ifndef NDEBUG 535 const BOOLEAN __DEBUG__ = (BOOLEAN)((long)(atGet(currRingHdl,"DEBUG",INT_CMD, (void*)TRUE))); 536 #else 537 const BOOLEAN __DEBUG__ = (BOOLEAN)((long)(atGet(currRingHdl,"DEBUG",INT_CMD, (void*)FALSE))); 538 #endif 539 540 if( h->Typ() == IDEAL_CMD || h->Typ() == MODUL_CMD) 541 { 542 const ideal id = (const ideal)h->Data(); 543 544 assume(id != NULL); 545 546 if( __DEBUG__ ) 547 { 548 PrintS("ComputeLeadingSyzygyTerms::Input: \n"); 549 550 const BOOLEAN __LEAD2SYZ__ = (BOOLEAN)((long)(atGet(currRingHdl,"LEAD2SYZ",INT_CMD, (void*)0))); 551 const BOOLEAN __TAILREDSYZ__ = (BOOLEAN)((long)(atGet(currRingHdl,"TAILREDSYZ",INT_CMD, (void*)0))); 552 const BOOLEAN __SYZCHECK__ = (BOOLEAN)((long)(atGet(currRingHdl,"SYZCHECK",INT_CMD, (void*)0))); 553 554 Print("\nSYZCHECK: \t%d", __SYZCHECK__); 555 Print(", DEBUG: \t%d", __DEBUG__); 556 Print(", LEAD2SYZ: \t%d", __LEAD2SYZ__); 557 Print(", TAILREDSYZ: \t%d\n", __TAILREDSYZ__); 558 559 dPrint(id, r, r, 1); 560 } 561 562 h = h->Next(); assume (h == NULL); 563 564 // 1. set of components S? 565 // 2. for each component c from S: set of indices of leading terms 566 // with this component? 567 // 3. short exp. vectors for each leading term? 568 569 const int size = IDELEMS(id); 570 571 if( size < 2 ) 572 { 573 const ideal newid = idInit(1, 0); // zero ideal... 574 575 newid->m[0] = NULL; 576 577 res->data = newid; 578 res->rtyp = MODUL_CMD; 579 580 return FALSE; 581 } 582 583 584 // TODO/NOTE: input is supposed to be sorted wrt "C,ds"!?? 585 586 // components should come in groups: count elements in each group 587 // && estimate the real size!!! 588 589 590 // use just a vector instead??? 591 const ideal newid = idInit( (size * (size-1))/2, size); // maximal size: ideal case! 592 593 int k = 0; 594 595 for (int j = 0; j < size; j++) 596 { 597 const poly p = id->m[j]; 598 assume( p != NULL ); 599 const int c = p_GetComp(p, r); 600 601 for (int i = j - 1; i >= 0; i--) 602 { 603 const poly pp = id->m[i]; 604 assume( pp != NULL ); 605 const int cc = p_GetComp(pp, r); 606 607 if( c != cc ) 608 continue; 609 610 const poly m = p_Init(r); // p_New??? 611 612 // m = LCM(p, pp) / p! // TODO: optimize: knowing the ring structure: (C/lp)! 613 for (int v = rVar(r); v > 0; v--) 614 { 615 assume( v > 0 ); 616 assume( v <= rVar(r) ); 617 618 const short e1 = p_GetExp(p , v, r); 619 const short e2 = p_GetExp(pp, v, r); 620 621 if( e1 >= e2 ) 622 p_SetExp(m, v, 0, r); 623 else 624 p_SetExp(m, v, e2 - e1, r); 625 626 } 627 628 assume( (j > i) && (i >= 0) ); 629 630 p_SetComp(m, j + 1, r); 631 pNext(m) = NULL; 632 p_SetCoeff0(m, n_Init(1, r->cf), r); // for later... 633 634 p_Setm(m, r); // should not do anything!!! 635 636 newid->m[k++] = m; 637 } 638 } 639 640 if( __DEBUG__ && FALSE ) 641 { 642 PrintS("ComputeLeadingSyzygyTerms::Temp0: \n"); 643 dPrint(newid, r, r, 1); 644 } 645 646 // the rest of newid is assumed to be zeroes... 647 648 // simplify(newid, 2 + 32)?? 649 // sort(newid, "C,ds")[1]??? 650 id_DelDiv(newid, r); // #define SIMPL_LMDIV 32 651 652 if( __DEBUG__ && FALSE ) 653 { 654 PrintS("ComputeLeadingSyzygyTerms::Temp1: \n"); 655 dPrint(newid, r, r, 1); 656 } 657 658 idSkipZeroes(newid); // #define SIMPL_NULL 2 659 660 if( __DEBUG__ ) 661 { 662 PrintS("ComputeLeadingSyzygyTerms::Output: \n"); 663 dPrint(newid, r, r, 1); 664 } 665 666 667 // TODO: add sorting wrt <c,ds> & reversing... 668 669 res->data = newid; 670 res->rtyp = MODUL_CMD; 671 672 return FALSE; 673 } 674 675 WarnS("ComputeLeadingSyzygyTerms needs a single ideal/module argument..."); 676 return TRUE; 677 } 678 679 519 680 520 681 … … 1036 1197 ADD(psModulFunctions, currPack->libname, "leadrawexp", FALSE, leadrawexp); 1037 1198 1038 ADD(psModulFunctions, currPack->libname, "Tail", FALSE, Tail);1039 1040 1199 ADD(psModulFunctions, currPack->libname, "ISUpdateComponents", FALSE, ISUpdateComponents); 1041 1200 ADD(psModulFunctions, currPack->libname, "SetInducedReferrence", FALSE, SetInducedReferrence); … … 1053 1212 ADD(psModulFunctions, currPack->libname, "p_Content", FALSE, _p_Content); 1054 1213 1214 ADD(psModulFunctions, currPack->libname, "Tail", FALSE, Tail); 1215 ADD(psModulFunctions, currPack->libname, "ComputeLeadingSyzygyTerms", FALSE, ComputeLeadingSyzygyTerms); 1216 1217 // ADD(psModulFunctions, currPack->libname, "", FALSE, ); 1218 1055 1219 ADD(psModulFunctions, currPack->libname, "m2_end", FALSE, _m2_end); 1056 // ADD(psModulFunctions, currPack->libname, "", FALSE, ); 1220 1057 1221 #undef ADD 1058 1222 return 0;
Note: See TracChangeset
for help on using the changeset viewer.