MLIR  16.0.0git
Public Member Functions | Public Attributes | List of all members
mlir::presburger::Fraction Struct Reference

A class to represent fractions. More...

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

+ Collaboration diagram for mlir::presburger::Fraction:

Public Member Functions

 Fraction ()=default
 Default constructor initializes the represented rational number to zero. More...
 
 Fraction (const MPInt &oNum, const MPInt &oDen)
 Construct a Fraction from a numerator and denominator. More...
 
 Fraction (const MPInt &num, int64_t den)
 Overloads for passing literals. More...
 
 Fraction (int64_t num, const MPInt &den)
 
 Fraction (int64_t num, int64_t den)
 
MPInt getAsInteger () const
 

Public Attributes

MPInt num {0}
 The numerator and denominator, respectively. More...
 
MPInt den {1}
 

Detailed Description

A class to represent fractions.

The sign of the fraction is represented in the sign of the numerator; the denominator is always positive.

Note that overflows may occur if the numerator or denominator are not representable by 64-bit integers.

Definition at line 28 of file Fraction.h.

Constructor & Destructor Documentation

◆ Fraction() [1/5]

mlir::presburger::Fraction::Fraction ( )
default

Default constructor initializes the represented rational number to zero.

Referenced by mlir::presburger::operator*(), and mlir::presburger::operator-().

◆ Fraction() [2/5]

mlir::presburger::Fraction::Fraction ( const MPInt oNum,
const MPInt oDen 
)
inline

Construct a Fraction from a numerator and denominator.

Definition at line 33 of file Fraction.h.

References den, and num.

◆ Fraction() [3/5]

mlir::presburger::Fraction::Fraction ( const MPInt num,
int64_t  den 
)
inline

Overloads for passing literals.

Definition at line 40 of file Fraction.h.

◆ Fraction() [4/5]

mlir::presburger::Fraction::Fraction ( int64_t  num,
const MPInt den 
)
inline

Definition at line 41 of file Fraction.h.

◆ Fraction() [5/5]

mlir::presburger::Fraction::Fraction ( int64_t  num,
int64_t  den 
)
inline

Definition at line 42 of file Fraction.h.

Member Function Documentation

◆ getAsInteger()

MPInt mlir::presburger::Fraction::getAsInteger ( ) const
inline

Definition at line 46 of file Fraction.h.

References den, and num.

Referenced by mlir::presburger::LexSimplex::findIntegerLexMin().

Member Data Documentation

◆ den

MPInt mlir::presburger::Fraction::den {1}

◆ num

MPInt mlir::presburger::Fraction::num {0}

The numerator and denominator, respectively.

The denominator is always positive.

Definition at line 53 of file Fraction.h.

Referenced by mlir::presburger::ceil(), mlir::presburger::compare(), mlir::presburger::floor(), Fraction(), getAsInteger(), mlir::presburger::operator*(), and mlir::presburger::operator-().


The documentation for this struct was generated from the following file: