SPRAAK
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Data Structures | Enumerations | Functions
API_LowLvl::lib::fvg
+ Collaboration diagram for API_LowLvl::lib::fvg:

Data Structures

struct  SprStatsStats
 (this module ignores this pointer) More...
 

Enumerations

enum  { SPR_STATS_MEAN, SPR_STATS_SIGMA, SPR_STATS_COVAR, SPR_STATS_MOMENTS_ONLY }
 

Functions

SprMathReal spr_math_stats_cvt (int vlen, double *stats, SprMathReal *mu, SprMathReal *cov, SprMathReal Npt_lim)
 
SprMathReal * spr_math_stats2fvg (SprMathReal *stats, int vlen, SprMathReal *tmp)
 
double spr_math_fvgs_read (SprMathReal ***stats, char *fname, int Efmt, int *Vlen, int *Ngauss)
 
double spr_math_fvgs_eval (double *pvec, SprMathReal **fvgs, int Ngauss, int vlen, SprMathReal *x, SprMathReal *mc_x)
 
SprStatsStatsspr_stats_free (SprStatsStats *stats)
 
void spr_stats_init (SprStatsStats *stats)
 
SprStatsStatsspr_stats_alloc (SprStatsStats *stats, int what, int vlen)
 
void spr_stats_update (SprStatsStats *stats, const SprMathReal *data, int what)
 
void spr_stats_wupdate (SprStatsStats *stats, const SprMathReal *data, float weight, int what)
 
int spr_stats_calc (SprStatsStats *stats, int what, const SprMathReal *const *Data, int ndata)
 

Detailed Description

Enumeration Type Documentation

anonymous enum
Enumerator
SPR_STATS_MEAN 
SPR_STATS_SIGMA 
SPR_STATS_COVAR 
SPR_STATS_MOMENTS_ONLY 

Function Documentation

SprMathReal spr_math_stats_cvt ( int  vlen,
double *  stats,
SprMathReal *  mu,
SprMathReal *  cov,
SprMathReal  Npt_lim 
)

Conversion of the statistics (M0,M1,M2) -> (N,mu,cov). The number of points 'N' is returned as return value. The mean vector mu may be the NULL pointer. The covariance matrix cov is stored as an upper triangular matrix (first row, second 'partial' row, ...). Distributions that are estimated with less than Npt_lim are replaced with a standard normal distribution.

SprMathReal* spr_math_stats2fvg ( SprMathReal *  stats,
int  vlen,
SprMathReal *  tmp 
)

Conversion of the statistics (N,mu,cov) to statistics that are ready for fast evaluation (Mu,Lr,log(|cov|)) format. The Lr matrix is the result of an LDL-decomposition of the covariance matrix, and had the following property:

 cov^(-1) = Lr(end:-1:1,:)*Lr(end:-1:1,:)'

with Lr(end:-1:1,:) a lower triangular matrix.
The scratch array tmp must be of the same size as the stats array.

double spr_math_fvgs_read ( SprMathReal ***  stats,
char *  fname,
int  Efmt,
int *  Vlen,
int *  Ngauss 
)

Read a set of full covariance matrices. If the input matrix is NULL, a matrix of the appropriate size will be allocated. The values of Vlen and Ngauss are checked w.r.t. the the key-set, except for (-1) values (see read_matrix for more details). The format indicator Efmt is used to switch between: "standard format:" (N/Ntot,mu,cov) format with cov in upper triangular format. "evaluation format:" (mu,U,Lr,N/Ntot,log(|cov|)) format for fast evaluation.

The total number of points underneath all gaussians (Ntot) is returned (-1.0 on error).

double spr_math_fvgs_eval ( double *  pvec,
SprMathReal **  fvgs,
int  Ngauss,
int  vlen,
SprMathReal *  x,
SprMathReal *  mc_x 
)

Evaluate a set of full variance gaussians <stats,Ngauss,vlen> for the given point x. The variable mc_x is a scratch array of length vlen and is used to store the mean compensated x value. The total probability is returned.

SprStatsStats* spr_stats_free ( SprStatsStats stats)
void spr_stats_init ( SprStatsStats stats)
Parameters
statsstat buffer to initialize
SprStatsStats* spr_stats_alloc ( SprStatsStats stats,
int  what,
int  vlen 
)
Parameters
statsbuffer to allocate / complete
whatallocate for the requested statistics
vlenvector length
void spr_stats_update ( SprStatsStats stats,
const SprMathReal *  data,
int  what 
)
Parameters
statsstat buffer to update
void spr_stats_wupdate ( SprStatsStats stats,
const SprMathReal *  data,
float  weight,
int  what 
)
Parameters
statsstat buffer to update
weightweighted updata
int spr_stats_calc ( SprStatsStats stats,
int  what,
const SprMathReal *const *  Data,
int  ndata 
)

Calculate statistics for a given data-set. If the data pointer Data equals the NULL pointer, the statistics accumulated using the UpdateStats() routine will be used.

Parameters
statsbuffer to store result
whatmean, variance, ...
Datathe data to process
ndatanumber of vectors