38 _term(new mpz_ptr[varCount]) {
49 for (
size_t var = 0; var <
_varCount; ++var)
50 _term[var] =
const_cast<mpz_ptr
>
54 void setTerm(
const vector<mpz_class>& term) {
57 for (
size_t var = 0; var <
_varCount; ++var)
58 _term[var] =
const_cast<mpz_ptr
>(term[var].get_mpz_t());
91 virtual void consume(
const vector<mpz_class>& term) {
136 const vector<mpz_class>& term) {
139 for (
size_t var = 0; var <
_varCount; ++var)
140 _term[var] =
const_cast<mpz_ptr
>(term[var].get_mpz_t());
182 _atVariable(variableCount) {
232 mpz_set(ref.get_mpz_t(), exponent);
237 mpz_class tmp(exponent);
242 mpz_class tmp(exponent);
247 const mpz_t* reflectionMonomial,
255 SliceFacade facade(params, bigIdeal, wrappedConsumer);
257 if (reflectionMonomial == 0)
260 vector<mpz_class> point;
262 for (
size_t var = 0; var < bigIdeal.
getVarCount(); ++var)
263 mpz_set(point[var].get_mpz_t(), reflectionMonomial[var]);
267 reflectionMonomial = 0;
280 const Ideal& reflectionMonomial,
291 const vector<mpz_class>& monomial = reflectionIdeal.
getTerm(0);
292 const mpz_t* monomialPtr = 0;
294 monomialPtr = (
const mpz_t*)&(monomial[0]);
306 SliceFacade facade(params, bigIdeal, wrappedConsumer);
317 SliceFacade facade(params, bigIdeal, wrappedConsumer);
338 _varCount = varCount;
339 _term.resize(varCount);
340 for (
size_t var = 0; var < _varCount; ++var)
341 _term[var] = _zero.get_mpz_t();
348 virtual void consume(mpz_ptr* exponentVector) {
349 _consumer->idealBegin(_varCount);
352 for (
size_t var = 0; var < _varCount; ++var) {
353 if (mpz_cmp_ui(exponentVector[var], 0) != 0) {
355 _term[var] = exponentVector[var];
356 _consumer->consume(&*(_term.begin()));
357 _term[var] = _zero.get_mpz_t();
361 _consumer->idealEnd();
390 SliceFacade facade(params, bigIdeal, wrappedConsumer);
403 SliceFacade facade(params, bigIdeal, wrappedConsumer);
415 SliceFacade facade(params, bigIdeal, wrappedConsumer);
427 vector<mpz_class> grading;
428 for (
size_t var = 0; var < bigIdeal.
getVarCount(); ++var)
429 grading.push_back(mpz_class(l[var]));
435 SliceFacade facade(params, bigIdeal, wrappedConsumer);
452 mpz_set(dim, dimen.get_mpz_t());
462 SliceFacade facade(params, bigIdeal, wrappedConsumer);
const vector< mpz_class > & getTerm(size_t term) const
mpz_class & getLastTermExponentRef(size_t var)
size_t getVarCount() const
size_t getGeneratorCount() const
ConsumerWrapper(size_t varCount)
void setTerm(const vector< mpz_class > &term)
void setTerm(const Term &term, const TermTranslator &translator)
virtual ~ConsumerWrapper()
virtual void doneConsuming()
Must be called once after each time beginConsuming has been called.
ExternalIdealConsumerWrapper(Frobby::IdealConsumer *consumer, size_t varCount)
Frobby::IdealConsumer * _consumer
virtual void consumeRing(const VarNames &names)
Tell the consumer which ring is being used.
virtual void consume(const Term &term, const TermTranslator &translator)
virtual void consume(const vector< mpz_class > &term)
virtual void beginConsuming()
Tell the consumer to begin consuming an ideal.
virtual void beginConsuming()
virtual void doneConsuming()
virtual void consume(const mpz_class &coef, const Term &term, const TermTranslator &translator)
virtual void consumeRing(const VarNames &names)
ExternalPolynomialConsumerWrapper(Frobby::PolynomialConsumer *consumer, size_t varCount)
Frobby::PolynomialConsumer * _consumer
virtual void consume(const mpz_class &coef, const vector< mpz_class > &term)
This is the base of the Frobby exception hierarchy for exceptions that can occur due to expected erro...
FrobbyIdealHelper(size_t variableCount)
static const BigIdeal & getIdeal(const Frobby::Ideal &ideal)
This class provides a way to get monomial ideals as output from Frobby one generator at a time.
virtual void idealBegin(size_t varCount)
Called before output of a monomial ideal.
virtual ~IdealConsumer()
The provided implementation does nothing.
virtual void idealEnd()
Called after output of a monomial ideal.
virtual void consume(mpz_ptr *exponentVector)=0
For output of a generator of the ideal.
Ideal & operator=(const Ideal &ideal)
Ideal(size_t variableCount)
FrobbyImpl::FrobbyIdealHelper * _data
void addExponent(const mpz_t exponent)
Call addExponent once for each variable to add a term one exponent at a time.
This class provides a way to get polynomials as output from Frobby one term at a time.
virtual void polynomialBegin(size_t varCount)
Called before output of a polynomial.
virtual ~PolynomialConsumer()
The provided implementation does nothing.
virtual void polynomialEnd()
Called after output of a polynomial.
virtual void consume(const mpz_t coefficient, mpz_ptr *exponentVector)=0
For output of a term of the polynomial.
A facade for performing operations on BigIdeal.
mpz_class computeDimension(const BigIdeal &ideal, bool codimension=false, bool squareFreeAndMinimal=false)
Compute the Krull dimension of ideal.
IdealConsumer * _consumer
virtual void idealBegin(size_t varCount)
Called before output of a monomial ideal.
virtual void idealEnd()
Called after output of a monomial ideal.
~IrreducibleIdealDecoder()
IrreducibleIdealDecoder(IdealConsumer *consumer)
virtual void consume(mpz_ptr *exponentVector)
For output of a generator of the ideal.
A facade for operations on monomial ideals using the Slice Algorithm.
void computeAlexanderDual(const vector< mpz_class > &point)
Compute the Alexander dual of the ideal.
void computeAssociatedPrimes()
Compute the associated primes of the ideal.
void computeMultigradedHilbertSeries()
Compute the numerator of the multigraded Hilbert-Poincare series.
bool solveStandardProgram(const vector< mpz_class > &grading, mpz_class &value, bool reportAllSolutions)
Solve an optimization program over maximal standard monomials.
void computeUnivariateHilbertSeries()
Compute the numerator of the univariate Hilbert-Poincare series.
void computePrimaryDecomposition()
Compute the unique "nicest" primary decomposition of the ideal.
void computeIrreducibleDecomposition(bool encode)
Compute the unique irredundant set of irreducible ideals whose intersection equals ideal.
void computeMaximalStandardMonomials()
Compute the maximal standard monomials of the ideal.
void useIndependenceSplits(bool value)
TermTranslator handles translation between terms whose exponents are infinite precision integers and ...
const mpz_class & getExponent(size_t variable, Exponent exponent) const
This method translates from IDs to arbitrary precision integers.
size_t getVarCount() const
Term represents a product of variables which does not include a coefficient.
size_t getVarCount() const
Defines the variables of a polynomial ring and facilities IO involving them.
size_t getVarCount() const
Returns the current number of variables.
The namespace FrobbyImpl is for internal use inside Frobby only.
void dimension(const Ideal &ideal, mpz_t dim)
Compute the Krull dimension of a monomial ideal.
bool alexanderDual(const Ideal &ideal, const mpz_t *reflectionMonomial, IdealConsumer &consumer)
Compute the Alexander dual of ideal using the point reflectionMonomial.
void irreducibleDecompositionAsIdeals(const Ideal &ideal, IdealConsumer &consumer)
Compute the irreducible decomposition of ideal.
void codimension(const Ideal &ideal, mpz_t codim)
Compute the codimension of a monomial ideal.
void associatedPrimes(const Ideal &ideal, IdealConsumer &consumer)
Compute the associated primes of the ideal.
void univariateHilbertPoincareSeries(const Ideal &ideal, PolynomialConsumer &consumer)
Compute the univariate Hilbert-Poincare series of ideal.
bool solveStandardMonomialProgram(const Ideal &ideal, const mpz_t *l, IdealConsumer &consumer)
Solve the optimization program.
bool irreducibleDecompositionAsMonomials(const Ideal &ideal, IdealConsumer &consumer)
Compute the irreducible decomposition of ideal, and encode each irreducible component as a monomial.
void maximalStandardMonomials(const Ideal &ideal, IdealConsumer &consumer)
Compute the maximal standard monomials of ideal.
void primaryDecomposition(const Ideal &ideal, IdealConsumer &consumer)
Compute the canonical primary decomposition of a monomial ideal.
void multigradedHilbertPoincareSeries(const Ideal &ideal, PolynomialConsumer &consumer)
Compute the multigraded Hilbert-Poincare series of ideal.
bool isIdentity(const Word *a, Word *aEnd)
const char *const version