[mathicgb] 351/393: Moving towards replacing const_monomial entirely with the types on Monoid.

Doug Torrance dtorrance-guest at moszumanska.debian.org
Fri Apr 3 15:59:33 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 f79c1d832ef9f1e772f00a37ca48485df32b0b35
Author: Bjarke Hammersholt Roune <bjarkehr.code at gmail.com>
Date:   Mon Sep 2 13:56:08 2013 +0200

    Moving towards replacing const_monomial entirely with the types on Monoid.
---
 src/mathicgb/BjarkeGeobucket.hpp |  7 ++++---
 src/mathicgb/MonoMonoid.hpp      | 24 ++++++++++++++++++++++--
 src/mathicgb/PolyRing.hpp        | 27 ++++++++++++++++++++-------
 3 files changed, 46 insertions(+), 12 deletions(-)

diff --git a/src/mathicgb/BjarkeGeobucket.hpp b/src/mathicgb/BjarkeGeobucket.hpp
index 9fce567..9c46526 100755
--- a/src/mathicgb/BjarkeGeobucket.hpp
+++ b/src/mathicgb/BjarkeGeobucket.hpp
@@ -20,9 +20,10 @@ template<
 class GeoConfiguration {
 public:
   GeoConfiguration(
-                   const PolyRing *R0,
-                   size_t geoBase,
-                   size_t minBucketSize):
+    const PolyRing *R0,
+    size_t geoBase,
+    size_t minBucketSize
+  ):
     R(R0), geoBase(geoBase), minBucketSize(minBucketSize), _comparisons(0) {}
 
   const PolyRing *R;
diff --git a/src/mathicgb/MonoMonoid.hpp b/src/mathicgb/MonoMonoid.hpp
index 4594c35..62bfa45 100755
--- a/src/mathicgb/MonoMonoid.hpp
+++ b/src/mathicgb/MonoMonoid.hpp
@@ -1177,7 +1177,11 @@ public:
       return *this;
     }
 
-    ConstMonoRef operator*() const {return *this;}
+    ConstMonoRef operator*() const {return ConstMonoRef(*this);}
+
+    /// @todo: Get rid of this as soon as all code has been migrated
+    /// to observe the ptr/ref distinction. Kill it with fire!
+    operator ConstMonoRef() const {return ConstMonoRef(*this);}
 
     bool isNull() const {return mMono == 0;}
     void toNull() {mMono = 0;}
@@ -1201,7 +1205,11 @@ public:
       return *this;
     }
 
-    MonoRef operator*() const {return *this;}
+    MonoRef operator*() const {return MonoRef(*this);}
+
+    /// @todo: Get rid of this as soon as all code has been migrated
+    /// to observe the ptr/ref distinction. Kill it with fire!
+    operator MonoRef() const {return MonoRef(*this);}
 
     bool isNull() const {return mMono == 0;}
     void toNull() {mMono = 0;}
@@ -1266,6 +1274,10 @@ public:
 
     MonoPtr ptr() const {return mMono;}
 
+    /// @todo: Get rid of this as soon as all code has been migrated
+    /// to observe the ptr/ref distinction. Kill it with fire!
+    operator MonoPtr() const {return ptr();}
+
     operator MonoRef() const {
       MATHICGB_ASSERT(!isNull());
       return *mMono;
@@ -1286,6 +1298,10 @@ public:
 
     MonoPtr ptr() const {return mMono;}
 
+    /// @todo: Get rid of this as soon as all code has been migrated
+    /// to observe the ptr/ref distinction. Kill it with fire!
+    operator MonoPtr() const {return ptr();}
+
     operator ConstMonoRef() const {return *static_cast<ConstMonoPtr>(mMono);}
 
   private:
@@ -1307,6 +1323,10 @@ public:
 
     ConstMonoPtr ptr() const {return mMono;}
 
+    /// @todo: Get rid of this as soon as all code has been migrated
+    /// to observe the ptr/ref distinction. Kill it with fire!
+    operator ConstMonoPtr() const {return ptr();}
+
   private:
     void operator=(const MonoRef&); // not available
     friend class MonoMonoid;
diff --git a/src/mathicgb/PolyRing.hpp b/src/mathicgb/PolyRing.hpp
index aeee47d..237833b 100755
--- a/src/mathicgb/PolyRing.hpp
+++ b/src/mathicgb/PolyRing.hpp
@@ -97,6 +97,8 @@ typedef PrimeField<unsigned long> Field;
 typedef exponent* vecmonomial; // includes a component
 typedef coefficient const_coefficient;
 
+#define OLDMON
+#ifdef OLDMON
 class Monomial;
 
 class ConstMonomial
@@ -186,22 +188,29 @@ inline const Monomial& ConstMonomial::castAwayConst() const
 
 typedef Monomial monomial;
 typedef ConstMonomial const_monomial;
+#else
+typedef MonoMonoid<exponent>::MonoPtr monomial;
+typedef MonoMonoid<exponent>::MonoPtr Monomial;
+typedef MonoMonoid<exponent>::ConstMonoPtr const_monomial;
+typedef MonoMonoid<exponent>::ConstMonoPtr ConstMonomial;
+#endif
 
 struct const_term {
-  const_coefficient coeff;
-  const_monomial monom; // includes component
-
   const_term() {}
   const_term(const_coefficient c, const_monomial m) : coeff(c), monom(m) {}
+
+  const_coefficient coeff;
+  const_monomial monom;
 };
 
 struct term {
-  coefficient coeff;
-  monomial monom; // includes component
-  operator const_term() const {return const_term(coeff, monom);}
-
   term() {}
   term(coefficient c, monomial m) : coeff(c), monom(m) {}
+
+  coefficient coeff;
+  monomial monom;
+
+  operator const_term() const {return const_term(coeff, monom);}
 };
 
 class PolyRing {
@@ -209,6 +218,10 @@ public:
   typedef MonoMonoid<exponent> Monoid;
   typedef PrimeField<unsigned long> Field;
 
+  /// @todo: make this dependent on the monoid and field once all code
+  /// has been migrated from ::term to PolyRing::Term.
+  typedef mgb::term Term;
+
   PolyRing(
     coefficient charac,
     int nvars,

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