[mathicgb] 32/393: Enabled support for some C++11 features and changed all uses of std::auto_ptr to std::unique_ptr.
Doug Torrance
dtorrance-guest at moszumanska.debian.org
Fri Apr 3 15:58:28 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 ead56f00efd6ba50adad93253a158d44e6bc8c17
Author: Bjarke Hammersholt Roune <bjarkehr.code at gmail.com>
Date: Thu Sep 27 19:16:42 2012 +0200
Enabled support for some C++11 features and changed all uses of std::auto_ptr to std::unique_ptr.
---
Makefile.am | 4 +-
src/cli/GBMain.cpp | 8 ++--
src/mathicgb/BuchbergerAlg.cpp | 16 ++++----
src/mathicgb/BuchbergerAlg.hpp | 6 +--
src/mathicgb/DivisorLookup.cpp | 22 +++++------
src/mathicgb/DivisorLookup.hpp | 4 +-
src/mathicgb/F4Reducer.cpp | 16 ++++----
src/mathicgb/F4Reducer.hpp | 10 ++---
src/mathicgb/FreeModuleOrder.cpp | 4 +-
src/mathicgb/FreeModuleOrder.hpp | 2 +-
src/mathicgb/GroebnerBasis.cpp | 6 +--
src/mathicgb/GroebnerBasis.hpp | 6 +--
src/mathicgb/Ideal.cpp | 2 +-
src/mathicgb/Ideal.hpp | 2 +-
src/mathicgb/PolyBasis.cpp | 14 +++----
src/mathicgb/PolyBasis.hpp | 14 +++----
src/mathicgb/Reducer.cpp | 64 ++++++++++++++++----------------
src/mathicgb/Reducer.hpp | 10 ++---
src/mathicgb/SigSPairs.hpp | 2 +-
src/mathicgb/SignatureGB.cpp | 12 ++++--
src/mathicgb/TypicalReducer.cpp | 26 ++++++-------
src/mathicgb/TypicalReducer.hpp | 12 +++---
src/mathicgb/io-util.cpp | 12 +++---
src/mathicgb/io-util.hpp | 6 +--
src/test/F4MatrixBuilder.cpp | 10 ++---
src/test/FreeModuleOrderTest.cpp | 4 +-
src/test/QuadMatrixBuilder.cpp | 10 ++---
src/test/gb-test.cpp | 6 +--
src/test/poly-test.cpp | 80 ++++++++++++++++++++--------------------
29 files changed, 198 insertions(+), 192 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 1f12799..8f86f9f 100755
--- a/Makefile.am
+++ b/Makefile.am
@@ -10,7 +10,7 @@ libmathicgb_la_CPPFLAGS = $(DEPS_CFLAGS)
noinst_LTLIBRARIES = libmathicgb.la
# set the C++ compiler to include src/
-AM_CXXFLAGS=-I$(top_srcdir)/src/
+AM_CXXFLAGS=-I$(top_srcdir)/src/ -std=gnu++0x
# libraries that are needed by this library
libmathicgb_la_LIBADD= $(DEPS_LIBS)
@@ -82,7 +82,7 @@ unittest_CPPFLAGS = $(DEPS_CFLAGS)
unittest_CXXFLAGS=\
-I$(top_srcdir)/libs/gtest/include\
-I$(top_srcdir)/libs/gtest/\
- -I$(top_srcdir)/src/
+ -I$(top_srcdir)/src/ -std=gnu++0x
unittest_LDADD = $(DEPS_LIBS) libmathicgb.la
test_LIBS=
diff --git a/src/cli/GBMain.cpp b/src/cli/GBMain.cpp
index 3f8cef3..a29b450 100755
--- a/src/cli/GBMain.cpp
+++ b/src/cli/GBMain.cpp
@@ -165,7 +165,7 @@ public:
tracingLevel = mTracingLevel.value();
// read input file
- std::auto_ptr<Ideal> ideal;
+ std::unique_ptr<Ideal> ideal;
{
std::string const inputIdealFile = mProjectName.value() + ".ideal";
std::ifstream inputFile(inputIdealFile.c_str());
@@ -173,7 +173,7 @@ public:
mic::reportError("Could not read input file " + inputIdealFile);
ideal.reset(Ideal::parse(inputFile));
}
- std::auto_ptr<PolyRing const> ring(&(ideal->ring()));
+ std::unique_ptr<PolyRing const> ring(&(ideal->ring()));
if (mClassicBuchbergerAlgorithm.value()) {
BuchbergerAlg alg(
@@ -310,7 +310,9 @@ int main(int argc, char **argv) {
commandLine[0] = "gb";
} else
commandLine.erase(commandLine.begin());
- std::auto_ptr<mic::Action> action = parser.parse(commandLine);
+ // todo: remove the .release once parser returns unique_ptr
+ // instead of auto_ptr.
+ std::unique_ptr<mic::Action> action(parser.parse(commandLine).release());
action->performAction();
} catch (const mic::MathicException& e) {
mic::display(e.what());
diff --git a/src/mathicgb/BuchbergerAlg.cpp b/src/mathicgb/BuchbergerAlg.cpp
index dc71d58..ba70aeb 100755
--- a/src/mathicgb/BuchbergerAlg.cpp
+++ b/src/mathicgb/BuchbergerAlg.cpp
@@ -35,7 +35,7 @@ BuchbergerAlg::BuchbergerAlg(
}
void BuchbergerAlg::insertReducedPoly(
- std::auto_ptr<Poly> polyToInsert
+ std::unique_ptr<Poly> polyToInsert
) {
ASSERT(polyToInsert.get() != 0);
if (polyToInsert->isZero())
@@ -59,7 +59,7 @@ void BuchbergerAlg::insertReducedPoly(
if (!mUseAutoTopReduction) {
size_t const newGen = mBasis.size();
- mBasis.insert(polyToInsert);
+ mBasis.insert(std::move(polyToInsert));
mSPairs.addPairs(newGen);
return;
}
@@ -71,9 +71,9 @@ void BuchbergerAlg::insertReducedPoly(
do {
// reduce polynomial and insert into basis
{
- std::auto_ptr<Poly> reduced;
+ std::unique_ptr<Poly> reduced;
if (toReduce.empty()) // if first iteration
- reduced = polyToInsert;
+ reduced = std::move(polyToInsert);
else {
reduced = mReducer->classicReduce(*toReduce.back(), mBasis);
if (tracingLevel > 20) {
@@ -95,8 +95,8 @@ void BuchbergerAlg::insertReducedPoly(
}
if (reduced->isZero())
continue;
- reduced->makeMonic();
- mBasis.insert(reduced);
+ reduced->makeMonic();
+ mBasis.insert(std::move(reduced));
}
// form S-pairs and retire basis elements that become top reducible.
@@ -161,10 +161,10 @@ void BuchbergerAlg::step() {
<< p.first << ", "
<< p.second << ")" << std::endl;
}
- std::auto_ptr<Poly> reduced(mReducer->classicReduceSPoly
+ std::unique_ptr<Poly> reduced(mReducer->classicReduceSPoly
(mBasis.poly(p.first), mBasis.poly(p.second), mBasis));
if (!reduced->isZero()) {
- insertReducedPoly(reduced);
+ insertReducedPoly(std::move(reduced));
if (mUseAutoTailReduction)
autoTailReduce();
}
diff --git a/src/mathicgb/BuchbergerAlg.hpp b/src/mathicgb/BuchbergerAlg.hpp
index 5b02ab6..4a03a1f 100644
--- a/src/mathicgb/BuchbergerAlg.hpp
+++ b/src/mathicgb/BuchbergerAlg.hpp
@@ -64,11 +64,11 @@ private:
void autoTailReduce();
- void insertReducedPoly(std::auto_ptr<Poly> poly);
+ void insertReducedPoly(std::unique_ptr<Poly> poly);
const PolyRing& mRing;
- std::auto_ptr<FreeModuleOrder> mOrder;
- std::auto_ptr<Reducer> mReducer;
+ std::unique_ptr<FreeModuleOrder> mOrder;
+ std::unique_ptr<Reducer> mReducer;
PolyBasis mBasis;
SPairs mSPairs;
mic::Timer mTimer;
diff --git a/src/mathicgb/DivisorLookup.cpp b/src/mathicgb/DivisorLookup.cpp
index b7d8576..c2886a5 100644
--- a/src/mathicgb/DivisorLookup.cpp
+++ b/src/mathicgb/DivisorLookup.cpp
@@ -21,7 +21,7 @@ namespace {
class DivListFactory : public DivisorLookup::Factory {
public:
DivListFactory(const PolyRing& ring, bool useDivMask): mRing(ring), mUseDivMask(useDivMask) {}
- virtual std::auto_ptr<DivisorLookup> create(
+ virtual std::unique_ptr<DivisorLookup> create(
bool preferSparseReducers,
bool allowRemovals
) const {
@@ -33,7 +33,7 @@ namespace {
private:
template<bool UseDivMask>
- std::auto_ptr<DivisorLookup> createIt(bool preferSparseReducers) const {
+ std::unique_ptr<DivisorLookup> createIt(bool preferSparseReducers) const {
typedef DivLookupConfiguration<true, UseDivMask> Configuration;
bool useDM = UseDivMask;
Configuration configuration(
@@ -45,7 +45,7 @@ namespace {
DefaultParams::minRebuildRatio,
(useDM ? 1 : 3),
preferSparseReducers);
- return std::auto_ptr<DivisorLookup>
+ return std::unique_ptr<DivisorLookup>
(new DivLookup<mathic::DivList<Configuration> >(configuration));
}
@@ -56,7 +56,7 @@ namespace {
class KDTreeFactory : public DivisorLookup::Factory {
public:
KDTreeFactory(const PolyRing& ring, bool useDivMask): mRing(ring), mUseDivMask(useDivMask) {}
- virtual std::auto_ptr<DivisorLookup> create(
+ virtual std::unique_ptr<DivisorLookup> create(
bool preferSparseReducers,
bool allowRemovals
) const {
@@ -75,7 +75,7 @@ namespace {
private:
template<bool AllowRemovals, bool UseDivMask>
- std::auto_ptr<DivisorLookup> createAllowRemovals(
+ std::unique_ptr<DivisorLookup> createAllowRemovals(
bool preferSparseReducers
) const {
typedef DivLookupConfiguration<AllowRemovals, UseDivMask> Configuration;
@@ -89,7 +89,7 @@ namespace {
DefaultParams::minRebuildRatio,
(useDM ? 2 : 4),
preferSparseReducers);
- return std::auto_ptr<DivisorLookup>
+ return std::unique_ptr<DivisorLookup>
(new DivLookup<mathic::KDTree<Configuration> >(configuration));
}
const PolyRing& mRing;
@@ -97,18 +97,18 @@ namespace {
};
}
-std::auto_ptr<DivisorLookup::Factory> DivisorLookup::makeFactory(
+std::unique_ptr<DivisorLookup::Factory> DivisorLookup::makeFactory(
const PolyRing& ring,
int type
) {
if (type == 1)
- return std::auto_ptr<Factory>(new DivListFactory(ring, true));
+ return std::unique_ptr<Factory>(new DivListFactory(ring, true));
else if (type == 2)
- return std::auto_ptr<Factory>(new KDTreeFactory(ring, true));
+ return std::unique_ptr<Factory>(new KDTreeFactory(ring, true));
if (type == 3)
- return std::auto_ptr<Factory>(new DivListFactory(ring, false));
+ return std::unique_ptr<Factory>(new DivListFactory(ring, false));
else if (type == 4)
- return std::auto_ptr<Factory>(new KDTreeFactory(ring, false));
+ return std::unique_ptr<Factory>(new KDTreeFactory(ring, false));
else if (type == 0)
throw std::runtime_error("Divisor lookup 0 (DivisorLookupGB) disabled.");
else
diff --git a/src/mathicgb/DivisorLookup.hpp b/src/mathicgb/DivisorLookup.hpp
index ae9889a..5ddd2fe 100644
--- a/src/mathicgb/DivisorLookup.hpp
+++ b/src/mathicgb/DivisorLookup.hpp
@@ -51,10 +51,10 @@ public:
class Factory {
public:
- virtual std::auto_ptr<DivisorLookup> create
+ virtual std::unique_ptr<DivisorLookup> create
(bool preferSparseReducers, bool allowRemovals) const = 0;
};
- static std::auto_ptr<Factory> makeFactory(const PolyRing& ring, int type);
+ static std::unique_ptr<Factory> makeFactory(const PolyRing& ring, int type);
// choices for type: 1: divlist, 2:kdtree.
class EntryOutput {
diff --git a/src/mathicgb/F4Reducer.cpp b/src/mathicgb/F4Reducer.cpp
index 42ed9c3..008d768 100755
--- a/src/mathicgb/F4Reducer.cpp
+++ b/src/mathicgb/F4Reducer.cpp
@@ -3,31 +3,31 @@
#include "F4MatrixBuilder.hpp"
-F4Reducer::F4Reducer(const PolyRing& ring, std::auto_ptr<Reducer> fallback):
- mFallback(fallback), mRing(ring) {
+F4Reducer::F4Reducer(const PolyRing& ring, std::unique_ptr<Reducer> fallback):
+ mFallback(std::move(fallback)), mRing(ring) {
}
-std::auto_ptr<Poly> F4Reducer::classicReduce
+std::unique_ptr<Poly> F4Reducer::classicReduce
(const Poly& poly, const PolyBasis& basis) {
- std::auto_ptr<Poly> p;
+ std::unique_ptr<Poly> p;
p = mFallback->classicReduce(poly, basis);
mSigStats = mFallback->sigStats();
mClassicStats = mFallback->classicStats();
return p;
}
-std::auto_ptr<Poly> F4Reducer::classicTailReduce
+std::unique_ptr<Poly> F4Reducer::classicTailReduce
(const Poly& poly, const PolyBasis& basis) {
- std::auto_ptr<Poly> p;
+ std::unique_ptr<Poly> p;
p = mFallback->classicTailReduce(poly, basis);
mSigStats = mFallback->sigStats();
mClassicStats = mFallback->classicStats();
return p;
}
-std::auto_ptr<Poly> F4Reducer::classicReduceSPoly
+std::unique_ptr<Poly> F4Reducer::classicReduceSPoly
(const Poly& a, const Poly& b, const PolyBasis& basis) {
- std::auto_ptr<Poly> p;
+ std::unique_ptr<Poly> p;
{
p = mFallback->classicReduceSPoly(a, b, basis);
mSigStats = mFallback->sigStats();
diff --git a/src/mathicgb/F4Reducer.hpp b/src/mathicgb/F4Reducer.hpp
index 91315d9..4651011 100755
--- a/src/mathicgb/F4Reducer.hpp
+++ b/src/mathicgb/F4Reducer.hpp
@@ -6,15 +6,15 @@
class F4Reducer : public Reducer {
public:
- F4Reducer(const PolyRing& ring, std::auto_ptr<Reducer> fallback);
+ F4Reducer(const PolyRing& ring, std::unique_ptr<Reducer> fallback);
- virtual std::auto_ptr<Poly> classicReduce
+ virtual std::unique_ptr<Poly> classicReduce
(const Poly& poly, const PolyBasis& basis);
- virtual std::auto_ptr<Poly> classicTailReduce
+ virtual std::unique_ptr<Poly> classicTailReduce
(const Poly& poly, const PolyBasis& basis);
- virtual std::auto_ptr<Poly> classicReduceSPoly
+ virtual std::unique_ptr<Poly> classicReduceSPoly
(const Poly& a, const Poly& b, const PolyBasis& basis);
virtual Poly* regularReduce(
@@ -27,7 +27,7 @@ public:
virtual size_t getMemoryUse() const;
private:
- std::auto_ptr<Reducer> mFallback;
+ std::unique_ptr<Reducer> mFallback;
const PolyRing& mRing;
};
diff --git a/src/mathicgb/FreeModuleOrder.cpp b/src/mathicgb/FreeModuleOrder.cpp
index e3e09f9..8e5dc39 100755
--- a/src/mathicgb/FreeModuleOrder.cpp
+++ b/src/mathicgb/FreeModuleOrder.cpp
@@ -258,9 +258,9 @@ public:
preComparisons = mPreComparisons;
}
- virtual std::auto_ptr<SigSPairQueue>
+ virtual std::unique_ptr<SigSPairQueue>
createSigSPairQueue(GroebnerBasis const& basis) const {
- return std::auto_ptr<SigSPairQueue>
+ return std::unique_ptr<SigSPairQueue>
(new ConcreteSigSPairQueue<Cmp>(basis, mCmp));
}
diff --git a/src/mathicgb/FreeModuleOrder.hpp b/src/mathicgb/FreeModuleOrder.hpp
index a4349ab..43f7da3 100755
--- a/src/mathicgb/FreeModuleOrder.hpp
+++ b/src/mathicgb/FreeModuleOrder.hpp
@@ -40,7 +40,7 @@ public:
virtual std::string description() const = 0;
- virtual std::auto_ptr<SigSPairQueue>
+ virtual std::unique_ptr<SigSPairQueue>
createSigSPairQueue(GroebnerBasis const& basis) const = 0;
/// @todo: We need at least an enum to make this clearer and the return type
diff --git a/src/mathicgb/GroebnerBasis.cpp b/src/mathicgb/GroebnerBasis.cpp
index 2b0d3d0..7dfdb95 100755
--- a/src/mathicgb/GroebnerBasis.cpp
+++ b/src/mathicgb/GroebnerBasis.cpp
@@ -42,14 +42,14 @@ GroebnerBasis::~GroebnerBasis()
}
void GroebnerBasis::addComponent() {
- std::auto_ptr<DivisorLookup> lookup =
+ std::unique_ptr<DivisorLookup> lookup =
mDivisorLookupFactory->create(mPreferSparseReducers, true);
lookup->setSigBasis(*this);
mSignatureLookup.push_back(0);
mSignatureLookup.back() = lookup.release(); // only release after alloc
}
-void GroebnerBasis::insert(monomial sig, std::auto_ptr<Poly> f)
+void GroebnerBasis::insert(monomial sig, std::unique_ptr<Poly> f)
{
ASSERT(f.get() != 0);
ASSERT(f->getLeadCoefficient() != 0);
@@ -70,7 +70,7 @@ void GroebnerBasis::insert(monomial sig, std::auto_ptr<Poly> f)
sigLeadRatio.push_back(ratio);
const_monomial const lead = f->getLeadMonomial();
- mBasis.insert(f);
+ mBasis.insert(std::move(f));
if (mBasis.leadMinimal(mBasis.size() - 1)) {
mMinimalDivisorLookup->removeMultiples(lead);
mMinimalDivisorLookup->insert(lead, index);
diff --git a/src/mathicgb/GroebnerBasis.hpp b/src/mathicgb/GroebnerBasis.hpp
index 0908696..51e291b 100644
--- a/src/mathicgb/GroebnerBasis.hpp
+++ b/src/mathicgb/GroebnerBasis.hpp
@@ -55,7 +55,7 @@ public:
// Takes over ownership of sig and f. sig must come from the pool
// of ring() and f must have been allocated with new.
- void insert(monomial sig, std::auto_ptr<Poly> f);
+ void insert(monomial sig, std::unique_ptr<Poly> f);
const_monomial getSignature(size_t i) const {
ASSERT(i < size());
@@ -139,7 +139,7 @@ private:
return mBasis.divisorLookup();
}
- std::auto_ptr<DivisorLookup::Factory const> const mDivisorLookupFactory;
+ std::unique_ptr<DivisorLookup::Factory const> const mDivisorLookupFactory;
// may change at next insert!
size_t ratioRank(size_t index) const {
@@ -180,7 +180,7 @@ private:
std::vector<DivisorLookup*> mSignatureLookup;
// contains those lead terms that are minimal
- std::auto_ptr<DivisorLookup> const mMinimalDivisorLookup;
+ std::unique_ptr<DivisorLookup> const mMinimalDivisorLookup;
PolyBasis mBasis;
bool const mPreferSparseReducers;
diff --git a/src/mathicgb/Ideal.cpp b/src/mathicgb/Ideal.cpp
index e5cc08c..25b4ed7 100644
--- a/src/mathicgb/Ideal.cpp
+++ b/src/mathicgb/Ideal.cpp
@@ -16,7 +16,7 @@ Ideal::~Ideal()
delete mGenerators[i];
}
-void Ideal::insert(std::auto_ptr<Poly> p) {
+void Ideal::insert(std::unique_ptr<Poly> p) {
mGenerators.reserve(mGenerators.size() + 1);
mGenerators.push_back(p.release());
}
diff --git a/src/mathicgb/Ideal.hpp b/src/mathicgb/Ideal.hpp
index e9105a9..2b2ed62 100755
--- a/src/mathicgb/Ideal.hpp
+++ b/src/mathicgb/Ideal.hpp
@@ -17,7 +17,7 @@ public:
Ideal(const PolyRing &R) : mRing(R) {}
~Ideal();
- void insert(std::auto_ptr<Poly> p);
+ void insert(std::unique_ptr<Poly> p);
static Ideal *parse(std::istream &i); // reads ring, #gens, each generator in turn
void display(std::ostream &o, bool print_comp) const; // inverse operation
diff --git a/src/mathicgb/PolyBasis.cpp b/src/mathicgb/PolyBasis.cpp
index 586ee6f..e305773 100755
--- a/src/mathicgb/PolyBasis.cpp
+++ b/src/mathicgb/PolyBasis.cpp
@@ -7,11 +7,11 @@
PolyBasis::PolyBasis(
const PolyRing& ring,
FreeModuleOrder& order,
- std::auto_ptr<DivisorLookup> divisorLookup
+ std::unique_ptr<DivisorLookup> divisorLookup
):
mRing(ring),
mOrder(order),
- mDivisorLookup(divisorLookup)
+ mDivisorLookup(std::move(divisorLookup))
{
ASSERT(mDivisorLookup.get() != 0);
mDivisorLookup->setBasis(*this);
@@ -25,21 +25,21 @@ PolyBasis::~PolyBasis() {
}
}
-std::auto_ptr<Ideal> PolyBasis::initialIdeal() const {
- std::auto_ptr<Ideal> ideal(new Ideal(mRing));
+std::unique_ptr<Ideal> PolyBasis::initialIdeal() const {
+ std::unique_ptr<Ideal> ideal(new Ideal(mRing));
size_t const idealSize = size();
for (size_t gen = 0; gen != idealSize; ++gen) {
if (!retired(gen) && leadMinimal(gen)) {
- std::auto_ptr<Poly> p(new Poly(&mRing));
+ std::unique_ptr<Poly> p(new Poly(&mRing));
p->appendTerm(1, leadMonomial(gen));
- ideal->insert(p);
+ ideal->insert(std::move(p));
}
}
ideal->sort(mOrder);
return ideal;
}
-void PolyBasis::insert(std::auto_ptr<Poly> poly) {
+void PolyBasis::insert(std::unique_ptr<Poly> poly) {
ASSERT(poly.get() != 0);
const size_t index = size();
EntryIter const stop = mEntries.end();
diff --git a/src/mathicgb/PolyBasis.hpp b/src/mathicgb/PolyBasis.hpp
index 5052835..a350b35 100755
--- a/src/mathicgb/PolyBasis.hpp
+++ b/src/mathicgb/PolyBasis.hpp
@@ -17,18 +17,18 @@ public:
PolyBasis(
const PolyRing& ring,
FreeModuleOrder& order,
- std::auto_ptr<DivisorLookup> divisorLookup);
+ std::unique_ptr<DivisorLookup> divisorLookup);
// Deletes the Poly's stored in the basis.
~PolyBasis();
// Returns the initial monomial ideal of the basis (not the ideal).
- std::auto_ptr<Ideal> initialIdeal() const;
+ std::unique_ptr<Ideal> initialIdeal() const;
// Inserts a polynomial into the basis at index size().
// Lead monomials must be unique among basis elements.
// So the index is size() - 1 afterwards since size() will increase by 1.
- void insert(std::auto_ptr<Poly> poly);
+ void insert(std::unique_ptr<Poly> poly);
// Returns the index of a basis element whose lead term divides mon.
// Returns -1 if there is no such basis element.
@@ -40,7 +40,7 @@ public:
// Replaces basis element at index with the given new value. The lead
// term of the new polynomial must be the same as the previous one.
// This is useful for auto-tail-reduction.
- void replaceSameLeadTerm(size_t index, std::auto_ptr<Poly> newValue) {
+ void replaceSameLeadTerm(size_t index, std::unique_ptr<Poly> newValue) {
ASSERT(index < size());
ASSERT(!retired(index));
ASSERT(newValue.get() != 0);
@@ -109,11 +109,11 @@ public:
// Retires the basis element at index, which frees the memory associated
// to it, including the basis element polynomial, and marks it as retired.
// todo: implement
- std::auto_ptr<Poly> retire(size_t index) {
+ std::unique_ptr<Poly> retire(size_t index) {
ASSERT(index < size());
ASSERT(!retired(index));
mDivisorLookup->remove(leadMonomial(index));
- std::auto_ptr<Poly> poly(mEntries[index].poly);
+ std::unique_ptr<Poly> poly(mEntries[index].poly);
mEntries[index].poly = 0;
mEntries[index].retired = true;
return poly;
@@ -256,7 +256,7 @@ private:
const PolyRing& mRing;
FreeModuleOrder& mOrder;
- std::auto_ptr<DivisorLookup> mDivisorLookup;
+ std::unique_ptr<DivisorLookup> mDivisorLookup;
std::vector<Entry> mEntries;
mutable Stats mStats;
diff --git a/src/mathicgb/Reducer.cpp b/src/mathicgb/Reducer.cpp
index e2d6f2d..2bc262e 100755
--- a/src/mathicgb/Reducer.cpp
+++ b/src/mathicgb/Reducer.cpp
@@ -31,11 +31,11 @@ Reducer::Reducer():
Reducer::~Reducer() {
}
-std::auto_ptr<Reducer> Reducer::makeReducer(
+std::unique_ptr<Reducer> Reducer::makeReducer(
ReducerType type,
PolyRing const& ring
) {
- std::auto_ptr<Reducer> reducer = makeReducerNullOnUnknown(type, ring);
+ std::unique_ptr<Reducer> reducer = makeReducerNullOnUnknown(type, ring);
if (reducer.get() == 0) {
std::ostringstream error;
error << "Unknown or unimplemented reducer type " << type << ".\n";
@@ -44,80 +44,80 @@ std::auto_ptr<Reducer> Reducer::makeReducer(
return reducer;
}
-std::auto_ptr<Reducer> Reducer::makeReducerNullOnUnknown(
+std::unique_ptr<Reducer> Reducer::makeReducerNullOnUnknown(
ReducerType type,
PolyRing const& ring
) {
switch (type) {
case Reducer_PolyHeap:
- return std::auto_ptr<Reducer>(new PolyHeap(&ring));
+ return std::unique_ptr<Reducer>(new PolyHeap(&ring));
case Reducer_PolyGeoBucket:
- return std::auto_ptr<Reducer>(new PolyGeoBucket(&ring));
+ return std::unique_ptr<Reducer>(new PolyGeoBucket(&ring));
case Reducer_Poly:
- return std::auto_ptr<Reducer>(new PolyReducer(&ring));
+ return std::unique_ptr<Reducer>(new PolyReducer(&ring));
case Reducer_PolyHash:
- return std::auto_ptr<Reducer>(new PolyHashReducer(&ring));
+ return std::unique_ptr<Reducer>(new PolyHashReducer(&ring));
case Reducer_BjarkeGeo:
- return std::auto_ptr<Reducer>(new BjarkeGeobucket2(&ring));
+ return std::unique_ptr<Reducer>(new BjarkeGeobucket2(&ring));
case Reducer_TournamentTree:
- return std::auto_ptr<Reducer>(new TournamentReducer(ring));
- //return std::auto_ptr<Reducer>
+ return std::unique_ptr<Reducer>(new TournamentReducer(ring));
+ //return std::unique_ptr<Reducer>
//(new ReducerPack<mic::TourTree>(ring));
case Reducer_HashTourTree:
- return std::auto_ptr<Reducer>(new HashTourReducer(ring));
+ return std::unique_ptr<Reducer>(new HashTourReducer(ring));
case Reducer_TourTree_NoDedup:
- return std::auto_ptr<Reducer>(new ReducerNoDedup<mic::TourTree>(ring));
+ return std::unique_ptr<Reducer>(new ReducerNoDedup<mic::TourTree>(ring));
case Reducer_TourTree_Dedup:
- return std::auto_ptr<Reducer>(new ReducerDedup<mic::TourTree>(ring));
+ return std::unique_ptr<Reducer>(new ReducerDedup<mic::TourTree>(ring));
case Reducer_TourTree_Hashed:
- return std::auto_ptr<Reducer>(new ReducerHash<mic::TourTree>(ring));
+ return std::unique_ptr<Reducer>(new ReducerHash<mic::TourTree>(ring));
//break;
case Reducer_TourTree_NoDedup_Packed:
- return std::auto_ptr<Reducer>(new ReducerPack<mic::TourTree>(ring));
+ return std::unique_ptr<Reducer>(new ReducerPack<mic::TourTree>(ring));
case Reducer_TourTree_Dedup_Packed:
- return std::auto_ptr<Reducer>(new ReducerPackDedup<mic::TourTree>(ring));
+ return std::unique_ptr<Reducer>(new ReducerPackDedup<mic::TourTree>(ring));
case Reducer_TourTree_Hashed_Packed:
- return std::auto_ptr<Reducer>(new ReducerHashPack<mic::TourTree>(ring));
+ return std::unique_ptr<Reducer>(new ReducerHashPack<mic::TourTree>(ring));
case Reducer_Heap_NoDedup:
- return std::auto_ptr<Reducer>(new ReducerNoDedup<mic::Heap>(ring));
+ return std::unique_ptr<Reducer>(new ReducerNoDedup<mic::Heap>(ring));
case Reducer_Heap_Dedup:
- return std::auto_ptr<Reducer>(new ReducerDedup<mic::Heap>(ring));
+ return std::unique_ptr<Reducer>(new ReducerDedup<mic::Heap>(ring));
case Reducer_Heap_Hashed:
- return std::auto_ptr<Reducer>(new ReducerHash<mic::Heap>(ring));
+ return std::unique_ptr<Reducer>(new ReducerHash<mic::Heap>(ring));
//break;
case Reducer_Heap_NoDedup_Packed:
- return std::auto_ptr<Reducer>(new ReducerPack<mic::Heap>(ring));
+ return std::unique_ptr<Reducer>(new ReducerPack<mic::Heap>(ring));
case Reducer_Heap_Dedup_Packed:
- return std::auto_ptr<Reducer>(new ReducerPackDedup<mic::Heap>(ring));
+ return std::unique_ptr<Reducer>(new ReducerPackDedup<mic::Heap>(ring));
case Reducer_Heap_Hashed_Packed:
- return std::auto_ptr<Reducer>(new ReducerHashPack<mic::Heap>(ring));
+ return std::unique_ptr<Reducer>(new ReducerHashPack<mic::Heap>(ring));
case Reducer_Geobucket_NoDedup:
- return std::auto_ptr<Reducer>(new ReducerNoDedup<mic::Geobucket>(ring));
+ return std::unique_ptr<Reducer>(new ReducerNoDedup<mic::Geobucket>(ring));
case Reducer_Geobucket_Dedup:
- return std::auto_ptr<Reducer>(new ReducerDedup<mic::Geobucket>(ring));
+ return std::unique_ptr<Reducer>(new ReducerDedup<mic::Geobucket>(ring));
case Reducer_Geobucket_Hashed:
- return std::auto_ptr<Reducer>(new ReducerHash<mic::Geobucket>(ring));
+ return std::unique_ptr<Reducer>(new ReducerHash<mic::Geobucket>(ring));
case Reducer_Geobucket_NoDedup_Packed:
- return std::auto_ptr<Reducer>(new ReducerPack<mic::Geobucket>(ring));
+ return std::unique_ptr<Reducer>(new ReducerPack<mic::Geobucket>(ring));
case Reducer_Geobucket_Dedup_Packed:
- return std::auto_ptr<Reducer>(new ReducerPackDedup<mic::Geobucket>(ring));
+ return std::unique_ptr<Reducer>(new ReducerPackDedup<mic::Geobucket>(ring));
case Reducer_Geobucket_Hashed_Packed:
- return std::auto_ptr<Reducer>(new ReducerHashPack<mic::Geobucket>(ring));
+ return std::unique_ptr<Reducer>(new ReducerHashPack<mic::Geobucket>(ring));
case Reducer_F4:
{
- std::auto_ptr<Reducer> fallback = makeReducer(Reducer_BjarkeGeo, ring);
- return std::auto_ptr<Reducer>(new F4Reducer(ring, fallback));
+ std::unique_ptr<Reducer> fallback = makeReducer(Reducer_BjarkeGeo, ring);
+ return std::unique_ptr<Reducer>(new F4Reducer(ring, std::move(fallback)));
}
default:
break;
};
- return std::auto_ptr<Reducer>();
+ return std::unique_ptr<Reducer>();
}
Reducer::ReducerType Reducer::reducerType(int typ)
diff --git a/src/mathicgb/Reducer.hpp b/src/mathicgb/Reducer.hpp
index 589738f..7f45b2c 100755
--- a/src/mathicgb/Reducer.hpp
+++ b/src/mathicgb/Reducer.hpp
@@ -23,17 +23,17 @@ public:
/** Clasically reduces poly by the basis elements of basis. The reduction
is classic in that no signatures are taken into account. */
- virtual std::auto_ptr<Poly> classicReduce
+ virtual std::unique_ptr<Poly> classicReduce
(const Poly& poly, const PolyBasis& basis) = 0;
/** Clasically reduces poly by the basis elements of basis, except that the
lead term is not reduced. The reduction is classic in that no signatures
are taken into account. */
- virtual std::auto_ptr<Poly> classicTailReduce
+ virtual std::unique_ptr<Poly> classicTailReduce
(const Poly& poly, const PolyBasis& basis) = 0;
/** Clasically reduces the S-polynomial between a and b. */
- virtual std::auto_ptr<Poly> classicReduceSPoly
+ virtual std::unique_ptr<Poly> classicReduceSPoly
(const Poly& a, const Poly& b, const PolyBasis& basis) = 0;
/** Regular reduce multiple*basisElement in signature sig by the
@@ -81,10 +81,10 @@ public:
Reducer_F4
};
- static std::auto_ptr<Reducer> makeReducer
+ static std::unique_ptr<Reducer> makeReducer
(ReducerType t, PolyRing const& ring);
- static std::auto_ptr<Reducer> makeReducerNullOnUnknown
+ static std::unique_ptr<Reducer> makeReducerNullOnUnknown
(ReducerType t, PolyRing const& ring);
static ReducerType reducerType(int typ);
diff --git a/src/mathicgb/SigSPairs.hpp b/src/mathicgb/SigSPairs.hpp
index 35c89d9..9f06855 100755
--- a/src/mathicgb/SigSPairs.hpp
+++ b/src/mathicgb/SigSPairs.hpp
@@ -129,7 +129,7 @@ private:
typedef std::vector<PreSPair> PrePairContainer;
- std::auto_ptr<SigSPairQueue> mQueue;
+ std::unique_ptr<SigSPairQueue> mQueue;
SigSPairQueue::IndexSigs mIndexSigs;
mutable Stats mStats;
diff --git a/src/mathicgb/SignatureGB.cpp b/src/mathicgb/SignatureGB.cpp
index 288340d..99eb3a4 100755
--- a/src/mathicgb/SignatureGB.cpp
+++ b/src/mathicgb/SignatureGB.cpp
@@ -112,8 +112,10 @@ SignatureGB::SignatureGB(
sig = R->allocMonomial();
R->monomialEi(i, sig);
GB->addComponent();
- std::auto_ptr<Poly> autoG(g);
- GB->insert(sig, autoG);
+ {
+ std::unique_ptr<Poly> autoG(g);
+ GB->insert(sig, std::move(autoG));
+ }
}
// Populate SP
@@ -173,8 +175,10 @@ bool SignatureGB::processSPair
// new basis element
ASSERT(!GB->isSingularTopReducible(*f, sig));
- std::auto_ptr<Poly> autoF(f);
- GB->insert(sig, autoF);
+ {
+ std::unique_ptr<Poly> autoF(f);
+ GB->insert(sig, std::move(autoF));
+ }
Hsyz->addComponent();
SP->newPairs(GB->size()-1);
diff --git a/src/mathicgb/TypicalReducer.cpp b/src/mathicgb/TypicalReducer.cpp
index c04f061..8a8eb33 100755
--- a/src/mathicgb/TypicalReducer.cpp
+++ b/src/mathicgb/TypicalReducer.cpp
@@ -77,7 +77,7 @@ Poly* TypicalReducer::regularReduce(
return result;
}
-std::auto_ptr<Poly> TypicalReducer::classicReduce(const Poly& poly, const PolyBasis& basis) {
+std::unique_ptr<Poly> TypicalReducer::classicReduce(const Poly& poly, const PolyBasis& basis) {
monomial identity = basis.ring().allocMonomial(mArena);
basis.ring().monomialSetIdentity(identity);
insert(identity, &poly);
@@ -85,7 +85,7 @@ std::auto_ptr<Poly> TypicalReducer::classicReduce(const Poly& poly, const PolyBa
return classicReduce(basis);
}
-std::auto_ptr<Poly> TypicalReducer::classicTailReduce(const Poly& poly, const PolyBasis& basis) {
+std::unique_ptr<Poly> TypicalReducer::classicTailReduce(const Poly& poly, const PolyBasis& basis) {
ASSERT(&poly.ring() == &basis.ring());
ASSERT(!poly.isZero());
term identity;
@@ -94,13 +94,13 @@ std::auto_ptr<Poly> TypicalReducer::classicTailReduce(const Poly& poly, const Po
basis.ring().coefficientSetOne(identity.coeff);
insertTail(identity, &poly);
- std::auto_ptr<Poly> result(new Poly(&basis.ring()));
+ std::unique_ptr<Poly> result(new Poly(&basis.ring()));
result->appendTerm(poly.getLeadCoefficient(), poly.getLeadMonomial());
- return classicReduce(result, basis);
+ return classicReduce(std::move(result), basis);
}
-std::auto_ptr<Poly> TypicalReducer::classicReduceSPoly(
+std::unique_ptr<Poly> TypicalReducer::classicReduceSPoly(
const Poly& a,
const Poly& b,
const PolyBasis& basis
@@ -125,15 +125,15 @@ std::auto_ptr<Poly> TypicalReducer::classicReduceSPoly(
ring.coefficientNegateTo(minusOne);
insertTail(const_term(minusOne, multiple2), &b);
- std::auto_ptr<Poly> reduced = classicReduce(basis);
+ std::unique_ptr<Poly> reduced = classicReduce(basis);
ring.freeMonomial(lcm);
ring.freeMonomial(multiple1);
ring.freeMonomial(multiple2);
- return reduced;
+ return std::move(reduced);
}
-std::auto_ptr<Poly> TypicalReducer::classicReduce
- (std::auto_ptr<Poly> result, const PolyBasis& basis) {
+std::unique_ptr<Poly> TypicalReducer::classicReduce
+ (std::unique_ptr<Poly> result, const PolyBasis& basis) {
const PolyRing& ring = basis.ring();
ASSERT(&result->ring() == &ring);
++mClassicStats.reductions;
@@ -186,10 +186,10 @@ std::auto_ptr<Poly> TypicalReducer::classicReduce
std::cerr << "Classic reduction done." << std::endl;
reset();
- return result;
+ return std::move(result);
}
-std::auto_ptr<Poly> TypicalReducer::classicReduce(const PolyBasis& basis) {
- std::auto_ptr<Poly> result(new Poly(&basis.ring()));
- return classicReduce(result, basis);
+std::unique_ptr<Poly> TypicalReducer::classicReduce(const PolyBasis& basis) {
+ std::unique_ptr<Poly> result(new Poly(&basis.ring()));
+ return classicReduce(std::move(result), basis);
}
diff --git a/src/mathicgb/TypicalReducer.hpp b/src/mathicgb/TypicalReducer.hpp
index 95bfb22..fc87db9 100755
--- a/src/mathicgb/TypicalReducer.hpp
+++ b/src/mathicgb/TypicalReducer.hpp
@@ -24,13 +24,13 @@ public:
size_t basisElement,
const GroebnerBasis& basis);
- virtual std::auto_ptr<Poly> classicReduce
+ virtual std::unique_ptr<Poly> classicReduce
(const Poly& poly, const PolyBasis& basis);
- virtual std::auto_ptr<Poly> classicTailReduce
+ virtual std::unique_ptr<Poly> classicTailReduce
(const Poly& poly, const PolyBasis& basis);
- virtual std::auto_ptr<Poly> classicReduceSPoly
+ virtual std::unique_ptr<Poly> classicReduceSPoly
(const Poly& a, const Poly& b, const PolyBasis& basis);
protected:
@@ -49,9 +49,9 @@ protected:
private:
void reset();
- std::auto_ptr<Poly> classicReduce(const PolyBasis& basis);
- std::auto_ptr<Poly> classicReduce
- (std::auto_ptr<Poly> partialResult, const PolyBasis& basis);
+ std::unique_ptr<Poly> classicReduce(const PolyBasis& basis);
+ std::unique_ptr<Poly> classicReduce
+ (std::unique_ptr<Poly> partialResult, const PolyBasis& basis);
};
#endif
diff --git a/src/mathicgb/io-util.cpp b/src/mathicgb/io-util.cpp
index 196edc5..1574dab 100755
--- a/src/mathicgb/io-util.cpp
+++ b/src/mathicgb/io-util.cpp
@@ -18,9 +18,9 @@
#include "Ideal.hpp"
#include "PolyBasis.hpp"
-std::auto_ptr<Poly> polyParseFromString(const PolyRing *R, const std::string &s)
+std::unique_ptr<Poly> polyParseFromString(const PolyRing *R, const std::string &s)
{
- std::auto_ptr<Poly> f(new Poly(R));
+ std::unique_ptr<Poly> f(new Poly(R));
std::istringstream in(s);
f->parse(in);
return f;
@@ -33,16 +33,16 @@ std::string toString(const Poly *g)
return o.str();
}
-std::auto_ptr<Ideal> idealParseFromString(std::string str)
+std::unique_ptr<Ideal> idealParseFromString(std::string str)
{
std::istringstream i(str);
- return std::auto_ptr<Ideal>(Ideal::parse(i));
+ return std::unique_ptr<Ideal>(Ideal::parse(i));
}
-std::auto_ptr<PolyRing> ringFromString(std::string ringinfo)
+std::unique_ptr<PolyRing> ringFromString(std::string ringinfo)
{
std::stringstream ifil(ringinfo);
- return std::auto_ptr<PolyRing>(PolyRing::read(ifil));
+ return std::unique_ptr<PolyRing>(PolyRing::read(ifil));
}
Monomial stringToMonomial(const PolyRing *R, std::string mon)
diff --git a/src/mathicgb/io-util.hpp b/src/mathicgb/io-util.hpp
index fa2df95..42b6a62 100755
--- a/src/mathicgb/io-util.hpp
+++ b/src/mathicgb/io-util.hpp
@@ -11,7 +11,7 @@ class MonomialTableArray;
class PolyBasis;
class Ideal;
-std::auto_ptr<PolyRing> ringFromString(std::string ringinfo);
+std::unique_ptr<PolyRing> ringFromString(std::string ringinfo);
monomial monomialFromString(const PolyRing *R, std::string mon);
monomial monomialParseFromString(const PolyRing *R, std::string mon);
std::string monomialToString(const PolyRing *R, const_monomial mon);
@@ -26,8 +26,8 @@ std::string toString(GroebnerBasis *, int unused); // also displays signature
std::string toString(Ideal *);
std::string toString(const Poly *);
-std::auto_ptr<Ideal> idealParseFromString(std::string str);
-std::auto_ptr<Poly> polyParseFromString(const PolyRing *R, const std::string &s);
+std::unique_ptr<Ideal> idealParseFromString(std::string str);
+std::unique_ptr<Poly> polyParseFromString(const PolyRing *R, const std::string &s);
void output(std::ostream &o, const PolyBasis &I);
diff --git a/src/test/F4MatrixBuilder.cpp b/src/test/F4MatrixBuilder.cpp
index f05e300..d9b0630 100755
--- a/src/test/F4MatrixBuilder.cpp
+++ b/src/test/F4MatrixBuilder.cpp
@@ -25,10 +25,10 @@ namespace {
}
const Poly& addBasisElement(const std::string& str) {
- std::auto_ptr<Poly> p(new Poly(mRing.get()));
+ std::unique_ptr<Poly> p(new Poly(mRing.get()));
std::istringstream in(str);
p->parse(in);
- mBasis.insert(p);
+ mBasis.insert(std::move(p));
return mBasis.poly(mBasis.size() - 1);
}
@@ -41,11 +41,11 @@ namespace {
const PolyRing& ring() const {return *mRing;}
private:
- std::auto_ptr<PolyRing> mRing;
+ std::unique_ptr<PolyRing> mRing;
Ideal mIdeal;
- std::auto_ptr<FreeModuleOrder> mOrder;
+ std::unique_ptr<FreeModuleOrder> mOrder;
PolyBasis mBasis;
- std::auto_ptr<F4MatrixBuilder> mBuilder;
+ std::unique_ptr<F4MatrixBuilder> mBuilder;
};
}
diff --git a/src/test/FreeModuleOrderTest.cpp b/src/test/FreeModuleOrderTest.cpp
index 2ca434e..9984db7 100755
--- a/src/test/FreeModuleOrderTest.cpp
+++ b/src/test/FreeModuleOrderTest.cpp
@@ -15,7 +15,7 @@ void runTest(
) {
std::string line;
- std::auto_ptr<Ideal> ideal = idealParseFromString(idealStr);
+ std::unique_ptr<Ideal> ideal = idealParseFromString(idealStr);
const PolyRing* ring = ideal->getPolyRing();
std::vector<monomial> sigs;
@@ -43,7 +43,7 @@ void runTest(
ASSERT(sigs.size() == pairs.size());
ASSERT(sigs.size() == pairs.size());
- std::auto_ptr<FreeModuleOrder> order
+ std::unique_ptr<FreeModuleOrder> order
(FreeModuleOrder::makeOrder(orderType, ideal.get()));
order->sortAndScrambleSignatures(pairs);
for (size_t i = 0; i < pairs.size(); ++i) {
diff --git a/src/test/QuadMatrixBuilder.cpp b/src/test/QuadMatrixBuilder.cpp
index 17daa41..1ad2536 100755
--- a/src/test/QuadMatrixBuilder.cpp
+++ b/src/test/QuadMatrixBuilder.cpp
@@ -69,7 +69,7 @@ TEST(QuadMatrixBuilder, Empty) {
}
TEST(QuadMatrixBuilder, Construction) {
- std::auto_ptr<PolyRing> ring(ringFromString("32003 6 1\n1 1 1 1 1 1"));
+ std::unique_ptr<PolyRing> ring(ringFromString("32003 6 1\n1 1 1 1 1 1"));
QuadMatrixBuilder b(*ring);
createColumns("a<1>+<0>", "b<0>+c<0>+bc<0>", b);
@@ -106,7 +106,7 @@ TEST(QuadMatrixBuilder, Construction) {
}
TEST(QuadMatrixBuilder, ColumnQuery) {
- std::auto_ptr<PolyRing> ring(ringFromString("32003 6 1\n1 1 1 1 1 1"));
+ std::unique_ptr<PolyRing> ring(ringFromString("32003 6 1\n1 1 1 1 1 1"));
QuadMatrixBuilder b(*ring);
createColumns("a<1>+<0>", "b<0>+c<0>+bc<0>", b);
@@ -132,9 +132,9 @@ TEST(QuadMatrixBuilder, ColumnQuery) {
TEST(QuadMatrixBuilder, SortColumns) {
// construct builder and reverse lex order
- std::auto_ptr<PolyRing> ring(ringFromString("32003 6 1\n1 1 1 1 1 1"));
+ std::unique_ptr<PolyRing> ring(ringFromString("32003 6 1\n1 1 1 1 1 1"));
Ideal ideal(*ring);
- std::auto_ptr<FreeModuleOrder> order(FreeModuleOrder::makeOrder(1, &ideal));
+ std::unique_ptr<FreeModuleOrder> order(FreeModuleOrder::makeOrder(1, &ideal));
// one row top, no rows bottom, no columns
{
@@ -206,7 +206,7 @@ TEST(QuadMatrixBuilder, SortColumns) {
}
TEST(QuadMatrixBuilder, BuildAndClear) {
- std::auto_ptr<PolyRing> ring(ringFromString("32003 6 1\n1 1 1 1 1 1"));
+ std::unique_ptr<PolyRing> ring(ringFromString("32003 6 1\n1 1 1 1 1 1"));
QuadMatrixBuilder b(*ring);
createColumns("a<1>+<0>", "b<0>+c<0>+bc<0>", b);
diff --git a/src/test/gb-test.cpp b/src/test/gb-test.cpp
index 3082b43..b5834a4 100755
--- a/src/test/gb-test.cpp
+++ b/src/test/gb-test.cpp
@@ -32,7 +32,7 @@ TEST(IO, ideal) {
-bc2+a2e \
";
- std::auto_ptr<Ideal> I = idealParseFromString(idealA_fromStr_format);
+ std::unique_ptr<Ideal> I = idealParseFromString(idealA_fromStr_format);
EXPECT_EQ(" -bc+ad\n -b2+af\n -bc2+a2e\n", toString(I.get()));
}
@@ -245,7 +245,7 @@ spairQueue reducerType divLookup monTable buchberger postponeKoszul useBaseDivis
// check that we have a valid reducer type
Reducer::ReducerType red = Reducer::ReducerType(reducerType);
MATHICGB_ASSERT(static_cast<int>(red) == reducerType);
- std::auto_ptr<Ideal> I(idealParseFromString(idealStr));
+ std::unique_ptr<Ideal> I(idealParseFromString(idealStr));
MATHICGB_ASSERT
(Reducer::makeReducerNullOnUnknown(red, I->ring()).get() != 0);
@@ -255,7 +255,7 @@ spairQueue reducerType divLookup monTable buchberger postponeKoszul useBaseDivis
alg.setUseAutoTopReduction(autoTopReduce);
alg.setUseAutoTailReduction(autoTailReduce);
alg.computeGrobnerBasis();
- std::auto_ptr<Ideal> initialIdeal =
+ std::unique_ptr<Ideal> initialIdeal =
alg.basis().initialIdeal();
EXPECT_EQ(initialIdealStr, toString(initialIdeal.get()))
<< reducerType << ' ' << divLookup << ' '
diff --git a/src/test/poly-test.cpp b/src/test/poly-test.cpp
index 119b714..2edc069 100755
--- a/src/test/poly-test.cpp
+++ b/src/test/poly-test.cpp
@@ -46,7 +46,7 @@ c3d3-b2d4 \
TEST(PolyRing, read) {
std::stringstream o;
std::string ringinfo = "32003 6\n1 1 1 1 1 1";
- std::auto_ptr<PolyRing> R(ringFromString(ringinfo));
+ std::unique_ptr<PolyRing> R(ringFromString(ringinfo));
R->write(o);
EXPECT_EQ("32003 6 1\n 1 1 1 1 1 1\n", o.str());
@@ -54,7 +54,7 @@ TEST(PolyRing, read) {
TEST(Poly,readwrite) {
std::string f1 = "14ce2<72>+13adf<16>";
- std::auto_ptr<PolyRing> R(ringFromString("32003 6 1\n1 1 1 1 1 1"));
+ std::unique_ptr<PolyRing> R(ringFromString("32003 6 1\n1 1 1 1 1 1"));
Poly f(R.get());
std::stringstream ifil(f1);
f.parse(ifil);
@@ -89,7 +89,7 @@ bool testPolyParse2(PolyRing* R, std::string s, std::string answer)
}
TEST(Poly,parse) {
- std::auto_ptr<PolyRing> R(ringFromString("32003 6 1\n1 1 1 1 1 1"));
+ std::unique_ptr<PolyRing> R(ringFromString("32003 6 1\n1 1 1 1 1 1"));
EXPECT_TRUE(testPolyParse(R.get(), "3a<1>+<0>"));
EXPECT_TRUE(testPolyParse(R.get(), "3a<1>+13af3<0>+14cde<0>"));
@@ -104,7 +104,7 @@ bool testMonomialParse(PolyRing* R, std::string s)
}
TEST(Monomial, parse) {
- std::auto_ptr<PolyRing> R(ringFromString("32003 6 1\n1 1 1 1 1 1"));
+ std::unique_ptr<PolyRing> R(ringFromString("32003 6 1\n1 1 1 1 1 1"));
EXPECT_TRUE(testMonomialParse(R.get(), "ab2d<2>"));
EXPECT_TRUE(testMonomialParse(R.get(), "ab2d<0>"));
EXPECT_TRUE(testMonomialParse(R.get(), "<13>"));
@@ -113,7 +113,7 @@ TEST(Monomial, parse) {
}
TEST(Monomial,compare) {
- std::auto_ptr<PolyRing> R(ringFromString("32003 6 1\n1 1 1 1 1 1"));
+ std::unique_ptr<PolyRing> R(ringFromString("32003 6 1\n1 1 1 1 1 1"));
Monomial mone = stringToMonomial(R.get(), "<0>");
Monomial mone2 = stringToMonomial(R.get(), "1");
@@ -149,7 +149,7 @@ TEST(Monomial,compare) {
}
TEST(Monomial,mult) {
- std::auto_ptr<PolyRing> R(ringFromString("32003 6 1\n1 1 1 1 1 1"));
+ std::unique_ptr<PolyRing> R(ringFromString("32003 6 1\n1 1 1 1 1 1"));
Monomial m1 = stringToMonomial(R.get(), "ab2<0>");
Monomial m2 = stringToMonomial(R.get(), "a2b<0>");
@@ -166,7 +166,7 @@ TEST(Monomial,mult) {
}
TEST(Monomial,multTo) {
- std::auto_ptr<PolyRing> R(ringFromString("32003 6 1\n1 1 1 1 1 1"));
+ std::unique_ptr<PolyRing> R(ringFromString("32003 6 1\n1 1 1 1 1 1"));
Monomial m1 = stringToMonomial(R.get(), "ab2<0>");
Monomial m2 = stringToMonomial(R.get(), "a2b<0>");
@@ -181,7 +181,7 @@ TEST(Monomial,multTo) {
TEST(Monomial, divide) {
// test of monomialDivide, monomialIsDivisibleBy, monomialQuotientAndMult
- std::auto_ptr<PolyRing> R(ringFromString("32003 6 1\n1 1 1 1 1 1"));
+ std::unique_ptr<PolyRing> R(ringFromString("32003 6 1\n1 1 1 1 1 1"));
Monomial m1 = stringToMonomial(R.get(), "ab2<0>");
Monomial m2 = stringToMonomial(R.get(), "a2b<0>");
@@ -204,7 +204,7 @@ TEST(Monomial, divide) {
TEST(Monomial, monomialQuotientAndMult) {
// test of monomialQuotientAndMult
- std::auto_ptr<PolyRing> R(ringFromString("32003 6 1\n1 1 1 1 1 1"));
+ std::unique_ptr<PolyRing> R(ringFromString("32003 6 1\n1 1 1 1 1 1"));
Monomial m1 = stringToMonomial(R.get(), "ab2f2<0>");
Monomial m2 = stringToMonomial(R.get(), "af<0>");
@@ -275,7 +275,7 @@ void testMonomialOps(const PolyRing* R, std::string s1, std::string s2)
TEST(Monomial, ops)
{
- std::auto_ptr<PolyRing> R(ringFromString("32003 6 1\n1 1 1 1 1 1"));
+ std::unique_ptr<PolyRing> R(ringFromString("32003 6 1\n1 1 1 1 1 1"));
testMonomialOps(R.get(), "ab2f2<0>", "bc2df3<0>");
testMonomialOps(R.get(), "ab2f2<0>", "<0>");
@@ -287,7 +287,7 @@ TEST(Monomial, ops)
TEST(Monomial, ei)
{
- std::auto_ptr<PolyRing> R(ringFromString("32003 6 1\n1 1 1 1 1 1"));
+ std::unique_ptr<PolyRing> R(ringFromString("32003 6 1\n1 1 1 1 1 1"));
Monomial m1 = stringToMonomial(R.get(), "<1>");
Monomial m1a = R->allocMonomial1();
@@ -310,7 +310,7 @@ TEST(Monomial, ei)
TEST(Monomial, strict)
{
- std::auto_ptr<PolyRing> R(ringFromString("32003 6 1\n1 1 1 1 1 1"));
+ std::unique_ptr<PolyRing> R(ringFromString("32003 6 1\n1 1 1 1 1 1"));
Monomial m1 = stringToMonomial(R.get(), "ab2c3d4e");
Monomial m2 = stringToMonomial(R.get(), "ab2c3d4");
@@ -323,7 +323,7 @@ TEST(Monomial, strict)
TEST(Monomial, divideToNegative)
{
- std::auto_ptr<PolyRing> R(ringFromString("32003 6 1\n1 1 1 1 1 1"));
+ std::unique_ptr<PolyRing> R(ringFromString("32003 6 1\n1 1 1 1 1 1"));
Monomial m1 = stringToMonomial(R.get(), "ab100<0>");
Monomial m2 = stringToMonomial(R.get(), "ab2c3d4<0>");
@@ -347,7 +347,7 @@ TEST(Monomial, divideToNegative)
TEST(Monomial, findSignature)
{
- std::auto_ptr<PolyRing> R(ringFromString("32003 6 1\n1 1 1 1 1 1"));
+ std::unique_ptr<PolyRing> R(ringFromString("32003 6 1\n1 1 1 1 1 1"));
Monomial v1 = stringToMonomial(R.get(), "abef");
Monomial v2 = stringToMonomial(R.get(), "acdf2");
@@ -461,7 +461,7 @@ TEST(OldMonomial, monomialQuotientAndMult) {
TEST(Coeff, reciprocal) {
- std::auto_ptr<PolyRing> R(ringFromString("11 6 1\n1 1 1 1 1 1"));
+ std::unique_ptr<PolyRing> R(ringFromString("11 6 1\n1 1 1 1 1 1"));
coefficient vals[10] = {1,2,3,4,5,6,7,8,9,10};
coefficient ans[10] = {1,6,4,3,9,2,8,7,5,10};
for (int i=0; i<10; i++)
@@ -473,7 +473,7 @@ TEST(Coeff, reciprocal) {
}
TEST(Coeff, reciprocal2) {
- std::auto_ptr<PolyRing> R(ringFromString("32003 6 1\n1 1 1 1 1 1"));
+ std::unique_ptr<PolyRing> R(ringFromString("32003 6 1\n1 1 1 1 1 1"));
for (int i=1; i<32002; i++)
{
coefficient a1;
@@ -489,7 +489,7 @@ TEST(Coeff, reciprocal2) {
}
TEST(Coeff, negate) {
- std::auto_ptr<PolyRing> R(ringFromString("32003 6 1\n1 1 1 1 1 1"));
+ std::unique_ptr<PolyRing> R(ringFromString("32003 6 1\n1 1 1 1 1 1"));
for (int i=1; i<32002; i++)
{
coefficient a1 = i;
@@ -503,7 +503,7 @@ TEST(Coeff, negate) {
}
TEST(Coeff, addone) {
- std::auto_ptr<PolyRing> R(ringFromString("32003 6 1\n1 1 1 1 1 1"));
+ std::unique_ptr<PolyRing> R(ringFromString("32003 6 1\n1 1 1 1 1 1"));
for (int i=0; i<32002; i++)
{
coefficient a1 = i;
@@ -519,8 +519,8 @@ TEST(Coeff, addone) {
TEST(MTArray,Naive1) {
// We create a table here
size_t not_used = 0;
- std::auto_ptr<PolyRing> R(ringFromString("32003 6 1\n1 1 1 1 1 1"));
- std::auto_ptr<MonomialTableArray> M(MonomialTableArray::make(R.get(), 1, 6, false));
+ std::unique_ptr<PolyRing> R(ringFromString("32003 6 1\n1 1 1 1 1 1"));
+ std::unique_ptr<MonomialTableArray> M(MonomialTableArray::make(R.get(), 1, 6, false));
std::string mons[2] = {
"abc<1>",
"a2d<1>"
@@ -545,7 +545,7 @@ TEST(MTArray,Naive1) {
TEST(MTArray,DivList1) {
// We create a table here
size_t not_used = 0;
- std::auto_ptr<PolyRing> R(ringFromString("32003 6 1\n1 1 1 1 1 1"));
+ std::unique_ptr<PolyRing> R(ringFromString("32003 6 1\n1 1 1 1 1 1"));
MonomialTableArray* M(MonomialTableArray::make(R.get(), 1, 6, false));
std::string mons[2] = {
"abc<1>",
@@ -570,8 +570,8 @@ TEST(MTArray,DivList1) {
TEST(MTArray,KDTree1) {
// We create a table here
size_t not_used = 0;
- std::auto_ptr<PolyRing> R(ringFromString("32003 6 1\n1 1 1 1 1 1"));
- std::auto_ptr<MonomialTableArray> M(MonomialTableArray::make(R.get(), 2, 6, false));
+ std::unique_ptr<PolyRing> R(ringFromString("32003 6 1\n1 1 1 1 1 1"));
+ std::unique_ptr<MonomialTableArray> M(MonomialTableArray::make(R.get(), 2, 6, false));
std::string mons[2] = {
"abc<1>",
"a2d<1>"
@@ -653,7 +653,7 @@ TEST(OldMonomial, findSignatures) {
TEST(Ideal,readwrite) {
// This also tests Poly::iterator
- std::auto_ptr<Ideal> I = idealParseFromString(ideal1);
+ std::unique_ptr<Ideal> I = idealParseFromString(ideal1);
size_t ngens = I->viewGenerators().size();
EXPECT_TRUE(2 == ngens);
@@ -672,8 +672,8 @@ TEST(Ideal,readwrite) {
TEST(Poly,lead) {
// This also tests Poly::iterator, Poly::read, Poly::write
- std::auto_ptr<Ideal> I = idealParseFromString(ideal1);
- std::auto_ptr<const PolyRing> R(I->getPolyRing());
+ std::unique_ptr<Ideal> I = idealParseFromString(ideal1);
+ std::unique_ptr<const PolyRing> R(I->getPolyRing());
monomial lm = stringToMonomial(R.get(), "ab");
EXPECT_TRUE(R->monomialEQ(lm, I->getPoly(0)->getLeadMonomial()));
EXPECT_EQ(1, I->getPoly(0)->getLeadCoefficient());
@@ -685,17 +685,17 @@ TEST(Poly,lead) {
// Test reducer code /////////
//////////////////////////////
-std::auto_ptr<Poly> multIdealByPolyReducer(int typ, const Ideal& ideal, const Poly& g)
+std::unique_ptr<Poly> multIdealByPolyReducer(int typ, const Ideal& ideal, const Poly& g)
{
const PolyRing& R = ideal.ring();
- std::auto_ptr<Poly> poly(new Poly(&R));
- std::auto_ptr<Reducer> H = Reducer::makeReducer(static_cast<Reducer::ReducerType>(typ), R);
+ std::unique_ptr<Poly> poly(new Poly(&R));
+ std::unique_ptr<Reducer> H = Reducer::makeReducer(static_cast<Reducer::ReducerType>(typ), R);
for (Poly::const_iterator i = g.begin(); i != g.end(); ++i) {
monomial mon = R.allocMonomial();
R.monomialCopy(i.getMonomial(), mon);
int x = R.monomialGetComponent(mon);
R.monomialChangeComponent(mon, 0);
- std::auto_ptr<Poly> h(ideal.getPoly(x)->copy());
+ std::unique_ptr<Poly> h(ideal.getPoly(x)->copy());
h->multByTerm(i.getCoefficient(), mon);
R.monomialSetIdentity(mon);
@@ -714,8 +714,8 @@ void testPolyReducer(
const std::string& ans
) {
const PolyRing& ring = *ideal.getPolyRing();
- std::auto_ptr<Poly> g = polyParseFromString(&ring, f);
- std::auto_ptr<Poly> h = multIdealByPolyReducer(reducerType, ideal, *g);
+ std::unique_ptr<Poly> g = polyParseFromString(&ring, f);
+ std::unique_ptr<Poly> h = multIdealByPolyReducer(reducerType, ideal, *g);
if (!h->isZero()) {
Poly::iterator prev = h->begin();
Poly::iterator it = prev;
@@ -734,7 +734,7 @@ TEST(Reducer, insert) {
// use this last poly to determine what to add to the heap
// at the end, take the value of the heap, compare to answer
- std::auto_ptr<Ideal> I = idealParseFromString(ideal2); // charac is 32003
+ std::unique_ptr<Ideal> I = idealParseFromString(ideal2); // charac is 32003
for (int typ = 0; typ <= 30; ++typ) {
Reducer::ReducerType red = Reducer::ReducerType(typ);
if (static_cast<int>(red) != typ ||
@@ -770,9 +770,9 @@ std::string somePolys =
";
TEST(PolyHashTable,test1) {
- std::auto_ptr<PolyRing> R = ringFromString("32003 6 1\n1 1 1 1 1 1");
+ std::unique_ptr<PolyRing> R = ringFromString("32003 6 1\n1 1 1 1 1 1");
PolyHashTable H(R.get(),3);
- std::auto_ptr<Poly> f1 = polyParseFromString(R.get(), "3bd2+7cd2+5c2f+2adf+bdf+10cef");
+ std::unique_ptr<Poly> f1 = polyParseFromString(R.get(), "3bd2+7cd2+5c2f+2adf+bdf+10cef");
PolyHashTable::MonomialArray M1, M2;
H.fromPoly(*f1, M1);
H.fromPoly(*f1, M2);
@@ -796,10 +796,10 @@ TEST(PolyHashTable,test1) {
}
TEST(PolyHashTable,test2) {
- std::auto_ptr<PolyRing> R(ringFromString("32003 6 1\n1 1 1 1 1 1"));
+ std::unique_ptr<PolyRing> R(ringFromString("32003 6 1\n1 1 1 1 1 1"));
PolyHashTable H(R.get(), 3);
- std::auto_ptr<Poly> f1(polyParseFromString(R.get(), "3bd2+7cd2+5c2f+2adf+bdf+10cef"));
- std::auto_ptr<Poly> f2(polyParseFromString(R.get(), "-3bd2+4c2f+cef+f3"));
+ std::unique_ptr<Poly> f1(polyParseFromString(R.get(), "3bd2+7cd2+5c2f+2adf+bdf+10cef"));
+ std::unique_ptr<Poly> f2(polyParseFromString(R.get(), "-3bd2+4c2f+cef+f3"));
PolyHashTable::MonomialArray M1, M2;
H.fromPoly(*f1, M1);
H.fromPoly(*f2, M2);
@@ -807,9 +807,9 @@ TEST(PolyHashTable,test2) {
}
TEST(MonomialHashTable,test1) {
- std::auto_ptr<PolyRing> R = ringFromString("32003 6 1\n1 1 1 1 1 1");
+ std::unique_ptr<PolyRing> R = ringFromString("32003 6 1\n1 1 1 1 1 1");
MonomialHashTable H(R.get(), 3);
- std::auto_ptr<Poly> f1 = polyParseFromString(R.get(), "3bd2+7cd2+5c2f+2adf+bdf+10cef");
+ 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++)
--
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