[mathicgb] 367/393: Removed ChainedHashTable and MonomialHashTable since they were not used any more, except by a single unit test.

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

    Removed ChainedHashTable and MonomialHashTable since they were not used any more, except by a single unit test.
---
 Makefile.am                                        |  92 ++++---
 build/vs12/mathicgb-lib/mathicgb-lib.vcxproj       |   3 -
 .../vs12/mathicgb-lib/mathicgb-lib.vcxproj.filters |   9 -
 src/mathicgb/ChainedHashTable.cpp                  |  10 -
 src/mathicgb/ChainedHashTable.hpp                  | 285 ---------------------
 src/mathicgb/MonomialHashTable.hpp                 |  88 -------
 src/test/poly-test.cpp                             |  19 --
 7 files changed, 45 insertions(+), 461 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index b402fe6..d68796f 100755
--- a/Makefile.am
+++ b/Makefile.am
@@ -13,53 +13,51 @@ libmathicgb_la_LIBADD= $(DEPS_LIBS)
 
 # the sources that are built to make libmathicgb. Listing the headers in
 # sources ensure that those files are included in distributions.
-libmathicgb_la_SOURCES = src/mathicgb/ReducerPack.hpp				  \
-  src/mathicgb/ReducerPack.cpp src/mathicgb/ClassicGBAlg.cpp		  \
-  src/mathicgb/ClassicGBAlg.hpp src/mathicgb/ChainedHashTable.cpp	  \
-  src/mathicgb/ChainedHashTable.hpp src/mathicgb/MonoLookup.hpp		  \
-  src/mathicgb/MonoLookup.cpp src/mathicgb/StaticMonoMap.hpp		  \
-  src/mathicgb/SigPolyBasis.cpp src/mathicgb/SigPolyBasis.hpp		  \
-  src/mathicgb/Basis.cpp src/mathicgb/Basis.hpp						  \
-  src/mathicgb/io-util.cpp src/mathicgb/io-util.hpp					  \
-  src/mathicgb/KoszulQueue.hpp src/mathicgb/MonomialHashTable.hpp	  \
-  src/mathicgb/ModuleMonoSet.cpp src/mathicgb/ModuleMonoSet.hpp		  \
-  src/mathicgb/PairTriangle.cpp src/mathicgb/PairTriangle.hpp		  \
-  src/mathicgb/Poly.cpp src/mathicgb/Poly.hpp						  \
-  src/mathicgb/PolyBasis.cpp src/mathicgb/PolyBasis.hpp				  \
-  src/mathicgb/PolyHashTable.cpp src/mathicgb/PolyHashTable.hpp		  \
-  src/mathicgb/PolyRing.cpp src/mathicgb/PolyRing.hpp				  \
-  src/mathicgb/Reducer.cpp src/mathicgb/Reducer.hpp					  \
-  src/mathicgb/ReducerDedup.hpp src/mathicgb/ReducerDedup.cpp		  \
-  src/mathicgb/ReducerHash.hpp src/mathicgb/ReducerHash.cpp			  \
-  src/mathicgb/ReducerHashPack.hpp src/mathicgb/ReducerHashPack.cpp	  \
-  src/mathicgb/ReducerHelper.hpp src/mathicgb/ReducerNoDedup.hpp	  \
-  src/mathicgb/ReducerNoDedup.cpp src/mathicgb/ReducerPackDedup.hpp	  \
-  src/mathicgb/ReducerPackDedup.cpp src/mathicgb/SignatureGB.cpp	  \
-  src/mathicgb/SignatureGB.hpp src/mathicgb/SigSPairs.cpp			  \
-  src/mathicgb/SigSPairs.hpp src/mathicgb/SPairs.cpp				  \
-  src/mathicgb/SPairs.hpp src/mathicgb/stdinc.h						  \
-  src/mathicgb/SigSPairQueue.hpp src/mathicgb/SigSPairQueue.cpp		  \
-  src/mathicgb/SparseMatrix.hpp src/mathicgb/SparseMatrix.cpp		  \
-  src/mathicgb/QuadMatrixBuilder.hpp								  \
-  src/mathicgb/QuadMatrixBuilder.cpp src/mathicgb/TypicalReducer.cpp  \
-  src/mathicgb/TypicalReducer.hpp src/mathicgb/F4Reducer.hpp		  \
-  src/mathicgb/F4Reducer.cpp src/mathicgb/F4MatrixBuilder.hpp		  \
-  src/mathicgb/F4MatrixBuilder.cpp src/mathicgb/QuadMatrix.hpp		  \
-  src/mathicgb/QuadMatrix.cpp src/mathicgb/F4MatrixReducer.cpp		  \
-  src/mathicgb/F4MatrixReducer.hpp src/mathicgb/MonomialMap.hpp		  \
-  src/mathicgb/RawVector.hpp src/mathicgb/Atomic.hpp				  \
-  src/mathicgb/FixedSizeMonomialMap.hpp src/mathicgb/CFile.hpp		  \
-  src/mathicgb/CFile.cpp src/mathicgb/LogDomain.hpp					  \
-  src/mathicgb/LogDomain.cpp src/mathicgb/LogDomainSet.hpp			  \
-  src/mathicgb/F4MatrixBuilder2.hpp src/mathicgb/F4MatrixBuilder2.cpp \
-  src/mathicgb/LogDomainSet.cpp src/mathicgb/F4ProtoMatrix.hpp		  \
-  src/mathicgb/F4ProtoMatrix.cpp src/mathicgb/F4MatrixProject.hpp	  \
-  src/mathicgb/F4MatrixProjection.cpp src/mathicgb/ScopeExit.hpp	  \
-  src/mathicgb.cpp src/mathicgb.h src/mathicgb/mtbb.hpp				  \
-  src/mathicgb/PrimeField.hpp src/mathicgb/MonoMonoid.hpp			  \
-  src/mathicgb/MonoProcessor.hpp src/mathicgb/MonoOrder.hpp			  \
-  src/mathicgb/Scanner.hpp src/mathicgb/Scanner.cpp					  \
-  src/mathicgb/Unchar.hpp src/mathicgb/MathicIO.hpp					  \
+libmathicgb_la_SOURCES = src/mathicgb/ReducerPack.hpp					\
+  src/mathicgb/ReducerPack.cpp src/mathicgb/ClassicGBAlg.cpp			\
+  src/mathicgb/ClassicGBAlg.hpp src/mathicgb/MonoLookup.hpp				\
+  src/mathicgb/MonoLookup.cpp src/mathicgb/StaticMonoMap.hpp			\
+  src/mathicgb/SigPolyBasis.cpp src/mathicgb/SigPolyBasis.hpp			\
+  src/mathicgb/Basis.cpp src/mathicgb/Basis.hpp							\
+  src/mathicgb/io-util.cpp src/mathicgb/io-util.hpp						\
+  src/mathicgb/KoszulQueue.hpp src/mathicgb/ModuleMonoSet.cpp			\
+  src/mathicgb/ModuleMonoSet.hpp src/mathicgb/PairTriangle.cpp			\
+  src/mathicgb/PairTriangle.hpp src/mathicgb/Poly.cpp					\
+  src/mathicgb/Poly.hpp src/mathicgb/PolyBasis.cpp						\
+  src/mathicgb/PolyBasis.hpp src/mathicgb/PolyHashTable.cpp				\
+  src/mathicgb/PolyHashTable.hpp src/mathicgb/PolyRing.cpp				\
+  src/mathicgb/PolyRing.hpp src/mathicgb/Reducer.cpp					\
+  src/mathicgb/Reducer.hpp src/mathicgb/ReducerDedup.hpp				\
+  src/mathicgb/ReducerDedup.cpp src/mathicgb/ReducerHash.hpp			\
+  src/mathicgb/ReducerHash.cpp src/mathicgb/ReducerHashPack.hpp			\
+  src/mathicgb/ReducerHashPack.cpp src/mathicgb/ReducerHelper.hpp		\
+  src/mathicgb/ReducerNoDedup.hpp src/mathicgb/ReducerNoDedup.cpp		\
+  src/mathicgb/ReducerPackDedup.hpp src/mathicgb/ReducerPackDedup.cpp	\
+  src/mathicgb/SignatureGB.cpp src/mathicgb/SignatureGB.hpp				\
+  src/mathicgb/SigSPairs.cpp src/mathicgb/SigSPairs.hpp					\
+  src/mathicgb/SPairs.cpp src/mathicgb/SPairs.hpp						\
+  src/mathicgb/stdinc.h src/mathicgb/SigSPairQueue.hpp					\
+  src/mathicgb/SigSPairQueue.cpp src/mathicgb/SparseMatrix.hpp			\
+  src/mathicgb/SparseMatrix.cpp src/mathicgb/QuadMatrixBuilder.hpp		\
+  src/mathicgb/QuadMatrixBuilder.cpp src/mathicgb/TypicalReducer.cpp	\
+  src/mathicgb/TypicalReducer.hpp src/mathicgb/F4Reducer.hpp			\
+  src/mathicgb/F4Reducer.cpp src/mathicgb/F4MatrixBuilder.hpp			\
+  src/mathicgb/F4MatrixBuilder.cpp src/mathicgb/QuadMatrix.hpp			\
+  src/mathicgb/QuadMatrix.cpp src/mathicgb/F4MatrixReducer.cpp			\
+  src/mathicgb/F4MatrixReducer.hpp src/mathicgb/MonomialMap.hpp			\
+  src/mathicgb/RawVector.hpp src/mathicgb/Atomic.hpp					\
+  src/mathicgb/FixedSizeMonomialMap.hpp src/mathicgb/CFile.hpp			\
+  src/mathicgb/CFile.cpp src/mathicgb/LogDomain.hpp						\
+  src/mathicgb/LogDomain.cpp src/mathicgb/LogDomainSet.hpp				\
+  src/mathicgb/F4MatrixBuilder2.hpp src/mathicgb/F4MatrixBuilder2.cpp	\
+  src/mathicgb/LogDomainSet.cpp src/mathicgb/F4ProtoMatrix.hpp			\
+  src/mathicgb/F4ProtoMatrix.cpp src/mathicgb/F4MatrixProject.hpp		\
+  src/mathicgb/F4MatrixProjection.cpp src/mathicgb/ScopeExit.hpp		\
+  src/mathicgb.cpp src/mathicgb.h src/mathicgb/mtbb.hpp					\
+  src/mathicgb/PrimeField.hpp src/mathicgb/MonoMonoid.hpp				\
+  src/mathicgb/MonoProcessor.hpp src/mathicgb/MonoOrder.hpp				\
+  src/mathicgb/Scanner.hpp src/mathicgb/Scanner.cpp						\
+  src/mathicgb/Unchar.hpp src/mathicgb/MathicIO.hpp						\
   src/mathicgb/NonCopyable.hpp
 
 
