Ignore:
Timestamp:
Aug 1, 2012, 5:25:00 PM (11 years ago)
Author:
Oleksandr Motsak <motsak@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', '1d362c315e551a5b527ab0759f8839cf0e94f3a5')
Children:
495328d14a955b215ad10b598e995ab522243881
Parents:
026171e1f09fe373a5c6ea5ed0b8db1abeb952f3
git-author:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2012-08-01 17:25:00+02:00
git-committer:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2014-05-07 04:41:46+02:00
Message:
separated FindReducer into a separate class CReducerFinder (m_div)

TODO: deal with m_LS via another CReducerFinder?

NOTE: this change resulted in some speedups esp. for Hybrid approach (see schreyer.lib)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • dyn_modules/syzextra/syzextra.h

    r026171 rdd24e5  
    1818
    1919#include <vector>
     20#include <map>
    2021
    2122// include basic definitions
     
    9697
    9798
     99class CReducerFinder
     100{
     101  private:
     102    class CLeadingTerm
     103    {
     104      public:
     105        CLeadingTerm(unsigned int id,  const poly p, const ring);
     106
     107      private:
     108        CLeadingTerm();
     109
     110      public:
     111
     112        const unsigned long m_sev; ///< not short exp. vector
     113        // NOTE/TODO: either of the following should be enough:
     114        const unsigned int  m_label; ///< index in the main L[] + 1
     115        const poly          m_lt; ///< the leading term itself L[label-1]
     116    };
     117
     118    typedef long TComponentKey;
     119    typedef std::vector<const CLeadingTerm*> TReducers;
     120    typedef std::map< TComponentKey, TReducers> CReducersHash;
     121   
     122  public:
     123
     124    /// goes over all leading terms
     125    CReducerFinder(const SchreyerSyzygyComputation& data);
     126
     127    ~CReducerFinder();
     128
     129    // TODO: save shortcut (syz: |-.->) LM(LM(m) * "t") -> syz?   
     130    poly FindReducer(const poly product, const poly syzterm) const;
     131
     132  private:
     133    const SchreyerSyzygyComputation& m_data;
     134
     135    CReducersHash m_hash; // can also be replaced with a vector indexed by components
     136};
     137
     138
     139
    98140/** @class SchreyerSyzygyComputation syzextra.h
    99141 *
     
    109151{
    110152  friend class CLCM;
     153  friend class CReducerFinder;
    111154 
    112155  public:
     
    117160        m_idLeads(idLeads), m_idTails(idTails),
    118161        m_syzLeads(NULL), m_syzTails(NULL), m_LS(NULL), m_atttributes(attribues),
    119         m_lcm(*this)
     162        m_lcm(*this), m_div(*this)
    120163    {
    121164    }
     
    127170        m_idLeads(idLeads), m_idTails(idTails),
    128171        m_syzLeads(NULL), m_syzTails(NULL), m_LS(syzLeads), m_atttributes(attribues),
    129         m_lcm(*this)
     172        m_lcm(*this), m_div(*this)
    130173    {
    131174    }
     
    151194    void ComputeLeadingSyzygyTerms(bool bComputeSecondTerms = true);
    152195
    153     // TODO: save shortcut (syz: |-.->) LM(LM(m) * "t") -> syz?
    154     poly FindReducer(poly product, poly syzterm) const;
    155    
    156196    poly SchreyerSyzygyNF(poly syz_lead, poly syz_2) const;
    157197
     
    162202    poly ReduceTerm(poly multiplier, poly term4reduction, poly syztermCheck) const;
    163203
     204  public:
     205    /// just for testing via the wrapper below
     206    inline poly _FindReducer(const poly product, const poly syzterm) const
     207        { return m_div.FindReducer(product, syzterm); } 
     208   
    164209  protected:
    165210
     
    195240    /// Bitmask for variables occuring in leading terms
    196241    const CLCM m_lcm;
     242
     243    /// Divisor finder
     244    const CReducerFinder m_div;
    197245};
    198246
     
    229277{
    230278  SchreyerSyzygyComputation syz(L, NULL, LS, R, A);
    231   return syz.FindReducer(product, syzterm);
     279  return syz._FindReducer(product, syzterm);
    232280}
    233281
Note: See TracChangeset for help on using the changeset viewer.