Frobby  0.9.5
TermExtra.h
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  Copyright (C) 2010 University of Aarhus
4  Contact Bjarke Hammersholt Roune for license information (www.broune.com)
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program. If not, see http://www.gnu.org/licenses/.
18 */
19 #ifndef TERM_EXTRA_GUARD
20 #define TERM_EXTRA_GUARD
21 
22 #include "Term.h"
23 
31 Exponent median(const Exponent* a, size_t varCount);
32 inline Exponent median(const Term& a) {
33  return median(a.begin(), a.getVarCount());
34 }
35 
38 Exponent medianPositive(const Exponent* a, size_t varCount);
39 inline Exponent medianPositive(const Term& a) {
40  return medianPositive(a.begin(), a.getVarCount());
41 }
42 
46 void totalDegree(mpz_class& res, const Exponent* a, size_t varCount);
47 inline void totalDegree(mpz_class& res, const Term& a) {
48  totalDegree(res, a.begin(), a.getVarCount());
49 }
50 
53 Exponent minimumPositive(const Exponent* a, size_t varCount);
54 inline Exponent minimumPositive(const Term& a) {
55  return minimumPositive(a.begin(), a.getVarCount());
56 }
57 
60 Exponent maximum(const Exponent* a, size_t varCount);
61 inline Exponent maximum(const Term& a) {
62  return maximum(a.begin(), a.getVarCount());
63 }
64 
65 #endif
Exponent median(const Exponent *a, size_t varCount)
Returns the lower median exponent of a.
Definition: TermExtra.cpp:25
Exponent medianPositive(const Exponent *a, size_t varCount)
Returns the lower median of the positive exponents of a.
Definition: TermExtra.cpp:35
void totalDegree(mpz_class &res, const Exponent *a, size_t varCount)
Puts the sum of the entries of a into res.
Definition: TermExtra.cpp:49
Exponent minimumPositive(const Exponent *a, size_t varCount)
Returns the smallest positive exponent of a.
Definition: TermExtra.cpp:55
Exponent maximum(const Exponent *a, size_t varCount)
Returns the largest exponent of a.
Definition: TermExtra.cpp:68
Term represents a product of variables which does not include a coefficient.
Definition: Term.h:49
Exponent * begin()
Definition: Term.h:79
size_t getVarCount() const
Definition: Term.h:85
unsigned int Exponent
Definition: stdinc.h:89