thepeg is hosted by Hepforge, IPPP Durham
 ThePEG  2.2.1
ThePEG::Math Namespace Reference

The Math namespace includes the declaration of some useful mathematical functions. More...

## Namespaces

Functions
This namespace introduces some useful function classes with known primitive and inverse primitive functions.

## Classes

struct  MathType
MathType is an empty non-polymorphic base class for all mathematical function types. More...

struct  Power
Templated class for calculating integer powers. More...

struct  Power< 0, false >
Struct for powers. More...

struct  Power< 0, true >
Struct for powers. More...

struct  Power< N, false >
Struct for powers. More...

struct  Power< N, true >
Struct for powers. More...

## Functions

double exp1m (double x)
Return , with highest possible precision for . More...

double log1m (double)
Return , with highest possible precision for . More...

double powi (double x, int p)
Return x rased to the integer power p, using recursion. More...

double pIntegrate (double p, double xl, double xu)
Return the integral of between xl and xu. More...

double pIntegrate (int p, double xl, double xu)
Return the integral of between xl and xu. More...

double pXIntegrate (double e, double xl, double dx)
Return the integral of between xl and xl+dx with highest possible precision for and/or . More...

double pGenerate (double p, double xl, double xu, double rnd)
Generate an x between xl and xu distributed as . More...

double pGenerate (int p, double xl, double xu, double rnd)
Generate an x between xl and xu distributed as . More...

double pXGenerate (double e, double xl, double dx, double rnd)
Generate an x between xl and xl + dx distributed as with highest possible precision for and/or * . More...

template<typename FloatType >
double relativeError (FloatType x, FloatType y)
Returns (x - y)/(|x| + |y|). More...

template<typename T >
absmin (const T &x, const T &y)
Return x if |x|<|y|, else return y. More...

template<typename T >
absmax (const T &x, const T &y)
Return x if |x|>|y|, else return y. More...

template<typename T , typename U >
sign (T x, U y)
Transfer the sign of the second argument to the first. More...

template<int N>
double Pow (double x)
Templated function to calculate integer powers known at compile-time. More...

## Detailed Description

The Math namespace includes the declaration of some useful mathematical functions.

## ◆ absmax()

template<typename T >
 T ThePEG::Math::absmax ( const T & x, const T & y )
inline

Return x if |x|>|y|, else return y.

Definition at line 92 of file Maths.h.

## ◆ absmin()

template<typename T >
 T ThePEG::Math::absmin ( const T & x, const T & y )
inline

Return x if |x|<|y|, else return y.

Definition at line 86 of file Maths.h.

## ◆ exp1m()

 double ThePEG::Math::exp1m ( double x )

Return , with highest possible precision for .

Referenced by ThePEG::PartonBinInstance::eps(), pXGenerate(), and pXIntegrate().

## ◆ log1m()

 double ThePEG::Math::log1m ( double )

Return , with highest possible precision for .

Referenced by pXGenerate(), and pXIntegrate().

## ◆ pGenerate() [1/2]

 double ThePEG::Math::pGenerate ( double p, double xl, double xu, double rnd )
inline

Generate an x between xl and xu distributed as .

Definition at line 55 of file Maths.h.

## ◆ pGenerate() [2/2]

 double ThePEG::Math::pGenerate ( int p, double xl, double xu, double rnd )
inline

Generate an x between xl and xu distributed as .

Definition at line 61 of file Maths.h.

References powi().

## ◆ pIntegrate() [1/2]

 double ThePEG::Math::pIntegrate ( double p, double xl, double xu )
inline

Return the integral of between xl and xu.

Definition at line 38 of file Maths.h.

## ◆ pIntegrate() [2/2]

 double ThePEG::Math::pIntegrate ( int p, double xl, double xu )
inline

Return the integral of between xl and xu.

Definition at line 43 of file Maths.h.

References powi().

## ◆ Pow()

template<int N>
 double ThePEG::Math::Pow ( double x )
inline

Templated function to calculate integer powers known at compile-time.

Definition at line 152 of file Maths.h.

## ◆ powi()

 double ThePEG::Math::powi ( double x, int p )

Return x rased to the integer power p, using recursion.

Referenced by pGenerate(), and pIntegrate().

## ◆ pXGenerate()

 double ThePEG::Math::pXGenerate ( double e, double xl, double dx, double rnd )
inline

Generate an x between xl and xl + dx distributed as with highest possible precision for and/or * .

Parameters
 e the parameter defining the power in . xl the lower bound of the generation interval. dx the interval. rnd a flat random number in the interval ]0,1[.

Definition at line 73 of file Maths.h.

References exp1m(), and log1m().

## ◆ pXIntegrate()

 double ThePEG::Math::pXIntegrate ( double e, double xl, double dx )
inline

Return the integral of between xl and xl+dx with highest possible precision for and/or .

Definition at line 50 of file Maths.h.

References exp1m(), and log1m().

## ◆ relativeError()

template<typename FloatType >
 double ThePEG::Math::relativeError ( FloatType x, FloatType y )
inline

Returns (x - y)/(|x| + |y|).

Definition at line 80 of file Maths.h.

## ◆ sign()

template<typename T , typename U >
 T ThePEG::Math::sign ( T x, U y )
inline

Transfer the sign of the second argument to the first.

Returns if otherwise return .

Definition at line 100 of file Maths.h.