[mathicgb] 18/393: Added support for MATHICGB_SLOW_DEBUG and MATHICGB_SLOW_ASSERT to disable the very slowest asserts for a standard build with asserts. make check is now much faster.

Doug Torrance dtorrance-guest at moszumanska.debian.org
Fri Apr 3 15:58:24 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 14c72423edbf133317c2eaa5cea521c488bc0352
Author: Bjarke Hammersholt Roune <bjarkehr.code at gmail.com>
Date:   Tue Aug 7 07:18:10 2012 -0400

    Added support for MATHICGB_SLOW_DEBUG and MATHICGB_SLOW_ASSERT to disable the very slowest asserts for a standard build with asserts. make check is now much faster.
---
 src/mathicgb/GroebnerBasis.cpp | 11 ++++++-----
 src/mathicgb/PolyBasis.hpp     |  2 +-
 src/mathicgb/PolyHashTable.cpp |  4 ++--
 src/mathicgb/stdinc.h          |  7 +++++++
 4 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/src/mathicgb/GroebnerBasis.cpp b/src/mathicgb/GroebnerBasis.cpp
old mode 100644
new mode 100755
index aa7e012..2b0d3d0
--- a/src/mathicgb/GroebnerBasis.cpp
+++ b/src/mathicgb/GroebnerBasis.cpp
@@ -165,16 +165,17 @@ size_t GroebnerBasis::regularReducer(
   const_monomial term
 ) const {
   size_t reducer = divisorLookup().regularReducer(sig, term);
-#ifdef DEBUG
+#ifdef MATHICGB_SLOW_DEBUG
   const size_t debugValue = regularReducerSlow(sig, term);
   if (reducer == static_cast<size_t>(-1)) {
-    ASSERT(debugValue == static_cast<size_t>(-1));
+    MATHICGB_SLOW_ASSERT(debugValue == static_cast<size_t>(-1));
   } else {
-    ASSERT(debugValue != static_cast<size_t>(-1));
+    MATHICGB_SLOW_ASSERT(debugValue != static_cast<size_t>(-1));
     monomial m = ring().allocMonomial();
-    ASSERT(ring().monomialDivide(term, getLeadMonomial(reducer), m));
+    MATHICGB_SLOW_ASSERT
+      (ring().monomialDivide(term, getLeadMonomial(reducer), m));
     ring().monomialMultTo(m, getSignature(reducer));
-    ASSERT(order().signatureCompare(sig, m) == GT);
+    MATHICGB_SLOW_ASSERT(order().signatureCompare(sig, m) == GT);
     ring().freeMonomial(m);
   }
 #endif
diff --git a/src/mathicgb/PolyBasis.hpp b/src/mathicgb/PolyBasis.hpp
old mode 100644
new mode 100755
index fc02c9b..5052835
--- a/src/mathicgb/PolyBasis.hpp
+++ b/src/mathicgb/PolyBasis.hpp
@@ -158,7 +158,7 @@ public:
   bool leadMinimal(size_t index) const {
     ASSERT(index < size());
     ASSERT(!retired(index));
-    ASSERT(mEntries[index].leadMinimal == leadMinimalSlow(index));
+    MATHICGB_SLOW_ASSERT(mEntries[index].leadMinimal == leadMinimalSlow(index));
     return mEntries[index].leadMinimal;
   }
 
diff --git a/src/mathicgb/PolyHashTable.cpp b/src/mathicgb/PolyHashTable.cpp
old mode 100644
new mode 100755
index cf0cc28..34cc696
--- a/src/mathicgb/PolyHashTable.cpp
+++ b/src/mathicgb/PolyHashTable.cpp
@@ -62,7 +62,7 @@ void PolyHashTable::reset()
   mNodeCount = 0;
   
   resetStats();
-  ASSERT(computeNodeCount() == 0);
+  MATHICGB_SLOW_ASSERT(computeNodeCount() == 0);
 }
 
 size_t PolyHashTable::computeNodeCount() const
@@ -199,7 +199,7 @@ bool PolyHashTable::lookup_and_insert(const_monomial m, coefficient val, node *&
   if (mNodeCount > mMaxCountBeforeRebuild)
     resize(mLogTableSize + 2);  // increase by a factor of 4??
 
-  ASSERT(computeNodeCount() == mNodeCount);
+  MATHICGB_SLOW_ASSERT(computeNodeCount() == mNodeCount);
 
   return false;
 }
diff --git a/src/mathicgb/stdinc.h b/src/mathicgb/stdinc.h
index a30b48d..5c96fa8 100755
--- a/src/mathicgb/stdinc.h
+++ b/src/mathicgb/stdinc.h
@@ -54,5 +54,12 @@
 // ASSERT.
 #define MATHICGB_ASSERT(X) ASSERT(X)
 
+#ifdef MATHICGB_SLOW_DEBUG
+// for asserts that take a long time.
+#define MATHICGB_SLOW_ASSERT(X) MATHICGB_ASSERT(X)
+#else
+#define MATHICGB_SLOW_ASSERT(X)
+#endif
+
 static const size_t BitsPerByte = 8;
 static const size_t MemoryAlignment = sizeof(void*);

-- 
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