diff --git a/build/vs12/mathicgb-lib/mathicgb-lib.vcxproj b/build/vs12/mathicgb-lib/mathicgb-lib.vcxproj
index 00fd5ad..b56418d 100755
--- a/build/vs12/mathicgb-lib/mathicgb-lib.vcxproj
+++ b/build/vs12/mathicgb-lib/mathicgb-lib.vcxproj
@@ -442,7 +442,6 @@
     <ClCompile Include="..\..\..\src\mathicgb.cpp" />
     <ClCompile Include="..\..\..\src\mathicgb\Basis.cpp" />
     <ClCompile Include="..\..\..\src\mathicgb\CFile.cpp" />
-    <ClCompile Include="..\..\..\src\mathicgb\ChainedHashTable.cpp" />
     <ClCompile Include="..\..\..\src\mathicgb\ClassicGBAlg.cpp" />
     <ClCompile Include="..\..\..\src\mathicgb\F4MatrixBuilder.cpp" />
     <ClCompile Include="..\..\..\src\mathicgb\F4MatrixBuilder2.cpp" />
@@ -483,7 +482,6 @@
     <ClInclude Include="..\..\..\src\mathicgb\Atomic.hpp" />
     <ClInclude Include="..\..\..\src\mathicgb\Basis.hpp" />
     <ClInclude Include="..\..\..\src\mathicgb\CFile.hpp" />
