MLIR  20.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"

Public Member Functions

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

Public Attributes

DynamicAPInt num {0}
 The numerator and denominator, respectively. More...
 
DynamicAPInt 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 29 of file Fraction.h.

Constructor & Destructor Documentation

◆ Fraction() [1/5]

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

Default constructor initializes the represented rational number to zero.

◆ Fraction() [2/5]

mlir::presburger::Fraction::Fraction ( const DynamicAPInt &  oNum,
const DynamicAPInt &  oDen = DynamicAPInt(1) 
)
inline

Construct a Fraction from a numerator and denominator.

Definition at line 34 of file Fraction.h.

References den, and num.

◆ Fraction() [3/5]

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

Overloads for passing literals.

Definition at line 42 of file Fraction.h.

◆ Fraction() [4/5]

mlir::presburger::Fraction::Fraction ( int64_t  num,
const DynamicAPInt &  den = DynamicAPInt(1) 
)
inline

Definition at line 44 of file Fraction.h.

◆ Fraction() [5/5]

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

Definition at line 46 of file Fraction.h.

Member Function Documentation

◆ getAsInteger()

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

Definition at line 51 of file Fraction.h.

References den, and num.

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

◆ print()

llvm::raw_ostream& mlir::presburger::Fraction::print ( llvm::raw_ostream &  os) const
inline

Definition at line 56 of file Fraction.h.

References den, and num.

Referenced by mlir::presburger::operator<<().

Member Data Documentation

◆ den

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

◆ num

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

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