[mathicgb] 370/393: Moving S-pair handling to using MonoMonoid.

Doug Torrance dtorrance-guest at moszumanska.debian.org
Fri Apr 3 15:59:36 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 cee466a03b4f6c6300452699812cda9607c2bda6
Author: Bjarke Hammersholt Roune <bjarkehr.code at gmail.com>
Date:   Tue Sep 17 17:20:25 2013 +0200

    Moving S-pair handling to using MonoMonoid.
---
 src/mathicgb/MonoLookup.cpp    |  4 ++--
 src/mathicgb/SPairs.cpp        | 31 +++++++++++++++++--------------
 src/mathicgb/SigSPairQueue.hpp |  2 +-
 src/mathicgb/SigSPairs.cpp     |  4 ----
 src/mathicgb/SigSPairs.hpp     |  3 ---
 src/mathicgb/SignatureGB.cpp   |  3 ---
 6 files changed, 20 insertions(+), 27 deletions(-)

diff --git a/src/mathicgb/MonoLookup.cpp b/src/mathicgb/MonoLookup.cpp
index 47c17df..51aa4e6 100755
--- a/src/mathicgb/MonoLookup.cpp
+++ b/src/mathicgb/MonoLookup.cpp
@@ -38,7 +38,7 @@ namespace {
       if (mBasis == &basis)
         return;
       MATHICGB_ASSERT(mBasis == 0);
-      MATHICGB_ASSERT(monoid() == basis.ring().monoid());
+      MATHICGB_ASSERT(&monoid() == &basis.ring().monoid());
       mBasis = &basis;
     }
 
@@ -47,7 +47,7 @@ namespace {
         return;
       MATHICGB_ASSERT(mSigBasis == 0);
       MATHICGB_ASSERT(mBasis == 0 || mBasis == &sigBasis.basis());
-      MATHICGB_ASSERT(monoid() == sigBasis.basis().ring().monoid());
+      MATHICGB_ASSERT(&monoid() == &sigBasis.basis().ring().monoid());
       mSigBasis = &sigBasis;
       setBasis(sigBasis.basis());
     }
diff --git a/src/mathicgb/SPairs.cpp b/src/mathicgb/SPairs.cpp
index 57e2a41..25f38ea 100755
--- a/src/mathicgb/SPairs.cpp
+++ b/src/mathicgb/SPairs.cpp
@@ -217,7 +217,6 @@ void SPairs::addPairs(size_t newGen) {
     mEliminated.addColumn();
   }
 
-
   if (newGen == std::numeric_limits<Queue::Index>::max())
     throw std::overflow_error
       ("Too large basis element index in constructing S-pairs.");
