[mathicgb] 303/393: Added support for specifying (rev)component for after base ordering. Used this to move all component/revcomponent distinction out of the order number.

Doug Torrance dtorrance-guest at moszumanska.debian.org
Fri Apr 3 15:59:26 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 30e7797256a05c4517acb2b88ea918a9c7fc140e
Author: Bjarke Hammersholt Roune <bjarkehr.code at gmail.com>
Date:   Mon Apr 29 21:25:09 2013 +0200

    Added support for specifying (rev)component for after base ordering. Used this to move all component/revcomponent distinction out of the order number.
---
 src/mathicgb/FreeModuleOrder.cpp |  28 +----------
 src/mathicgb/MonoMonoid.hpp      |  27 ++++++++++
 src/test/gb-test.cpp             |  28 +++++------
 src/test/ideals.cpp              | 103 +++++++++++++++++++++++++--------------
 src/test/ideals.hpp              |  13 +++--
 5 files changed, 115 insertions(+), 84 deletions(-)

diff --git a/src/mathicgb/FreeModuleOrder.cpp b/src/mathicgb/FreeModuleOrder.cpp
index 431407b..9999f36 100755
--- a/src/mathicgb/FreeModuleOrder.cpp
+++ b/src/mathicgb/FreeModuleOrder.cpp
@@ -338,36 +338,12 @@ void FreeModuleOrder::displayOrderTypes(std::ostream &o)
   o << "  4   SchreyerGrevLexUp" << std::endl; // done
   o << "  5   SchreyerGrevLexDown" << std::endl; // done
   o << "  6   IndexUp SchreyerGrevLex" << std::endl; // done
-  o << "  7   IndexDown SchreyerGrevLex" << std::endl;
+  o << "  7   IndexDown SchreyerGrevLex" << std::endl; // done
 }
 
 std::unique_ptr<FreeModuleOrder> FreeModuleOrder::makeOrder(FreeModuleOrderType type, const PolyRing& ring)
 {
-  if (type == 0)
-    type = 1;  // Set the default
-
-  switch (type) {
-  case 4:
-  case 5:
-  case 1:
-  case 6:
-  case 7:
-    return make_unique<ConcreteOrder<OrderA>>(ring);
-
-  case 2:
-  case 3:
-   return make_unique<ConcreteOrder<OrderC>>(ring);
-
-  default: break;
-  }
-
-  std::cerr << "unknown free module order type" << std::endl;
-  std::cerr << "possible orders are: " << std::endl;
-  for (size_t i = 1; i <= 7; ++i) {
-    auto order = makeOrder(static_cast<FreeModuleOrderType>(i), ring);
-    std::cerr << "  " << i << ": " << order->description() << std::endl;
-  }
-  exit(1);
+  return make_unique<ConcreteOrder<OrderA>>(ring);
 }
 
 // Local Variables:
diff --git a/src/mathicgb/MonoMonoid.hpp b/src/mathicgb/MonoMonoid.hpp
index 6451e3a..0e891a9 100755
--- a/src/mathicgb/MonoMonoid.hpp
+++ b/src/mathicgb/MonoMonoid.hpp
@@ -1778,6 +1778,7 @@ auto MonoMonoid<E, HC, SH, SO>::readMonoid(std::istream& in) ->
     if (!std::isdigit(c)) {
       std::string str;
       in >> str;
+    
       if (str == "component")
         componentsAscendingDesired = true;
       else if (str == "revcomponent")
@@ -1802,6 +1803,32 @@ auto MonoMonoid<E, HC, SH, SO>::readMonoid(std::istream& in) ->
   }
   MATHICGB_ASSERT(w == gradings.size());
 
