[mathicgb] 219/393: Slight performance improvement to MonoMonoid::lcm and (temporary) ability to do MonoMonoid::lcmRaw.

Doug Torrance dtorrance-guest at moszumanska.debian.org
Fri Apr 3 15:59:05 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 f4bec2c16d0994d0cf9564d14df5a43986ecc185
Author: Bjarke Hammersholt Roune <bjarkehr.code at gmail.com>
Date:   Wed Apr 3 16:22:22 2013 +0200

    Slight performance improvement to MonoMonoid::lcm and (temporary) ability to do MonoMonoid::lcmRaw.
---
 src/mathicgb/MonoMonoid.hpp | 14 ++++++++++++++
 src/mathicgb/PolyRing.hpp   |  2 +-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/src/mathicgb/MonoMonoid.hpp b/src/mathicgb/MonoMonoid.hpp
index 949be65..bee8dd4 100755
--- a/src/mathicgb/MonoMonoid.hpp
+++ b/src/mathicgb/MonoMonoid.hpp
@@ -532,6 +532,20 @@ public:
     MATHICGB_ASSERT(debugValid(lcmAB));
   }
 
+  /// todo: get rid of this
+  void lcmRaw(ConstMonoRef a, ConstMonoRef b, MonoRef lcmAB) const {
+    MATHICGB_ASSERT(component(a) == component(b));
+
+    // Loop also sets component.
+    access(lcmAB, componentIndex()) = 0;
+    for (auto i = exponentsIndexBegin(); i != exponentsIndexEnd(); ++i)
+      access(lcmAB, i) = std::max(access(a, i), access(b, i));
+    //setOrderData(lcmAB);
+    //setHash(lcmAB);
+
+    MATHICGB_ASSERT(debugValid(lcmAB));
+  }
+
   /// Parses a monomial out of a string. Valid examples: 1 abc a2bc
   /// aA. Variable names are case sensitive. Whitespace terminates the
   /// parse as does any other character that is not a letter or a
diff --git a/src/mathicgb/PolyRing.hpp b/src/mathicgb/PolyRing.hpp
index 2036f0c..550e64d 100755
--- a/src/mathicgb/PolyRing.hpp
+++ b/src/mathicgb/PolyRing.hpp
@@ -981,7 +981,7 @@ inline void PolyRing::monomialLeastCommonMultipleNoWeights(
   Monomial& l) const
 {
 #ifdef MATHICGB_USE_MONOID
-  monoid().lcm(a, b, l);
+  monoid().lcmRaw(a, b, l);
 #else
   *l = 0;
   for (size_t i = 1; i <= mNumVars; ++i)

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