Sleipnir
Static Public Member Functions
Sleipnir::CMath Class Reference

Utility class containing static basic math functions. More...

#include <mathb.h>

Inheritance diagram for Sleipnir::CMath:
Sleipnir::CMathImpl Sleipnir::CStatisticsImpl Sleipnir::CStatistics

Static Public Member Functions

static double LogFact (size_t iN)
 Returns the log of N factorial.
static double Sigmoid (double dHeight, double dShift, double dSlope, double dVertical, double dX)
 Calculates the sigmoid function with the given parameters.
static size_t GCD (size_t iA, size_t iB)
 Return greatest common denominator of A and B.
static size_t Round (double d)
 Return given value rounded to the nearest unsigned integer.
template<class tType , class tIter >
static bool LeastSquares (const tIter BeginY, const tIter EndY, const tIter BeginX, const tIter EndX, tType &Alpha, tType &Beta, bool fAlpha=true)

Detailed Description

Utility class containing static basic math functions.

Definition at line 35 of file mathb.h.


Member Function Documentation

static size_t Sleipnir::CMath::GCD ( size_t  iA,
size_t  iB 
) [inline, static]

Return greatest common denominator of A and B.

Parameters:
iAFirst integer.
iBSecond integer.
Returns:
Greatest common denominator of A and B.
Remarks:
Mmm, Euclid's algorithm.

Definition at line 81 of file mathb.h.

double Sleipnir::CMath::LogFact ( size_t  iN) [static]

Returns the log of N factorial.

Parameters:
iNInteger to be factorialed and logged.
Returns:
log(N!)
Remarks:
Calculated exactly and cached for small N, calculated using Stirling's approximation for large N.

Definition at line 42 of file mathb.cpp.

Referenced by Sleipnir::CStatistics::HypergeometricPDF().

static size_t Sleipnir::CMath::Round ( double  d) [inline, static]

Return given value rounded to the nearest unsigned integer.

Parameters:
dFloating point value to round.
Returns:
Given value rounded to the nearest unsigned integer.
Remarks:
Calculated as the floor of the given value plus 0.5. It would be peachy if Microsoft would get on top of C99 and implement round correctly...

Definition at line 105 of file mathb.h.

Referenced by Sleipnir::CColor::operator*().

static double Sleipnir::CMath::Sigmoid ( double  dHeight,
double  dShift,
double  dSlope,
double  dVertical,
double  dX 
) [inline, static]

Calculates the sigmoid function with the given parameters.

Parameters:
dHeightHeight (multiplier) of sigmoid.
dShiftHorizontal shift (difference) of sigmoid.
dSlopeSlope (sharpness) of sigmoid.
dVerticalVertical shift (constant addend) of sigmoid.
dXPoint at which sigmoid should be evaluated.
Returns:
dVertical + (dHeight / (1 + exp(-dSlope * (dX - dShift))))

Definition at line 61 of file mathb.h.


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