+  in >> c;
+  in.unget();
+  if (c == '_') {
+    in >> str;
+
+    if (str == "_revlex")
+      lexBaseOrder = false;
+    else if (str == "_lex")
+      lexBaseOrder = true;
+    else
+      mathic::reportError("Expected _lex or _revlex but read \"" + str + "\".");
+
+    in >> c;
+    in.unget();
+    if (!std::isdigit(c)) {
+      in >> str;
+      if (str == "component")
+        componentsAscendingDesired = true;
+      else if (str == "revcomponent")
+        componentsAscendingDesired = false;
+      else
+        mathic::reportError
+          ("Expected component or revcomponent but read \"" + str + "\".");
+    }
+  }
+
   Order order(
     varCount,
     std::move(gradings),
diff --git a/src/test/gb-test.cpp b/src/test/gb-test.cpp
index 6160e85..e3c5810 100755
--- a/src/test/gb-test.cpp
+++ b/src/test/gb-test.cpp
@@ -292,13 +292,6 @@ spairQueue	reducerType	divLookup	monTable	buchberger	postponeKoszul	useBaseDivis
     auto tuple = Basis::parse(in);
     auto& I = std::get<1>(tuple);
 
-    auto typ = freeModuleOrder;
-    if (typ == 2 || typ == 4)
-      std::get<2>(tuple)->setComponentsAscendingDesired(true);
-    else if (typ == 0 || typ == 1 || typ == 3 || typ == 5)
-      std::get<2>(tuple)->setComponentsAscendingDesired(false);
-    // xxx
-
     MATHICGB_ASSERT
       (Reducer::makeReducerNullOnUnknown(red, I->ring()).get() != 0);
 
@@ -350,46 +343,49 @@ spairQueue	reducerType	divLookup	monTable	buchberger	postponeKoszul	useBaseDivis
 }
 
 TEST(GB, small) {
-  testGB(0, idealSmall, idealSmallBasis, idealSmallSyzygies, idealSmallInitial, 7);
+  testGB(1, smallIdealComponentLastDescending(),
+         idealSmallBasis, idealSmallSyzygies, idealSmallInitial, 7);
 }
 
 TEST(GB, liu_0_1) {
-  testGB(1, liu_ideal, liu_gb_strat0_free1,
+  testGB(1, liuIdealComponentLastDescending(), liu_gb_strat0_free1,
     liu_syzygies_strat0_free1, liu_initial_strat0_free1, 13);
 }
 
 TEST(GB, weispfennig97_0_4) {
-  testGB(4, weispfennig97_ideal, weispfennig97_gb_strat0_free4,
+  testGB(4, weispfennig97IdealComponentLast(true),
+         weispfennig97_gb_strat0_free4,
          weispfennig97_syzygies_strat0_free4, weispfennig97_initial_strat0_free4, 31);
 }
 
 TEST(GB, weispfennig97_0_5) {
-  testGB(5, weispfennig97_ideal, weispfennig97_gb_strat0_free5,
+  testGB(5, weispfennig97IdealComponentLast(false),
+         weispfennig97_gb_strat0_free5,
          weispfennig97_syzygies_strat0_free5, weispfennig97_initial_strat0_free5, 27);
 }
 
 TEST(GB, gerdt93_0_1) {
-  testGB(1, gerdt93Ideal(), gerdt93_gb_strat0_free1,
+  testGB(1, gerdt93IdealComponentLast(false), gerdt93_gb_strat0_free1,
          gerdt93_syzygies_strat0_free1, gerdt93_initial_strat0_free1, 9);
 }
 
 TEST(GB, gerdt93_0_2) {
-  testGB(2, gerdt93Ideal(), gerdt93_gb_strat0_free2,
+  testGB(2, gerdt93IdealComponentMiddle(true), gerdt93_gb_strat0_free2,
          gerdt93_syzygies_strat0_free2, gerdt93_initial_strat0_free2, 7);
 }
 
 TEST(GB, gerdt93_0_3) {
-  testGB(3, gerdt93Ideal(), gerdt93_gb_strat0_free3,
+  testGB(3, gerdt93IdealComponentMiddle(false), gerdt93_gb_strat0_free3,
          gerdt93_syzygies_strat0_free3, gerdt93_initial_strat0_free3, 9);
 }
 
 TEST(GB, gerdt93_0_4) {
-  testGB(4, gerdt93Ideal(), gerdt93_gb_strat0_free4,
+  testGB(4, gerdt93IdealComponentLast(true), gerdt93_gb_strat0_free4,
          gerdt93_syzygies_strat0_free4, gerdt93_initial_strat0_free4, 7);
 }
 
 TEST(GB, gerdt93_0_5) {
-  testGB(5, gerdt93Ideal(), gerdt93_gb_strat0_free5,
+  testGB(5, gerdt93IdealComponentLast(false), gerdt93_gb_strat0_free5,
          gerdt93_syzygies_strat0_free5, gerdt93_initial_strat0_free5, 7);
 }
 
diff --git a/src/test/ideals.cpp b/src/test/ideals.cpp
index b2e6f68..13313b3 100755
--- a/src/test/ideals.cpp
+++ b/src/test/ideals.cpp
@@ -3,13 +3,16 @@
 
 #include <sstream>
 
-const char* idealSmall =
-"32003 6 \
-1 1 1 1 1 1 1 \
-3 \
--bc+ad \
--b2+af \
--bc2+a2e";
+std::string smallIdealComponentLastDescending() {
+  return 
+    "32003 6\n"
+    "1 1 1 1 1 1 1\n"
+    "_revlex revcomponent\n"
+    "3\n"
+    "-bc+ad\n"
+    "-b2+af\n"
+    "-bc2+a2e\n";
+}
 
 const char* idealSmallBasis = "\
 0 <0>  bc-ad\n\
@@ -29,15 +32,17 @@ const char* idealSmallSyzygies =
 const char* idealSmallInitial =
   "  bc\n  b2\n  acd\n  abd\n  a2be\n  a2d2\n  a3de\n  a4e2\n";
 
-const char* liu_ideal = 
-"2 6 \
-1 1 1 1 1 1 1 \
-4 \
-bc+bd+af+ef \
-ac+cd+bf+ef \
-ad+bd+cf+ef \
-ab+ac+df+ef \
-";
+std::string liuIdealComponentLastDescending() {
+  return 
+    "2 6\n"
+    "1 1 1 1 1 1 1\n"
+    "_revlex revcomponent\n"
+    "4\n"
+    "bc+bd+af+ef\n"
+    "ac+cd+bf+ef\n"
+    "ad+bd+cf+ef\n"
+    "ab+ac+df+ef\n";
+}
 
 const char* liu_gb_strat0_free1 = 
 "\
@@ -65,13 +70,21 @@ const char* liu_syzygies_strat0_free1 =
 const char* liu_initial_strat0_free1 =
   "  ad\n  bc\n  ac\n  ab\n  a2f\n  bd2\n  c2d\n  b2d\n  cd2f\n  c3f\n  b3f\n  b2ef2\n  bde2f2\n  c2e2f3\n  cde2f4\n  d2e3f4\n";
 
-const char* weispfennig97_ideal = 
-"7583 4 1 1 1 1 1 \
-3 \
-b4+ab2c+a2d2-2abd2+b2d2+c2d2 \
-a2b2c-bc4+a3d2+ab2d2+ac2d2+3d5 \
-a3b2-abc3+a2d3+b2d3+c2d3 \
-";
+std::string weispfennig97IdealComponentLast(bool componentsAscending) {
+  std::ostringstream out;
+  out << "7583 4 1\n";
+  if (componentsAscending)
+    out << "1 1 1 1 _revlex component\n";
+  else
+    out << "1 1 1 1 _revlex revcomponent\n";
+  out <<
+    "3\n"
+    "b4+ab2c+a2d2-2abd2+b2d2+c2d2 \n"
+    "a2b2c-bc4+a3d2+ab2d2+ac2d2+3d5 \n"
+    "a3b2-abc3+a2d3+b2d3+c2d3\n";
+  return out.str();
+}
+
 
 const char* weispfennig97_gb_strat0_free4 = "\
 0 <0>  b4+ab2c+a2d2-2abd2+b2d2+c2d2\n\
@@ -150,27 +163,43 @@ const char* weispfennig97_syzygies_strat0_free5 =
 const char* weispfennig97_initial_strat0_free5 =
   "  b4\n  a2b2c\n  a3b2\n  a4d2\n  b3c4\n  ab3c3\n  a2bc3d2\n  a3c3d2\n  ab3c2d2\n  a3bc4\n  a3bd5\n  a2c5d2\n  ab2c4d2\n  a2b3d5\n  b2c6d2\n  abc6d2\n  a2c4d5\n  bc8d2\n  ac6d5\n  abc5d5\n  bc7d5\n  c9d5\n";
 
-std::string gerdt93Ideal() {
-  return
-  "7583 6 1 1 1 1 1 1 1\n\
-   3\n\
-   ab-b2-4bc+ae\n\
-   a2c-6bc2+a2f\n\
-   a3+b2c-a2d\n\
-  ";
+const char* Gert93RawIdeal = 
+  "3\n"
+  "ab-b2-4bc+ae\n"
+  "a2c-6bc2+a2f\n"
+  "a3+b2c-a2d\n";
+
+
+std::string gerdt93IdealComponentLast(bool componentsAscending) {
+  std::ostringstream out;
+  out << "7583 6 ";
+  if (componentsAscending)
+    out << "1 1 1 1 1 1 1 _revlex component\n";
+  else
+    out << "1 1 1 1 1 1 1 _revlex revcomponent\n";
+  out << Gert93RawIdeal;
+  return out.str();
 }
 
-std::string gerdt93IdealComponentFirst(bool componentIncreasing) {
+std::string gerdt93IdealComponentFirst(bool componentsAscending) {
   std::ostringstream out;
   out << "7583 6 ";
-  if (componentIncreasing)
+  if (componentsAscending)
     out << "2 component 1 1 1 1 1 1\n";
   else
     out << "2 revcomponent 1 1 1 1 1 1\n";
-  out << "3\n"
-    " ab-b2-4bc+ae\n"
-    " a2c-6bc2+a2f\n"
-    " a3+b2c-a2d\n";
+  out << Gert93RawIdeal;
+  return out.str();
+}
+
+std::string gerdt93IdealComponentMiddle(bool componentsAscending) {
+  std::ostringstream out;
+  out << "7583 6 ";
+  if (componentsAscending)
+    out << "2 1 1 1 1 1 1 component\n";
+  else
+    out << "2 1 1 1 1 1 1 revcomponent\n";
+  out << Gert93RawIdeal;
   return out.str();
 }
 
diff --git a/src/test/ideals.hpp b/src/test/ideals.hpp
index d79a0cb..4c03da9 100755
--- a/src/test/ideals.hpp
+++ b/src/test/ideals.hpp
@@ -2,19 +2,21 @@
 #define _test_ideals_h_
 
 // small
-extern const char* idealSmall;
+std::string smallIdealComponentLastDescending();
+
 extern const char* idealSmallBasis;
 extern const char* idealSmallSyzygies;
 extern const char* idealSmallInitial;
 
 // liu
-extern const char* liu_ideal;
+std::string liuIdealComponentLastDescending();
+
 extern const char* liu_gb_strat0_free1;
 extern const char* liu_syzygies_strat0_free1;
 extern const char* liu_initial_strat0_free1;
 
 // weispfennig97
-extern const char* weispfennig97_ideal;
+std::string weispfennig97IdealComponentLast(bool componentsAscending);
 
 extern const char* weispfennig97_gb_strat0_free4;
 extern const char* weispfennig97_syzygies_strat0_free4;
@@ -25,8 +27,9 @@ extern const char* weispfennig97_syzygies_strat0_free5;
 extern const char* weispfennig97_initial_strat0_free5;
 
 // gerdt93
-std::string gerdt93Ideal();
-std::string gerdt93IdealComponentFirst(bool componentIncreasing);
+std::string gerdt93IdealComponentFirst(bool componentsAscending);
+std::string gerdt93IdealComponentMiddle(bool componentsAscending);
+std::string gerdt93IdealComponentLast(bool componentsAscending);
 
 extern const char* gerdt93_gb_strat0_free1;
 extern const char* gerdt93_syzygies_strat0_free1;

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