[mathicgb] 319/393: Finally got rid of FreeModuleOrder. Completely Gone. Yahoo\!
Doug Torrance
dtorrance-guest at moszumanska.debian.org
Fri Apr 3 15:59:28 UTC 2015
This is an automated email from the git hooks/post-receive script.
dtorrance-guest pushed a commit to branch upstream
in repository mathicgb.
commit 05b572107f70e288800106ebcbae0d3415bf4edd
Author: Bjarke Hammersholt Roune <bjarkehr.code at gmail.com>
Date: Sat May 11 21:10:51 2013 +0200
Finally got rid of FreeModuleOrder. Completely Gone. Yahoo\!
---
Makefile.am | 1 -
src/mathicgb/BuchbergerAlg.cpp | 1 -
src/mathicgb/BuchbergerAlg.hpp | 2 -
src/mathicgb/DivLookup.hpp | 55 ----------------------
src/mathicgb/DivisorLookup.cpp | 1 -
src/mathicgb/DivisorLookup.hpp | 1 -
src/mathicgb/FreeModuleOrder.cpp | 43 -----------------
src/mathicgb/FreeModuleOrder.hpp | 41 ----------------
src/mathicgb/PairTriangle.cpp | 3 +-
src/mathicgb/PairTriangle.hpp | 79 +++++++++++++++----------------
src/mathicgb/QuadMatrixBuilder.cpp | 1 -
src/mathicgb/QuadMatrixBuilder.hpp | 1 -
src/mathicgb/SignatureGB.cpp | 7 +--
src/mathicgb/SignatureGB.hpp | 5 --
src/test/FreeModuleOrderTest.cpp | 96 --------------------------------------
src/test/QuadMatrixBuilder.cpp | 2 -
16 files changed, 40 insertions(+), 299 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 11b2192..8139165 100755
--- a/Makefile.am
+++ b/Makefile.am
@@ -19,7 +19,6 @@ libmathicgb_la_SOURCES = src/mathicgb/BjarkeGeobucket2.cpp \
src/mathicgb/BuchbergerAlg.hpp src/mathicgb/ChainedHashTable.cpp \
src/mathicgb/ChainedHashTable.hpp src/mathicgb/DivisorLookup.hpp \
src/mathicgb/DivisorLookup.cpp src/mathicgb/DivLookup.hpp \
- src/mathicgb/FreeModuleOrder.cpp src/mathicgb/FreeModuleOrder.hpp \
src/mathicgb/GroebnerBasis.cpp src/mathicgb/GroebnerBasis.hpp \
src/mathicgb/HashTourReducer.cpp src/mathicgb/HashTourReducer.hpp \
src/mathicgb/Basis.cpp src/mathicgb/Basis.hpp \
diff --git a/src/mathicgb/BuchbergerAlg.cpp b/src/mathicgb/BuchbergerAlg.cpp
index d5aa751..f08b190 100755
--- a/src/mathicgb/BuchbergerAlg.cpp
+++ b/src/mathicgb/BuchbergerAlg.cpp
@@ -24,7 +24,6 @@ BuchbergerAlg::BuchbergerAlg(
mUseAutoTopReduction(true),
mUseAutoTailReduction(false),
mRing(*basis.getPolyRing()),
- mOrder(FreeModuleOrder::makeOrder(0, *basis.getPolyRing())), // todo: remove
mReducer(reducer),
mBasis(mRing, DivisorLookup::makeFactory(
*basis.getPolyRing(),
diff --git a/src/mathicgb/BuchbergerAlg.hpp b/src/mathicgb/BuchbergerAlg.hpp
index 7e582b6..812bc18 100755
--- a/src/mathicgb/BuchbergerAlg.hpp
+++ b/src/mathicgb/BuchbergerAlg.hpp
@@ -2,7 +2,6 @@
#define MATHICGB_BUCHBERGER_ALG_GUARD
#include "Reducer.hpp"
-#include "FreeModuleOrder.hpp"
#include "SPairs.hpp"
#include "PolyBasis.hpp"
#include <mathic.h>
@@ -92,7 +91,6 @@ private:
void insertPolys(std::vector<std::unique_ptr<Poly> >& polynomials);
const PolyRing& mRing;
- std::unique_ptr<FreeModuleOrder> mOrder; // todo: remove
Reducer& mReducer;
PolyBasis mBasis;
SPairs mSPairs;
diff --git a/src/mathicgb/DivLookup.hpp b/src/mathicgb/DivLookup.hpp
index 8764d38..ed6bb67 100755
--- a/src/mathicgb/DivLookup.hpp
+++ b/src/mathicgb/DivLookup.hpp
@@ -8,7 +8,6 @@
#include "GroebnerBasis.hpp"
#include "DivisorLookup.hpp"
#include "PolyRing.hpp"
-#include "FreeModuleOrder.hpp"
/** Configuration class for interface to KDTree, DivList */
/* As such, it has entries that both will expect */
@@ -512,60 +511,6 @@ private:
size_t mReducer;
};
- /*
- // Class used in findDivisor()
- class DO {
- public:
- DO(const FreeModuleOrder *F0, const PolyRing *R0, const_monomial sig, const_monomial monom, size_t &val, monomial &result_multiplier)
- : F(F0),
- R(R0),
- _sig(sig),
- _monom(monom),
- _val(val),
- _multiplier(result_multiplier),
- _found(false)
- {}
-
- bool proceed(const Entry &e)
- {
- bool result = true;
- // MATHICGB_ASSERT(R->monomialDivide(_monom, e.monom, _multiplier));
- // stats_n_reducer_divides++;
- R->monomialDivide(_monom, e.monom, _multiplier);
- // stats_n_reducer_sig_compares++;
- if (GT == F->signatureCompare(_sig, _multiplier, e.sig))
- {
- //if (divisors) divisors[hashval] = i;
- _val = e.index;
- _found = true;
- result = false;
- }
- if (tracingLevel==11)
- {
- std::cerr << " PR: " << result << " _monom= ";
- R->monomialDisplay(std::cerr, _monom);
- std::cerr << "e.monom= ";
- R->monomialDisplay(std::cerr, e.monom);
- std::cerr << " _multiplier= ";
- R->monomialDisplay(std::cerr, _multiplier);
- std::cerr << std::endl;
- }
- return result;
- }
-
- bool found() const { return _found; }
- private:
- const FreeModuleOrder *F;
- const PolyRing *R;
- const_monomial _sig;
- const_monomial _monom;
- // output values (the first two are references elsewhere, so no interface to them is needed).
- size_t &_val;
- monomial &_multiplier;
- bool _found;
- };
- */
-
class DOCheckAll {
public:
DOCheckAll(
diff --git a/src/mathicgb/DivisorLookup.cpp b/src/mathicgb/DivisorLookup.cpp
old mode 100644
new mode 100755
index c2886a5..69cef21
--- a/src/mathicgb/DivisorLookup.cpp
+++ b/src/mathicgb/DivisorLookup.cpp
@@ -5,7 +5,6 @@
#include <mathic.h>
#include "GroebnerBasis.hpp"
-#include "FreeModuleOrder.hpp"
#include "DivLookup.hpp"
namespace {
diff --git a/src/mathicgb/DivisorLookup.hpp b/src/mathicgb/DivisorLookup.hpp
old mode 100644
new mode 100755
index 5988614..f765894
--- a/src/mathicgb/DivisorLookup.hpp
+++ b/src/mathicgb/DivisorLookup.hpp
@@ -8,7 +8,6 @@
class PolyBasis;
class GroebnerBasis;
-class FreeModuleOrder;
// Supports queries on the lead terms of the monomials in a PolyBasis.
// todo: rename to MonomialLookup.
diff --git a/src/mathicgb/FreeModuleOrder.cpp b/src/mathicgb/FreeModuleOrder.cpp
deleted file mode 100755
index 06eef39..0000000
--- a/src/mathicgb/FreeModuleOrder.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright 2011 Michael E. Stillman
-
-#include "stdinc.h"
-#include "FreeModuleOrder.hpp"
-
-#include "Poly.hpp"
-#include "SigSPairQueue.hpp"
-#include "GroebnerBasis.hpp"
-#include "PolyRing.hpp"
-#include <mathic.h>
-#include <iostream>
-#include <algorithm>
-#include <limits>
-#include <stdexcept>
-
-class ConcreteOrder : public FreeModuleOrder {
-public:
- ConcreteOrder(const PolyRing& ring): mRing(ring) {}
-
- virtual int signatureCompare(const_monomial sigA, const_monomial sigB) const {
- return mRing.monomialCompare(sigA, sigB);
- }
-
- virtual int signatureCompare(
- const_monomial sigA,
- const_monomial monoB,
- const_monomial sigB
- ) const {
- return mRing.monomialCompare(sigA, monoB, sigB);
- }
-
- virtual std::string description() const {
- return "todo";
- }
-
-private:
- const PolyRing& mRing;
-};
-
-std::unique_ptr<FreeModuleOrder> FreeModuleOrder::makeOrder(FreeModuleOrderType type, const PolyRing& ring)
-{
- return make_unique<ConcreteOrder>(ring);
-}
diff --git a/src/mathicgb/FreeModuleOrder.hpp b/src/mathicgb/FreeModuleOrder.hpp
deleted file mode 100755
index 1fd3a1a..0000000
--- a/src/mathicgb/FreeModuleOrder.hpp
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright 2011 Michael E. Stillman
-
-#ifndef _free_module_order_h_
-#define _free_module_order_h_
-
-#include "PolyRing.hpp"
-#include "SigSPairQueue.hpp"
-
-class PolyRing;
-class GroebnerBasis;
-class SigSPairQueue;
-typedef int FreeModuleOrderType;
-
-class FreeModuleOrder
-{
-public:
- FreeModuleOrder() {}
- virtual ~FreeModuleOrder() {}
-
- // returns LT, EQ, or GT, depending on sig ? sig2.
- virtual int signatureCompare(const_monomial sig, const_monomial sig2) const = 0;
-
- // compares sig vs (m2*sig)
- virtual int signatureCompare(
- const_monomial sig,
- const_monomial m2,
- const_monomial sig2
- ) const = 0;
-
- virtual std::string description() const = 0;
-
- /// @todo: We need at least an enum to make this clearer
- static std::unique_ptr<FreeModuleOrder> makeOrder(FreeModuleOrderType type, const PolyRing& ring);
-};
-
-#endif
-
-// Local Variables:
-// compile-command: "make -C .. "
-// indent-tabs-mode: nil
-// End:
diff --git a/src/mathicgb/PairTriangle.cpp b/src/mathicgb/PairTriangle.cpp
index bc89984..056ad7f 100755
--- a/src/mathicgb/PairTriangle.cpp
+++ b/src/mathicgb/PairTriangle.cpp
@@ -4,9 +4,8 @@
#include <limits>
#include <stdexcept>
-PairTriangle::PairTriangle(const FreeModuleOrder& order, const PolyRing& ring, size_t queueType):
+PairTriangle::PairTriangle(const PolyRing& ring, size_t queueType):
mColumnCount(0),
- mOrder(order),
mRing(ring),
mPairQueue(*this) {
}
diff --git a/src/mathicgb/PairTriangle.hpp b/src/mathicgb/PairTriangle.hpp
index 7d2040a..20afc47 100755
--- a/src/mathicgb/PairTriangle.hpp
+++ b/src/mathicgb/PairTriangle.hpp
@@ -4,8 +4,7 @@
#include <memtailor.h>
#include <mathic.h>
#include "PolyRing.hpp"
-#include "FreeModuleOrder.hpp"
-class FreeModuleOrder;
+#include "SigSPairQueue.hpp"
/*typedef unsigned short SmallIndex;
typedef unsigned int BigIndex;
@@ -20,10 +19,7 @@ struct PreSPair {
// or signature.
class PairTriangle {
public:
- PairTriangle(
- const FreeModuleOrder& order,
- const PolyRing& ring,
- size_t queueType);
+ PairTriangle(const PolyRing& ring, size_t queueType);
// Returns how many columns the triangle has
size_t columnCount() const {return mPairQueue.columnCount();}
@@ -76,33 +72,32 @@ protected:
virtual bool calculateOrderBy(size_t a, size_t b, monomial orderBy) const = 0;
private:
- FreeModuleOrder const& mOrder;
std::vector<PreSPair> mPrePairs;
PolyRing const& mRing;
class PC {
public:
- PC(PairTriangle const& tri): mTri(tri) {}
-
- typedef monomial PairData;
- void computePairData(size_t col, size_t row, monomial m) {
- mTri.calculateOrderBy(col, row, m);
- }
-
- typedef bool CompareResult;
- bool compare(int colA, int rowA, const_monomial a,
- int colB, int rowB, const_monomial b) const {
- return mTri.mOrder.signatureCompare(a, b) == GT;
- }
- bool cmpLessThan(bool v) const {return v;}
-
- // these are not required for a configuration but we will use
- // them from this code.
- monomial allocPairData() {return mTri.mRing.allocMonomial();}
- void freePairData(monomial m) {mTri.mRing.freeMonomial(m);}
+ PC(PairTriangle const& tri): mTri(tri) {}
+
+ typedef monomial PairData;
+ void computePairData(size_t col, size_t row, monomial m) {
+ mTri.calculateOrderBy(col, row, m);
+ }
+
+ typedef bool CompareResult;
+ bool compare(int colA, int rowA, const_monomial a,
+ int colB, int rowB, const_monomial b) const {
+ return mTri.mRing.monoid().lessThan(b, a);
+ }
+ bool cmpLessThan(bool v) const {return v;}
+
+ // these are not required for a configuration but we will use
+ // them from this code.
+ monomial allocPairData() {return mTri.mRing.allocMonomial();}
+ void freePairData(monomial m) {mTri.mRing.freeMonomial(m);}
private:
- PairTriangle const& mTri;
+ PairTriangle const& mTri;
};
mathic::PairQueue<PC> mPairQueue;
friend void mathic::PairQueueNamespace::constructPairData<PC>(void*,Index,Index,PC&);
@@ -111,22 +106,22 @@ private:
namespace mathic {
namespace PairQueueNamespace {
- template<>
- inline void constructPairData<PairTriangle::PC>
- (void* memory, Index col, Index row, PairTriangle::PC& conf) {
- MATHICGB_ASSERT(memory != 0);
- MATHICGB_ASSERT(col > row);
- monomial* pd = new (memory) monomial(conf.allocPairData());
- conf.computePairData(col, row, *pd);
- }
-
- template<>
- inline void destructPairData
- (monomial* pd, Index col, Index row, PairTriangle::PC& conf) {
- MATHICGB_ASSERT(pd != 0);
- MATHICGB_ASSERT(col > row);
- conf.freePairData(*pd);
- }
+ template<>
+ inline void constructPairData<PairTriangle::PC>
+ (void* memory, Index col, Index row, PairTriangle::PC& conf) {
+ MATHICGB_ASSERT(memory != 0);
+ MATHICGB_ASSERT(col > row);
+ monomial* pd = new (memory) monomial(conf.allocPairData());
+ conf.computePairData(col, row, *pd);
+ }
+
+ template<>
+ inline void destructPairData
+ (monomial* pd, Index col, Index row, PairTriangle::PC& conf) {
+ MATHICGB_ASSERT(pd != 0);
+ MATHICGB_ASSERT(col > row);
+ conf.freePairData(*pd);
+ }
}
}
diff --git a/src/mathicgb/QuadMatrixBuilder.cpp b/src/mathicgb/QuadMatrixBuilder.cpp
index 93ddaa1..29a8a99 100755
--- a/src/mathicgb/QuadMatrixBuilder.cpp
+++ b/src/mathicgb/QuadMatrixBuilder.cpp
@@ -1,7 +1,6 @@
#include "stdinc.h"
#include "QuadMatrixBuilder.hpp"
-#include "FreeModuleOrder.hpp"
#include "QuadMatrix.hpp"
#include <mathic.h>
#include <sstream>
diff --git a/src/mathicgb/QuadMatrixBuilder.hpp b/src/mathicgb/QuadMatrixBuilder.hpp
index 924e014..53763df 100755
--- a/src/mathicgb/QuadMatrixBuilder.hpp
+++ b/src/mathicgb/QuadMatrixBuilder.hpp
@@ -11,7 +11,6 @@
#include <string>
#include <ostream>
#include <memtailor.h>
-class FreeModuleOrder;
class QuadMatrix;
/** Builder for QuadMatrix. This is not quite the builder pattern in
diff --git a/src/mathicgb/SignatureGB.cpp b/src/mathicgb/SignatureGB.cpp
index 897592d..d5dcf0a 100755
--- a/src/mathicgb/SignatureGB.cpp
+++ b/src/mathicgb/SignatureGB.cpp
@@ -2,7 +2,6 @@
#include "stdinc.h"
#include "SignatureGB.hpp"
-#include "FreeModuleOrder.hpp"
#include "Basis.hpp"
#include "DivisorLookup.hpp"
#include "SigSPairs.hpp"
@@ -27,7 +26,6 @@ SignatureGB::SignatureGB(
mBreakAfter(0),
mPrintInterval(0),
R(basis.getPolyRing()),
- F(FreeModuleOrder::makeOrder(0, *basis.getPolyRing())),
mPostponeKoszul(postponeKoszul),
mUseBaseDivisors(useBaseDivisors),
stats_sPairSignaturesDone(0),
@@ -176,8 +174,8 @@ bool SignatureGB::processSPair
// new basis element
MATHICGB_ASSERT(!GB->isSingularTopReducibleSlow(*f, sig));
{
- std::unique_ptr<Poly> autoF(f);
- GB->insert(sig, std::move(autoF));
+ std::unique_ptr<Poly> uniqueF(f);
+ GB->insert(sig, std::move(uniqueF));
}
Hsyz->addComponent();
SP->newPairs(GB->size()-1);
@@ -303,7 +301,6 @@ void SignatureGB::displayStats(std::ostream &o) const
o << " strategy: signature"
<< (mPostponeKoszul ? "-postpone" : "")
<< (mUseBaseDivisors ? "-basediv" : "") << '\n';
- o << " sig-order: " << F->description() << '\n';
o << " reduction type: " << reducer->description() << '\n';
o << " divisor tab type: " << GB->basis().divisorLookup().getName() << '\n';
o << " syzygy tab type: " << Hsyz->description() << '\n';
diff --git a/src/mathicgb/SignatureGB.hpp b/src/mathicgb/SignatureGB.hpp
index 278f5b2..2c13b2e 100755
--- a/src/mathicgb/SignatureGB.hpp
+++ b/src/mathicgb/SignatureGB.hpp
@@ -6,7 +6,6 @@
#include "PolyRing.hpp"
#include "MTArray.hpp"
#include "GroebnerBasis.hpp"
-#include "FreeModuleOrder.hpp"
#include "SigSPairs.hpp"
#include "Reducer.hpp"
#include "KoszulQueue.hpp"
@@ -74,10 +73,6 @@ private:
bool step();
const PolyRing *R;
- std::unique_ptr<FreeModuleOrder> F; // todo: remove
-
-
-
bool const mPostponeKoszul;
diff --git a/src/test/FreeModuleOrderTest.cpp b/src/test/FreeModuleOrderTest.cpp
deleted file mode 100755
index 0ec45c2..0000000
--- a/src/test/FreeModuleOrderTest.cpp
+++ /dev/null
@@ -1,96 +0,0 @@
-#include "mathicgb/stdinc.h"
-
-#include "mathicgb/PolyRing.hpp"
-#include "mathicgb/Basis.hpp"
-#include "mathicgb/FreeModuleOrder.hpp"
-#include "mathicgb/io-util.hpp"
-#include <gtest/gtest.h>
-#include <algorithm>
-
-void runTest(
- const char* basisStr,
- const char* signatureStr,
- const char* correctStr,
- int orderType
-) {
- std::string line;
-
- std::unique_ptr<Basis> basis = basisParseFromString(basisStr);
- const PolyRing* ring = basis->getPolyRing();
-
- std::vector<monomial> sigs;
- std::vector<PreSPair> pairs;
- {
- std::istringstream in(signatureStr);
- while (std::getline(in, line)) {
- sigs.push_back(monomialParseFromString(ring, line));
- PreSPair pair;
- pair.i = static_cast<BigIndex>(pairs.size());
- pair.signature = monomialParseFromString(ring, line);
- pairs.push_back(pair);
- }
- }
-
- std::vector<size_t> answer(pairs.size());
- {
- std::istringstream in(correctStr);
- for (size_t i = 0; i < answer.size(); ++i) {
- in >> answer[i];
- MATHICGB_ASSERT(!!in);
- }
- }
-
- MATHICGB_ASSERT(sigs.size() == pairs.size());
- MATHICGB_ASSERT(sigs.size() == pairs.size());
-
- std::unique_ptr<FreeModuleOrder> order
- (FreeModuleOrder::makeOrder(orderType, *basis->getPolyRing()));
- order->sortSignatures(pairs);
- for (size_t i = 0; i < pairs.size(); ++i) {
- ring->freeMonomial(pairs[i].signature);
- pairs[i].signature = sigs[pairs[i].i];
- }
- sigs.clear();
-
- for (size_t i = 0; i < pairs.size(); ++i)
- ASSERT_EQ(pairs[i].i, answer[i]) << i << ' ' << orderType;
- for (size_t i = 0; i < pairs.size(); ++i) {
- const_monomial sigi = pairs[i].signature;
- ASSERT_EQ(order->signatureCompare(sigi, sigi), EQ)
- << i << ' ' << orderType;
- for (size_t j = 0; j < i; ++j) {
- const_monomial sigj = pairs[j].signature;
- ASSERT_EQ(order->signatureCompare(sigj, sigi), LT)
- << i << ' ' << j << ' ' << orderType;
- ASSERT_EQ(order->signatureCompare(sigi, sigj), GT)
- << i << ' ' << j << ' ' << orderType;
- }
- }
-}
-
-TEST(FreeModuleOrder, One) {
- const char* basis =
-"32003 3 "
-"1 1 1 1 "
-"3 "
-"a3b2c2 "
-"a "
-"a3c2 ";
- const char* sigs =
- "<1>\n" // 0
- "<0>\n" // 1
- "b10<0>\n" // 2
- "ac<0>\n" // 3
- "bc<0>\n" // 4
- "ac<1>\n" // 5
- "bc<1>\n" // 6
- "ab2c<2>\n"; // 7
-
- runTest(basis, sigs, "0 1 6 4 5 3 7 2", 1);
- //runTest(basis, sigs, "0 6 5 1 4 3 7 2", 2);
- //runTest(basis, sigs, "0 6 5 1 7 4 3 2", 3);
- //runTest(basis, sigs, "0 6 5 1 4 3 7 2", 4);
- //runTest(basis, sigs, "0 6 5 1 4 7 3 2", 5);
- //runTest(basis, sigs, "1 4 3 2 0 6 5 7", 6);
- //runTest(basis, sigs, "7 0 6 5 1 4 3 2", 7);
-}
diff --git a/src/test/QuadMatrixBuilder.cpp b/src/test/QuadMatrixBuilder.cpp
index f8c480a..5d9affa 100755
--- a/src/test/QuadMatrixBuilder.cpp
+++ b/src/test/QuadMatrixBuilder.cpp
@@ -4,7 +4,6 @@
#include "mathicgb/PolyRing.hpp"
#include "mathicgb/QuadMatrixBuilder.hpp"
#include "mathicgb/io-util.hpp"
-#include "mathicgb/FreeModuleOrder.hpp"
#include "mathicgb/Basis.hpp"
#include "mathicgb/QuadMatrix.hpp"
#include <gtest/gtest.h>
@@ -149,7 +148,6 @@ TEST(QuadMatrixBuilder, SortColumns) {
// construct builder and reverse lex order
std::unique_ptr<PolyRing> ring(ringFromString("32003 6 1\n1 1 1 1 1 1"));
Basis basis(*ring);
- std::unique_ptr<FreeModuleOrder> order(FreeModuleOrder::makeOrder(1, *basis.getPolyRing()));
// one row top, no rows bottom, no columns
{
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/mathicgb.git
More information about the debian-science-commits
mailing list