MLIR 22.0.0git
mlir::presburger::MultiAffineFunction Class Reference

This class represents a multi-affine function with the domain as Z^d, where d is the number of domain variables of the function. More...

#include "mlir/Analysis/Presburger/PWMAFunction.h"

Public Member Functions

 MultiAffineFunction (const PresburgerSpace &space, const IntMatrix &output)
 MultiAffineFunction (const PresburgerSpace &space, const IntMatrix &output, const DivisionRepr &divs)
unsigned getNumDomainVars () const
unsigned getNumSymbolVars () const
unsigned getNumOutputs () const
unsigned getNumDivs () const
const PresburgerSpacegetSpace () const
 Get the space of this function.
PresburgerSpace getDomainSpace () const
 Get the domain/output space of the function.
PresburgerSpace getOutputSpace () const
const IntMatrixgetOutputMatrix () const
 Get a matrix with each row representing row^th output expression.
ArrayRef< DynamicAPInt > getOutputExpr (unsigned i) const
 Get the i^th output expression.
const DivisionReprgetDivs () const
 Get the divisions used in this function.
void removeOutputs (unsigned start, unsigned end)
 Remove the specified range of outputs.
void mergeDivs (MultiAffineFunction &other)
 Given a MAF other, merges division variables such that both functions have the union of the division vars that exist in the functions.
SmallVector< DynamicAPInt, 8 > valueAt (ArrayRef< DynamicAPInt > point) const
SmallVector< DynamicAPInt, 8 > valueAt (ArrayRef< int64_t > point) const
bool isEqual (const MultiAffineFunction &other) const
 Return whether the this and other are equal when the domain is restricted to domain.
bool isEqual (const MultiAffineFunction &other, const IntegerPolyhedron &domain) const
bool isEqual (const MultiAffineFunction &other, const PresburgerSet &domain) const
void subtract (const MultiAffineFunction &other)
PresburgerSet getLexSet (OrderingKind comp, const MultiAffineFunction &other) const
 Return the set of domain points where the output of this and other are ordered lexicographically according to the given ordering.
IntegerRelation getAsRelation () const
 Get this function as a relation.
void print (raw_ostream &os) const
void dump () const

Detailed Description

This class represents a multi-affine function with the domain as Z^d, where d is the number of domain variables of the function.

For example:

(x, y) -> (x + 2, 2*x - 3y + 5, 2*x + y).

The output expressions are represented as a matrix with one row for every output, one column for each var including division variables, and an extra column at the end for the constant term.

Checking equality of two such functions is supported, as well as finding the value of the function at a specified point.

Definition at line 41 of file PWMAFunction.h.

Constructor & Destructor Documentation

◆ MultiAffineFunction() [1/2]

mlir::presburger::MultiAffineFunction::MultiAffineFunction ( const PresburgerSpace & space,
const IntMatrix & output )
inline

Definition at line 43 of file PWMAFunction.h.

Referenced by getLexSet(), isEqual(), isEqual(), isEqual(), mergeDivs(), and subtract().

◆ MultiAffineFunction() [2/2]

mlir::presburger::MultiAffineFunction::MultiAffineFunction ( const PresburgerSpace & space,
const IntMatrix & output,
const DivisionRepr & divs )
inline

Definition at line 49 of file PWMAFunction.h.

Member Function Documentation

◆ dump()

void MultiAffineFunction::dump ( ) const

Definition at line 68 of file PWMAFunction.cpp.

References print().

◆ getAsRelation()

IntegerRelation MultiAffineFunction::getAsRelation ( ) const

◆ getDivs()

const DivisionRepr & mlir::presburger::MultiAffineFunction::getDivs ( ) const
inline

Get the divisions used in this function.

Definition at line 75 of file PWMAFunction.h.

◆ getDomainSpace()

PresburgerSpace mlir::presburger::MultiAffineFunction::getDomainSpace ( ) const
inline

Get the domain/output space of the function.

The returned space is a set space.

Definition at line 64 of file PWMAFunction.h.

References mlir::presburger::PresburgerSpace::getDomainSpace().

