LibTest.h
Go to the documentation of this file.
/* Frobby: Software for monomial ideal computations.
Copyright (C) 2009 Bjarke Hammersholt Roune (www.broune.com)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see http://www.gnu.org/licenses/.
*/
#ifndef LIB_TEST_GUARD
#define LIB_TEST_GUARD
#include "frobby.h"
#include "BigIdeal.h"
#include "BigPolynomial.h"
#include <vector>
Frobby::Ideal toLibIdeal(const BigIdeal& ideal);
const mpz_t* castLibArray(const vector<mpz_class>& vect);
class LibIdealConsumer : public Frobby::IdealConsumer {
public:
LibIdealConsumer(const VarNames& names);
virtual void idealBegin(size_t varCount);
virtual void consume(mpz_ptr* exponentVector);
const BigIdeal& getIdeal() const;
bool hasAnyOutput() const;
private:
bool _hasAnyOutput;
mutable BigIdeal _ideal;
};
class LibIdealsConsumer : public Frobby::IdealConsumer {
public:
LibIdealsConsumer(const VarNames& names);
virtual void idealBegin(size_t varCount);
virtual void consume(mpz_ptr* exponentVector);
const vector<BigIdeal>& getIdeals() const;
private:
mutable vector<BigIdeal> _ideals;
VarNames _names;
};
class LibPolynomialConsumer : public Frobby::PolynomialConsumer {
public:
LibPolynomialConsumer(const VarNames& names);
virtual void polynomialBegin(size_t varCount);
virtual void consume(const mpz_t coef, mpz_ptr* exponentVector);
const BigPolynomial& getPolynomial() const;
private:
mutable BigPolynomial _polynomial;
};
#endif
BigIdeal.h
BigPolynomial.h
castLibArray
const mpz_t * castLibArray(const vector< mpz_class > &vect)
Returns a pointer to an array of mpt_t that represents the entries in the mpz_class.
Definition LibTest.cpp:41
toLibIdeal
Frobby::Ideal toLibIdeal(const BigIdeal &ideal)
Returns a library interface ideal that corresponds to the parameter ideal.
Definition LibTest.cpp:26
BigIdeal
Definition BigIdeal.h:27
BigPolynomial
Definition BigPolynomial.h:27
Frobby::IdealConsumer
This class provides a way to get monomial ideals as output from Frobby one generator at a time.
Definition frobby.h:75
Frobby::Ideal
Definition frobby.h:35
Frobby::PolynomialConsumer
This class provides a way to get polynomials as output from Frobby one term at a time.
Definition frobby.h:112
LibIdealConsumer::getIdeal
const BigIdeal & getIdeal() const
Returns the recorded ideal in a canonical form.
Definition LibTest.cpp:66
LibIdealConsumer::consume
virtual void consume(mpz_ptr *exponentVector)
For output of a generator of the ideal.
Definition LibTest.cpp:60
LibIdealConsumer::idealBegin
virtual void idealBegin(size_t varCount)
Called before output of a monomial ideal.
Definition LibTest.cpp:53
LibIdealConsumer::_hasAnyOutput
bool _hasAnyOutput
Definition LibTest.h:53
LibIdealConsumer::LibIdealConsumer
LibIdealConsumer(const VarNames &names)
Definition LibTest.cpp:48
LibIdealConsumer::_ideal
BigIdeal _ideal
Definition LibTest.h:54
LibIdealConsumer::hasAnyOutput
bool hasAnyOutput() const
Returns whether any ideal has been recorded.
Definition LibTest.cpp:71
LibIdealsConsumer::_names
VarNames _names
Definition LibTest.h:70
LibIdealsConsumer::consume
virtual void consume(mpz_ptr *exponentVector)
For output of a generator of the ideal.
Definition LibTest.cpp:85
LibIdealsConsumer::LibIdealsConsumer
LibIdealsConsumer(const VarNames &names)
Definition LibTest.cpp:76
LibIdealsConsumer::idealBegin
virtual void idealBegin(size_t varCount)
Called before output of a monomial ideal.
Definition LibTest.cpp:80
LibIdealsConsumer::getIdeals
const vector< BigIdeal > & getIdeals() const
Returns the recorded ideals in a canonical form.
Definition LibTest.cpp:91
LibIdealsConsumer::_ideals
vector< BigIdeal > _ideals
Definition LibTest.h:69
LibPolynomialConsumer::getPolynomial
const BigPolynomial & getPolynomial() const
Returns the recorded polynomial in a canonical form.
Definition LibTest.cpp:113
LibPolynomialConsumer::polynomialBegin
virtual void polynomialBegin(size_t varCount)
Called before output of a polynomial.
Definition LibTest.cpp:102
LibPolynomialConsumer::consume
virtual void consume(const mpz_t coef, mpz_ptr *exponentVector)
For output of a term of the polynomial.
Definition LibTest.cpp:106
LibPolynomialConsumer::_polynomial
BigPolynomial _polynomial
Definition LibTest.h:85
LibPolynomialConsumer::LibPolynomialConsumer
LibPolynomialConsumer(const VarNames &names)
Definition LibTest.cpp:98
VarNames
Defines the variables of a polynomial ring and facilities IO involving them.
Definition VarNames.h:40
frobby.h