-    <ClInclude Include="..\..\..\src\mathicgb\ChainedHashTable.hpp" />
     <ClInclude Include="..\..\..\src\mathicgb\ClassicGBAlg.hpp" />
     <ClInclude Include="..\..\..\src\mathicgb\F4MatrixBuilder.hpp" />
     <ClInclude Include="..\..\..\src\mathicgb\F4MatrixBuilder2.hpp" />
@@ -499,7 +497,6 @@
     <ClInclude Include="..\..\..\src\mathicgb\MathicIO.hpp" />
     <ClInclude Include="..\..\..\src\mathicgb\ModuleMonoSet.hpp" />
     <ClInclude Include="..\..\..\src\mathicgb\MonoLookup.hpp" />
-    <ClInclude Include="..\..\..\src\mathicgb\MonomialHashTable.hpp" />
     <ClInclude Include="..\..\..\src\mathicgb\MonomialMap.hpp" />
     <ClInclude Include="..\..\..\src\mathicgb\MonoMonoid.hpp" />
     <ClInclude Include="..\..\..\src\mathicgb\MonoOrder.hpp" />
diff --git a/build/vs12/mathicgb-lib/mathicgb-lib.vcxproj.filters b/build/vs12/mathicgb-lib/mathicgb-lib.vcxproj.filters
index 33306c9..4005f21 100755
--- a/build/vs12/mathicgb-lib/mathicgb-lib.vcxproj.filters
+++ b/build/vs12/mathicgb-lib/mathicgb-lib.vcxproj.filters
@@ -11,9 +11,6 @@
     </Filter>
   </ItemGroup>
   <ItemGroup>