Referenced by getLexSet().

◆ getLexSet()

◆ getNumDivs()

unsigned mlir::presburger::MultiAffineFunction::getNumDivs ( ) const
inline

Definition at line 58 of file PWMAFunction.h.

Referenced by getLexSet(), and mergeDivs().

◆ getNumDomainVars()

unsigned mlir::presburger::MultiAffineFunction::getNumDomainVars ( ) const
inline

Definition at line 55 of file PWMAFunction.h.

Referenced by getAsRelation(), and valueAt().

◆ getNumOutputs()

unsigned mlir::presburger::MultiAffineFunction::getNumOutputs ( ) const
inline

Definition at line 57 of file PWMAFunction.h.

Referenced by getAsRelation(), getLexSet(), removeOutputs(), subtract(), and valueAt().

◆ getNumSymbolVars()

unsigned mlir::presburger::MultiAffineFunction::getNumSymbolVars ( ) const
inline

Definition at line 56 of file PWMAFunction.h.

Referenced by valueAt().

◆ getOutputExpr()

ArrayRef< DynamicAPInt > mlir::presburger::MultiAffineFunction::getOutputExpr ( unsigned i) const
inline

Get the i^th output expression.

Definition at line 70 of file PWMAFunction.h.

Referenced by getAsRelation(), getLexSet(), and subtract().

◆ getOutputMatrix()

const IntMatrix & mlir::presburger::MultiAffineFunction::getOutputMatrix ( ) const
inline

Get a matrix with each row representing row^th output expression.

Definition at line 68 of file PWMAFunction.h.

◆ getOutputSpace()

PresburgerSpace mlir::presburger::MultiAffineFunction::getOutputSpace ( ) const
inline

Definition at line 65 of file PWMAFunction.h.

References mlir::presburger::PresburgerSpace::getRangeSpace().

◆ getSpace()

const PresburgerSpace & mlir::presburger::MultiAffineFunction::getSpace ( ) const
inline

Get the space of this function.

Definition at line 61 of file PWMAFunction.h.

Referenced by getLexSet().

◆ isEqual() [1/3]

bool MultiAffineFunction::isEqual ( const MultiAffineFunction & other) const

Return whether the this and other are equal when the domain is restricted to domain.

This is the case if they lie in the same space, and their outputs are equal for every point in domain.

Definition at line 96 of file PWMAFunction.cpp.

References getAsRelation(), mlir::presburger::IntegerRelation::isEqual(), and MultiAffineFunction().

◆ isEqual() [2/3]

◆ isEqual() [3/3]

bool MultiAffineFunction::isEqual ( const MultiAffineFunction & other,
const PresburgerSet & domain ) const

◆ mergeDivs()

◆ print()

void MultiAffineFunction::print ( raw_ostream & os) const

Definition at line 60 of file PWMAFunction.cpp.

Referenced by dump().

◆ removeOutputs()

void MultiAffineFunction::removeOutputs ( unsigned start,
unsigned end )

Remove the specified range of outputs.

Definition at line 125 of file PWMAFunction.cpp.

References getNumOutputs(), and mlir::presburger::Range.

◆ subtract()

void MultiAffineFunction::subtract ( const MultiAffineFunction & other)

Definition at line 387 of file PWMAFunction.cpp.

References getNumOutputs(), getOutputExpr(), mergeDivs(), and MultiAffineFunction().

◆ valueAt() [1/2]

SmallVector< DynamicAPInt, 8 > MultiAffineFunction::valueAt ( ArrayRef< DynamicAPInt > point) const

Definition at line 71 of file PWMAFunction.cpp.

References getNumDomainVars(), getNumOutputs(), getNumSymbolVars(), and result.

Referenced by valueAt().

◆ valueAt() [2/2]

SmallVector< DynamicAPInt, 8 > mlir::presburger::MultiAffineFunction::valueAt ( ArrayRef< int64_t > point) const
inline

Definition at line 86 of file PWMAFunction.h.

References mlir::presburger::getDynamicAPIntVec(), and valueAt().


The documentation for this class was generated from the following files: