Commit 489d02b3 by SPAENLEHAUER Pierre-Jean

### almost done: some linking problems

parent b7301ceb
This diff is collapsed.
 ... ... @@ -14,3 +14,6 @@ modify memory_report implement rule of 0/3/5 remove EXTRACT_ALL option from the Doxygen file do five subprograms: selred selcrit buildmat addcrit tinygb_init
 ... ... @@ -9,27 +9,20 @@ namespace tinygb { // TODO: remove this forward definition template class CriticalPair; template std::ostream& operator<<(std::ostream&, const CriticalPair &); // This class represents critical pairs, i.e. pairs ((m1,p1),(m2,p2)) such that // the leading monomial of m1*p1 equals that of m2*p2. // Polynomials p1 and p2 are assumed to be monic. template class CriticalPair { public: CriticalPair(const PolynomialInMatrix& p1, const PolynomialInMatrix& p2); CriticalPair(const PolynomialInMatrix& p1, const PolynomialInMatrix& p2); const std::pair >& left() const { const std::pair& left() const { return left_; } const std::pair >& right() const { const std::pair& right() const { return right_; } ... ... @@ -40,56 +33,51 @@ class CriticalPair { unsigned Degree() const { return left_.second.Degree()+left_.first.Degree();} Polynomial Spolynomial() const; Polynomial Spolynomial() const; // Returns the set of monomials that airse with non zero coeff in both sides. // Unicity in the returned list is not ensured. std::list GetMonomials() const; bool operator<(CriticalPair &cp2); bool operator==(const CriticalPair &cp2) const; friend std::ostream& operator<< (std::ostream&, const CriticalPair&); bool operator<(CriticalPair &cp2); bool operator==(const CriticalPair &cp2) const; friend std::ostream& operator<<(std::ostream&, const CriticalPair&); private: std::pair > left_; std::pair > right_; std::pair left_; std::pair right_; Monomial LCM_; }; template CriticalPair::CriticalPair(const PolynomialInMatrix &p1, const PolynomialInMatrix &p2) { CriticalPair::CriticalPair(const PolynomialInMatrix &p1, const PolynomialInMatrix &p2) { std::pair c = p1.LeadingMonomial().Cofactors(p2.LeadingMonomial()); left_ = std::pair >(c.first, p1); right_ = std::pair >(c.second, p2); left_ = std::pair(c.first, p1); right_ = std::pair(c.second, p2); LCM_ = left_.first*left_.second.LeadingMonomial(); } // TODO(pj): extends to different strategies. // TODO(pj): where is this used? template bool CriticalPair::operator<(CriticalPair &cp2) { bool CriticalPair::operator<(CriticalPair &cp2) { if (Degree() < cp2.Degree()) return true; return false; } template std::ostream& operator<<(std::ostream& o, const std::pair > P) { const std::pair P) { o << "(" << P.first << "," << P.second << ")"; return o; } template std::ostream& operator<<(std::ostream& o, const CriticalPair & cp) { std::ostream& operator<<(std::ostream& o, const CriticalPair& cp) { o << cp.left_ << " " << cp.right_; return o; } // TODO(pj): improve by merging both lists template std::list CriticalPair::GetMonomials() const { std::list CriticalPair::GetMonomials() const { std::list result; for (const auto& m : left_.second.GetMonomials()) result.push_back(left_.first * m); ... ... @@ -98,11 +86,10 @@ std::list CriticalPair::GetMonomials() const { return result; } template Polynomial CriticalPair::Spolynomial() const { Polynomial tmp = left_.second.to_polynomial(); Polynomial CriticalPair::Spolynomial() const { Polynomial tmp = left_.second.to_polynomial(); tmp = tmp * left_.first; Polynomial R = right_.second.to_polynomial(); Polynomial R = right_.second.to_polynomial(); R = R * right_.first; R -= tmp; R.Normalize(); ... ...
 ... ... @@ -13,11 +13,10 @@ class NormalStrategy { public: // Selects critical pairs to reduce during a step from the current list of // critical pairs. Removes the selected pairs from the global list. template static std::list > SelectCriticalPairs( std::list > &global_critical_pairs) { static std::list SelectCriticalPairs( std::list &global_critical_pairs) { unsigned step_degree; std::list > step_critical_pairs; std::list step_critical_pairs; log(LOG_INFO) << "Normal strategy" << std::endl; step_degree = global_critical_pairs.front().Degree(); ... ... @@ -49,11 +48,10 @@ class SparseStrategy { // Selects critical pairs to reduce during a step from the current list of // critical pairs. Removes the selected pairs from the global list. // TODO(pj): beware of code duplication! template static std::list > SelectCriticalPairs( std::list > &global_critical_pairs) { static std::list SelectCriticalPairs( std::list &global_critical_pairs) { unsigned step_degree; std::list > step_critical_pairs; std::list step_critical_pairs; step_degree = SparseDegree(global_critical_pairs.front()); for (const auto& current_critical_pair : global_critical_pairs) ... ... @@ -72,14 +70,12 @@ class SparseStrategy { } private: template static unsigned SparseDegree(const CriticalPair&); static unsigned SparseDegree(const CriticalPair&); }; std::vector > SparseStrategy::linear_forms; template unsigned SparseStrategy::SparseDegree(const CriticalPair& crit_pair) { unsigned SparseStrategy::SparseDegree(const CriticalPair& crit_pair) { std::list list_monomials = crit_pair.GetMonomials(); unsigned sparse_deg = 0; for (const auto& m : list_monomials) ... ...
 ... ... @@ -23,10 +23,10 @@ void field_clear(); template void launchF4(std::istream &in, std::ostream &out) { log(LOG_INFO) << "begin parsing" << std::endl; Parser parser(in); std::vector > sys = parser.parse(); Parser parser(in); std::vector sys = parser.parse(); log(LOG_INFO) << "parsing done" << std::endl; std::vector > gb = F4(sys); std::vector gb = F4(sys); for (const auto& f : gb) { f.Print(out); out << std::endl; ... ...