Context algorithm
Semi-predictive context algorithm implementation
 All Data Structures Files Functions Variables Typedefs Macros Pages
gammaFunc.c File Reference
#include "gammaTable.h"
#include "gammaFunc.h"
#include "debug.h"
#include "reset.h"
#include <math.h>

Go to the source code of this file.

Macros

#define LNPI_2   M_LNPI / 2
 Ln of PI/2. More...
 

Functions

static double evalLogGamma (int n)
 Calculates Ln (gamma(n)). More...
 
static double evalLogGamma2 (int n)
 Calculates Ln (gamma(n + 1/2)). More...
 
double kt (statistics_t stats)
 Calculates the Krichevsky-Trofimov probability assignment. More...
 
double nodeCost (statistics_t stats)
 Calculates the cost of a node. More...
 
double escapeCost (statistics_t stats, Uint *distinct)
 Calculates the cost of escapes in a node. More...
 
double log2Alpha ()
 Returns the log2 of the alphabet size. More...
 
double hAlpha ()
 Returns the binary entropy of 1/alphasize. More...
 

Variables

static double alphasizeLog = 0
 Log2 of the alphabet size. More...
 
static double alphaEntropy = 0
 Binary entropy of 1/alphasize. More...
 

Macro Definition Documentation

#define LNPI_2   M_LNPI / 2

Ln of PI/2.

Definition at line 36 of file gammaFunc.c.

Function Documentation

double escapeCost ( statistics_t  stats,
Uint distinct 
)

Calculates the cost of escapes in a node.

Parameters
[in]statsThe statistics needed to calculate the probability assignment.
Returns
KT probability assignment.

Definition at line 143 of file gammaFunc.c.

static double evalLogGamma ( int  n)
static

Calculates Ln (gamma(n)).

Parameters
[in]nthe argument.
Returns
Ln (gamma(n)).

Definition at line 49 of file gammaFunc.c.

static double evalLogGamma2 ( int  n)
static

Calculates Ln (gamma(n + 1/2)).

Parameters
[in]nthe argument.
Returns
Ln (gamma(n + 1/2)).

Definition at line 73 of file gammaFunc.c.

double hAlpha ( )

Returns the binary entropy of 1/alphasize.

Returns
binary entropy of 1/alphasize.

Definition at line 171 of file gammaFunc.c.

double kt ( statistics_t  stats)

Calculates the Krichevsky-Trofimov probability assignment.

Parameters
[in]statsThe statistics needed to calculate the probability assignment.
Returns
KT probability assignment.

Definition at line 96 of file gammaFunc.c.

double log2Alpha ( )

Returns the log2 of the alphabet size.

Returns
log2 of the alphabet size.

Definition at line 160 of file gammaFunc.c.

double nodeCost ( statistics_t  stats)

Calculates the cost of a node.

Parameters
[in]statsThe statistics needed to calculate the probability assignment.
Returns
KT probability assignment.

Definition at line 123 of file gammaFunc.c.

Variable Documentation

double alphaEntropy = 0
static

Binary entropy of 1/alphasize.

Definition at line 42 of file gammaFunc.c.

double alphasizeLog = 0
static

Log2 of the alphabet size.

Definition at line 39 of file gammaFunc.c.