Frobby 0.9.5
CoefBigTermConsumer.cpp
Go to the documentation of this file.
1/* Frobby: Software for monomial ideal computations.
2 Copyright (C) 2007 Bjarke Hammersholt Roune (www.broune.com)
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see http://www.gnu.org/licenses/.
16*/
17#include "stdinc.h"
18#include "CoefBigTermConsumer.h"
19
20#include "BigPolynomial.h"
21#include "Term.h"
22
23// Do not use this implementation when in need of high performance, since
24// allocating a new big term each time is not very efficient.
25void CoefBigTermConsumer::consume(const mpz_class& coef, const Term& term) {
26 vector<mpz_class> bigTerm;
27 bigTerm.reserve(term.getVarCount());
28 for (size_t var = 0; var < term.getVarCount(); ++var)
29 bigTerm.push_back(term[var]);
30 consume(coef, bigTerm);
31}
32
34 consumeRing(poly.getNames());
36 for (size_t index = 0; index < poly.getTermCount(); ++index)
37 consume(poly.getCoef(index), poly.getTerm(index));
39}
void nameFactoryRegister(NameFactory< AbstractProduct > &factory)
Registers the string returned by ConcreteProduct::getStaticName() to a function that default-construc...
virtual void beginConsuming()=0
virtual void consume(const mpz_class &coef, const Term &term)
virtual void doneConsuming()=0
virtual void consumeRing(const VarNames &names)=0
Term represents a product of variables which does not include a coefficient.
Definition Term.h:49
size_t getVarCount() const
Definition Term.h:85