-    <ClCompile Include="..\..\..\src\mathicgb\ChainedHashTable.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
     <ClCompile Include="..\..\..\src\mathicgb\F4MatrixBuilder.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
@@ -127,9 +124,6 @@
     </ClCompile>
   </ItemGroup>
   <ItemGroup>
-    <ClInclude Include="..\..\..\src\mathicgb\ChainedHashTable.hpp">
-      <Filter>Header Files</Filter>
-    </ClInclude>
     <ClInclude Include="..\..\..\src\mathicgb\F4MatrixBuilder.hpp">
       <Filter>Header Files</Filter>
     </ClInclude>
@@ -145,9 +139,6 @@
     <ClInclude Include="..\..\..\src\mathicgb\KoszulQueue.hpp">
       <Filter>Header Files</Filter>
     </ClInclude>
-    <ClInclude Include="..\..\..\src\mathicgb\MonomialHashTable.hpp">
-      <Filter>Header Files</Filter>
-    </ClInclude>
     <ClInclude Include="..\..\..\src\mathicgb\PairTriangle.hpp">
       <Filter>Header Files</Filter>
     </ClInclude>
diff --git a/src/mathicgb/ChainedHashTable.cpp b/src/mathicgb/ChainedHashTable.cpp
deleted file mode 100755
index 97191be..0000000
--- a/src/mathicgb/ChainedHashTable.cpp
+++ /dev/null
@@ -1,10 +0,0 @@
-// MathicGB copyright 2012 all rights reserved. MathicGB comes with ABSOLUTELY
-// NO WARRANTY and is licensed as GPL v2.0 or later - see LICENSE.txt.
-#include "stdinc.h"
-#include "ChainedHashTable.hpp"
-
-MATHICGB_NAMESPACE_BEGIN
-
-template class ChainedHashTable<HashControlExample>;
-
-MATHICGB_NAMESPACE_END
diff --git a/src/mathicgb/ChainedHashTable.hpp b/src/mathicgb/ChainedHashTable.hpp
deleted file mode 100755
index b2a1c42..0000000
--- a/src/mathicgb/ChainedHashTable.hpp
+++ /dev/null
@@ -1,285 +0,0 @@
-// MathicGB copyright 2012 all rights reserved. MathicGB comes with ABSOLUTELY
-// NO WARRANTY and is licensed as GPL v2.0 or later - see LICENSE.txt.
-#ifndef MATHICGB_CHAINED_HASH_TABLE_GUARD
-#define MATHICGB_CHAINED_HASH_TABLE_GUARD
-
-#include <vector>
-#include <iostream>
-#include <ostream>
-#include <memtailor.h>
-
-MATHICGB_NAMESPACE_BEGIN
-
-// One template parameter, with the following:
-//   types:
-//     ValueType, KeyType
-//   functions:
-//     size_t HashControl::hash_value(key)
-//     bool ::is_equal(key1, key2)
-//     void ValueType::combine(value &already_there, value new_one);
-//     void ValueType::show(ostream &o, KeyType k, ValueType v)
-//
-// keys and values: are not copied or stored, except via standard operator=.
-
-class HashControlExample
-{
-public:
-  typedef int * KeyType;
-  typedef int ValueType;
-
-  size_t hash_value(KeyType k) const { return static_cast<size_t>(k - static_cast<int *>(0)); }
-  bool is_equal(KeyType k1, KeyType k2) const { return k1 == k2; }
-  void combine(ValueType &v, ValueType w) const { v += w; }
-  void show(std::ostream &o, KeyType k, ValueType v) const { o << "[" << k << " " << v << "]"; }
-};
-
-template<typename HashControl>
-class ChainedHashTable {
-  typedef typename HashControl::KeyType Key;
-  typedef typename HashControl::ValueType Value;
-
-  struct node {
-    node *next;
-    Key key;
-    Value value;
-    void *unused;
-  };
-
-  typedef std::vector<node *> NodeArray;
-public:
-  struct Stats {
-    size_t max_chain_len;
-    size_t n_nonempty_bins;
-    size_t n_inserts; // # calls to insert a monomial
-    size_t n_nodes; // # of unique monomials represented here
-    size_t n_eq_true; // total number of true is_equal calls during lookup_and_insert
-    size_t n_eq_false;  // same, but number for false.
-  };
-
-  ChainedHashTable(HashControl M, int nbits);
-
-  ~ChainedHashTable() {}
-
-  std::string description() const { return "chained hash table"; }
-
-  void reset();  // Clear the table, and memory areas, but don't release space grabbed so far
-
-  void resize(int new_nbits);  // Don't change the nodes, table, but do recreate hashtable_
-
-  bool member(Key k, Value &result_v) const;
-  // Return true if k is in the hash table.
-  // In this case, set 'result_v' with its value
-
-  void insertUnique(Key m, Value v);
-  // The caller must insure that 'm' is not currently in the table.
-
-  bool lookupAndInsert(Key k, Value v);
-  // returns true if 'k' is in the table.  In this case, combine values.
-  // If false, 'k' is inserted with the given value.
-
-  void getStats(Stats &stats) const; // set the stats table with current values
-
-  void resetStats() const; // reset all stat values to 0
-
-  void dump(int level = 0) const; // For debugging: display the current state of the table
-
-  size_t getMemoryUse() const;
-private:
-  node * lookup(Key k) const;
-
-  HashControl M_;
-  size_t table_size_;
-  mutable Stats stats_;
-
-  std::vector<node *> hashtable_;
-  memt::Arena mNodes; // where we keep 'node's
-};
-
-template <typename HashControl>
-ChainedHashTable<HashControl>::ChainedHashTable(HashControl M, int nbits)
-  : M_(M),
-    table_size_(static_cast<size_t>(1) << nbits)
-{
-  hashtable_.resize(table_size_);
-
-  // set each entry of hashtable_ to null
-  reset();
-}
-
-template <typename HashControl>
-size_t ChainedHashTable<HashControl>::getMemoryUse() const
-{
-  size_t total = mNodes.getMemoryUse();
-  total += sizeof(node *) * hashtable_.size();
-  return total;
-}
-
-template <typename HashControl>
-void ChainedHashTable<HashControl>::reset()
-{
-  // Clear the table, and memory areas.
-  for (typename NodeArray::iterator i = hashtable_.begin(); i != hashtable_.end(); ++i)
-    *i = 0;
-
-  mNodes.freeAllAllocs();
-  resetStats();
-}
-
-template <typename HashControl>
-void ChainedHashTable<HashControl>::resize(int new_nbits)
-// Don't change the nodes, table, but do recreate hashtable_
-{
-  // Make a new vector of node *'s.
-  // swap the two.
-  // Loop through each one, reinserting the node into the proper bin.
-
-  size_t old_table_size = table_size_;
-  table_size_ = static_cast<size_t>(1) << new_nbits;
-  NodeArray old_table(table_size_);
-  swap(old_table, hashtable_);
-  for (size_t i = 0; i<old_table_size; i++)
-    {
-      node *p = old_table[i];
-      while (p != 0)
-        {
-          node *q = p;
-          p = p->next;
-          // Reinsert node.  We know that it is unique
-          size_t hashval = M_.hash_value(q->key) % table_size_;
-          node *r = hashtable_[hashval];
-          q->next = r;
-          hashtable_[hashval] = q;
-        }
-    }
-}
-
-template <typename HashControl>
-bool ChainedHashTable<HashControl>::member(Key m, Value &val) const
-{
-  node *p = lookup(m);
-  if (p == 0) return false;
-  val = p->value; // ASSIGN
-  return true;
-}
-
-template <typename HashControl>
-bool ChainedHashTable<HashControl>::lookupAndInsert(Key m, Value val)
-// Returns true if m is in the table
-{
-  node *p = lookup(m);
-  if (p == 0)
-    {
-      insertUnique(m, val);
-      return false;
-    }
-  else
-    {
-      M_.combine(p->value, val);
-      return true;
-    }
-}
-
-template <typename HashControl>
-void ChainedHashTable<HashControl>::insertUnique(Key k, Value v)
-// Returns null if not in the table
-{
-  size_t hashval = M_.hash_value(k) % table_size_; // table_size is a power of 2
-
-  node *q = static_cast<node *>(mNodes.alloc(sizeof(node)));
-  q->next = hashtable_[hashval];
-  q->key = k; // ASSIGN
-  q->value = v; // ASSIGN
-  hashtable_[hashval] = q;
-
-  stats_.n_inserts++;
-}
-
-template <typename HashControl>
-typename ChainedHashTable<HashControl>::node * ChainedHashTable<HashControl>::lookup(Key k) const
-// Returns null if not in the table
-{
-  size_t hashval = M_.hash_value(k) % table_size_; // table_size is a power of 2
-  for (node *p=hashtable_[hashval]; p != 0; p = p->next)
-    if (M_.is_equal(k, p->key))
-      {
-        stats_.n_eq_true++;
-        return p;
-      }
-    else
-      {
-        stats_.n_eq_false++;
-      }
-  return 0;
-}
-
-template <typename HashControl>
-void ChainedHashTable<HashControl>::resetStats() const
-{
-  stats_.max_chain_len = 0;
-  stats_.n_nonempty_bins = 0;
-  stats_.n_inserts = 0;
-  stats_.n_nodes = 0;
-  stats_.n_eq_true = 0;
-  stats_.n_eq_false = 0;
-}
-
-template <typename HashControl>
-void ChainedHashTable<HashControl>::getStats(Stats &stats) const
-{
-  // First we set the values in stats_
-
-  stats_.n_nonempty_bins = 0;
-  stats_.max_chain_len = 0;
-  stats_.n_nodes = 0;
-  for (size_t i = 0; i<table_size_; i++)
-    {
-      if (hashtable_[i] == 0) continue;
-      stats_.n_nonempty_bins++;
-      size_t chain_len = 0;
-      for (node *p = hashtable_[i]; p != 0; p = p->next)
-        chain_len++;
-      stats_.n_nodes += chain_len;
-      if (chain_len > stats_.max_chain_len)
-        stats_.max_chain_len = chain_len;
-    }
-
-  if (&stats != &stats_)
-    stats = stats_;
-}
-
-template <typename HashControl>
-void ChainedHashTable<HashControl>::dump(int level) const
-{
-  // Compute:
-  //  # bins in use
-  //  max chain length
-  //  # keys in use
-  //  average number in non-zero bins
-  // Report on:
-  //  number of is_equal true/false
-  //  # of lookup and insert calls
-  //
-  // For debugging: display the current state of the table
-  getStats(stats_);
-  std::cout << "ChainedHashTable stats:" << std::endl;
-  std::cout << "  # nonempty bins: " << stats_.n_nonempty_bins << std::endl;
-  std::cout << "  # nodes: " << stats_.n_nodes << std::endl;
-  std::cout << "  max chain length: " << stats_.max_chain_len << std::endl;
-  std::cout << "  # insert calls: " << stats_.n_inserts << std::endl;
-  std::cout << "  # isequal true calls: " << stats_.n_eq_true << std::endl;
-  std::cout << "  # isequal false calls: " << stats_.n_eq_false << std::endl;
-
-  if (level == 0) return;
-
-  for (size_t i = 0; i<table_size_; i++)
-    {
-      if (hashtable_[i] == 0) continue;
-      std::cout << "bin " << i << ": ";
-      for (node *p = hashtable_[i]; p != 0; p = p->next)
-        M_.show(std::cout, p->key, p->value);
-      std::cout << std::endl;
-    }
-}
-
-MATHICGB_NAMESPACE_END
-#endif
diff --git a/src/mathicgb/MonomialHashTable.hpp b/src/mathicgb/MonomialHashTable.hpp
deleted file mode 100755
index 28fe9af..0000000
--- a/src/mathicgb/MonomialHashTable.hpp
+++ /dev/null
@@ -1,88 +0,0 @@
-// MathicGB copyright 2012 all rights reserved. MathicGB comes with ABSOLUTELY
-// NO WARRANTY and is licensed as GPL v2.0 or later - see LICENSE.txt.
-#ifndef MATHICGB_MONOMIAL_HASH_TABLE_GUARD
-#define MATHICGB_MONOMIAL_HASH_TABLE_GUARD
-
-#include "ChainedHashTable.hpp"
-#include "PolyRing.hpp"
-
-MATHICGB_NAMESPACE_BEGIN
-
-class MonomialHashControl
-{
-public:
-  typedef const_monomial KeyType;
-  typedef int ValueType;
-
-  MonomialHashControl(const PolyRing *R) : R_(R) {}
-  size_t hash_value(KeyType k) const { return R_->monomialHashValue(k); }
-  bool is_equal(KeyType k1, KeyType k2) const { return R_->monomialEQ(k1, k2); }
-  void combine(ValueType &, ValueType) const { }
-  void show(std::ostream &o, KeyType k, ValueType v) const { 
-    o << "["; 
-    R_->monomialDisplay(o, k);
-    o << " " << v << "]"; 
-  }
-private:
-  const PolyRing *R_;
-};
-
-typedef ChainedHashTable<MonomialHashControl> MonomialHashTableBasic;
-
-class MonomialHashTable
-{
-public:
-  typedef MonomialHashTableBasic::Stats Stats;
-
-  MonomialHashTable(const PolyRing *R, int nbits)
-  : R_(R), H_(R, nbits) {}
-
-  ~MonomialHashTable() {}
-
-  std::string description() const { return "monomial hash table"; }
-
-  void reset() {
-    // Clear the table, and memory areas, but don't release space grabbed so far
-    mMonomialPool.freeAllAllocs();
-    H_.reset();
-  }
-
-  void resize(int new_nbits) { H_.resize(new_nbits); }
-  // Don't change the nodes, table, but do recreate hashtable_
-
-  bool member(const_monomial m, int &result_val) const { return H_.member(m, result_val); }
-    // Return true if m is in the hash table.
-    // In this case, set 'result_val' with its value
-
-  void insertUnique(const_monomial m, int v) {
-    // The caller must insure that 'm' is not currently in the table.
-    // First copy m.
-    monomial m1 = R_->allocMonomial(mMonomialPool);
-    R_->monomialCopy(m, m1);
-    H_.insertUnique(m1,v);
-  }
-
-  bool lookupAndInsert(const_monomial m, int  &v) {
-    // returns true if 'm' is in the table.  In this case, v is set to value that is in the table,
-    // If false, 'm' is inserted, and its value is set to v.
-    if (member(m, v)) return true;
-    insertUnique(m, v);
-    return false;
-  }
-
-  void getStats(Stats &stats) const { H_.getStats(stats) ; }
-
-  void resetStats() const { H_.resetStats(); }
-  // reset all values to 0
-
-  void dump(int level = 0) const { H_.dump(level); }  // For debugging: display the current state of the table
-
-  size_t getMemoryUse() const { return mMonomialPool.getMemoryUse() + H_.getMemoryUse(); }
-private:
-  const PolyRing *R_;
-  memt::Arena mMonomialPool;
-  MonomialHashTableBasic H_;
-};
-
-MATHICGB_NAMESPACE_END
-#endif
diff --git a/src/test/poly-test.cpp b/src/test/poly-test.cpp
index 7cd2c52..d7118db 100755
--- a/src/test/poly-test.cpp
+++ b/src/test/poly-test.cpp
@@ -6,7 +6,6 @@
 #include "mathicgb/Basis.hpp"
 #include "mathicgb/ModuleMonoSet.hpp"
 #include "mathicgb/io-util.hpp"
