Changeset efcad1 in git


Ignore:
Timestamp:
Oct 14, 2016, 4:20:21 PM (8 years ago)
Author:
Andreas Steenpass <steenpass@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', '4fa496c5b814dbde0a905c54f0796301d03f6dc9')
Children:
c86bbe3f55d8a362921878398a1579907ed5fff9
Parents:
74dc544f60e1fb4461ed4301bd9f05ac85132898
git-author:
Andreas Steenpass <steenpass@mathematik.uni-kl.de>2016-10-14 16:20:21+02:00
git-committer:
Andreas Steenpass <steenpass@mathematik.uni-kl.de>2017-12-15 12:17:07+01:00
Message:
chg: simplify caching code
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/GBEngine/syz4.cc

    r74dc544 refcad1  
    160160
    161161#if CACHE
    162 bool my_p_LmCmp_test (poly a, poly b, const ring r)
    163 {
    164   return p_LmCmp(a, b, r) == -1;
    165 }
    166 
    167162struct CCacheCompare_test
    168163{
    169   const ring& m_ring_test;
    170   CCacheCompare_test(): m_ring_test(currRing) {}
    171   CCacheCompare_test(const ring& r): m_ring_test(r) {}
    172   CCacheCompare_test(const CCacheCompare_test& lhs):
    173     m_ring_test(lhs.m_ring_test) {}
    174   CCacheCompare_test& operator=(const CCacheCompare_test& lhs)
    175   {
    176     return (const_cast<CCacheCompare_test&>(lhs));
    177   }
    178164  inline bool operator() (const poly& l, const poly& r)
    179165    const
    180166  {
    181     return my_p_LmCmp_test(l, r, m_ring_test);
     167    return (p_LmCmp(l, r, currRing) == -1);
    182168  }
    183169};
     
    189175static TCache_test m_cache_test;
    190176
    191 static FORCE_INLINE poly myp_Head_test(const poly p, const bool bIgnoreCoeff,
    192   const ring r)
    193 {
    194   p_LmCheckPolyRing1(p, r);
    195   poly np;
    196   omTypeAllocBin(poly, np, r->PolyBin);
    197   p_SetRingOfLm(np, r);
    198   memcpy(np->exp, p->exp, r->ExpL_Size*sizeof(long));
    199   pNext(np) = NULL;
    200   pSetCoeff0(np, (bIgnoreCoeff)? NULL : n_Copy(pGetCoeff(p), r->cf));
    201   p_LmCheckPolyRing1(np, r);
    202   return np;
    203 }
     177// note: we don't need to keep the coeffs of those terms which are lifted to 0
    204178
    205179static void delete_cache()
     
    212186            p_Delete(const_cast<poly*>(&(vit->first)), currRing);
    213187        }
    214         T.erase(T.begin(), T.end());
    215     }
    216     m_cache_test.erase(m_cache_test.begin(), m_cache_test.end());
     188        T.clear();
     189    }
     190    m_cache_test.clear();
    217191}
    218192#endif   // CACHE
     
    247221     if( itr == T.end() )
    248222     {
    249        T.insert(TP2PCache_test::value_type(myp_Head_test(multiplier, (p==NULL),
     223       T.insert(TP2PCache_test::value_type(p_Head(multiplier,
    250224         r), p) );
    251225       return p_Copy(p, r);
     
    264238    if( itr == T.end() )
    265239    {
    266       T.insert(TP2PCache_test::value_type(myp_Head_test(multiplier, (p==NULL),
     240      T.insert(TP2PCache_test::value_type(p_Head(multiplier,
    267241          r), p));
    268242      return p_Copy(p, r);
     
    270244    return p;
    271245  }
    272   CCacheCompare_test o(r);
    273   TP2PCache_test T(o);
    274   T.insert(TP2PCache_test::value_type(myp_Head_test(multiplier, (p==NULL), r),
     246  TP2PCache_test T;
     247  T.insert(TP2PCache_test::value_type(p_Head(multiplier, r),
    275248    p));
    276249  m_cache_test.insert( TCache_test::value_type(tail, T) );
Note: See TracChangeset for help on using the changeset viewer.