14 #ifndef MLIR_ANALYSIS_PRESBURGER_GENERATINGFUNCTION_H
15 #define MLIR_ANALYSIS_PRESBURGER_GENERATINGFUNCTION_H
21 namespace presburger {
54 std::vector<ParamPoint> nums,
55 std::vector<std::vector<Point>> dens)
56 : numParam(numParam), signs(signs), numerators(nums), denominators(dens) {
59 assert(term.getNumRows() == numParam + 1 &&
60 "dimensionality of numerator exponents does not match number of "
77 "two generating functions with different numbers of parameters "
80 sumSigns.append(gf.signs);
82 std::vector<ParamPoint> sumNumerators = numerators;
83 sumNumerators.insert(sumNumerators.end(), gf.numerators.begin(),
86 std::vector<std::vector<Point>> sumDenominators = denominators;
87 sumDenominators.insert(sumDenominators.end(), gf.denominators.begin(),
88 gf.denominators.end());
93 llvm::raw_ostream &
print(llvm::raw_ostream &os)
const {
94 for (
unsigned i = 0, e = signs.size(); i < e; i++) {
106 unsigned r = numerators[i].getNumRows();
107 for (
unsigned j = 0;
j < r - 1;
j++) {
109 for (
unsigned k = 0, c = numerators[i].getNumColumns(); k < c - 1; k++)
110 os << numerators[i].at(
j, k) <<
",";
111 os << numerators[i].getRow(
j).back() <<
"],";
114 for (
unsigned k = 0, c = numerators[i].getNumColumns(); k < c - 1; k++)
115 os << numerators[i].at(r - 1, k) <<
",";
116 os << numerators[i].getRow(r - 1).back() <<
"]]/";
118 for (
const Point &den : denominators[i]) {
120 for (
unsigned j = 0, e = den.size();
j < e - 1;
j++)
122 os << den.back() <<
"])";
131 std::vector<ParamPoint> numerators;
132 std::vector<std::vector<Point>> denominators;
unsigned getNumParams() const
llvm::raw_ostream & print(llvm::raw_ostream &os) const
GeneratingFunction operator+(const GeneratingFunction &gf) const
std::vector< ParamPoint > getNumerators() const
std::vector< std::vector< Point > > getDenominators() const
SmallVector< int > getSigns() const
GeneratingFunction(unsigned numParam, SmallVector< int > signs, std::vector< ParamPoint > nums, std::vector< std::vector< Point >> dens)
Include the generated interface declarations.
Eliminates variable at the specified position using Fourier-Motzkin variable elimination.