Ignore:
Timestamp:
Apr 28, 2014, 8:49:00 PM (10 years ago)
Author:
Oleksandr Motsak <motsak@…>
Branches:
(u'spielwiese', '4a9821a93ffdc22a6696668bd4f6b8c9de3e6c5f')
Children:
c7d29b194535c9015230fc587b2ae178c075ef3e
Parents:
92992c08c2f387188f53d5f874a342fb60dccc06
git-author:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2014-04-28 20:49:00+02:00
git-committer:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2014-05-07 04:41:46+02:00
Message:
introduced SchreyerSyzygyComputationFlags for storing and passing ring attributes within SchreyerSyzygyComputatio

chg: renamed internal functions to avoid name conflicts
chg: better namespace handling
File:
1 edited

Legend:

Unmodified
Added
Removed
  • dyn_modules/syzextra/mod_main.cc

    r92992c r4eba3ad  
    506506
    507507
     508
    508509static BOOLEAN _ComputeLeadingSyzygyTerms(leftv res, leftv h)
    509510{
     511  const SchreyerSyzygyComputationFlags attributes(currRingHdl);
     512     
     513  const BOOLEAN __DEBUG__      = attributes.__DEBUG__;
     514//  const BOOLEAN __SYZCHECK__   = attributes.__SYZCHECK__;
     515  const BOOLEAN __LEAD2SYZ__   = attributes.__LEAD2SYZ__;
     516//  const BOOLEAN __HYBRIDNF__   = attributes.__HYBRIDNF__;
     517//  const BOOLEAN __TAILREDSYZ__ = attributes.__TAILREDSYZ__;
     518
    510519  const ring r = currRing;
    511520  NoReturn(res);
     
    518527
    519528  assume( h != NULL ); 
    520 
    521 #ifndef NDEBUG
    522   const BOOLEAN __DEBUG__ = (BOOLEAN)((long)(atGet(currRingHdl,"DEBUG",INT_CMD, (void*)TRUE)));
    523 #else
    524   const BOOLEAN __DEBUG__ = (BOOLEAN)((long)(atGet(currRingHdl,"DEBUG",INT_CMD, (void*)FALSE)));
    525 #endif
    526529
    527530  if( h->Typ() == IDEAL_CMD || h->Typ() == MODUL_CMD)
     
    533536    if( __DEBUG__ )
    534537    {
    535       PrintS("ComputeLeadingSyzygyTerms::Input: \n");
    536      
    537       const BOOLEAN __LEAD2SYZ__ = (BOOLEAN)((long)(atGet(currRingHdl,"LEAD2SYZ",INT_CMD, (void*)0)));
    538       const BOOLEAN __TAILREDSYZ__ = (BOOLEAN)((long)(atGet(currRingHdl,"TAILREDSYZ",INT_CMD, (void*)0)));
    539       const BOOLEAN __SYZCHECK__ = (BOOLEAN)((long)(atGet(currRingHdl,"SYZCHECK",INT_CMD, (void*)0)));
    540 
    541 
    542       Print("\nSYZCHECK: \t%d", __SYZCHECK__);
    543       Print(", DEBUG: \t%d", __DEBUG__);
    544       Print(", LEAD2SYZ: \t%d", __LEAD2SYZ__);
    545       Print(", TAILREDSYZ: \t%d\n", __TAILREDSYZ__);
    546 
     538      PrintS("ComputeLeadingSyzygyTerms::Input: \n");     
    547539      dPrint(id, r, r, 1);
    548 
    549       assume( !__LEAD2SYZ__ );
    550540    }
     541   
     542    assume( !__LEAD2SYZ__ );
    551543
    552544    h = h->Next(); assume (h == NULL);
    553545
    554     const ideal newid = ComputeLeadingSyzygyTerms(id, r);
     546    const ideal newid = ComputeLeadingSyzygyTerms(id, r, attributes);
    555547   
    556548    res->data = newid; res->rtyp = MODUL_CMD;
     
    567559static BOOLEAN _Sort_c_ds(leftv res, leftv h)
    568560{
     561  const SchreyerSyzygyComputationFlags attributes(currRingHdl);
     562
     563  const BOOLEAN __DEBUG__      = attributes.__DEBUG__;
     564//  const BOOLEAN __SYZCHECK__   = attributes.__SYZCHECK__;
     565//  const BOOLEAN __LEAD2SYZ__   = attributes.__LEAD2SYZ__;
     566//  const BOOLEAN __HYBRIDNF__   = attributes.__HYBRIDNF__;
     567//  const BOOLEAN __TAILREDSYZ__ = attributes.__TAILREDSYZ__;
     568
    569569  NoReturn(res);
    570570
     
    579579
    580580  assume( h != NULL ); 
    581 
    582 #ifndef NDEBUG
    583   const BOOLEAN __DEBUG__ = (BOOLEAN)((long)(atGet(currRingHdl,"DEBUG",INT_CMD, (void*)FALSE)));
    584 #else
    585   const BOOLEAN __DEBUG__ = (BOOLEAN)((long)(atGet(currRingHdl,"DEBUG",INT_CMD, (void*)FALSE)));
    586 #endif
    587581
    588582  if(    (h->Typ() == IDEAL_CMD || h->Typ() == MODUL_CMD)
     
    598592    {
    599593      PrintS("Sort_c_ds::Input: \n");
    600 
    601       const BOOLEAN __LEAD2SYZ__ = (BOOLEAN)((long)(atGet(currRingHdl,"LEAD2SYZ",INT_CMD, (void*)0)));
    602       const BOOLEAN __TAILREDSYZ__ = (BOOLEAN)((long)(atGet(currRingHdl,"TAILREDSYZ",INT_CMD, (void*)0)));
    603       const BOOLEAN __SYZCHECK__ = (BOOLEAN)((long)(atGet(currRingHdl,"SYZCHECK",INT_CMD, (void*)0)));   
    604 
    605       Print("\nSYZCHECK: \t%d", __SYZCHECK__);
    606       Print(", DEBUG: \t%d", __DEBUG__);
    607       Print(", LEAD2SYZ: \t%d", __LEAD2SYZ__);
    608       Print(", TAILREDSYZ: \t%d\n", __TAILREDSYZ__);
    609 
    610594      dPrint(id, r, r, 1);     
    611595    }
     
    637621static BOOLEAN _Compute2LeadingSyzygyTerms(leftv res, leftv h)
    638622{
     623  const SchreyerSyzygyComputationFlags attributes(currRingHdl);
     624
     625  const BOOLEAN __DEBUG__      = attributes.__DEBUG__;
     626//  const BOOLEAN __SYZCHECK__   = attributes.__SYZCHECK__;
     627  const BOOLEAN __LEAD2SYZ__   = attributes.__LEAD2SYZ__;
     628//  const BOOLEAN __HYBRIDNF__   = attributes.__HYBRIDNF__;
     629//  const BOOLEAN __TAILREDSYZ__ = attributes.__TAILREDSYZ__;
     630
    639631  const ring r = currRing;
    640632  NoReturn(res);
     
    648640  assume( h != NULL ); 
    649641
    650 #ifndef NDEBUG
    651   const BOOLEAN __DEBUG__ = (BOOLEAN)((long)(atGet(currRingHdl,"DEBUG",INT_CMD, (void*)TRUE)));
    652 #else
    653   const BOOLEAN __DEBUG__ = (BOOLEAN)((long)(atGet(currRingHdl,"DEBUG",INT_CMD, (void*)FALSE)));
    654 #endif
    655 
    656   const BOOLEAN __LEAD2SYZ__ = (BOOLEAN)((long)(atGet(currRingHdl,"LEAD2SYZ",INT_CMD, (void*)0)));
    657  
    658   assume( __LEAD2SYZ__ );
     642  assume( __LEAD2SYZ__ ); // ???
    659643 
    660644  if( h->Typ() == IDEAL_CMD || h->Typ() == MODUL_CMD)
     
    672656    h = h->Next(); assume (h == NULL);
    673657
    674     res->data = Compute2LeadingSyzygyTerms(id, r);
     658    res->data = Compute2LeadingSyzygyTerms(id, r, attributes);
    675659    res->rtyp = MODUL_CMD;
    676660
     
    687671static BOOLEAN _FindReducer(leftv res, leftv h)
    688672{
     673  const SchreyerSyzygyComputationFlags attributes(currRingHdl);
     674
     675  const BOOLEAN __DEBUG__      = attributes.__DEBUG__;
     676//   const BOOLEAN __SYZCHECK__   = attributes.__SYZCHECK__;
     677//   const BOOLEAN __LEAD2SYZ__   = attributes.__LEAD2SYZ__;
     678//   const BOOLEAN __HYBRIDNF__   = attributes.__HYBRIDNF__;
     679  const BOOLEAN __TAILREDSYZ__ = attributes.__TAILREDSYZ__;
     680
    689681  const char* usage = "`FindReducer(<poly/vector>, <vector/0>, <ideal/module>[,<module>])` expected";
    690682  const ring r = currRing;
     
    692684  NoReturn(res);
    693685
    694 
    695 #ifndef NDEBUG
    696   const BOOLEAN __DEBUG__ = (BOOLEAN)((long)(atGet(currRingHdl,"DEBUG",INT_CMD, (void*)TRUE)));
    697 #else
    698   const BOOLEAN __DEBUG__ = (BOOLEAN)((long)(atGet(currRingHdl,"DEBUG",INT_CMD, (void*)FALSE)));
    699 #endif
    700 
    701   const BOOLEAN __TAILREDSYZ__ = (BOOLEAN)((long)(atGet(currRingHdl,"TAILREDSYZ",INT_CMD, (void*)0)));
    702686
    703687  if ((h==NULL) || (h->Typ()!=VECTOR_CMD && h->Typ() !=POLY_CMD) || (h->Data() == NULL))
     
    766750
    767751  res->rtyp = VECTOR_CMD;
    768   res->data = FindReducer(product, syzterm, L, LS, r);
     752  res->data = FindReducer(product, syzterm, L, LS, r, attributes);
    769753
    770754  if( __DEBUG__ )
     
    781765static BOOLEAN _SchreyerSyzygyNF(leftv res, leftv h)
    782766{
     767  const SchreyerSyzygyComputationFlags attributes(currRingHdl);
     768
     769  const BOOLEAN __DEBUG__      = attributes.__DEBUG__;
     770//   const BOOLEAN __SYZCHECK__   = attributes.__SYZCHECK__;
     771//   const BOOLEAN __LEAD2SYZ__   = attributes.__LEAD2SYZ__;
     772  const BOOLEAN __HYBRIDNF__   = attributes.__HYBRIDNF__;
     773  const BOOLEAN __TAILREDSYZ__ = attributes.__TAILREDSYZ__;
     774
    783775  const char* usage = "`SchreyerSyzygyNF(<vector>, <vector>, <ideal/module>, <ideal/module>[,<module>])` expected";
    784776  const ring r = currRing;
     
    786778  NoReturn(res);
    787779
    788 #ifndef NDEBUG
    789   const BOOLEAN __DEBUG__ = (BOOLEAN)((long)(atGet(currRingHdl,"DEBUG",INT_CMD, (void*)TRUE)));
    790 #else
    791   const BOOLEAN __DEBUG__ = (BOOLEAN)((long)(atGet(currRingHdl,"DEBUG",INT_CMD, (void*)FALSE)));
    792 #endif
    793 
    794   const BOOLEAN __TAILREDSYZ__ = (BOOLEAN)((long)(atGet(currRingHdl,"TAILREDSYZ",INT_CMD, (void*)0)));
    795 //  const BOOLEAN __LEAD2SYZ__ = (BOOLEAN)((long)(atGet(currRingHdl,"LEAD2SYZ",INT_CMD, (void*)0)));
    796   const BOOLEAN __SYZCHECK__ = (BOOLEAN)((long)(atGet(currRingHdl,"SYZCHECK",INT_CMD, (void*)0)));   
    797 
    798   const BOOLEAN __HYBRIDNF__ = (BOOLEAN)((long)(atGet(currRingHdl,"HYBRIDNF",INT_CMD, (void*)0)));
    799 
    800   assume( __HYBRIDNF__ );
     780  assume( __HYBRIDNF__ ); // ???
    801781 
    802782  if ((h==NULL) || (h->Typ() != VECTOR_CMD) || (h->Data() == NULL))
     
    872852 
    873853  res->rtyp = VECTOR_CMD;
    874   res->data = SchreyerSyzygyNF(syz_lead, syz_2, L, T, LS, r);
     854  res->data = SchreyerSyzygyNF(syz_lead, syz_2, L, T, LS, r, attributes);
    875855
    876856  if( __DEBUG__ )
     
    890870static BOOLEAN _ReduceTerm(leftv res, leftv h)
    891871{
     872  const SchreyerSyzygyComputationFlags attributes(currRingHdl);
     873
     874  const BOOLEAN __DEBUG__      = attributes.__DEBUG__;
     875  const BOOLEAN __SYZCHECK__   = attributes.__SYZCHECK__;
     876//   const BOOLEAN __LEAD2SYZ__   = attributes.__LEAD2SYZ__;
     877//   const BOOLEAN __HYBRIDNF__   = attributes.__HYBRIDNF__;
     878  const BOOLEAN __TAILREDSYZ__ = attributes.__TAILREDSYZ__;
     879
    892880  const char* usage = "`ReduceTerm(<poly>, <poly/vector>, <vector/0>, <ideal/module>, <ideal/module>[,<module>])` expected";
    893881  const ring r = currRing;
    894882
    895883  NoReturn(res);
    896 
    897 #ifndef NDEBUG
    898   const BOOLEAN __DEBUG__ = (BOOLEAN)((long)(atGet(currRingHdl,"DEBUG",INT_CMD, (void*)TRUE)));
    899 #else
    900   const BOOLEAN __DEBUG__ = (BOOLEAN)((long)(atGet(currRingHdl,"DEBUG",INT_CMD, (void*)FALSE)));
    901 #endif
    902 
    903   const BOOLEAN __TAILREDSYZ__ = (BOOLEAN)((long)(atGet(currRingHdl,"TAILREDSYZ",INT_CMD, (void*)0)));
    904 //  const BOOLEAN __LEAD2SYZ__ = (BOOLEAN)((long)(atGet(currRingHdl,"LEAD2SYZ",INT_CMD, (void*)0)));
    905   const BOOLEAN __SYZCHECK__ = (BOOLEAN)((long)(atGet(currRingHdl,"SYZCHECK",INT_CMD, (void*)0)));   
    906884
    907885  if ((h==NULL) || (h->Typ() !=POLY_CMD) || (h->Data() == NULL))
     
    1014992
    1015993  res->rtyp = VECTOR_CMD;
    1016   res->data = ReduceTerm(multiplier, term4reduction, syztermCheck, L, T, LS, r);
     994  res->data = ReduceTerm(multiplier, term4reduction, syztermCheck, L, T, LS, r, attributes);
    1017995
    1018996
     
    10341012static BOOLEAN _TraverseTail(leftv res, leftv h)
    10351013{
     1014  const SchreyerSyzygyComputationFlags attributes(currRingHdl);
     1015
     1016  const BOOLEAN __DEBUG__      = attributes.__DEBUG__;
     1017//   const BOOLEAN __SYZCHECK__   = attributes.__SYZCHECK__;
     1018//   const BOOLEAN __LEAD2SYZ__   = attributes.__LEAD2SYZ__;
     1019//   const BOOLEAN __HYBRIDNF__   = attributes.__HYBRIDNF__;
     1020  const BOOLEAN __TAILREDSYZ__ = attributes.__TAILREDSYZ__;
     1021
    10361022  const char* usage = "`TraverseTail(<poly>, <poly/vector>, <ideal/module>, <ideal/module>[,<module>])` expected";
    10371023  const ring r = currRing;
    10381024
    10391025  NoReturn(res);
    1040 
    1041 #ifndef NDEBUG
    1042   const BOOLEAN __DEBUG__ = (BOOLEAN)((long)(atGet(currRingHdl,"DEBUG",INT_CMD, (void*)TRUE)));
    1043 #else
    1044   const BOOLEAN __DEBUG__ = (BOOLEAN)((long)(atGet(currRingHdl,"DEBUG",INT_CMD, (void*)FALSE)));
    1045 #endif
    1046 
    1047   const BOOLEAN __TAILREDSYZ__ = (BOOLEAN)((long)(atGet(currRingHdl,"TAILREDSYZ",INT_CMD, (void*)1)));
    10481026
    10491027  if ((h==NULL) || (h->Typ() !=POLY_CMD) || (h->Data() == NULL))
     
    11211099
    11221100  res->rtyp = VECTOR_CMD;
    1123   res->data = TraverseTail(multiplier, tail, L, T, LS, r);
     1101  res->data = TraverseTail(multiplier, tail, L, T, LS, r, attributes);
    11241102
    11251103
     
    11391117static BOOLEAN _ComputeSyzygy(leftv res, leftv h)
    11401118{
     1119  const SchreyerSyzygyComputationFlags attributes(currRingHdl);
     1120
     1121  const BOOLEAN __DEBUG__      = attributes.__DEBUG__;
     1122//   const BOOLEAN __SYZCHECK__   = attributes.__SYZCHECK__;
     1123//   const BOOLEAN __LEAD2SYZ__   = attributes.__LEAD2SYZ__;
     1124//   const BOOLEAN __HYBRIDNF__   = attributes.__HYBRIDNF__;
     1125//   const BOOLEAN __TAILREDSYZ__ = attributes.__TAILREDSYZ__;
     1126
    11411127  const char* usage = "`ComputeSyzygy(<ideal/module>, <ideal/module>])` expected";
    11421128  const ring r = currRing;
     
    11441130  NoReturn(res);
    11451131
    1146 #ifndef NDEBUG
    1147   const BOOLEAN __DEBUG__ = (BOOLEAN)((long)(atGet(currRingHdl,"DEBUG",INT_CMD, (void*)TRUE)));
    1148 #else
    1149   const BOOLEAN __DEBUG__ = (BOOLEAN)((long)(atGet(currRingHdl,"DEBUG",INT_CMD, (void*)FALSE)));
    1150 #endif
    1151 
    11521132  if ((h==NULL) || (h->Typ()!=IDEAL_CMD && h->Typ() !=MODUL_CMD) || (h->Data() == NULL))
    11531133  {
     
    11831163  ideal LL, TT;
    11841164
    1185   ComputeSyzygy(L, T, LL, TT, r);
     1165  ComputeSyzygy(L, T, LL, TT, r, attributes);
    11861166
    11871167  lists l = (lists)omAllocBin(slists_bin); l->Init(2);
Note: See TracChangeset for help on using the changeset viewer.