-#include "mathicgb/MonomialHashTable.hpp"
 #include "mathicgb/SigPolyBasis.hpp"
 #include "mathicgb/SignatureGB.hpp"
 #include <gtest/gtest.h>
@@ -731,21 +730,3 @@ std::string somePolys =
   cde2f4+d2e2f4+ae3f4+be3f4+ce3f4+e4f4+bc2f5+b2df5+c2df5+ad2f5+cd2f5+d3f5+acef5+adef5+bdef5+d2ef5+ce2f5+e3f5\n\
   d2e3f4+de4f4+bc2df5+abd2f5+bcd2f5+c2d2f5+bc2ef5+abdef5+bd2ef5+d3ef5+b2e2f5+ace2f5+bce2f5+cde2f5+ae3f5+de3f5\n\
 ";
-
-TEST(MonomialHashTable,test1) {
-  std::unique_ptr<PolyRing> R = ringFromString("32003 6 1\n1 1 1 1 1 1");
-  MonomialHashTable H(R.get(), 3);
-  std::unique_ptr<Poly> f1 = polyParseFromString(R.get(), "3bd2+7cd2+5c2f+2adf+bdf+10cef");
-  int count = 0;
-  int was_there_count = 0;
-  for (int j = 0; j<10; j++)
-    for (Poly::iterator i = f1->begin(); i != f1->end(); ++i)
-      {
-	bool was_there = H.lookupAndInsert(i.getMonomial(), count);
-	count++;
-	if (was_there) was_there_count++;
-      }
-  MonomialHashTable::Stats stats;
-  H.getStats(stats);
-  //H.dump(1);
-}

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