[mathicgb] 91/393: All code now uses MATHICGB_ASSERT - ASSERT is gone.
Doug Torrance
dtorrance-guest at moszumanska.debian.org
Fri Apr 3 15:58:38 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 be029b38eec4dbc4e8e23183eec992ef05800519
Author: Bjarke Hammersholt Roune <bjarkehr.code at gmail.com>
Date: Thu Nov 1 17:36:02 2012 +0100
All code now uses MATHICGB_ASSERT - ASSERT is gone.
---
src/mathicgb/BjarkeGeobucket.cpp | 20 ++++----
src/mathicgb/BjarkeGeobucket.hpp | 5 +-
src/mathicgb/BjarkeGeobucket2.hpp | 4 +-
src/mathicgb/BuchbergerAlg.cpp | 32 ++++++------
src/mathicgb/DivLookup.hpp | 24 ++++-----
src/mathicgb/F4MatrixBuilder.hpp | 6 +--
src/mathicgb/FreeModuleOrder.cpp | 8 +--
src/mathicgb/GroebnerBasis.cpp | 74 +++++++++++++--------------
src/mathicgb/GroebnerBasis.hpp | 6 +--
src/mathicgb/HashTourReducer.cpp | 14 +++---
src/mathicgb/KoszulQueue.hpp | 10 ++--
src/mathicgb/MTArray.cpp | 18 +++----
src/mathicgb/MonTableDivList.hpp | 4 +-
src/mathicgb/MonTableKDTree.hpp | 14 +++---
src/mathicgb/PairTriangle.cpp | 8 +--
src/mathicgb/Poly.cpp | 2 +-
src/mathicgb/PolyBasis.cpp | 49 +++++++++---------
src/mathicgb/PolyHashTable.cpp | 10 ++--
src/mathicgb/PolyRing.cpp | 12 ++---
src/mathicgb/ReducerHash.hpp | 18 +++----
src/mathicgb/ReducerHashPack.hpp | 14 +++---
src/mathicgb/ReducerHelper.hpp | 11 +++-
src/mathicgb/ReducerPackDedup.hpp | 10 ++--
src/mathicgb/SPairs.cpp | 102 +++++++++++++++++++-------------------
src/mathicgb/SigSPairs.cpp | 36 +++++++-------
src/mathicgb/SignatureGB.cpp | 12 ++---
src/mathicgb/TypicalReducer.cpp | 12 ++---
src/mathicgb/stdinc.h | 3 --
28 files changed, 273 insertions(+), 265 deletions(-)
diff --git a/src/mathicgb/BjarkeGeobucket.cpp b/src/mathicgb/BjarkeGeobucket.cpp
index e359692..9e27781 100644
--- a/src/mathicgb/BjarkeGeobucket.cpp
+++ b/src/mathicgb/BjarkeGeobucket.cpp
@@ -23,7 +23,7 @@ void BjarkeGeobucket::insertTail(const_term multiplier, const Poly *g1)
{
if (g1->nTerms() <= 1) return;
- ASSERT(mNodeCount == H_.getNodeCount());
+ MATHICGB_ASSERT(mNodeCount == H_.getNodeCount());
HashPoly M;
H_.insert(multiplier, ++(g1->begin()), g1->end(), M);
@@ -37,14 +37,14 @@ void BjarkeGeobucket::insertTail(const_term multiplier, const Poly *g1)
stats_n_compares += G_.getConfiguration().getComparisons();
G_.getConfiguration().resetComparisons();
- ASSERT(mNodeCount == H_.getNodeCount());
+ MATHICGB_ASSERT(mNodeCount == H_.getNodeCount());
}
void BjarkeGeobucket::insert(monomial multiplier, const Poly *g1)
{
HashPoly M;
- ASSERT(mNodeCount == H_.getNodeCount());
+ MATHICGB_ASSERT(mNodeCount == H_.getNodeCount());
H_.insert(multiplier, g1->begin(), g1->end(), M);
@@ -58,12 +58,12 @@ void BjarkeGeobucket::insert(monomial multiplier, const Poly *g1)
stats_n_compares += G_.getConfiguration().getComparisons();
G_.getConfiguration().resetComparisons();
- ASSERT(mNodeCount == H_.getNodeCount());
+ MATHICGB_ASSERT(mNodeCount == H_.getNodeCount());
}
bool BjarkeGeobucket::findLeadTerm(const_term &result)
{
- ASSERT(mNodeCount == H_.getNodeCount());
+ MATHICGB_ASSERT(mNodeCount == H_.getNodeCount());
while (!G_.empty())
{
if (H_.popTerm(G_.top(), result.coeff, result.monom))
@@ -81,7 +81,7 @@ void BjarkeGeobucket::removeLeadTerm()
G_.pop();
mNodeCount--;
- ASSERT(mNodeCount == H_.getNodeCount());
+ MATHICGB_ASSERT(mNodeCount == H_.getNodeCount());
}
void BjarkeGeobucket::value(Poly &result)
@@ -95,22 +95,22 @@ void BjarkeGeobucket::value(Poly &result)
mNodeCount--;
}
- ASSERT(mNodeCount == H_.getNodeCount());
+ MATHICGB_ASSERT(mNodeCount == H_.getNodeCount());
resetReducer();
}
void BjarkeGeobucket::resetReducer()
{
- ASSERT(mNodeCount == H_.getNodeCount());
+ MATHICGB_ASSERT(mNodeCount == H_.getNodeCount());
const_term t;
while (findLeadTerm(t))
{
G_.pop();
mNodeCount--;
}
- ASSERT(mNodeCount == H_.getNodeCount());
+ MATHICGB_ASSERT(mNodeCount == H_.getNodeCount());
H_.reset();
- ASSERT(mNodeCount == H_.getNodeCount());
+ MATHICGB_ASSERT(mNodeCount == H_.getNodeCount());
// how to reset G_ ?
}
diff --git a/src/mathicgb/BjarkeGeobucket.hpp b/src/mathicgb/BjarkeGeobucket.hpp
index a7c0104..35e638c 100755
--- a/src/mathicgb/BjarkeGeobucket.hpp
+++ b/src/mathicgb/BjarkeGeobucket.hpp
@@ -39,7 +39,10 @@ public:
static const bool supportDeduplication = Deduplicate;
bool cmpEqual(CompareResult r) const {return r;} // NOT USED IN OUR CASE HERRE!
- Entry deduplicate(const Entry& a, const Entry& /* b */) const {ASSERT(false); return a;}
+ Entry deduplicate(const Entry& a, const Entry& /* b */) const {
+ MATHICGB_ASSERT(false);
+ return a;
+ }
size_t getComparisons() const {return _comparisons;}
void resetComparisons() const {_comparisons = 0;}
diff --git a/src/mathicgb/BjarkeGeobucket2.hpp b/src/mathicgb/BjarkeGeobucket2.hpp
index 2438bca..016a35a 100755
--- a/src/mathicgb/BjarkeGeobucket2.hpp
+++ b/src/mathicgb/BjarkeGeobucket2.hpp
@@ -30,8 +30,8 @@ public:
bool cmpLessThan(CompareResult r) const {return r;}
static const bool supportDeduplication = false;
- bool cmpEqual(CompareResult r) const {ASSERT(false);return r;} // NOT USED IN OUR CASE HERRE!
- Entry deduplicate(const Entry& a, const Entry& /* b */) const {ASSERT(false); return a;}
+ bool cmpEqual(CompareResult r) const {MATHICGB_ASSERT(false);return r;} // NOT USED IN OUR CASE HERRE!
+ Entry deduplicate(const Entry& a, const Entry& /* b */) const {MATHICGB_ASSERT(false); return a;}
size_t getComparisons() const {return _comparisons;}
void resetComparisons() const {_comparisons = 0;}
diff --git a/src/mathicgb/BuchbergerAlg.cpp b/src/mathicgb/BuchbergerAlg.cpp
index dc9a443..1675bd6 100755
--- a/src/mathicgb/BuchbergerAlg.cpp
+++ b/src/mathicgb/BuchbergerAlg.cpp
@@ -103,10 +103,10 @@ void BuchbergerAlg::insertPolys
void BuchbergerAlg::insertReducedPoly(
std::unique_ptr<Poly> polyToInsert
) {
- ASSERT(polyToInsert.get() != 0);
+ MATHICGB_ASSERT(polyToInsert.get() != 0);
if (polyToInsert->isZero())
return;
- ASSERT(mBasis.divisor(polyToInsert->getLeadMonomial()) ==
+ MATHICGB_ASSERT(mBasis.divisor(polyToInsert->getLeadMonomial()) ==
static_cast<size_t>(-1));
if (tracingLevel > 20) {
@@ -182,8 +182,8 @@ void BuchbergerAlg::insertReducedPoly(
delete *it;
throw;
}
- ASSERT(toReduce.empty());
- ASSERT(toRetireAndReduce.empty());
+ MATHICGB_ASSERT(toReduce.empty());
+ MATHICGB_ASSERT(toRetireAndReduce.empty());
}
void BuchbergerAlg::computeGrobnerBasis() {
@@ -217,20 +217,20 @@ void BuchbergerAlg::computeGrobnerBasis() {
}
void BuchbergerAlg::step() {
- ASSERT(!mSPairs.empty());
+ MATHICGB_ASSERT(!mSPairs.empty());
if (tracingLevel > 30)
std::cerr << "Determining next S-pair" << std::endl;
if (mSPairGroupSize == 0) {
std::pair<size_t, size_t> p = mSPairs.pop();
if (p.first == static_cast<size_t>(-1)) {
- ASSERT(p.second == static_cast<size_t>(-1));
+ MATHICGB_ASSERT(p.second == static_cast<size_t>(-1));
return; // no more S-pairs
}
- ASSERT(p.first != static_cast<size_t>(-1));
- ASSERT(p.second != static_cast<size_t>(-1));
- ASSERT(!mBasis.retired(p.first));
- ASSERT(!mBasis.retired(p.second));
+ MATHICGB_ASSERT(p.first != static_cast<size_t>(-1));
+ MATHICGB_ASSERT(p.second != static_cast<size_t>(-1));
+ MATHICGB_ASSERT(!mBasis.retired(p.first));
+ MATHICGB_ASSERT(!mBasis.retired(p.second));
if (tracingLevel > 20) {
std::cerr << "Reducing S-pair ("
@@ -252,13 +252,13 @@ void BuchbergerAlg::step() {
std::pair<size_t, size_t> p;
p = mSPairs.pop(w);
if (p.first == static_cast<size_t>(-1)) {
- ASSERT(p.second == static_cast<size_t>(-1));
+ MATHICGB_ASSERT(p.second == static_cast<size_t>(-1));
break; // no more S-pairs
}
- ASSERT(p.first != static_cast<size_t>(-1));
- ASSERT(p.second != static_cast<size_t>(-1));
- ASSERT(!mBasis.retired(p.first));
- ASSERT(!mBasis.retired(p.second));
+ MATHICGB_ASSERT(p.first != static_cast<size_t>(-1));
+ MATHICGB_ASSERT(p.second != static_cast<size_t>(-1));
+ MATHICGB_ASSERT(!mBasis.retired(p.first));
+ MATHICGB_ASSERT(!mBasis.retired(p.second));
spairGroup.push_back(p);
}
@@ -284,7 +284,7 @@ void BuchbergerAlg::step() {
}
void BuchbergerAlg::autoTailReduce() {
- ASSERT(mUseAutoTailReduction);
+ MATHICGB_ASSERT(mUseAutoTailReduction);
for (size_t i = 0; i < mBasis.size(); ++i) {
if (mBasis.retired(i))
diff --git a/src/mathicgb/DivLookup.hpp b/src/mathicgb/DivLookup.hpp
index 366a569..94228af 100644
--- a/src/mathicgb/DivLookup.hpp
+++ b/src/mathicgb/DivLookup.hpp
@@ -45,23 +45,23 @@ public:
_type(type),
_preferSparseReducers(preferSparseReducers)
{
- ASSERT(rebuildRatio >= 0);
+ MATHICGB_ASSERT(rebuildRatio >= 0);
}
void setBasis(const PolyBasis& basis) {
if (mBasis == &basis)
return;
- ASSERT(mBasis == 0);
- ASSERT(mRing == &basis.ring());
+ MATHICGB_ASSERT(mBasis == 0);
+ MATHICGB_ASSERT(mRing == &basis.ring());
mBasis = &basis;
}
void setSigBasis(const GroebnerBasis& sigBasis) {
if (mSigBasis == &sigBasis)
return;
- ASSERT(mSigBasis == 0);
- ASSERT(mBasis == 0 || mBasis == &sigBasis.basis());
- ASSERT(mRing == &sigBasis.basis().ring());
+ MATHICGB_ASSERT(mSigBasis == 0);
+ MATHICGB_ASSERT(mBasis == 0 || mBasis == &sigBasis.basis());
+ MATHICGB_ASSERT(mRing == &sigBasis.basis().ring());
mSigBasis = &sigBasis;
setBasis(sigBasis.basis());
}
@@ -243,7 +243,7 @@ class DivLookup : public DivisorLookup {
DivLookup(const Configuration &C) :
_finder(C)
{
- ASSERT(!C.UseTreeDivMask || C.UseDivMask);
+ MATHICGB_ASSERT(!C.UseTreeDivMask || C.UseDivMask);
}
~DivLookup() {}
@@ -268,14 +268,14 @@ class DivLookup : public DivisorLookup {
const_monomial sigNew = GB->getSignature(newGenerator);
- ASSERT(newGenerator < GB->size());
+ MATHICGB_ASSERT(newGenerator < GB->size());
LowBaseDivisor searchObject(*GB, divisors, maxDivisors, newGenerator);
_finder.findAllDivisors(sigNew, searchObject);
}
virtual size_t highBaseDivisor(size_t newGenerator) const {
const GroebnerBasis* basis = _finder.getConfiguration().basis();
- ASSERT(newGenerator < basis->size());
+ MATHICGB_ASSERT(newGenerator < basis->size());
HighBaseDivisor searchObject(*basis, newGenerator);
_finder.findAllDivisors
@@ -372,7 +372,7 @@ private:
}
if (mDivisors.size() > mMaxDivisors)
mDivisors.pop_back();
- ASSERT(mDivisors.size() <= mMaxDivisors);
+ MATHICGB_ASSERT(mDivisors.size() <= mMaxDivisors);
return true;
}
private:
@@ -449,7 +449,7 @@ private:
const const_monomial minSig = mSigBasis.getSignature(mMinLeadGen);
const const_monomial genSig = mSigBasis.getSignature(entry.index);
int sigCmp = mSigBasis.order().signatureCompare(minSig, genSig);
- ASSERT(sigCmp != EQ); // no two generators have same signature
+ MATHICGB_ASSERT(sigCmp != EQ); // no two generators have same signature
if (sigCmp == GT)
return true;
}
@@ -481,7 +481,7 @@ private:
bool proceed(const Entry &e)
{
bool result = true;
- // ASSERT(R->monomialDivide(_monom, e.monom, _multiplier));
+ // MATHICGB_ASSERT(R->monomialDivide(_monom, e.monom, _multiplier));
// stats_n_reducer_divides++;
R->monomialDivide(_monom, e.monom, _multiplier);
// stats_n_reducer_sig_compares++;
diff --git a/src/mathicgb/F4MatrixBuilder.hpp b/src/mathicgb/F4MatrixBuilder.hpp
index 51f797f..48b3220 100755
--- a/src/mathicgb/F4MatrixBuilder.hpp
+++ b/src/mathicgb/F4MatrixBuilder.hpp
@@ -69,7 +69,7 @@ private:
/** Creates a column with monomial label x and schedules a new row to
reduce that column if possible. Here x is monoA if monoB is
null and otherwise x is the product of monoA and monoB. */
- MATHIC_NO_INLINE LeftRightColIndex createColumn
+ MATHICGB_NO_INLINE LeftRightColIndex createColumn
(QuadMatrixBuilder& builder, const_monomial monoA, const_monomial monoB);
/// Represents the task of adding a row to the matrix. If sPairPoly is null
@@ -97,10 +97,10 @@ private:
QuadMatrixBuilder& builder
);
- MATHIC_INLINE LeftRightColIndex findOrCreateColumn
+ MATHICGB_INLINE LeftRightColIndex findOrCreateColumn
(const_monomial monoA, const_monomial monoB, QuadMatrixBuilder& builder);
- MATHIC_INLINE const std::pair<LeftRightColIndex, LeftRightColIndex>
+ MATHICGB_INLINE const std::pair<LeftRightColIndex, LeftRightColIndex>
findOrCreateTwoColumns(
const const_monomial monoA1,
const const_monomial monoA2,
diff --git a/src/mathicgb/FreeModuleOrder.cpp b/src/mathicgb/FreeModuleOrder.cpp
index a3541d9..660a300 100755
--- a/src/mathicgb/FreeModuleOrder.cpp
+++ b/src/mathicgb/FreeModuleOrder.cpp
@@ -80,7 +80,7 @@ namespace {
typedef monomial PairData;
void computePairData(size_t col, size_t row, monomial sig) {
- ASSERT(mBasis.ratioCompare(col, row) != EQ);
+ MATHICGB_ASSERT(mBasis.ratioCompare(col, row) != EQ);
// ensure that ratio(col) > ratio(row)
if (mBasis.ratioCompare(col, row) == LT)
std::swap(col, row);
@@ -133,11 +133,11 @@ namespace {
#ifdef DEBUG
monomial tmp = ring().allocMonomial();
for (size_t i = 0; i < pairs.size(); ++i) {
- ASSERT(pairs[i].i < columnCount());
+ MATHICGB_ASSERT(pairs[i].i < columnCount());
mPairQueue.configuration().computePairData
(columnCount(), pairs[i].i, tmp);
comparer().unscrambleSignature(tmp);
- ASSERT(ring().monomialEQ(tmp, pairs[i].signature));
+ MATHICGB_ASSERT(ring().monomialEQ(tmp, pairs[i].signature));
}
ring().freeMonomial(tmp);
#endif
@@ -503,7 +503,7 @@ public:
monomial unscrambled = mRing->allocMonomial();
mRing->monomialCopy(sig, unscrambled);
unscrambleSignature(unscrambled);
- ASSERT(mRing->monomialEQ(original, unscrambled));
+ MATHICGB_ASSERT(mRing->monomialEQ(original, unscrambled));
mRing->freeMonomial(original);
mRing->freeMonomial(unscrambled);
#endif
diff --git a/src/mathicgb/GroebnerBasis.cpp b/src/mathicgb/GroebnerBasis.cpp
index 7dfdb95..30a5aa3 100755
--- a/src/mathicgb/GroebnerBasis.cpp
+++ b/src/mathicgb/GroebnerBasis.cpp
@@ -27,8 +27,8 @@ GroebnerBasis::GroebnerBasis(
GroebnerBasis::~GroebnerBasis()
{
- ASSERT(mBasis.size() == mSignatures.size());
- ASSERT(mBasis.size() == sigLeadRatio.size());
+ MATHICGB_ASSERT(mBasis.size() == mSignatures.size());
+ MATHICGB_ASSERT(mBasis.size() == sigLeadRatio.size());
for (size_t i = 0; i < mBasis.size(); i++) {
if (! mSignatures[i].isNull())
@@ -51,9 +51,9 @@ void GroebnerBasis::addComponent() {
void GroebnerBasis::insert(monomial sig, std::unique_ptr<Poly> f)
{
- ASSERT(f.get() != 0);
- ASSERT(f->getLeadCoefficient() != 0);
- ASSERT(sig.isNull() || ring().getMonomialPool().fromPool(sig.unsafeGetRepresentation()));
+ MATHICGB_ASSERT(f.get() != 0);
+ MATHICGB_ASSERT(f->getLeadCoefficient() != 0);
+ MATHICGB_ASSERT(sig.isNull() || ring().getMonomialPool().fromPool(sig.unsafeGetRepresentation()));
const size_t index = mSignatures.size();
mSignatures.push_back(sig);
@@ -61,7 +61,7 @@ void GroebnerBasis::insert(monomial sig, std::unique_ptr<Poly> f)
monomial ratio = 0;
if (!sig.isNull()) {
const size_t component = ring().monomialGetComponent(sig);
- ASSERT(component < mSignatureLookup.size());
+ MATHICGB_ASSERT(component < mSignatureLookup.size());
mSignatureLookup[component]->insert(sig, index);
ratio = ring().allocMonomial(ring().getMonomialPool());
@@ -76,10 +76,10 @@ void GroebnerBasis::insert(monomial sig, std::unique_ptr<Poly> f)
mMinimalDivisorLookup->insert(lead, index);
}
- ASSERT(mMinimalDivisorLookup->type() == 0 ||
+ MATHICGB_ASSERT(mMinimalDivisorLookup->type() == 0 ||
mBasis.minimalLeadCount() == mMinimalDivisorLookup->size());
- ASSERT(mSignatures.size() == index + 1);
- ASSERT(mBasis.size() == index + 1);
+ MATHICGB_ASSERT(mSignatures.size() == index + 1);
+ MATHICGB_ASSERT(mBasis.size() == index + 1);
if (!mUseRatioRank || sig.isNull())
return;
@@ -111,7 +111,7 @@ again:
return;
}
}
- ASSERT(prevRank < nextRank);
+ MATHICGB_ASSERT(prevRank < nextRank);
// this formula avoids the overflow inherent in prevRank + nextRank;
Rank rank = prevRank + (nextRank - prevRank) / 2;
@@ -125,7 +125,7 @@ again:
size_t increment = std::numeric_limits<Rank>::max() / (mSignatures.size() + 1);
if (increment == 0)
increment = 2;
- ASSERT(!mRatioSorted.empty());
+ MATHICGB_ASSERT(!mRatioSorted.empty());
size_t rankSum = increment; // leave a gap at beginning
Rank prevRank = *mRatioRanks.begin();
for (RatioSortedType::iterator it = mRatioSorted.begin();
@@ -139,22 +139,22 @@ again:
}
goto again;
}
- ASSERT(rank > 0);
- ASSERT(rank < std::numeric_limits<Rank>::max());
- ASSERT(prevRank + 1 < rank && rank < nextRank - 1);
+ MATHICGB_ASSERT(rank > 0);
+ MATHICGB_ASSERT(rank < std::numeric_limits<Rank>::max());
+ MATHICGB_ASSERT(prevRank + 1 < rank && rank < nextRank - 1);
mRatioRanks.push_back(rank);
- ASSERT(mRatioRanks.size() == index + 1);
+ MATHICGB_ASSERT(mRatioRanks.size() == index + 1);
#ifdef DEBUG
// Check that at least one space has been left between every rank
- ASSERT(mRatioRanks[*mRatioSorted.begin()] > 0);
- ASSERT(mRatioRanks[*mRatioSorted.rbegin()] <
+ MATHICGB_ASSERT(mRatioRanks[*mRatioSorted.begin()] > 0);
+ MATHICGB_ASSERT(mRatioRanks[*mRatioSorted.rbegin()] <
std::numeric_limits<Rank>::max());
RatioSortedType::iterator it2 = mRatioSorted.begin();
for (++it2; it2 != mRatioSorted.end(); ++it2) {
RatioSortedType::iterator prev = it2;
--prev;
- ASSERT(mRatioRanks[*it2] == mRatioRanks[*prev] ||
+ MATHICGB_ASSERT(mRatioRanks[*it2] == mRatioRanks[*prev] ||
mRatioRanks[*it2] - 1 > mRatioRanks[*prev]);
}
#endif
@@ -206,7 +206,7 @@ void GroebnerBasis::lowBaseDivisors(
size_t maxDivisors,
size_t newGenerator) const
{
- ASSERT(newGenerator < size());
+ MATHICGB_ASSERT(newGenerator < size());
const_monomial sigNew = getSignature(newGenerator);
const size_t component = ring().monomialGetComponent(sigNew);
mSignatureLookup[component]->
@@ -214,10 +214,10 @@ void GroebnerBasis::lowBaseDivisors(
#ifdef DEBUG
std::vector<size_t> debugValue;
lowBaseDivisorsSlow(debugValue, maxDivisors, newGenerator);
- ASSERT(divisors.size() <= maxDivisors);
- ASSERT(debugValue.size() == divisors.size());
+ MATHICGB_ASSERT(divisors.size() <= maxDivisors);
+ MATHICGB_ASSERT(debugValue.size() == divisors.size());
for (size_t i = 0; i < divisors.size(); ++i) {
- ASSERT(ratioCompare(debugValue[i], divisors[i]) == EQ);
+ MATHICGB_ASSERT(ratioCompare(debugValue[i], divisors[i]) == EQ);
}
#endif
}
@@ -227,7 +227,7 @@ void GroebnerBasis::lowBaseDivisorsSlow(
size_t maxDivisors,
size_t newGenerator) const
{
- ASSERT(newGenerator < size());
+ MATHICGB_ASSERT(newGenerator < size());
divisors.clear();
divisors.reserve(maxDivisors + 1);
@@ -253,26 +253,26 @@ void GroebnerBasis::lowBaseDivisorsSlow(
}
if (divisors.size() > maxDivisors)
divisors.pop_back();
- ASSERT(divisors.size() <= maxDivisors);
+ MATHICGB_ASSERT(divisors.size() <= maxDivisors);
}
- ASSERT(divisors.size() <= maxDivisors);
+ MATHICGB_ASSERT(divisors.size() <= maxDivisors);
}
size_t GroebnerBasis::highBaseDivisor(size_t newGenerator) const {
- ASSERT(newGenerator < size());
+ MATHICGB_ASSERT(newGenerator < size());
size_t highDivisor = divisorLookup().highBaseDivisor(newGenerator);
#ifdef DEBUG
size_t debugValue = highBaseDivisorSlow(newGenerator);
- ASSERT((highDivisor == static_cast<size_t>(-1)) ==
+ MATHICGB_ASSERT((highDivisor == static_cast<size_t>(-1)) ==
(debugValue == static_cast<size_t>(-1)));
- ASSERT(highDivisor == static_cast<size_t>(-1) ||
+ MATHICGB_ASSERT(highDivisor == static_cast<size_t>(-1) ||
ratioCompare(debugValue, highDivisor) == EQ);
#endif
return highDivisor;
}
size_t GroebnerBasis::highBaseDivisorSlow(size_t newGenerator) const {
- ASSERT(newGenerator < size());
+ MATHICGB_ASSERT(newGenerator < size());
size_t highDivisor = static_cast<size_t>(-1);
const_monomial leadNew = getLeadMonomial(newGenerator);
@@ -291,10 +291,10 @@ size_t GroebnerBasis::highBaseDivisorSlow(size_t newGenerator) const {
}
size_t GroebnerBasis::minimalLeadInSig(const_monomial sig) const {
- ASSERT(! sig.isNull() );
+ MATHICGB_ASSERT(! sig.isNull() );
const size_t component = ring().monomialGetComponent(sig);
const size_t minLeadGen = mSignatureLookup[component]->minimalLeadInSig(sig);
- ASSERT(minLeadGen == minimalLeadInSigSlow(sig));
+ MATHICGB_ASSERT(minLeadGen == minimalLeadInSigSlow(sig));
return minLeadGen;
}
@@ -330,7 +330,7 @@ size_t GroebnerBasis::minimalLeadInSigSlow(const_monomial sig) const {
const const_monomial minSig = getSignature(minLeadGen);
const const_monomial genSig = getSignature(gen);
int sigCmp = order().signatureCompare(minSig, genSig);
- ASSERT(sigCmp != EQ); // no two generators have same signature
+ MATHICGB_ASSERT(sigCmp != EQ); // no two generators have same signature
if (sigCmp == GT)
continue;
}
@@ -347,7 +347,7 @@ size_t GroebnerBasis::minimalLeadInSigSlow(const_monomial sig) const {
bool GroebnerBasis::isSingularTopReducible
(const Poly& poly, const_monomial sig) const {
- ASSERT( ! sig.isNull() );
+ MATHICGB_ASSERT( ! sig.isNull() );
if (poly.isZero())
return false;
@@ -424,7 +424,7 @@ size_t GroebnerBasis::getMemoryUse() const
}
size_t GroebnerBasis::ratioRank(const_monomial ratio) const {
- ASSERT(mUseRatioRank);
+ MATHICGB_ASSERT(mUseRatioRank);
const size_t index = size();
if (index == 0)
return 0; // any value will do as there is nothing to compare to
@@ -436,18 +436,18 @@ size_t GroebnerBasis::ratioRank(const_monomial ratio) const {
sigLeadRatioNonConst.pop_back();
if (pos == mRatioSorted.end()) {
- ASSERT(ratioRank(*mRatioSorted.rbegin()) <
+ MATHICGB_ASSERT(ratioRank(*mRatioSorted.rbegin()) <
std::numeric_limits<Rank>::max());
return std::numeric_limits<Rank>::max();
} else {
if (order().signatureCompare(ratio, getSigLeadRatio(*pos)) == EQ)
return ratioRank(*pos);
- ASSERT(ratioRank(*pos) > 0);
+ MATHICGB_ASSERT(ratioRank(*pos) > 0);
#ifdef DEBUG
if (pos != mRatioSorted.begin()) {
RatioSortedType::iterator prev = pos;
--prev;
- ASSERT(ratioRank(*pos) - 1 > ratioRank(*prev));
+ MATHICGB_ASSERT(ratioRank(*pos) - 1 > ratioRank(*prev));
}
#endif
return ratioRank(*pos) - 1;
diff --git a/src/mathicgb/GroebnerBasis.hpp b/src/mathicgb/GroebnerBasis.hpp
index b0c928c..174fcab 100644
--- a/src/mathicgb/GroebnerBasis.hpp
+++ b/src/mathicgb/GroebnerBasis.hpp
@@ -44,7 +44,7 @@ public:
}
const_monomial getSigLeadRatio(size_t i) const {
- ASSERT(i < size());
+ MATHICGB_ASSERT(i < size());
return sigLeadRatio[i];
}
@@ -58,7 +58,7 @@ public:
void insert(monomial sig, std::unique_ptr<Poly> f);
const_monomial getSignature(size_t i) const {
- ASSERT(i < size());
+ MATHICGB_ASSERT(i < size());
return mSignatures[i];
}
@@ -143,7 +143,7 @@ private:
// may change at next insert!
size_t ratioRank(size_t index) const {
- ASSERT(index < size());
+ MATHICGB_ASSERT(index < size());
return mRatioRanks[index];
}
diff --git a/src/mathicgb/HashTourReducer.cpp b/src/mathicgb/HashTourReducer.cpp
index 01a272b..ba990a1 100755
--- a/src/mathicgb/HashTourReducer.cpp
+++ b/src/mathicgb/HashTourReducer.cpp
@@ -39,8 +39,8 @@ HashTourReducer::~HashTourReducer()
///////////////////////////////////////
void HashTourReducer::insertTail(const_term multiple, const Poly* poly)
{
- ASSERT(poly != 0);
- ASSERT(&poly->ring() == &mRing);
+ MATHICGB_ASSERT(poly != 0);
+ MATHICGB_ASSERT(&poly->ring() == &mRing);
if (poly->nTerms() < 2)
return;
MultipleWithPos* entry =
@@ -51,8 +51,8 @@ void HashTourReducer::insertTail(const_term multiple, const Poly* poly)
void HashTourReducer::insert(monomial multiple, const Poly* poly)
{
- ASSERT(poly != 0);
- ASSERT(&poly->ring() == &mRing);
+ MATHICGB_ASSERT(poly != 0);
+ MATHICGB_ASSERT(&poly->ring() == &mRing);
if (poly->isZero())
return;
term termMultiple(1, multiple);
@@ -107,7 +107,7 @@ bool HashTourReducer::leadTerm(const_term& result)
if (mQueue.empty())
return false;
MultipleWithPos* entry = mQueue.top();
- ASSERT(entry != 0);
+ MATHICGB_ASSERT(entry != 0);
// remove node from hash table first since we are going to be changing
// the monomial after this, and if we do that before the hash value will
@@ -120,7 +120,7 @@ bool HashTourReducer::leadTerm(const_term& result)
mLeadTerm.coeff = entry->node->coeff;
// remove old monomial from hash table and insert next
- ASSERT(entry->pos != entry->end);
+ MATHICGB_ASSERT(entry->pos != entry->end);
while (true) {
++entry->pos;
if (entry->pos == entry->end) {
@@ -158,7 +158,7 @@ void HashTourReducer::removeLeadTerm()
}
void HashTourReducer::insertEntry(MultipleWithPos* entry) {
- ASSERT(entry != 0);
+ MATHICGB_ASSERT(entry != 0);
for (; entry->pos != entry->end; ++entry->pos) {
term t;
t.monom = entry->current;
diff --git a/src/mathicgb/KoszulQueue.hpp b/src/mathicgb/KoszulQueue.hpp
index 2871e3f..784eba2 100644
--- a/src/mathicgb/KoszulQueue.hpp
+++ b/src/mathicgb/KoszulQueue.hpp
@@ -17,22 +17,22 @@ public:
}
const_monomial top() const {
- ASSERT(!empty());
+ MATHICGB_ASSERT(!empty());
return mQueue.top();
}
monomial popRelease() {
- ASSERT(!empty());
+ MATHICGB_ASSERT(!empty());
return mQueue.pop();
}
void pop() {
- ASSERT(!empty());
+ MATHICGB_ASSERT(!empty());
mQueue.getConfiguration().getPool().free(popRelease().unsafeGetRepresentation());
}
void push(monomial sig) {
- //TODO: ASSERT(mPool.member(sig));
+ //TODO: MATHICGB_ASSERT(mPool.member(sig));
mQueue.push(sig);
}
@@ -53,7 +53,7 @@ private:
mOrder(order),
mPool(pool)
{
- ASSERT(mOrder != 0);
+ MATHICGB_ASSERT(mOrder != 0);
}
memt::BufferPool &getPool() { return mPool; }
diff --git a/src/mathicgb/MTArray.cpp b/src/mathicgb/MTArray.cpp
index f17c797..697abe0 100644
--- a/src/mathicgb/MTArray.cpp
+++ b/src/mathicgb/MTArray.cpp
@@ -63,8 +63,8 @@ bool MTArrayT<MT>::insert(const_monomial m, V val)
{
stats_.n_calls_insert++;
size_t x = R->monomialGetComponent(m);
- ASSERT(x < tables.size());
- ASSERT(tables[x] != 0);
+ MATHICGB_ASSERT(x < tables.size());
+ MATHICGB_ASSERT(tables[x] != 0);
bool result = tables[x]->insert(m, val);
if (result) stats_.n_actual_inserts++;
return result;
@@ -75,8 +75,8 @@ bool MTArrayT<MT>::member(const_monomial m, V &result)
{
stats_.n_calls_member++;
size_t x = R->monomialGetComponent(m);
- ASSERT(x < tables.size());
- ASSERT(tables[x] != 0);
+ MATHICGB_ASSERT(x < tables.size());
+ MATHICGB_ASSERT(tables[x] != 0);
return tables[x]->member(m, result);
}
@@ -91,7 +91,7 @@ void MTArrayT<MT>::getStats(Stats &stats) const
unsigned long long exponentCount = 0;
for (size_t i=0; i<tables.size(); i++) {
T *p = tables[i];
- ASSERT(p != 0);
+ MATHICGB_ASSERT(p != 0);
monomials.clear();
p->getMonomials(monomials);
typedef std::vector<const_monomial>::const_iterator iter;
@@ -115,7 +115,7 @@ void MTArrayT<MT>::display(std::ostream &o, int level) const
for (size_t i=0; i<tables.size(); i++)
{
T *p = tables[i];
- ASSERT(p != 0);
+ MATHICGB_ASSERT(p != 0);
if (p->n_elems() == 0)
continue;
@@ -140,9 +140,9 @@ void MTArrayT<MT>::printFrobbyM2Format
{
R->printRingFrobbyM2Format(out);
- ASSERT(component < tables.size());
+ MATHICGB_ASSERT(component < tables.size());
T* p = tables[component];
- ASSERT(p != 0);
+ MATHICGB_ASSERT(p != 0);
std::vector<const_monomial> monomials;
p->getMonomials(monomials);
std::sort(monomials.begin(), monomials.end(),
@@ -181,7 +181,7 @@ size_t MTArrayT<MT>::getMemoryUse() const
{
size_t sum = tables.capacity() * sizeof(tables.front());
for (size_t i = 0; i < tables.size(); ++i) {
- ASSERT(tables[i] != 0);
+ MATHICGB_ASSERT(tables[i] != 0);
sum += sizeof(tables[i]) + tables[i]->getMemoryUse();
}
return sum;
diff --git a/src/mathicgb/MonTableDivList.hpp b/src/mathicgb/MonTableDivList.hpp
index 4f3e628..5e94d5c 100644
--- a/src/mathicgb/MonTableDivList.hpp
+++ b/src/mathicgb/MonTableDivList.hpp
@@ -109,13 +109,13 @@ class MonTableDivList {
size_t minRebuild):
_finder(C(R, minimizeOnInsert, moveDivisorToFront, sortOnInsert, rebuildRatio, minRebuild))
{
- ASSERT(!sortOnInsert || !moveDivisorToFront);
+ MATHICGB_ASSERT(!sortOnInsert || !moveDivisorToFront);
}
MonTableDivList(const Configuration &C) :
_finder(C)
{
- ASSERT(!C.getSortOnInsert() || !C.getMoveDivisorToFront());
+ MATHICGB_ASSERT(!C.getSortOnInsert() || !C.getMoveDivisorToFront());
}
const C& getConfiguration() const {return _finder.getConfiguration();}
diff --git a/src/mathicgb/MonTableKDTree.hpp b/src/mathicgb/MonTableKDTree.hpp
index 81867a1..6b875c2 100644
--- a/src/mathicgb/MonTableKDTree.hpp
+++ b/src/mathicgb/MonTableKDTree.hpp
@@ -36,7 +36,7 @@ class MonTableKDTreeConfiguration {
_rebuildRatio(rebuildRatio),
_minRebuild(minRebuild),
_expQueryCount(0) {
- ASSERT(rebuildRatio >= 0);
+ MATHICGB_ASSERT(rebuildRatio >= 0);
}
size_t getVarCount() const {return _varCount;}
@@ -109,13 +109,13 @@ class MonTableKDTree {
size_t minRebuild):
_finder(C(R, minimizeOnInsert, sortOnInsert, useDivisorCache, rebuildRatio, minRebuild))
{
- ASSERT(!UseTreeDivMask || UseDivMask);
+ MATHICGB_ASSERT(!UseTreeDivMask || UseDivMask);
}
MonTableKDTree(const Configuration &C) :
_finder(C)
{
- ASSERT(!UseTreeDivMask || UseDivMask);
+ MATHICGB_ASSERT(!UseTreeDivMask || UseDivMask);
}
const C& getConfiguration() const {return _finder.getConfiguration();}
@@ -207,13 +207,13 @@ inline bool MonTableKDTree<UDM, UTDM, LS, AR>::insert(const Entry& entry) {
MonomialDeleter mondelete(getPolyRing()->getMonomialPool());
_finder.removeMultiples(entry, mondelete);
} else {
- ASSERT(findDivisor(entry) == 0);
+ MATHICGB_ASSERT(findDivisor(entry) == 0);
MonomialDeleter mondelete(getPolyRing()->getMonomialPool());
// todo: can't do the below ASSERT as KD tree won't allow a
// removal action when removals are not allowed. So there
// should be a getMultiples() method that could be
// used instead.
- //ASSERT(!_finder.removeMultiples(entry, mondelete));
+ //MATHICGB_ASSERT(!_finder.removeMultiples(entry, mondelete));
}
_finder.insert(entry);
return true;
@@ -232,12 +232,12 @@ insert(const Entry& entry, MultipleOutput& removed) {
return false;
_finder.removeMultiples(entry, removed);
} else {
- ASSERT(findDivisor(entry) == _finder.end());
+ MATHICGB_ASSERT(findDivisor(entry) == _finder.end());
// todo: can't do the below ASSERT as KD tree won't allow a
// removal action when removals are not allowed. So there
// should be a getMultiples() method that could be
// used instead.
- //ASSERT(!_finder.removeMultiples(entry, removed));
+ //MATHICGB_ASSERT(!_finder.removeMultiples(entry, removed));
}
_finder.insert(entry);
return true;
diff --git a/src/mathicgb/PairTriangle.cpp b/src/mathicgb/PairTriangle.cpp
index 39326d5..ca11f45 100755
--- a/src/mathicgb/PairTriangle.cpp
+++ b/src/mathicgb/PairTriangle.cpp
@@ -13,7 +13,7 @@ PairTriangle::PairTriangle(const FreeModuleOrder& order, const PolyRing& ring, s
}
void PairTriangle::beginColumn() {
- ASSERT(mPrePairs.empty());
+ MATHICGB_ASSERT(mPrePairs.empty());
size_t const maxBigIndex = std::numeric_limits<BigIndex>::max();
if (mColumnCount >= maxBigIndex)
throw std::overflow_error
@@ -21,11 +21,11 @@ void PairTriangle::beginColumn() {
}
void PairTriangle::addPair(size_t index, monomial orderBy) {
- ASSERT(index < mColumnCount);
+ MATHICGB_ASSERT(index < mColumnCount);
#ifdef DEBUG
monomial tmp = mRing.allocMonomial();
calculateOrderBy(mColumnCount, index, tmp);
- ASSERT(mRing.monomialEQ(tmp, orderBy));
+ MATHICGB_ASSERT(mRing.monomialEQ(tmp, orderBy));
mRing.freeMonomial(tmp);
#endif
@@ -71,7 +71,7 @@ void PairTriangle::endColumn() {
(Iter(mPrePairs.begin()), Iter(mPrePairs.end()));
++mColumnCount;
- ASSERT(mColumnCount == columnCount());
+ MATHICGB_ASSERT(mColumnCount == columnCount());
for (std::vector<PreSPair>::iterator it = mPrePairs.begin();
it != mPrePairs.end(); ++it)
mRing.freeMonomial(it->signature);
diff --git a/src/mathicgb/Poly.cpp b/src/mathicgb/Poly.cpp
index 13a39ae..56dd8ac 100755
--- a/src/mathicgb/Poly.cpp
+++ b/src/mathicgb/Poly.cpp
@@ -198,7 +198,7 @@ Poly * Poly::add(const PolyRing *R,
}
const_monomial Poly::backMonomial() const {
- ASSERT(begin() != end());
+ MATHICGB_ASSERT(begin() != end());
return &(monoms.front()) + R->maxMonomialSize() * (nTerms() - 1);
}
diff --git a/src/mathicgb/PolyBasis.cpp b/src/mathicgb/PolyBasis.cpp
index 5bbe2dc..0d78a12 100755
--- a/src/mathicgb/PolyBasis.cpp
+++ b/src/mathicgb/PolyBasis.cpp
@@ -13,7 +13,7 @@ PolyBasis::PolyBasis(
mOrder(order),
mDivisorLookup(std::move(divisorLookup))
{
- ASSERT(mDivisorLookup.get() != 0);
+ MATHICGB_ASSERT(mDivisorLookup.get() != 0);
mDivisorLookup->setBasis(*this);
}
@@ -22,7 +22,7 @@ PolyBasis::~PolyBasis() {
for (EntryIter it = mEntries.begin(); it != stop; ++it) {
if (it->retired)
continue;
- ASSERT(it->poly != 0);
+ MATHICGB_ASSERT(it->poly != 0);
delete it->poly;
}
}
@@ -53,7 +53,7 @@ void PolyBasis::insert(std::unique_ptr<Poly> poly) {
for (EntryIter it = mEntries.begin(); it != stop; ++it) {
if (it->retired)
continue;
- ASSERT(!ring().monomialEQ(lead, it->poly->getLeadMonomial()));
+ MATHICGB_ASSERT(!ring().monomialEQ(lead, it->poly->getLeadMonomial()));
}
#endif
@@ -64,7 +64,7 @@ void PolyBasis::insert(std::unique_ptr<Poly> poly) {
public:
MultipleOutput(EntryCont& entries): mEntries(entries) {}
virtual bool proceed(size_t index) {
- ASSERT(index < mEntries.size());
+ MATHICGB_ASSERT(index < mEntries.size());
mEntries[index].leadMinimal = false;
return true;
}
@@ -89,9 +89,9 @@ void PolyBasis::insert(std::unique_ptr<Poly> poly) {
size_t PolyBasis::divisor(const_monomial mon) const {
size_t index = divisorLookup().divisor(mon);
- ASSERT((index == static_cast<size_t>(-1)) ==
+ MATHICGB_ASSERT((index == static_cast<size_t>(-1)) ==
(divisorSlow(mon) == static_cast<size_t>(-1)));
- ASSERT(index == static_cast<size_t>(-1) ||
+ MATHICGB_ASSERT(index == static_cast<size_t>(-1) ||
ring().monomialIsDivisibleBy(mon, leadMonomial(index)));
return index;
}
@@ -105,8 +105,8 @@ size_t PolyBasis::divisorSlow(const_monomial mon) const {
}
bool PolyBasis::leadMinimalSlow(size_t index) const {
- ASSERT(index < size());
- ASSERT(!retired(index));
+ MATHICGB_ASSERT(index < size());
+ MATHICGB_ASSERT(!retired(index));
const_monomial const lead = leadMonomial(index);
EntryCIter const skip = mEntries.begin() + index;
EntryCIter const stop = mEntries.end();
@@ -158,9 +158,9 @@ size_t PolyBasis::getMemoryUse() const {
}
bool PolyBasis::buchbergerLcmCriterion(size_t a, size_t b) const {
- ASSERT(a != b);
- ASSERT(!retired(a));
- ASSERT(!retired(b));
+ MATHICGB_ASSERT(a != b);
+ MATHICGB_ASSERT(!retired(a));
+ MATHICGB_ASSERT(!retired(b));
// We don't need to set the weights on the lcm since we will only use it
// for testing divisibility, not for determining order.
monomial lcmAB = mRing.allocMonomial();
@@ -174,10 +174,10 @@ bool PolyBasis::buchbergerLcmCriterion(size_t a, size_t b) const {
bool PolyBasis::buchbergerLcmCriterion
(size_t a, size_t b, const_monomial lcmAB) const
{
- ASSERT(a != b);
- ASSERT(!retired(a));
- ASSERT(!retired(b));
- ASSERT(mRing.monomialIsLeastCommonMultipleNoWeights
+ MATHICGB_ASSERT(a != b);
+ MATHICGB_ASSERT(!retired(a));
+ MATHICGB_ASSERT(!retired(b));
+ MATHICGB_ASSERT(mRing.monomialIsLeastCommonMultipleNoWeights
(leadMonomial(a), leadMonomial(b), lcmAB));
class Criterion : public DivisorLookup::EntryOutput {
@@ -191,9 +191,10 @@ bool PolyBasis::buchbergerLcmCriterion
mAlmostApplies(false) {}
virtual bool proceed(size_t index) {
- ASSERT(index < mBasis.size());
- ASSERT(!applies()); // should have stopped search in this case
- ASSERT(mRing.monomialIsDivisibleBy(mLcmAB, mBasis.leadMonomial(index)));
+ MATHICGB_ASSERT(index < mBasis.size());
+ MATHICGB_ASSERT(!applies()); // should have stopped search in this case
+ MATHICGB_ASSERT(
+ mRing.monomialIsDivisibleBy(mLcmAB, mBasis.leadMonomial(index)));
if (!mBasis.leadMinimal(index))
return true;
if (index == mA || index == mB)
@@ -279,12 +280,12 @@ bool PolyBasis::buchbergerLcmCriterion
if (applies)
++mStats.buchbergerLcmCacheHits;
else {
- ASSERT(!criterion.applies());
+ MATHICGB_ASSERT(!criterion.applies());
mDivisorLookup->divisors(criterion.lcmAB(), criterion);
applies = criterion.applies();
if (mUseBuchbergerLcmHitCache && applies) {
- ASSERT(criterion.hit() < size());
+ MATHICGB_ASSERT(criterion.hit() < size());
mBuchbergerLcmHitCache[a] = criterion.hit();
mBuchbergerLcmHitCache[b] = criterion.hit();
}
@@ -298,14 +299,14 @@ bool PolyBasis::buchbergerLcmCriterion
else if (almostApplies)
++mStats.buchbergerLcmNearHits;
- ASSERT(applies == buchbergerLcmCriterionSlow(a, b));
+ MATHICGB_ASSERT(applies == buchbergerLcmCriterionSlow(a, b));
return applies;
}
bool PolyBasis::buchbergerLcmCriterionSlow(size_t a, size_t b) const {
- ASSERT(a != b);
- ASSERT(!retired(a));
- ASSERT(!retired(b));
+ MATHICGB_ASSERT(a != b);
+ MATHICGB_ASSERT(!retired(a));
+ MATHICGB_ASSERT(!retired(b));
monomial lcmAB = ring().allocMonomial();
monomial lcm = ring().allocMonomial();
diff --git a/src/mathicgb/PolyHashTable.cpp b/src/mathicgb/PolyHashTable.cpp
index 49c5b6c..3222b78 100755
--- a/src/mathicgb/PolyHashTable.cpp
+++ b/src/mathicgb/PolyHashTable.cpp
@@ -47,7 +47,7 @@ void PolyHashTable::reset()
mStats.n_resets++;
#if 0
- ASSERT(mNodeCount != 0);
+ MATHICGB_ASSERT(mNodeCount != 0);
for (size_t count = 0; count < mTableSize; ++count)
{
if ( mHashTable[count] != 0)
@@ -81,7 +81,7 @@ void PolyHashTable::resize(size_t new_nbits)
// Loop through each one, reinserting the node into the proper bin.
// std::cout << "resizing PolyHashTable to " << new_nbits << " bits" << " count=" << mNodeCount << std::endl;
- ASSERT(computeNodeCount() == mNodeCount);
+ MATHICGB_ASSERT(computeNodeCount() == mNodeCount);
size_t const old_table_size = mTableSize;
mTableSize = static_cast<size_t>(1) << new_nbits;
mLogTableSize = new_nbits;
@@ -124,7 +124,7 @@ void PolyHashTable::resize(size_t new_nbits)
mMaxCountBeforeRebuild =
static_cast<size_t>(std::floor(mTableSize * threshold));
- ASSERT(computeNodeCount() == mNodeCount);
+ MATHICGB_ASSERT(computeNodeCount() == mNodeCount);
}
PolyHashTable::node * PolyHashTable::makeNode(coefficient coeff, const_monomial monom)
@@ -149,7 +149,7 @@ bool PolyHashTable::lookup_and_insert(const_monomial m, coefficient val, node *&
size_t fullHashVal = mRing.monomialHashValue(m);
size_t hashval = fullHashVal & mHashMask;
- ASSERT(hashval < mHashTable.size());
+ MATHICGB_ASSERT(hashval < mHashTable.size());
node *tmpNode = mHashTable[hashval];
if (tmpNode == 0)
{
@@ -301,7 +301,7 @@ void PolyHashTable::unlink(node* p)
// That probably means either that the node has been deleted twice
// or that the value in the node changed so that its hash value
// changed. That is not allowed.
- ASSERT(false);
+ MATHICGB_ASSERT(false);
}
void PolyHashTable::remove(node* n) {
diff --git a/src/mathicgb/PolyRing.cpp b/src/mathicgb/PolyRing.cpp
index 2d89dcd..ad22a52 100755
--- a/src/mathicgb/PolyRing.cpp
+++ b/src/mathicgb/PolyRing.cpp
@@ -140,10 +140,10 @@ void PolyRing::monomialFindSignature(ConstMonomial v1,
// t1 := (v2:v1) u1
*t1 = *u1.mValue;
if (mTotalDegreeGradedOnly) {
- ASSERT(mNumWeights == 1);
+ MATHICGB_ASSERT(mNumWeights == 1);
exponent weight = 0;
for (size_t i = 1; i <= mNumVars; ++i) {
- ASSERT(mWeights[i - 1] == -1);
+ MATHICGB_ASSERT(mWeights[i - 1] == -1);
if (v1[i] < v2[i])
weight -= t1[i] = u1[i] + v2[i] - v1[i];
else
@@ -151,7 +151,7 @@ void PolyRing::monomialFindSignature(ConstMonomial v1,
}
#ifdef MATHICGB_DEBUG
setWeightsOnly(t1);
- ASSERT(t1[mNumVars + 1] == weight);
+ MATHICGB_ASSERT(t1[mNumVars + 1] == weight);
#endif
t1[mNumVars + 1] = weight;
} else {
@@ -493,10 +493,10 @@ void PolyRing::monomialFindSignature(const_monomial v1,
// t1 := (v2:v1) u1
*t1 = *u1;
if (mTotalDegreeGradedOnly) {
- ASSERT(mNumWeights == 1);
+ MATHICGB_ASSERT(mNumWeights == 1);
exponent weight = 0;
for (size_t i = 1; i <= mNumVars; ++i) {
- ASSERT(mWeights[i - 1] == -1);
+ MATHICGB_ASSERT(mWeights[i - 1] == -1);
if (v1[i] < v2[i])
weight -= t1[i] = u1[i] + v2[i] - v1[i];
else
@@ -504,7 +504,7 @@ void PolyRing::monomialFindSignature(const_monomial v1,
}
#ifdef DEBUG
setWeightsOnly(t1);
- ASSERT(t1[mNumVars + 1] == weight);
+ MATHICGB_ASSERT(t1[mNumVars + 1] == weight);
#endif
t1[mNumVars + 1] = weight;
} else {
diff --git a/src/mathicgb/ReducerHash.hpp b/src/mathicgb/ReducerHash.hpp
index 1673ce1..098b306 100755
--- a/src/mathicgb/ReducerHash.hpp
+++ b/src/mathicgb/ReducerHash.hpp
@@ -87,7 +87,7 @@ void ReducerHash<Q>::insertTail(const_term multiplier, const Poly *g1)
{
if (g1->nTerms() <= 1) return;
- ASSERT(mNodeCount == mHashTable.getNodeCount());
+ MATHICGB_ASSERT(mNodeCount == mHashTable.getNodeCount());
PolyHashTable::MonomialArray M;
mHashTable.insert(multiplier, ++(g1->begin()), g1->end(), M);
@@ -100,7 +100,7 @@ void ReducerHash<Q>::insertTail(const_term multiplier, const Poly *g1)
stats_n_compares += mQueue.getConfiguration().getComparisonCount();
mQueue.getConfiguration().resetComparisonCount();
- ASSERT(mNodeCount == mHashTable.getNodeCount());
+ MATHICGB_ASSERT(mNodeCount == mHashTable.getNodeCount());
}
template<template<typename> class Q>
@@ -108,7 +108,7 @@ void ReducerHash<Q>::insert(monomial multiplier, const Poly *g1)
{
PolyHashTable::MonomialArray M;
- ASSERT(mNodeCount == mHashTable.getNodeCount());
+ MATHICGB_ASSERT(mNodeCount == mHashTable.getNodeCount());
mHashTable.insert(multiplier, g1->begin(), g1->end(), M);
@@ -126,13 +126,13 @@ void ReducerHash<Q>::insert(monomial multiplier, const Poly *g1)
stats_n_compares += mQueue.getConfiguration().getComparisonCount();
mQueue.getConfiguration().resetComparisonCount();
- ASSERT(mNodeCount == mHashTable.getNodeCount());
+ MATHICGB_ASSERT(mNodeCount == mHashTable.getNodeCount());
}
template<template<typename> class Q>
bool ReducerHash<Q>::leadTerm(const_term &result)
{
- ASSERT(mNodeCount == mHashTable.getNodeCount());
+ MATHICGB_ASSERT(mNodeCount == mHashTable.getNodeCount());
while (!mQueue.empty())
{
if (mHashTable.popTerm(mQueue.top(), result.coeff, result.monom))
@@ -151,22 +151,22 @@ void ReducerHash<Q>::removeLeadTerm()
mQueue.pop();
mNodeCount--;
- ASSERT(mNodeCount == mHashTable.getNodeCount());
+ MATHICGB_ASSERT(mNodeCount == mHashTable.getNodeCount());
}
template<template<typename> class Q>
void ReducerHash<Q>::resetReducer()
{
- ASSERT(mNodeCount == mHashTable.getNodeCount());
+ MATHICGB_ASSERT(mNodeCount == mHashTable.getNodeCount());
const_term t;
while (leadTerm(t))
{
mQueue.pop();
mNodeCount--;
}
- ASSERT(mNodeCount == mHashTable.getNodeCount());
+ MATHICGB_ASSERT(mNodeCount == mHashTable.getNodeCount());
mHashTable.reset();
- ASSERT(mNodeCount == mHashTable.getNodeCount());
+ MATHICGB_ASSERT(mNodeCount == mHashTable.getNodeCount());
// how to reset mQueue ?
}
diff --git a/src/mathicgb/ReducerHashPack.hpp b/src/mathicgb/ReducerHashPack.hpp
index e5dd061..53ca579 100755
--- a/src/mathicgb/ReducerHashPack.hpp
+++ b/src/mathicgb/ReducerHashPack.hpp
@@ -109,8 +109,8 @@ ReducerHashPack<Q>::~ReducerHashPack()
template<template<typename> class Q>
void ReducerHashPack<Q>::insertTail(const_term multiple, const Poly* poly)
{
- ASSERT(poly != 0);
- ASSERT(&poly->ring() == &mRing);
+ MATHICGB_ASSERT(poly != 0);
+ MATHICGB_ASSERT(&poly->ring() == &mRing);
if (poly->nTerms() < 2)
return;
MultipleWithPos* entry =
@@ -122,8 +122,8 @@ void ReducerHashPack<Q>::insertTail(const_term multiple, const Poly* poly)
template<template<typename> class Q>
void ReducerHashPack<Q>::insert(monomial multiple, const Poly* poly)
{
- ASSERT(poly != 0);
- ASSERT(&poly->ring() == &mRing);
+ MATHICGB_ASSERT(poly != 0);
+ MATHICGB_ASSERT(&poly->ring() == &mRing);
if (poly->isZero())
return;
term termMultiple(1, multiple);
@@ -183,7 +183,7 @@ bool ReducerHashPack<Q>::leadTerm(const_term& result)
if (mQueue.empty())
return false;
MultipleWithPos* entry = mQueue.top();
- ASSERT(entry != 0);
+ MATHICGB_ASSERT(entry != 0);
// remove node from hash table first since we are going to be changing
// the monomial after this, and if we do that before the hash value will
@@ -196,7 +196,7 @@ bool ReducerHashPack<Q>::leadTerm(const_term& result)
mLeadTerm.coeff = entry->node->coeff;
// remove old monomial from hash table and insert next
- ASSERT(entry->pos != entry->end);
+ MATHICGB_ASSERT(entry->pos != entry->end);
while (true) {
++entry->pos;
if (entry->pos == entry->end) {
@@ -236,7 +236,7 @@ void ReducerHashPack<Q>::removeLeadTerm()
template<template<typename> class Q>
void ReducerHashPack<Q>::insertEntry(MultipleWithPos* entry) {
- ASSERT(entry != 0);
+ MATHICGB_ASSERT(entry != 0);
for (; entry->pos != entry->end; ++entry->pos) {
term t;
t.monom = entry->current;
diff --git a/src/mathicgb/ReducerHelper.hpp b/src/mathicgb/ReducerHelper.hpp
index d943061..c604f23 100644
--- a/src/mathicgb/ReducerHelper.hpp
+++ b/src/mathicgb/ReducerHelper.hpp
@@ -50,8 +50,15 @@ namespace ReducerHelper {
// The dummy deduplicate function has to be a template since we do not
// know what type Entry is.
template<class Entry>
- Entry deduplicate(Entry a, Entry b) const {ASSERT(false); return a;}
- bool cmpEqual(bool) const {ASSERT(false); return false;}
+ Entry deduplicate(Entry a, Entry b) const {
+ MATHICGB_ASSERT(false);
+ return a;
+ }
+
+ bool cmpEqual(bool) const {
+ MATHICGB_ASSERT(false);
+ return false;
+ }
};
// Base class for a configuration with deduplication turned on.
diff --git a/src/mathicgb/ReducerPackDedup.hpp b/src/mathicgb/ReducerPackDedup.hpp
index 3c4b472..07776b6 100755
--- a/src/mathicgb/ReducerPackDedup.hpp
+++ b/src/mathicgb/ReducerPackDedup.hpp
@@ -185,7 +185,7 @@ void ReducerPackDedup<Q>::MultipleWithPos::destroy(const PolyRing& ring) {
ConstMonomial& monom = const_cast<ConstMonomial&>(entry->multiple.monom);
ring.freeMonomial(monom.castAwayConst());
MultipleWithPos* next = entry->chain;
- ASSERT(next != 0);
+ MATHICGB_ASSERT(next != 0);
// Call the destructor to destruct the iterators into std::vector.
// In debug mode MSVC puts those in a linked list and the destructor
@@ -226,7 +226,7 @@ bool ReducerPackDedup<Q>::leadTerm(const_term& result)
} else {
entry->computeCurrent(mRing);
// Inserted spans must be in descending order
- ASSERT(mQueue.getConfiguration().ring().
+ MATHICGB_ASSERT(mQueue.getConfiguration().ring().
monomialLT(entry->current, mLeadTerm.monom));
mQueue.decreaseTop(entry);
}
@@ -234,8 +234,8 @@ bool ReducerPackDedup<Q>::leadTerm(const_term& result)
// handle any chained elements
MultipleWithPos* chain = chainBegin;
while (chain != chainEnd) {
- ASSERT(chain != 0);
- ASSERT(mRing.monomialEQ(chain->current, mLeadTerm.monom));
+ MATHICGB_ASSERT(chain != 0);
+ MATHICGB_ASSERT(mRing.monomialEQ(chain->current, mLeadTerm.monom));
MultipleWithPos* const next = chain->chain;
chain->chain = chain; // detach from remaining chained elements
@@ -248,7 +248,7 @@ bool ReducerPackDedup<Q>::leadTerm(const_term& result)
} else {
chain->computeCurrent(mRing);
// Inserted spans must be in descending order
- ASSERT(mQueue.getConfiguration().ring().
+ MATHICGB_ASSERT(mQueue.getConfiguration().ring().
monomialLT(chain->current, mLeadTerm.monom));
mQueue.push(chain);
}
diff --git a/src/mathicgb/SPairs.cpp b/src/mathicgb/SPairs.cpp
index ee3e277..564166b 100755
--- a/src/mathicgb/SPairs.cpp
+++ b/src/mathicgb/SPairs.cpp
@@ -12,7 +12,7 @@ SPairs::SPairs(const PolyBasis& basis, size_t queueType):
std::pair<size_t, size_t> SPairs::pop() {
// Must call addPairs for new elements before popping.
- ASSERT(mEliminated.columnCount() == mBasis.size());
+ MATHICGB_ASSERT(mEliminated.columnCount() == mBasis.size());
while (!mTri.empty()) {
std::pair<size_t, size_t> p;
@@ -22,7 +22,7 @@ std::pair<size_t, size_t> SPairs::pop() {
continue;
}
const_monomial lcm = mTri.topOrderBy();
- ASSERT(mRing.monomialIsLeastCommonMultiple
+ MATHICGB_ASSERT(mRing.monomialIsLeastCommonMultiple
(mBasis.leadMonomial(p.first),
mBasis.leadMonomial(p.second), lcm));
// Can't pop before done with lcm as popping overwrites lcm.
@@ -38,7 +38,7 @@ std::pair<size_t, size_t> SPairs::pop() {
std::pair<size_t, size_t> SPairs::pop(exponent& w) {
// Must call addPairs for new elements before popping.
- ASSERT(mEliminated.columnCount() == mBasis.size());
+ MATHICGB_ASSERT(mEliminated.columnCount() == mBasis.size());
while (!mTri.empty()) {
std::pair<size_t, size_t> p;
@@ -48,7 +48,7 @@ std::pair<size_t, size_t> SPairs::pop(exponent& w) {
continue;
}
const_monomial lcm = mTri.topOrderBy();
- ASSERT(mRing.monomialIsLeastCommonMultiple
+ MATHICGB_ASSERT(mRing.monomialIsLeastCommonMultiple
(mBasis.leadMonomial(p.first),
mBasis.leadMonomial(p.second), lcm));
// Can't pop before done with lcm as popping overwrites lcm.
@@ -107,14 +107,14 @@ void SPairs::addPairsAssumeAutoReduce(
size_t newGen,
std::vector<size_t>& toRetireAndReduce
) {
- ASSERT(mTri.columnCount() == newGen);
+ MATHICGB_ASSERT(mTri.columnCount() == newGen);
- ASSERT(newGen < mBasis.size());
- ASSERT(!mBasis.retired(newGen));
+ MATHICGB_ASSERT(newGen < mBasis.size());
+ MATHICGB_ASSERT(!mBasis.retired(newGen));
while (mEliminated.columnCount() < mBasis.size()) {
if (mUseBuchbergerLcmHitCache) {
- ASSERT(mEliminated.columnCount() == mBuchbergerLcmHitCache.size());
+ MATHICGB_ASSERT(mEliminated.columnCount() == mBuchbergerLcmHitCache.size());
mBuchbergerLcmHitCache.push_back(0);
}
mEliminated.addColumn();
@@ -130,14 +130,14 @@ void SPairs::addPairs(size_t newGen) {
// newGen could be implicitly picked up from mTri.columnCount(), but
// doing it this way ensures that what happens is what the client thinks
// is happening and offers an ASSERT to inform mistaken client code.
- ASSERT(mTri.columnCount() == newGen);
+ MATHICGB_ASSERT(mTri.columnCount() == newGen);
- ASSERT(newGen < mBasis.size());
- ASSERT(!mBasis.retired(newGen));
+ MATHICGB_ASSERT(newGen < mBasis.size());
+ MATHICGB_ASSERT(!mBasis.retired(newGen));
while (mEliminated.columnCount() < mBasis.size()) {
if (mUseBuchbergerLcmHitCache) {
- ASSERT(mEliminated.columnCount() == mBuchbergerLcmHitCache.size());
+ MATHICGB_ASSERT(mEliminated.columnCount() == mBuchbergerLcmHitCache.size());
mBuchbergerLcmHitCache.push_back(0);
}
mEliminated.addColumn();
@@ -179,14 +179,14 @@ SPairs::ClassicPairTriangle::ClassicPairTriangle(const PolyBasis& basis, size_t
bool SPairs::simpleBuchbergerLcmCriterion
(size_t a, size_t b, const_monomial lcmAB) const
{
- ASSERT(a < mBasis.size());
- ASSERT(b < mBasis.size());
- ASSERT(a != b);
- ASSERT(!mBasis.retired(a));
- ASSERT(!mBasis.retired(b));
- ASSERT(mRing.monomialIsLeastCommonMultipleNoWeights
+ MATHICGB_ASSERT(a < mBasis.size());
+ MATHICGB_ASSERT(b < mBasis.size());
+ MATHICGB_ASSERT(a != b);
+ MATHICGB_ASSERT(!mBasis.retired(a));
+ MATHICGB_ASSERT(!mBasis.retired(b));
+ MATHICGB_ASSERT(mRing.monomialIsLeastCommonMultipleNoWeights
(mBasis.leadMonomial(a), mBasis.leadMonomial(b), lcmAB));
- ASSERT(mEliminated.columnCount() == mBasis.size());
+ MATHICGB_ASSERT(mEliminated.columnCount() == mBasis.size());
class Criterion : public DivisorLookup::EntryOutput {
public:
@@ -200,9 +200,9 @@ bool SPairs::simpleBuchbergerLcmCriterion
mAlmostApplies(false) {}
virtual bool proceed(size_t index) {
- ASSERT(index < mBasis.size());
- ASSERT(!applies()); // should have stopped search in this case
- ASSERT(mRing.monomialIsDivisibleBy(mLcmAB, mBasis.leadMonomial(index)));
+ MATHICGB_ASSERT(index < mBasis.size());
+ MATHICGB_ASSERT(!applies()); // should have stopped search in this case
+ MATHICGB_ASSERT(mRing.monomialIsDivisibleBy(mLcmAB, mBasis.leadMonomial(index)));
if (index == mA || index == mB)
return true;
mAlmostApplies = true;
@@ -289,12 +289,12 @@ bool SPairs::simpleBuchbergerLcmCriterion
++mStats.buchbergerLcmCacheHits;
}
else {
- ASSERT(!criterion.applies());
+ MATHICGB_ASSERT(!criterion.applies());
mBasis.divisorLookup().divisors(criterion.lcmAB(), criterion);
applies = criterion.applies();
if (mUseBuchbergerLcmHitCache && applies) {
- ASSERT(criterion.hit() < mBasis.size());
+ MATHICGB_ASSERT(criterion.hit() < mBasis.size());
mBuchbergerLcmHitCache[a] = criterion.hit();
mBuchbergerLcmHitCache[b] = criterion.hit();
}
@@ -311,17 +311,17 @@ bool SPairs::simpleBuchbergerLcmCriterion
++mStats.buchbergerLcmSimpleHits;
}
- ASSERT(applies == simpleBuchbergerLcmCriterionSlow(a, b));
+ MATHICGB_ASSERT(applies == simpleBuchbergerLcmCriterionSlow(a, b));
return applies;
}
bool SPairs::simpleBuchbergerLcmCriterionSlow(size_t a, size_t b) const {
- ASSERT(a < mBasis.size());
- ASSERT(b < mBasis.size());
- ASSERT(a != b);
- ASSERT(!mBasis.retired(a));
- ASSERT(!mBasis.retired(b));
- ASSERT(mEliminated.columnCount() == mBasis.size());
+ MATHICGB_ASSERT(a < mBasis.size());
+ MATHICGB_ASSERT(b < mBasis.size());
+ MATHICGB_ASSERT(a != b);
+ MATHICGB_ASSERT(!mBasis.retired(a));
+ MATHICGB_ASSERT(!mBasis.retired(b));
+ MATHICGB_ASSERT(mEliminated.columnCount() == mBasis.size());
// todo: use iterators
monomial lcmAB = mRing.allocMonomial();
@@ -360,15 +360,15 @@ bool SPairs::simpleBuchbergerLcmCriterionSlow(size_t a, size_t b) const {
bool SPairs::advancedBuchbergerLcmCriterion
(size_t a, size_t b, const_monomial lcmAB) const
{
- ASSERT(a != b);
- ASSERT(mEliminated.columnCount() == mBasis.size());
- ASSERT(mRing.monomialIsLeastCommonMultipleNoWeights
+ MATHICGB_ASSERT(a != b);
+ MATHICGB_ASSERT(mEliminated.columnCount() == mBasis.size());
+ MATHICGB_ASSERT(mRing.monomialIsLeastCommonMultipleNoWeights
(mBasis.leadMonomial(a), mBasis.leadMonomial(b), lcmAB));
mStats.late = true;
if (simpleBuchbergerLcmCriterion(a, b, lcmAB)) {
mStats.late = false;
- ASSERT(advancedBuchbergerLcmCriterionSlow(a, b));
+ MATHICGB_ASSERT(advancedBuchbergerLcmCriterionSlow(a, b));
return true;
}
mStats.late = false;
@@ -397,7 +397,7 @@ bool SPairs::advancedBuchbergerLcmCriterion
if (graph.size() <= 3) {
// For the graph approach to be better than the simpler approach of
// considering triples, there has to be more than 3 nodes in the graph.
- ASSERT(!advancedBuchbergerLcmCriterionSlow(a, b));
+ MATHICGB_ASSERT(!advancedBuchbergerLcmCriterionSlow(a, b));
return false;
}
@@ -422,7 +422,7 @@ bool SPairs::advancedBuchbergerLcmCriterion
while (!applies && !todo.empty()) {
size_t const currentIndex = todo.back()->first;
Connection const currentConnect = todo.back()->second;
- ASSERT(currentConnect != NotConnected);
+ MATHICGB_ASSERT(currentConnect != NotConnected);
todo.pop_back();
// loop through all potential edges (currentIndex, otherIndex)
@@ -432,7 +432,7 @@ bool SPairs::advancedBuchbergerLcmCriterion
if (currentConnect == otherConnect)
continue;
size_t const otherIndex = other->first;
- ASSERT(otherIndex != currentIndex);
+ MATHICGB_ASSERT(otherIndex != currentIndex);
const_monomial const otherLead = mBasis.leadMonomial(otherIndex);
// Note that
@@ -451,7 +451,7 @@ bool SPairs::advancedBuchbergerLcmCriterion
} else {
// At this point we have found an edge between a node connected to
// a and a node connected to b. So a and b are connected.
- ASSERT(currentConnect != otherConnect);
+ MATHICGB_ASSERT(currentConnect != otherConnect);
applies = true;
break;
}
@@ -464,13 +464,13 @@ bool SPairs::advancedBuchbergerLcmCriterion
// if (graph.size() >= 10)
// std::cout << "[adv size=" << graph.size() << " result= " << applies << std::endl;
- ASSERT(applies == advancedBuchbergerLcmCriterionSlow(a, b));
+ MATHICGB_ASSERT(applies == advancedBuchbergerLcmCriterionSlow(a, b));
return applies;
}
bool SPairs::advancedBuchbergerLcmCriterionSlow(size_t a, size_t b) const {
- ASSERT(a != b);
- ASSERT(mEliminated.columnCount() == mBasis.size());
+ MATHICGB_ASSERT(a != b);
+ MATHICGB_ASSERT(mEliminated.columnCount() == mBasis.size());
monomial lcmAB = mRing.allocMonomial();
monomial lcm = mRing.allocMonomial();
@@ -505,17 +505,17 @@ bool SPairs::advancedBuchbergerLcmCriterionSlow(size_t a, size_t b) const {
// since then a and b are connected so that the criterion applies.
bool applies = false;
while (!applies && !todo.empty()) {
- ASSERT(todo.size() <= graph.size());
+ MATHICGB_ASSERT(todo.size() <= graph.size());
std::pair<size_t, Connection> const node = graph[todo.back()];
todo.pop_back();
- ASSERT(node.second != NotConnected);
+ MATHICGB_ASSERT(node.second != NotConnected);
// loop through all potential edges (node.first, i)
const_monomial leadNode = mBasis.leadMonomial(node.first);
for (size_t i = 0; i < graph.size(); ++i) {
if (node.second == graph[i].second)
continue;
- ASSERT(graph[i].first != node.first);
+ MATHICGB_ASSERT(graph[i].first != node.first);
size_t const other = graph[i].first;
const_monomial const leadOther = mBasis.leadMonomial(other);
@@ -529,7 +529,7 @@ bool SPairs::advancedBuchbergerLcmCriterionSlow(size_t a, size_t b) const {
} else {
// At this point we have found an edge between something a node to
// a and a node connected to b. So a and b are connected.
- ASSERT(graph[i].second != node.second);
+ MATHICGB_ASSERT(graph[i].second != node.second);
applies = true;
break;
}
@@ -538,7 +538,7 @@ bool SPairs::advancedBuchbergerLcmCriterionSlow(size_t a, size_t b) const {
mRing.freeMonomial(lcmAB);
mRing.freeMonomial(lcm);
- ASSERT(applies || !simpleBuchbergerLcmCriterionSlow(a, b));
+ MATHICGB_ASSERT(applies || !simpleBuchbergerLcmCriterionSlow(a, b));
return applies;
}
@@ -557,10 +557,10 @@ bool SPairs::ClassicPairTriangle::calculateOrderBy(
size_t b,
monomial orderBy
) const {
- ASSERT(!orderBy.isNull());
- ASSERT(a != b);
- ASSERT(a < mBasis.size());
- ASSERT(b < mBasis.size());
+ MATHICGB_ASSERT(!orderBy.isNull());
+ MATHICGB_ASSERT(a != b);
+ MATHICGB_ASSERT(a < mBasis.size());
+ MATHICGB_ASSERT(b < mBasis.size());
if (mBasis.retired(a) || mBasis.retired(b))
return false;
const_monomial const leadA = mBasis.leadMonomial(a);
diff --git a/src/mathicgb/SigSPairs.cpp b/src/mathicgb/SigSPairs.cpp
index 0c9eb44..ba437ba 100755
--- a/src/mathicgb/SigSPairs.cpp
+++ b/src/mathicgb/SigSPairs.cpp
@@ -35,11 +35,11 @@ SigSPairs::SigSPairs(
SigSPairs::~SigSPairs()
{
- ASSERT(mUseBaseDivisors || mUseHighBaseDivisors || mKnownSyzygyTri.empty());
+ MATHICGB_ASSERT(mUseBaseDivisors || mUseHighBaseDivisors || mKnownSyzygyTri.empty());
}
void SigSPairs::newSyzygy(const_monomial sig) {
- ASSERT(Hsyz->member(sig));
+ MATHICGB_ASSERT(Hsyz->member(sig));
}
SigSPairs::Stats SigSPairs::getStats() const
@@ -60,12 +60,12 @@ monomial SigSPairs::popSignature(PairContainer& pairs) {
void SigSPairs::newPairs(size_t newGen)
{
- ASSERT(mIndexSigs.empty());
+ MATHICGB_ASSERT(mIndexSigs.empty());
makePreSPairs(newGen);
mQueue->pushPairs(newGen, mIndexSigs);
mIndexSigs.clear();
- ASSERT((!mUseBaseDivisors && !mUseHighBaseDivisors) ||
+ MATHICGB_ASSERT((!mUseBaseDivisors && !mUseHighBaseDivisors) ||
mKnownSyzygyTri.columnCount() == newGen + 1);
}
@@ -80,8 +80,8 @@ void SigSPairs::setupBaseDivisors(
if (mUseBaseDivisors || mUseHighBaseDivisors)
divisors.reserve(MaxBaseDivisors + 1);
- ASSERT(mUseBaseDivisors || mUseHighBaseDivisors);
- ASSERT(mKnownSyzygyTri.columnCount() == newGenerator);
+ MATHICGB_ASSERT(mUseBaseDivisors || mUseHighBaseDivisors);
+ MATHICGB_ASSERT(mKnownSyzygyTri.columnCount() == newGenerator);
mKnownSyzygyTri.addColumn();
if (mUseHighBaseDivisors) {
@@ -104,7 +104,7 @@ void SigSPairs::setupBaseDivisors(
std::vector<size_t> divs;
GB->lowBaseDivisors(divs, MaxBaseDivisors, newGenerator);
- ASSERT(divs.size() <= MaxBaseDivisors);
+ MATHICGB_ASSERT(divs.size() <= MaxBaseDivisors);
divisors.resize(divs.size());
for (size_t i = 0; i < divisors.size(); ++i) {
@@ -136,15 +136,15 @@ void SigSPairs::setupBaseDivisors(
divisor1 = divisors.front();
if (divisors.size() == 2) {
divisor2 = divisors.back();
- ASSERT(GB->ratioCompare
+ MATHICGB_ASSERT(GB->ratioCompare
(divisor1.ratioLessThan, divisor2.ratioLessThan) != LT);
}
}
void SigSPairs::makePreSPairs(size_t newGen)
{
- ASSERT(mIndexSigs.empty());
- ASSERT(newGen < GB->size());
+ MATHICGB_ASSERT(mIndexSigs.empty());
+ MATHICGB_ASSERT(newGen < GB->size());
mStats.spairsConstructed += newGen;
monomial baseDivisorMonomial = 0;
@@ -188,7 +188,7 @@ void SigSPairs::makePreSPairs(size_t newGen)
highDivisorCmp != static_cast<size_t>(-1) &&
GB->ratioCompare(oldGen, highDivisorCmp) == GT &&
mKnownSyzygyTri.bitUnordered(oldGen, highDivisorCmp)) {
- ASSERT(oldGen != highDivisorCmp); // otherwise ratios should be equal
+ MATHICGB_ASSERT(oldGen != highDivisorCmp); // otherwise ratios should be equal
mKnownSyzygyTri.setBit(newGen, oldGen, true);
++mStats.highBaseDivisorHits;
// if DEBUG defined, get to the ASSERT below stating
@@ -230,7 +230,7 @@ void SigSPairs::makePreSPairs(size_t newGen)
if (cmp == GT)
R->monomialFindSignature(newLead, oldLead, newSig, pairSig);
else {
- ASSERT(cmp == LT);
+ MATHICGB_ASSERT(cmp == LT);
R->monomialFindSignature(oldLead, newLead, oldSig, pairSig);
}
@@ -249,12 +249,12 @@ void SigSPairs::makePreSPairs(size_t newGen)
mKnownSyzygyTri.setBit(newGen, oldGen, true);
continue;
}
- ASSERT((!mUseBaseDivisors && !mUseHighBaseDivisors)
+ MATHICGB_ASSERT((!mUseBaseDivisors && !mUseHighBaseDivisors)
|| !mKnownSyzygyTri.bit(newGen, oldGen));
if (!mPostponeKoszuls) {
// add koszul syzygy to Hsyz.
- ASSERT(cmp == GT || cmp == LT);
+ MATHICGB_ASSERT(cmp == GT || cmp == LT);
if (cmp == GT)
R->monomialMult(newSig, oldLead, hsyz);
else
@@ -269,7 +269,7 @@ void SigSPairs::makePreSPairs(size_t newGen)
}
if (mUseSingularCriterionEarly) {
- ASSERT(cmp == GT || cmp == LT);
+ MATHICGB_ASSERT(cmp == GT || cmp == LT);
size_t const givesSig = (cmp == GT ? newGen : oldGen);
if (GB->ratioCompare(GB->minimalLeadInSig(pairSig), givesSig) == GT &&
!R->monomialRelativelyPrime(newLead, oldLead)) {
@@ -302,9 +302,9 @@ void SigSPairs::setKnownSyzygies(std::vector<std::pair<size_t, size_t> >& pairs)
}
void SigSPairs::setKnownSyzygy(size_t gen1, size_t gen2) {
- ASSERT(gen1 < GB->size());
- ASSERT(gen2 < GB->size());
- ASSERT(gen1 != gen2);
+ MATHICGB_ASSERT(gen1 < GB->size());
+ MATHICGB_ASSERT(gen2 < GB->size());
+ MATHICGB_ASSERT(gen1 != gen2);
if (mUseBaseDivisors || mUseHighBaseDivisors)
mKnownSyzygyTri.setBitUnordered(gen1, gen2, true);
}
diff --git a/src/mathicgb/SignatureGB.cpp b/src/mathicgb/SignatureGB.cpp
index ad87aa2..a4ee36d 100755
--- a/src/mathicgb/SignatureGB.cpp
+++ b/src/mathicgb/SignatureGB.cpp
@@ -124,11 +124,11 @@ SignatureGB::~SignatureGB() {}
bool SignatureGB::processSPair
(monomial sig, const SigSPairs::PairContainer& pairs)
{
- ASSERT(!pairs.empty());
+ MATHICGB_ASSERT(!pairs.empty());
// the module term to reduce is multiple * GB->getSignature(gen)
size_t gen = GB->minimalLeadInSig(sig);
- ASSERT(gen != static_cast<size_t>(-1));
+ MATHICGB_ASSERT(gen != static_cast<size_t>(-1));
monomial multiple = R->allocMonomial();
R->monomialDivide(sig, GB->getSignature(gen), multiple);
GB->basis().usedAsStart(gen);
@@ -139,13 +139,13 @@ bool SignatureGB::processSPair
R->freeMonomial(multiple);
if (f == 0) { // singular reduction
- ASSERT(f == 0);
+ MATHICGB_ASSERT(f == 0);
if (tracingLevel >= 7)
std::cerr << "singular reduction" << std::endl;
R->freeMonomial(sig);
return true;
}
- ASSERT(f != 0);
+ MATHICGB_ASSERT(f != 0);
if (f->isZero()) { // reduction to zero
if (tracingLevel >= 7)
@@ -158,7 +158,7 @@ bool SignatureGB::processSPair
}
// new basis element
- ASSERT(!GB->isSingularTopReducible(*f, sig));
+ MATHICGB_ASSERT(!GB->isSingularTopReducible(*f, sig));
{
std::unique_ptr<Poly> autoF(f);
GB->insert(sig, std::move(autoF));
@@ -245,7 +245,7 @@ bool SignatureGB::step()
for (iter it = mSpairTmp.begin(); it != mSpairTmp.end(); ++it) {
const_monomial a = GB->getLeadMonomial(it->first);
const_monomial b = GB->getLeadMonomial(it->second);
- ASSERT(!R->monomialRelativelyPrime(a, b));
+ MATHICGB_ASSERT(!R->monomialRelativelyPrime(a, b));
}
#endif
diff --git a/src/mathicgb/TypicalReducer.cpp b/src/mathicgb/TypicalReducer.cpp
index 4138218..9053949 100755
--- a/src/mathicgb/TypicalReducer.cpp
+++ b/src/mathicgb/TypicalReducer.cpp
@@ -41,7 +41,7 @@ Poly* TypicalReducer::regularReduce(
ring.coefficientSet(coef, 1);
insertTail(const_term(coef, multiple), &basis.poly(basisElement));
- ASSERT(ring.coefficientIsOne(basis.getLeadCoefficient(reducer)));
+ MATHICGB_ASSERT(ring.coefficientIsOne(basis.getLeadCoefficient(reducer)));
ring.coefficientFromInt(coef, -1);
insertTail(const_term(coef, u), &basis.poly(reducer));
basis.basis().usedAsReducer(reducer);
@@ -50,7 +50,7 @@ Poly* TypicalReducer::regularReduce(
unsigned long long steps = 2; // number of steps in this reduction
for (const_term v; leadTerm(v); ++steps) {
- ASSERT(v.coeff != 0);
+ MATHICGB_ASSERT(v.coeff != 0);
reducer = basis.regularReducer(sig, v.monom);
if (reducer == static_cast<size_t>(-1)) { // no reducer found
result->appendTerm(v.coeff, v.monom);
@@ -85,8 +85,8 @@ std::unique_ptr<Poly> TypicalReducer::classicReduce(const Poly& poly, const Poly
}
std::unique_ptr<Poly> TypicalReducer::classicTailReduce(const Poly& poly, const PolyBasis& basis) {
- ASSERT(&poly.ring() == &basis.ring());
- ASSERT(!poly.isZero());
+ MATHICGB_ASSERT(&poly.ring() == &basis.ring());
+ MATHICGB_ASSERT(!poly.isZero());
term identity;
identity.monom = basis.ring().allocMonomial(mArena);
basis.ring().monomialSetIdentity(identity.monom);
@@ -165,7 +165,7 @@ void TypicalReducer::setMemoryQuantum(size_t quantum) {
std::unique_ptr<Poly> TypicalReducer::classicReduce
(std::unique_ptr<Poly> result, const PolyBasis& basis) {
const PolyRing& ring = basis.ring();
- ASSERT(&result->ring() == &ring);
+ MATHICGB_ASSERT(&result->ring() == &ring);
++mClassicStats.reductions;
if (tracingLevel > 100)
@@ -182,7 +182,7 @@ std::unique_ptr<Poly> TypicalReducer::classicReduce
size_t reducer = basis.divisor(v.monom);
if (reducer == static_cast<size_t>(-1)) { // no reducer found
- ASSERT(result->isZero() ||
+ MATHICGB_ASSERT(result->isZero() ||
basis.order().signatureCompare(v.monom, result->backMonomial()) == LT);
result->appendTerm(v.coeff, v.monom);
removeLeadTerm();
diff --git a/src/mathicgb/stdinc.h b/src/mathicgb/stdinc.h
index ef087a6..25d2f27 100755
--- a/src/mathicgb/stdinc.h
+++ b/src/mathicgb/stdinc.h
@@ -105,9 +105,6 @@
#define MATHICGB_ASSERT_NO_ASSUME(X)
#define MATHICGB_IF_DEBUG(X)
#endif
-// todo: eventually move all ASSERTs to MATHICGB_ASSERTs and then remove
-// ASSERT.
-#define ASSERT(X) MATHICGB_ASSERT(X)
#ifdef MATHICGB_SLOW_DEBUG
// for asserts that take a long time.
--
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