MLIR 22.0.0git
Barvinok.cpp File Reference
#include "mlir/Analysis/Presburger/Barvinok.h"
#include "mlir/Analysis/Presburger/Utils.h"
#include "llvm/ADT/Sequence.h"
#include <algorithm>

Go to the source code of this file.

Functions

static std::pair< QuasiPolynomial, std::vector< Fraction > > substituteMuInTerm (unsigned numParams, const ParamPoint &v, const std::vector< Point > &ds, const Point &mu)
 Substitute x_i = t^μ_i in one term of a generating function, returning a quasipolynomial which represents the exponent of the numerator of the result, and a vector which represents the exponents of the denominator of the result.
static void normalizeDenominatorExponents (int &sign, QuasiPolynomial &num, std::vector< Fraction > &dens)
 Normalize all denominator exponents dens to their absolute values by multiplying and dividing by the inverses, in a function of the form sign * t^num / prod_j (1 - t^dens[j]).
static std::vector< QuasiPolynomialgetBinomialCoefficients (const QuasiPolynomial &n, unsigned r)
 Compute the binomial coefficients nCi for 0 ≤ i ≤ r, where n is a QuasiPolynomial.
static std::vector< FractiongetBinomialCoefficients (const Fraction &n, const Fraction &r)
 Compute the binomial coefficients nCi for 0 ≤ i ≤ r, where n is a QuasiPolynomial.

Function Documentation

◆ getBinomialCoefficients() [1/2]

std::vector< Fraction > getBinomialCoefficients ( const Fraction & n,
const Fraction & r )
static

Compute the binomial coefficients nCi for 0 ≤ i ≤ r, where n is a QuasiPolynomial.

Definition at line 654 of file Barvinok.cpp.

References mlir::presburger::floor().

◆ getBinomialCoefficients() [2/2]

std::vector< QuasiPolynomial > getBinomialCoefficients ( const QuasiPolynomial & n,
unsigned r )
static

Compute the binomial coefficients nCi for 0 ≤ i ≤ r, where n is a QuasiPolynomial.

Definition at line 638 of file Barvinok.cpp.

References mlir::presburger::QuasiPolynomial::getNumInputs().

Referenced by mlir::presburger::detail::computeNumTerms().

◆ normalizeDenominatorExponents()

void normalizeDenominatorExponents ( int & sign,
QuasiPolynomial & num,
std::vector< Fraction > & dens )
static

Normalize all denominator exponents dens to their absolute values by multiplying and dividing by the inverses, in a function of the form sign * t^num / prod_j (1 - t^dens[j]).

Here, sign = ± 1, num is a QuasiPolynomial, and each dens[j] is a Fraction.

Definition at line 609 of file Barvinok.cpp.

References mlir::presburger::QuasiPolynomial::getNumInputs().

Referenced by mlir::presburger::detail::computeNumTerms().

◆ substituteMuInTerm()

std::pair< QuasiPolynomial, std::vector< Fraction > > substituteMuInTerm ( unsigned numParams,
const ParamPoint & v,
const std::vector< Point > & ds,
const Point & mu )
static

Substitute x_i = t^μ_i in one term of a generating function, returning a quasipolynomial which represents the exponent of the numerator of the result, and a vector which represents the exponents of the denominator of the result.

If the returned value is {num, dens}, it represents the function t^num / \prod_j (1 - t^dens[j]). v represents the affine functions whose floors are multiplied by the generators, and ds represents the list of generators.

Definition at line 558 of file Barvinok.cpp.

References mlir::presburger::dotProduct(), and mlir::presburger::Matrix< T >::transpose().

Referenced by mlir::presburger::detail::computeNumTerms().