Changeset afe156 in git


Ignore:
Timestamp:
Apr 8, 2016, 2:58:56 PM (8 years ago)
Author:
Andreas Steenpass <steenpass@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', '4bd32dfef92ec9f5ed8dceee82d14318ae147107')
Children:
7d09f3ae72357972dd5a2f399332c16aa125f56b
Parents:
08d042789438ab919c949e165d338ba0580cb0f0
git-author:
Andreas Steenpass <steenpass@mathematik.uni-kl.de>2016-04-08 14:58:56+02:00
git-committer:
Andreas Steenpass <steenpass@mathematik.uni-kl.de>2017-12-15 12:17:07+01:00
Message:
chg: remove classes CDivisorEnumerator and CDivisorEnumerator2
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/GBEngine/syz4.cc

    r08d042 rafe156  
    336336class CReducerFinder_test
    337337{
    338   friend class CDivisorEnumerator_test;
    339   friend class CDivisorEnumerator2_test;
    340 
    341338  public:
    342339    typedef long TComponentKey;
     
    413410static CReducerFinder_test m_div(NULL);
    414411
    415 class CDivisorEnumerator_test
    416 {
    417   private:
    418     const CReducerFinder_test& m_reds;
    419     const poly m_product;
    420     const unsigned long m_not_sev;
    421     const long m_comp;
    422 
    423     CReducerFinder_test::CReducersHash::const_iterator m_itr;
    424     CReducerFinder_test::TReducers::const_iterator m_current, m_finish;
    425 
    426     bool m_active;
    427 
    428   public:
    429     CDivisorEnumerator_test(const CReducerFinder_test& self, const poly product):
    430         m_reds(self),
    431         m_product(product),
    432         m_not_sev(~p_GetShortExpVector(product, currRing)),
    433         m_comp(p_GetComp(product, currRing)),
    434         m_itr(), m_current(), m_finish(),
    435         m_active(false)
    436     {
    437     }
    438 
    439     inline bool Reset()
    440     {
    441       m_active = false;
    442       m_itr = m_reds.m_hash.find(m_comp);
    443       if( m_itr == m_reds.m_hash.end() )
    444         return false;
    445       m_current = (m_itr->second).begin();
    446       m_finish = (m_itr->second).end();
    447       if (m_current == m_finish)
    448         return false;
    449       return true;
    450     }
    451 
    452     const CLeadingTerm_test& Current() const
    453     {
    454       return *(*m_current);
    455     }
    456 
    457     inline bool MoveNext()
    458     {
    459       if( m_active )
    460         ++m_current;
    461       else
    462         m_active = true; // for Current()
    463       for( ; m_current != m_finish; ++m_current )
    464       {
    465         if( Current().DivisibilityCheck(m_product, m_not_sev, currRing) )
    466         {
    467           return true;
    468         }
    469       }
    470       m_active = false;
    471       return false;
    472     }
    473 };
    474 
    475 class CDivisorEnumerator2_test
    476 {
    477   private:
    478     const CReducerFinder_test& m_reds;
    479     const poly m_multiplier, m_term;
    480     const unsigned long m_not_sev;
    481     const long m_comp;
    482 
    483     CReducerFinder_test::CReducersHash::const_iterator m_itr;
    484     CReducerFinder_test::TReducers::const_iterator m_current, m_finish;
    485 
    486     bool m_active;
    487 
    488   public:
    489     CDivisorEnumerator2_test(const CReducerFinder_test& self, const poly m, const poly t):
    490         m_reds(self),
    491         m_multiplier(m), m_term(t),
    492         m_not_sev(~p_GetShortExpVector(m, t, currRing)),
    493         m_comp(p_GetComp(t, currRing)),
    494         m_itr(), m_current(), m_finish(),
    495         m_active(false)
    496     {
    497     }
    498 
    499     inline bool Reset()
    500     {
    501       m_active = false;
    502       m_itr = m_reds.m_hash.find(m_comp);
    503       if( m_itr == m_reds.m_hash.end() )
    504         return false;
    505       m_current = (m_itr->second).begin();
    506       m_finish = (m_itr->second).end();
    507       if (m_current == m_finish)
    508         return false;
    509       return true;
    510     }
    511 
    512     const CLeadingTerm_test& Current() const
    513     {
    514       return *(*m_current);
    515     }
    516 
    517     inline bool MoveNext()
    518     {
    519       if( m_active )
    520         ++m_current;
    521       else
    522         m_active = true;
    523       // looking for the next good entry
    524       for( ; m_current != m_finish; ++m_current )
    525       {
    526         if( Current().DivisibilityCheck(m_multiplier, m_term, m_not_sev, currRing) )
    527         {
    528           return true;
    529         }
    530       }
    531       m_active = false;
    532       return false;
    533     }
    534 };
    535 
    536412poly CReducerFinder_test::FindReducer(const poly multiplier, const poly t,
    537413                                 const poly syzterm,
     
    539415{
    540416  const ring r = currRing;
    541   CDivisorEnumerator2_test itr(m_div, multiplier, t);
    542   if( !itr.Reset() )
     417  CReducerFinder_test::CReducersHash::const_iterator m_itr
     418      = m_div.m_hash.find(p_GetComp(t, currRing));
     419  if (m_itr == m_div.m_hash.end()) {
    543420    return NULL;
     421  }
     422  CReducerFinder_test::TReducers::const_iterator m_current
     423      = (m_itr->second).begin();
     424  CReducerFinder_test::TReducers::const_iterator m_finish
     425      = (m_itr->second).end();
     426  if (m_current == m_finish) {
     427    return NULL;
     428  }
    544429  long c = 0;
    545430  if (syzterm != NULL)
     
    548433  const poly q = p_New(r);
    549434  pNext(q) = NULL;
    550   while( itr.MoveNext() )
    551   {
    552     const poly p = itr.Current().lt();
    553     const int k  = itr.Current().label();
     435  const unsigned long m_not_sev = ~p_GetShortExpVector(multiplier, t, r);
     436  while (true) {
     437    for( ; m_current != m_finish; ++m_current) {
     438      if((*(*m_current)).DivisibilityCheck(multiplier, t, m_not_sev, r) ) {
     439        break;
     440      }
     441    }
     442    if (m_current == m_finish) {
     443      break;
     444    }
     445    const poly p = (*(*m_current)).lt();
     446    const int k  = (*(*m_current)).label();
     447    ++m_current;
    554448    p_ExpVectorSum(q, multiplier, t, r); // q == product == multiplier * t
    555449    p_ExpVectorDiff(q, q, p, r); // (LM(product) / LM(L[k]))
     
    577471bool CReducerFinder_test::IsDivisible(const poly product) const
    578472{
    579   CDivisorEnumerator_test itr(*this, product);
    580   if( !itr.Reset() )
     473    CReducerFinder_test::CReducersHash::const_iterator m_itr
     474        = (*this).m_hash.find(p_GetComp(product, currRing));
     475    if (m_itr == (*this).m_hash.end()) {
     476        return false;
     477    }
     478    CReducerFinder_test::TReducers::const_iterator m_current
     479        = (m_itr->second).begin();
     480    CReducerFinder_test::TReducers::const_iterator m_finish
     481        = (m_itr->second).end();
     482    const unsigned long m_not_sev = ~p_GetShortExpVector(product, currRing);
     483    for ( ; m_current != m_finish; ++m_current) {
     484        if ((*(*m_current)).DivisibilityCheck(product, m_not_sev, currRing)) {
     485            return true;
     486        }
     487    }
    581488    return false;
    582   return itr.MoveNext();
    583489}
    584490
Note: See TracChangeset for help on using the changeset viewer.