Ignore:
Timestamp:
Jul 30, 2012, 5:19:40 PM (11 years ago)
Author:
Oleksandr Motsak <motsak@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', '1d362c315e551a5b527ab0759f8839cf0e94f3a5')
Children:
dd24e5dded66979eda13e955b93fc284cbb341e7
Parents:
c93fda01f3f4eb9609a2210ea9eec1816d8fb7f1
git-author:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2012-07-30 17:19:40+02:00
git-committer:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2014-05-07 04:41:46+02:00
Message:
introduced a bitmask of `leading` variables

NOTE: this is the 2nd Schreyer's optimization idea

chg: further removal of unused variables
File:
1 edited

Legend:

Unmodified
Added
Removed
  • dyn_modules/syzextra/syzextra.cc

    rc93fda r026171  
    366366
    367367
    368     // TODO/NOTE: input is supposed to be sorted wrt "C,ds"!??
    369 
    370     // components should come in groups: count elements in each group
    371     // && estimate the real size!!!
    372 
    373 
    374     // use just a vector instead???
     368  // TODO/NOTE: input is supposed to be sorted wrt "C,ds"!??
     369 
     370  // components should come in groups: count elements in each group
     371  // && estimate the real size!!!
     372
     373
     374  // use just a vector instead???
    375375  ideal newid = idInit( (size * (size-1))/2, size); // maximal size: ideal case!
    376376
     
    489489}
    490490
     491CLCM::CLCM(const SchreyerSyzygyComputation& data): std::vector<bool>(), m_data(data), m_compute(false)
     492{
     493  const ideal& L = data.m_idLeads;
     494  const ring&  R = data.m_rBaseRing;
     495  const SchreyerSyzygyComputationFlags& attributes = data.m_atttributes;
     496
     497//  const BOOLEAN __DEBUG__      = attributes.__DEBUG__;
     498//  const BOOLEAN __SYZCHECK__   = attributes.__SYZCHECK__;
     499  const BOOLEAN __HYBRIDNF__   = attributes.__HYBRIDNF__;
     500  const BOOLEAN __TAILREDSYZ__ = attributes.__TAILREDSYZ__;
     501
     502
     503  assume( L != NULL );
     504  assume( R != NULL );
     505  assume( R == currRing );
     506
     507  if( __TAILREDSYZ__ && !__HYBRIDNF__ )
     508  {
     509    const int l = IDELEMS(L);
     510
     511    resize(l, false);
     512
     513    const unsigned int N = rVar(R);
     514
     515    for( int k = l - 1; k >= 0; k-- )
     516    {
     517      const poly a = L->m[k]; assume( a != NULL );
     518
     519      for (unsigned int j = N; j > 0; j--)
     520        if ( !(*this)[j] )
     521          (*this)[j] = (p_GetExp(a, j, R) > 0);
     522    }
     523
     524    m_compute = true;   
     525  }
     526}
     527
     528
     529bool CLCM::Check(const poly m) const
     530{
     531  assume( m != NULL );
     532  if( m_compute && (m != NULL))
     533  { 
     534    const ring& R = m_data.m_rBaseRing;
     535    const SchreyerSyzygyComputationFlags& attributes = m_data.m_atttributes;
     536
     537  //  const BOOLEAN __DEBUG__      = attributes.__DEBUG__;
     538  //  const BOOLEAN __SYZCHECK__   = attributes.__SYZCHECK__;
     539    const BOOLEAN __HYBRIDNF__   = attributes.__HYBRIDNF__;
     540    const BOOLEAN __TAILREDSYZ__ = attributes.__TAILREDSYZ__;
     541
     542    assume( R != NULL );
     543    assume( R == currRing );
     544
     545    assume( __TAILREDSYZ__ && !__HYBRIDNF__ );
     546   
     547    const unsigned int N = rVar(R);
     548
     549    for (unsigned int j = N; j > 0; j--)
     550      if ( (*this)[j] )
     551        if(p_GetExp(m, j, R) > 0)
     552          return true;
     553
     554    return false;
     555   
     556  } else return true;
     557}
     558
    491559void SchreyerSyzygyComputation::ComputeSyzygy()
    492560{
     
    507575  const BOOLEAN __LEAD2SYZ__   = attributes.__LEAD2SYZ__;
    508576  const BOOLEAN __HYBRIDNF__   = attributes.__HYBRIDNF__;
    509   const BOOLEAN __TAILREDSYZ__ = attributes.__TAILREDSYZ__;
     577//  const BOOLEAN __TAILREDSYZ__ = attributes.__TAILREDSYZ__;
    510578
    511579  assume( R == currRing ); // For attributes :-/
     
    524592    return;
    525593
    526 
    527   ideal LS = NULL;
    528 
    529   if( __TAILREDSYZ__ )
    530     LS = LL;
    531594
    532595  for( int k = size - 1; k >= 0; k-- )
     
    593656
    594657  if( bComputeSecondTerms )
     658  {
     659    assume( __LEAD2SYZ__ );
    595660//    m_syzLeads = FROM_NAMESPACE(INTERNAL, _Compute2LeadingSyzygyTerms(m_idLeads, m_rBaseRing, m_atttributes));
    596661    m_syzLeads = Compute2LeadingSyzygyTerms();
     662  }
    597663  else
     664  {
     665    assume( !__LEAD2SYZ__ );
     666   
    598667    m_syzLeads = Compute1LeadingSyzygyTerms();
     668  }
    599669//    m_syzLeads = FROM_NAMESPACE(INTERNAL, _ComputeLeadingSyzygyTerms(m_idLeads, m_rBaseRing, m_atttributes));
    600670 
     
    603673  if (__TAILREDSYZ__)
    604674    m_LS = m_syzLeads;
     675
     676  (void)( __LEAD2SYZ__ );
    605677}
    606678
     
    732804  const ideal& L = m_idLeads;
    733805  const ideal& T = m_idTails;
    734   const ideal& LS = m_LS;
     806//  const ideal& LS = m_LS;
    735807  const ring& r = m_rBaseRing;
    736   const SchreyerSyzygyComputationFlags& attributes = m_atttributes;
    737 
    738  
     808
     809//   const SchreyerSyzygyComputationFlags& attributes = m_atttributes;
    739810//   const BOOLEAN __DEBUG__      = attributes.__DEBUG__;
    740811//   const BOOLEAN __SYZCHECK__   = attributes.__SYZCHECK__;
     
    798869  const ideal& L = m_idLeads;
    799870  const ideal& T = m_idTails;
    800   const ideal& LS = m_LS;
     871//  const ideal& LS = m_LS;
    801872  const ring& r = m_rBaseRing;
    802873  const SchreyerSyzygyComputationFlags& attributes = m_atttributes;
     
    814885//   const BOOLEAN __LEAD2SYZ__   = attributes.__LEAD2SYZ__;
    815886//   const BOOLEAN __HYBRIDNF__   = attributes.__HYBRIDNF__;
    816 //   const BOOLEAN __TAILREDSYZ__ = attributes.__TAILREDSYZ__;
     887   const BOOLEAN __TAILREDSYZ__ = attributes.__TAILREDSYZ__;
    817888
    818889  assume( multiplier != NULL );
     
    823894  poly s = NULL;
    824895
    825   // iterate over the tail
    826   for(poly p = tail; p != NULL; p = pNext(p))
    827     s = p_Add_q(s, ReduceTerm(multiplier, p, NULL), r); 
     896  if( (!__TAILREDSYZ__) || m_lcm.Check(multiplier) )
     897    for(poly p = tail; p != NULL; p = pNext(p))   // iterate over the tail
     898      s = p_Add_q(s, ReduceTerm(multiplier, p, NULL), r); 
    828899
    829900  return s;
     
    837908  const ideal& L = m_idLeads;
    838909  const ideal& T = m_idTails;
    839   const ideal& LS = m_LS;
     910//  const ideal& LS = m_LS;
    840911  const ring& r = m_rBaseRing;
    841912  const SchreyerSyzygyComputationFlags& attributes = m_atttributes;
     
    853924//   const BOOLEAN __LEAD2SYZ__   = attributes.__LEAD2SYZ__;
    854925//   const BOOLEAN __HYBRIDNF__   = attributes.__HYBRIDNF__;
    855 //   const BOOLEAN __TAILREDSYZ__ = attributes.__TAILREDSYZ__;
     926  const BOOLEAN __TAILREDSYZ__ = attributes.__TAILREDSYZ__;
    856927
    857928  assume( multiplier != NULL );
     
    867938  poly s = NULL;
    868939
    869   if(1)
     940  if( (!__TAILREDSYZ__) || m_lcm.Check(multiplier) )
    870941  {
    871942    // NOTE: only LT(term4reduction) should be used in the following:
     
    897968BEGIN_NAMESPACE_NONAME
    898969   
    899 static inline int atGetInt(idhdl rootRingHdl, const char* attribute, int def)
     970static inline int atGetInt(idhdl rootRingHdl, const char* attribute, long def)
    900971{
    901972  return ((int)(long)(atGet(rootRingHdl, attribute, INT_CMD, (void*)def)));
Note: See TracChangeset for help on using the changeset viewer.