@@ -228,12 +227,12 @@ void SPairs::addPairs(size_t newGen) {
   prePairMonos.reserve(newGen);
   prePairs.reserve(newGen);
 
-  ConstMonoRef newLead = mBasis.leadMonomial(newGen);
+  auto newLead = mBasis.leadMonomial(newGen);
   auto lcm = mBareMonoid.alloc();
   for (size_t oldGen = 0; oldGen < newGen; ++oldGen) {
     if (mBasis.retired(oldGen))
       continue;
-    ConstMonoRef oldLead = mBasis.leadMonomial(oldGen);
+    auto oldLead = mBasis.leadMonomial(oldGen);
     if (monoid().relativelyPrime(newLead, oldLead)) {
       ++mStats.relativelyPrimeHits;
       mEliminated.setBit(newGen, oldGen, true);
@@ -310,16 +309,20 @@ bool SPairs::simpleBuchbergerLcmCriterion(
       // exists i such that b[i] > a[i] && b[i] > c[i] <=>
       // exists i such that b[i] > max(a[i], c[i]) <=>
       // b does not divide lcm(a[i], c[i])
-      const_monomial leadA = mBasis.leadMonomial(mA);
-      const_monomial leadB = mBasis.leadMonomial(mB);
-      const_monomial leadC = mBasis.leadMonomial(index);
-      if (!mSPairs.eliminated(index, mA) &&
-          mMonoid.dividesLcm(leadB, leadC, leadA))
+      auto leadA = mBasis.leadMonomial(mA);
+      auto leadB = mBasis.leadMonomial(mB);
+      auto leadC = mBasis.leadMonomial(index);
+      if (
+        !mSPairs.eliminated(index, mA) &&
+        mMonoid.dividesLcm(leadB, leadC, leadA)
+      )
         return true; // we had lcm(a,index) == lcm(a,b)
 
       // check lcm(b,index) != lcm(a,b)
-      if (!mSPairs.eliminated(index, mB) &&
-          mMonoid.dividesLcm(leadA, leadC, leadB))
+      if (
+        !mSPairs.eliminated(index, mB) &&
+        mMonoid.dividesLcm(leadA, leadC, leadB)
+      )
         return true;  // we had lcm(b,index) == lcm(a,b)
 
       mHit = index;
@@ -545,7 +548,7 @@ bool SPairs::advancedBuchbergerLcmCriterion(
     todo.pop_back();
 
     // loop through all potential edges (currentIndex, otherIndex)
-    const_monomial const currentLead = mBasis.leadMonomial(currentIndex);
+    auto currentLead = mBasis.leadMonomial(currentIndex);
     for (Graph::iterator other = graph.begin(); other != graphEnd; ++other) {
       Connection const otherConnect = other->second;
       if (currentConnect == otherConnect)
@@ -553,7 +556,7 @@ bool SPairs::advancedBuchbergerLcmCriterion(
       size_t const otherIndex = other->first;
       MATHICGB_ASSERT(otherIndex != currentIndex);
 
-      const_monomial const otherLead = mBasis.leadMonomial(otherIndex);
+      auto const otherLead = mBasis.leadMonomial(otherIndex);
       // Note that
       //  lcm(c,d) != lcmAB <=>
       //  exists i such that max(c[i], d[i]) < lcmAB[i] <=>
@@ -637,9 +640,9 @@ bool SPairs::advancedBuchbergerLcmCriterionSlow(size_t a, size_t b) const {
       if (node.second == graph[i].second)
         continue;
       MATHICGB_ASSERT(graph[i].first != node.first);
-      size_t const other = graph[i].first;
+      const size_t other = graph[i].first;
 
-      const_monomial const leadOther = mBasis.leadMonomial(other);
+      auto const leadOther = mBasis.leadMonomial(other);
       monoid().lcm(leadNode, leadOther, lcm);
       if (!eliminated(node.first, other) && monoid().equal(*lcm, *lcmAB))
         continue; // not an edge in G
diff --git a/src/mathicgb/SigSPairQueue.hpp b/src/mathicgb/SigSPairQueue.hpp
index 651ce8b..976f061 100755
--- a/src/mathicgb/SigSPairQueue.hpp
+++ b/src/mathicgb/SigSPairQueue.hpp
@@ -52,7 +52,7 @@ public:
   // added to the queue. sig must be the signature of the S-pair
   // (pairWith, x).
   //
-  // ATTENTION: the class to pushPairs must have pairWith in the
+  // ATTENTION: the calls to pushPairs must have pairWith in the
   // sequence 0, 1, 2, 3 and so on. It follows from this that the
   // queue can figure out what pairWith is without being told. Thus
   // the purpose of pairWith is to make it possible to make an
diff --git a/src/mathicgb/SigSPairs.cpp b/src/mathicgb/SigSPairs.cpp
index 253dc83..c9a3060 100755
--- a/src/mathicgb/SigSPairs.cpp
+++ b/src/mathicgb/SigSPairs.cpp
@@ -38,10 +38,6 @@ SigSPairs::~SigSPairs()
   MATHICGB_ASSERT(mUseBaseDivisors || mUseHighBaseDivisors || mKnownSyzygyTri.empty());
 }
 
-void SigSPairs::newSyzygy(const_monomial sig) {
-  MATHICGB_ASSERT(Hsyz->member(sig));
-}
-
 auto SigSPairs::popSignature(PairContainer& pairs) -> Mono {
   auto sig = mQueue->popSignature(pairs);
   if (!sig.isNull()) {
diff --git a/src/mathicgb/SigSPairs.hpp b/src/mathicgb/SigSPairs.hpp
index 6fd5bfb..66b530b 100755
--- a/src/mathicgb/SigSPairs.hpp
+++ b/src/mathicgb/SigSPairs.hpp
@@ -46,9 +46,6 @@ public:
   // fills in all the S-pairs with i.
   void newPairs(size_t i);
 
-  // Inform the S-pair handler that there is a new syzygy signature in play.
-  void newSyzygy(const_monomial sig);
-
   struct Stats {
     unsigned long long spairsConstructed; // all spairs
     unsigned long long spairsFinal; // spairs given to client
diff --git a/src/mathicgb/SignatureGB.cpp b/src/mathicgb/SignatureGB.cpp
index 9cf1f2a..7b11eea 100755
--- a/src/mathicgb/SignatureGB.cpp
+++ b/src/mathicgb/SignatureGB.cpp
@@ -170,7 +170,6 @@ bool SignatureGB::processSPair
     // todo: what are the correct ownership relations here?
     auto ptr = sig.release();
     Hsyz->insert(*ptr);
-    SP->newSyzygy(Monoid::toOld(*ptr));
     SP->setKnownSyzygies(mSpairTmp);
     MATHICGB_LOG(SigSPairFinal) << "   s-reduced to zero.\n";
     return false;
@@ -224,7 +223,6 @@ bool SignatureGB::step() {
     // todo: what are the correct ownership relations here?
     auto ptr = sig.release();
     Hsyz->insert(*ptr);
-    SP->newSyzygy(Monoid::toOld(*ptr));
     SP->setKnownSyzygies(mSpairTmp);
     MATHICGB_LOG(SigSPairFinal) << "   eliminated by Koszul criterion.\n";
     return true;
@@ -240,7 +238,6 @@ bool SignatureGB::step() {
         // todo: what are the correct ownership relations here?
         auto ptr = sig.release();
         Hsyz->insert(*ptr);
-        SP->newSyzygy(Monoid::toOld(*ptr));
         SP->setKnownSyzygies(mSpairTmp);
         MATHICGB_LOG(SigSPairFinal) <<
           "   eliminated by relatively prime criterion.\n";

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