Generated on: Thu Mar 29 07:46:58 PDT 2012 for custom file set
// doxy/ or-tools/ src/ base/

operations_research::MathUtil Class Reference

#include <mathutil.h>

List of all members.

Static Public Member Functions

template<typename IntegralType>
static IntegralType CeilOfRatio (IntegralType numerator, IntegralType denominator)
 CeilOfRatio<IntegralType> FloorOfRatio<IntegralType> Returns the ceil (resp.
template<typename IntegralType>
static IntegralType FloorOfRatio (IntegralType numerator, IntegralType denominator)
static unsigned int GCD (unsigned int x, unsigned int y)
 Returns the greatest common divisor of two unsigned integers x and y.
static unsigned int LeastCommonMultiple (unsigned int a, unsigned int b)
 Returns the least common multiple of two unsigned integers.
template<typename T>
static T Abs (const T x)
 Absolute value of x Works correctly for unsigned types and for special floating point values.
template<typename T>
static T Square (const T x)
 Returns the square of x.


Detailed Description

Definition at line 29 of file mathutil.h.


Member Function Documentation

template<typename IntegralType>
static IntegralType operations_research::MathUtil::CeilOfRatio ( IntegralType  numerator,
IntegralType  denominator 
) [inline, static]

CeilOfRatio<IntegralType> FloorOfRatio<IntegralType> Returns the ceil (resp.

floor) of the ratio of two integers.

IntegralType: any integral type, whether signed or not. numerator: any integer: positive, negative, or zero. denominator: a non-zero integer, positive or negative.

Definition at line 39 of file mathutil.h.

template<typename IntegralType>
static IntegralType operations_research::MathUtil::FloorOfRatio ( IntegralType  numerator,
IntegralType  denominator 
) [inline, static]

Definition at line 53 of file mathutil.h.

static unsigned int operations_research::MathUtil::GCD ( unsigned int  x,
unsigned int  y 
) [inline, static]

Returns the greatest common divisor of two unsigned integers x and y.

Definition at line 68 of file mathutil.h.

static unsigned int operations_research::MathUtil::LeastCommonMultiple ( unsigned int  a,
unsigned int  b 
) [inline, static]

Returns the least common multiple of two unsigned integers.

Returns zero if either is zero.

Definition at line 79 of file mathutil.h.

template<typename T>
static T operations_research::MathUtil::Abs ( const T  x  )  [inline, static]

Absolute value of x Works correctly for unsigned types and for special floating point values.

Note: 0.0 and -0.0 are not differentiated by Abs (Abs(0.0) is -0.0), which should be OK: see the comment for Max above.

Definition at line 94 of file mathutil.h.

template<typename T>
static T operations_research::MathUtil::Square ( const T  x  )  [inline, static]

Returns the square of x.

Definition at line 99 of file mathutil.h.


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