Frobby 0.9.5
fourti2.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 "fourti2.h"
19
20#include "BigIdeal.h"
21#include "Scanner.h"
22#include "IOHandler.h"
23#include "error.h"
24
25namespace fourti2 {
27 ideal.newLastTerm();
28
30 scanner.readIntegerAndNegativeAsZero(tmp);
31
32 if (tmp > 0)
33 reportError("Encountered positive entry as first entry in term. "
34 "This is impossible if using the required degree reverse "
35 "lexicographic term order.\n");
36
37 for (size_t i = 0; i < ideal.getVarCount(); ++i) {
38 scanner.readIntegerAndNegativeAsZero(tmp);
39 if (tmp > 0)
41 }
42 }
43
45 size_t termCount;
46 size_t varCount;
47
48 scanner.readSizeT(termCount);
49 scanner.readSizeT(varCount);
50
51 if (varCount == 0)
53 ("The matrix defining the Frobenius-related Grobner basis must "
54 "have at least one column, and this one has none.");
55
57 basis.clearAndSetNames(names);
58
59 for (size_t i = 0; i < termCount; ++i)
61 }
62
64 size_t rowCount;
65 size_t columnCount;
66
67 scanner.readSizeT(rowCount);
68 scanner.readSizeT(columnCount);
69
71 basis.clearAndSetNames(names);
72
73 for (unsigned int i = 0; i < rowCount; ++i) {
74 basis.newLastTerm();
75 for (unsigned int j = 0; j < columnCount; ++j)
76 scanner.readInteger(basis.getLastTermExponentRef(j));
77 }
78 }
79
81 fprintf(out, "%lu %lu\n",
82 (unsigned long)basis.getGeneratorCount(),
83 (unsigned long)basis.getVarCount());
84 for (unsigned int i = 0; i < basis.getGeneratorCount(); ++i) {
85 const char* prefix = "";
86 for (unsigned int j = 0; j < basis[i].size(); ++j) {
87 gmp_fprintf(out, "%s%Zd", prefix, basis[i][j].get_mpz_t());
88 prefix = " ";
89 }
90 fputc('\n', out);
91 }
92 }
93}
void nameFactoryRegister(NameFactory< AbstractProduct > &factory)
Registers the string returned by ConcreteProduct::getStaticName() to a function that default-construc...
void newLastTerm()
Definition BigIdeal.cpp:104
mpz_class & getLastTermExponentRef(size_t var)
Definition BigIdeal.h:126
size_t getVarCount() const
Definition BigIdeal.h:148
This class offers an input interface which is more convenient and for some purposes more efficient th...
Definition Scanner.h:50
Defines the variables of a polynomial ring and facilities IO involving them.
Definition VarNames.h:40
void reportError(const string &errorMsg)
Definition error.cpp:23
void readGrobnerBasis(Scanner &scanner, BigIdeal &basis)
Definition fourti2.cpp:44
void readTerm(BigIdeal &ideal, Scanner &scanner)
Definition fourti2.cpp:26
void readLatticeBasis(Scanner &scanner, BigIdeal &basis)
Definition fourti2.cpp:63
void writeLatticeBasis(FILE *out, const BigIdeal &basis)
Definition fourti2.cpp:80