Changeset 7088f18 in git


Ignore:
Timestamp:
Jul 9, 2012, 9:34:12 PM (11 years ago)
Author:
Oleksandr Motsak <motsak@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'ad2543eab51733612ba7d118afc77edca719600e')
Children:
92992c08c2f387188f53d5f874a342fb60dccc06
Parents:
20409220dfe91ce9647c6b8d12e43f086961aa14
git-author:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2012-07-09 21:34:12+02:00
git-committer:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2014-05-07 04:41:45+02:00
Message:
Old Schreyer Syzygy functions went to a namespace accesed via a class + wrappers & moved internal declarations to syzextra.cc
Location:
dyn_modules/syzextra
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • dyn_modules/syzextra/syzextra.cc

    r204092 r7088f18  
    5656BEGIN_NAMESPACE_SINGULARXX     BEGIN_NAMESPACE(SYZEXTRA)
    5757
     58
    5859BEGIN_NAMESPACE(SORT_c_ds)
    5960
     
    223224
    224225
     226BEGIN_NAMESPACE(INTERNAL)
    225227
    226228ideal ComputeLeadingSyzygyTerms(const ideal& id, const ring r)
     
    791793}
    792794
    793 
    794 
    795 
    796 
    797 
     795END_NAMESPACE
     796
     797
     798void SchreyerSyzygyComputation::ComputeSyzygy()
     799{
     800  /// assumes m_syzLeads == m_syzTails == NULL!
     801  INTERNAL::ComputeSyzygy(m_idLeads, m_idTails, m_syzLeads, m_syzTails, m_rBaseRing); // TODO: just a wrapper for now :/
     802}
     803
     804void SchreyerSyzygyComputation::ComputeLeadingSyzygyTerms(bool bComputeSecondTerms)
     805{
     806  if( bComputeSecondTerms )
     807    m_syzLeads = INTERNAL::Compute2LeadingSyzygyTerms(m_idLeads, m_rBaseRing);
     808  else
     809    m_syzLeads = INTERNAL::ComputeLeadingSyzygyTerms(m_idLeads, m_rBaseRing);
     810 
     811  // NOTE: set m_LS if tails are to be reduced!
     812}
     813
     814poly SchreyerSyzygyComputation::FindReducer(poly product, poly syzterm)
     815{
     816  return INTERNAL::FindReducer(product, syzterm, m_idLeads, m_LS, m_rBaseRing);
     817}
     818
     819poly SchreyerSyzygyComputation::SchreyerSyzygyNF(poly syz_lead, poly syz_2)
     820{
     821  return INTERNAL::SchreyerSyzygyNF(syz_lead, syz_2, m_idLeads, m_idTails, m_LS, m_rBaseRing);
     822}
     823
     824poly SchreyerSyzygyComputation::TraverseTail(poly multiplier, poly tail)
     825{
     826  return INTERNAL::TraverseTail(multiplier, tail, m_idLeads, m_idTails, m_LS, m_rBaseRing);
     827}
     828
     829poly SchreyerSyzygyComputation::ReduceTerm(poly multiplier, poly term4reduction, poly syztermCheck)
     830{
     831  return INTERNAL::ReduceTerm(multiplier, term4reduction, syztermCheck, m_idLeads, m_idTails, m_LS, m_rBaseRing);
     832}
     833
     834   
    798835
    799836
  • dyn_modules/syzextra/syzextra.h

    r204092 r7088f18  
    4747ideal id_Tail(const ideal id, const ring r);
    4848
    49 
    5049/// inplace sorting of the module (ideal) id wrt >_(c,ds)
    5150void Sort_c_ds(const ideal id, const ring r);
    5251
    53 ideal ComputeLeadingSyzygyTerms(const ideal& id, const ring r);
    5452
    55 ideal Compute2LeadingSyzygyTerms(const ideal& id, const ring r);
     53/** @class SchreyerSyzygyComputation syzextra.h
     54 *
     55 * Computing syzygies after Schreyer
     56 *
     57 * Storing/accumulating data during the computation requires some global
     58 * object, like this class. Ideally the above global functions should not
     59 * be used in favour of this class.
     60 *
     61 * @sa Schreyer Syzygy Computation Paper & Talk & Python prototype
     62 */
     63class SchreyerSyzygyComputation
     64{
     65  public:
     66    /// Construct a global object for given input data (separated into leads & tails)
     67    SchreyerSyzygyComputation(const ideal idLeads, const ideal idTails, const ring rBaseRing):
     68        m_idLeads(idLeads), m_idTails(idTails), m_rBaseRing(rBaseRing),
     69        m_syzLeads(NULL), m_syzTails(NULL), m_LS(NULL) {}
    5670
    5771
    58 poly FindReducer(poly product, poly syzterm,
    59                  ideal L, ideal LS,
    60                  const ring r);
     72    /// Construct a global object for given input data (separated into leads & tails)
     73    SchreyerSyzygyComputation(const ideal idLeads, const ideal idTails, const ideal syzLeads, const ring rBaseRing):
     74        m_idLeads(idLeads), m_idTails(idTails), m_rBaseRing(rBaseRing),
     75        m_syzLeads(NULL), m_syzTails(NULL), m_LS(syzLeads) {}
     76
     77   
     78    /// Destructor should not destruct the resulting m_syzLeads, m_syzTails.
     79    ~SchreyerSyzygyComputation(){ CleanUp(); }
     80
     81    /// Read off the results while detaching them from this object
     82    /// NOTE: no copy!
     83    inline void ReadOffResult(ideal& syzL, ideal& syzT)
     84    {
     85      syzL = m_syzLeads; syzT = m_syzTails;
     86
     87      m_syzLeads = m_syzTails = NULL; // m_LS ?
     88    }
     89   
     90    /// The main driver function: computes
     91    void ComputeSyzygy();
     92
     93    /// Computes Syz(leads) or only LEAD of it.
     94    /// The result is stored into m_syzLeads
     95    void ComputeLeadingSyzygyTerms(bool bComputeSecondTerms = true);
     96
     97    poly FindReducer(poly product, poly syzterm);
     98    poly SchreyerSyzygyNF(poly syz_lead, poly syz_2);
     99    poly TraverseTail(poly multiplier, poly tail);
     100    poly ReduceTerm(poly multiplier, poly term4reduction, poly syztermCheck);
     101
     102   
     103  protected:
     104   
     105    /// Clean up all the accumulated data
     106    void CleanUp() {}
     107
     108  private:
     109    /// global base ring
     110    const ring  m_rBaseRing;
     111
     112    /// input leading terms
     113    const ideal m_idLeads;
     114
     115    /// input tails
     116    const ideal m_idTails;
     117
     118    /// output (syzygy) leading terms (+2nd terms?)
     119    ideal m_syzLeads;
     120
     121    /// output (syzygy) tails
     122    ideal m_syzTails;
     123
     124    /*mutable?*/ ideal m_LS; ///< leading syzygy terms used for reducing syzygy tails
     125};
    61126
    62127
    63 poly TraverseTail(poly multiplier, poly tail,
    64                   ideal L, ideal T, ideal LS,
    65                   const ring r);
     128// The following wrappers are just for testing separate functions on highest level (within schreyer.lib)
    66129
    67 poly ReduceTerm(poly multiplier, poly term4reduction, poly syztermCheck,
    68                 ideal L, ideal T, ideal LS, const ring r);
     130static inline void ComputeSyzygy(const ideal L, const ideal T, ideal& LL, ideal& TT, const ring R)
     131{
     132  SchreyerSyzygyComputation syz(L, T, R);
     133  syz.ComputeSyzygy();
     134  syz.ReadOffResult(LL, TT);
     135}
     136
     137static inline ideal ComputeLeadingSyzygyTerms(const ideal& L, const ring R)
     138{
     139  SchreyerSyzygyComputation syz(L, NULL, R);
     140  syz.ComputeLeadingSyzygyTerms(false);
     141  ideal LL, TT;
     142  syz.ReadOffResult(LL, TT);
     143  return LL; // assume TT is NULL!
     144}
     145
     146static inline ideal Compute2LeadingSyzygyTerms(const ideal& L, const ring R)
     147{
     148  SchreyerSyzygyComputation syz(L, NULL, R);
     149  syz.ComputeLeadingSyzygyTerms(true);
     150  ideal LL, TT;
     151  syz.ReadOffResult(LL, TT);
     152  return LL; // assume TT is NULL!
     153}
     154
     155static inline poly FindReducer(poly product, poly syzterm,
     156                               ideal L, ideal LS, const ring R)
     157{
     158  SchreyerSyzygyComputation syz(L, NULL, LS, R);
     159  return syz.FindReducer(product, syzterm);
     160}
     161
     162static inline poly TraverseTail(poly multiplier, poly tail,
     163                                ideal L, ideal T, ideal LS, const ring R)
     164{
     165  SchreyerSyzygyComputation syz(L, T, LS, R);
     166  return syz.TraverseTail(multiplier, tail);
     167}
     168
     169static inline poly ReduceTerm(poly multiplier, poly term4reduction, poly syztermCheck,
     170                              ideal L, ideal T, ideal LS, const ring R)
     171{
     172  SchreyerSyzygyComputation syz(L, T, LS, R);
     173  return syz.ReduceTerm(multiplier, term4reduction, syztermCheck);
     174}
     175
     176
     177static inline poly SchreyerSyzygyNF(poly syz_lead, poly syz_2,
     178                                    ideal L, ideal T, ideal LS, const ring R)
     179{
     180  SchreyerSyzygyComputation syz(L, T, LS, R);
     181  return syz.SchreyerSyzygyNF(syz_lead, syz_2);
     182}
    69183
    70184
    71185
    72 poly SchreyerSyzygyNF(poly syz_lead, poly syz_2, ideal L, ideal T, ideal LS, const ring r);
    73 
    74 
    75 void ComputeSyzygy(const ideal L, const ideal T, ideal& LL, ideal& TT, const ring R);
    76 
    77 
    78 END_NAMESPACE               END_NAMESPACE_SINGULARXX
     186END_NAMESPACE
     187   
     188END_NAMESPACE_SINGULARXX
    79189
    80190#endif
Note: See TracChangeset for help on using the changeset viewer.