tesseract-doxygen/classify/cluster.cpp File Reference

#include "oldheap.h"
#include "const.h"
#include "cluster.h"
#include "general.h"
#include "cutil.h"
#include "ocrfeatures.h"
#include "oldlist.h"
#include "emalloc.h"
#include "tprintf.h"
#include "danerror.h"
#include "freelist.h"
#include <math.h>

Classes

struct  TEMPCLUSTER
struct  STATISTICS
struct  BUCKETS
struct  CHISTRUCT

Defines

#define HOTELLING   1
#define FTABLE_X   10
#define FTABLE_Y   100
#define MINVARIANCE   0.0001
#define MINBUCKETS   5
#define MINSAMPLESPERBUCKET   5
#define MINSAMPLES   (MINBUCKETS * MINSAMPLESPERBUCKET)
#define MINSAMPLESNEEDED   1
#define BUCKETTABLESIZE   1024
#define NORMALEXTENT   3.0
#define Odd(N)   ((N)%2)
#define Mirror(N, R)   ((R) - (N) - 1)
#define Abs(N)   ( ( (N) < 0 ) ? ( -(N) ) : (N) )
#define SqrtOf2Pi   2.506628275
#define LOOKUPTABLESIZE   8
#define MAXBUCKETS   39
#define MAXDEGREESOFFREEDOM   MAXBUCKETS
#define MAXNEIGHBORS   2
#define MAXDISTANCE   MAX_FLOAT32
#define CHIACCURACY   0.01
#define MINALPHA   (1e-200)
#define INITIALDELTA   0.1
#define DELTARATIO   0.1
#define ILLEGAL_CHAR   2

Typedefs

typedef FLOAT64(* DENSITYFUNC )(inT32)
typedef FLOAT64(* SOLVEFUNC )(CHISTRUCT *, double)

Functions

void CreateClusterTree (CLUSTERER *Clusterer)
void MakePotentialClusters (CLUSTER *Cluster, VISIT Order, inT32 Level)
CLUSTERFindNearestNeighbor (KDTREE *Tree, CLUSTER *Cluster, FLOAT32 *Distance)
CLUSTERMakeNewCluster (CLUSTERER *Clusterer, TEMPCLUSTER *TempCluster)
inT32 MergeClusters (inT16 N, register PARAM_DESC ParamDesc[], register inT32 n1, register inT32 n2, register FLOAT32 m[], register FLOAT32 m1[], register FLOAT32 m2[])
void ComputePrototypes (CLUSTERER *Clusterer, CLUSTERCONFIG *Config)
PROTOTYPEMakePrototype (CLUSTERER *Clusterer, CLUSTERCONFIG *Config, CLUSTER *Cluster)
PROTOTYPEMakeDegenerateProto (uinT16 N, CLUSTER *Cluster, STATISTICS *Statistics, PROTOSTYLE Style, inT32 MinSamples)
PROTOTYPETestEllipticalProto (CLUSTERER *Clusterer, CLUSTERCONFIG *Config, CLUSTER *Cluster, STATISTICS *Statistics)
PROTOTYPEMakeSphericalProto (CLUSTERER *Clusterer, CLUSTER *Cluster, STATISTICS *Statistics, BUCKETS *Buckets)
PROTOTYPEMakeEllipticalProto (CLUSTERER *Clusterer, CLUSTER *Cluster, STATISTICS *Statistics, BUCKETS *Buckets)
PROTOTYPEMakeMixedProto (CLUSTERER *Clusterer, CLUSTER *Cluster, STATISTICS *Statistics, BUCKETS *NormalBuckets, FLOAT64 Confidence)
void MakeDimRandom (uinT16 i, PROTOTYPE *Proto, PARAM_DESC *ParamDesc)
void MakeDimUniform (uinT16 i, PROTOTYPE *Proto, STATISTICS *Statistics)
STATISTICSComputeStatistics (inT16 N, PARAM_DESC ParamDesc[], CLUSTER *Cluster)
PROTOTYPENewSphericalProto (uinT16 N, CLUSTER *Cluster, STATISTICS *Statistics)
PROTOTYPENewEllipticalProto (inT16 N, CLUSTER *Cluster, STATISTICS *Statistics)
PROTOTYPENewMixedProto (inT16 N, CLUSTER *Cluster, STATISTICS *Statistics)
PROTOTYPENewSimpleProto (inT16 N, CLUSTER *Cluster)
BOOL8 Independent (PARAM_DESC ParamDesc[], inT16 N, FLOAT32 *CoVariance, FLOAT32 Independence)
BUCKETSGetBuckets (DISTRIBUTION Distribution, uinT32 SampleCount, FLOAT64 Confidence)
BUCKETSMakeBuckets (DISTRIBUTION Distribution, uinT32 SampleCount, FLOAT64 Confidence)
uinT16 OptimumNumberOfBuckets (uinT32 SampleCount)
FLOAT64 ComputeChiSquared (uinT16 DegreesOfFreedom, FLOAT64 Alpha)
FLOAT64 NormalDensity (inT32 x)
FLOAT64 UniformDensity (inT32 x)
FLOAT64 Integral (FLOAT64 f1, FLOAT64 f2, FLOAT64 Dx)
void FillBuckets (BUCKETS *Buckets, CLUSTER *Cluster, uinT16 Dim, PARAM_DESC *ParamDesc, FLOAT32 Mean, FLOAT32 StdDev)
uinT16 NormalBucket (PARAM_DESC *ParamDesc, FLOAT32 x, FLOAT32 Mean, FLOAT32 StdDev)
uinT16 UniformBucket (PARAM_DESC *ParamDesc, FLOAT32 x, FLOAT32 Mean, FLOAT32 StdDev)
BOOL8 DistributionOK (BUCKETS *Buckets)
void FreeStatistics (STATISTICS *Statistics)
void FreeBuckets (BUCKETS *Buckets)
void FreeCluster (CLUSTER *Cluster)
uinT16 DegreesOfFreedom (DISTRIBUTION Distribution, uinT16 HistogramBuckets)
int NumBucketsMatch (void *arg1, void *arg2)
int ListEntryMatch (void *arg1, void *arg2)
void AdjustBuckets (BUCKETS *Buckets, uinT32 NewSampleCount)
void InitBuckets (BUCKETS *Buckets)
int AlphaMatch (void *arg1, void *arg2)
CHISTRUCTNewChiStruct (uinT16 DegreesOfFreedom, FLOAT64 Alpha)
FLOAT64 Solve (SOLVEFUNC Function, void *FunctionParams, FLOAT64 InitialGuess, FLOAT64 Accuracy)
FLOAT64 ChiArea (CHISTRUCT *ChiParams, FLOAT64 x)
BOOL8 MultipleCharSamples (CLUSTERER *Clusterer, CLUSTER *Cluster, FLOAT32 MaxIllegal)
double InvertMatrix (const float *input, int size, float *inv)
CLUSTERERMakeClusterer (inT16 SampleSize, PARAM_DESC ParamDesc[])
SAMPLEMakeSample (CLUSTERER *Clusterer, FLOAT32 Feature[], inT32 CharID)
LIST ClusterSamples (CLUSTERER *Clusterer, CLUSTERCONFIG *Config)
void FreeClusterer (CLUSTERER *Clusterer)
void FreeProtoList (LIST *ProtoList)
void FreePrototype (void *arg)
CLUSTERNextSample (LIST *SearchState)
FLOAT32 Mean (PROTOTYPE *Proto, uinT16 Dimension)
FLOAT32 StandardDeviation (PROTOTYPE *Proto, uinT16 Dimension)

Variables

double FTable [FTABLE_Y][FTABLE_X]

Define Documentation

#define Abs (  )     ( ( (N) < 0 ) ? ( -(N) ) : (N) )
#define BUCKETTABLESIZE   1024
#define CHIACCURACY   0.01
#define DELTARATIO   0.1
#define FTABLE_X   10
#define FTABLE_Y   100
#define HOTELLING   1
#define ILLEGAL_CHAR   2
#define INITIALDELTA   0.1
#define LOOKUPTABLESIZE   8
#define MAXBUCKETS   39
#define MAXDEGREESOFFREEDOM   MAXBUCKETS
#define MAXDISTANCE   MAX_FLOAT32
#define MAXNEIGHBORS   2
#define MINALPHA   (1e-200)
#define MINBUCKETS   5
#define MINSAMPLES   (MINBUCKETS * MINSAMPLESPERBUCKET)
#define MINSAMPLESNEEDED   1
#define MINSAMPLESPERBUCKET   5
#define MINVARIANCE   0.0001
#define Mirror ( N,
 )     ((R) - (N) - 1)
#define NORMALEXTENT   3.0
#define Odd (  )     ((N)%2)
#define SqrtOf2Pi   2.506628275

Typedef Documentation

typedef FLOAT64(* DENSITYFUNC)(inT32)
typedef FLOAT64(* SOLVEFUNC)(CHISTRUCT *, double)

Function Documentation

void AdjustBuckets ( BUCKETS Buckets,
uinT32  NewSampleCount 
)
int AlphaMatch ( void *  arg1,
void *  arg2 
)
FLOAT64 ChiArea ( CHISTRUCT ChiParams,
FLOAT64  x 
)
LIST ClusterSamples ( CLUSTERER Clusterer,
CLUSTERCONFIG Config 
)

ClusterSamples *********************************************************** Parameters: Clusterer data struct containing samples to be clustered Config parameters which control clustering process Globals: None Operation: This routine first checks to see if the samples in this clusterer have already been clustered before; if so, it does not bother to recreate the cluster tree. It simply recomputes the prototypes based on the new Config info. If the samples have not been clustered before, the samples in the KD tree are formed into a cluster tree and then the prototypes are computed from the cluster tree. In either case this routine returns a pointer to a list of prototypes that best represent the samples given the constraints specified in Config. Return: Pointer to a list of prototypes Exceptions: None History: 5/29/89, DSJ, Created.

FLOAT64 ComputeChiSquared ( uinT16  DegreesOfFreedom,
FLOAT64  Alpha 
)
void ComputePrototypes ( CLUSTERER Clusterer,
CLUSTERCONFIG Config 
)

ComputePrototypes ******************************************************* Parameters: Clusterer data structure holding cluster tree Config parameters used to control prototype generation Globals: None Operation: This routine decides which clusters in the cluster tree should be represented by prototypes, forms a list of these prototypes, and places the list in the Clusterer data structure. Return: None Exceptions: None History: 5/30/89, DSJ, Created.

STATISTICS * ComputeStatistics ( inT16  N,
PARAM_DESC  ParamDesc[],
CLUSTER Cluster 
)

ComputeStatistics ********************************************************* Parameters: N number of dimensions ParamDesc array of dimension descriptions Cluster cluster whose stats are to be computed Globals: None Operation: This routine searches the cluster tree for all leaf nodes which are samples in the specified cluster. It computes a full covariance matrix for these samples as well as keeping track of the ranges (min and max) for each dimension. A special data structure is allocated to return this information to the caller. An incremental algorithm for computing statistics is not used because it will not work with circular dimensions. Return: Pointer to new data structure containing statistics Exceptions: None History: 6/2/89, DSJ, Created.

void CreateClusterTree ( CLUSTERER Clusterer  ) 

CreateClusterTree ******************************************************* Parameters: Clusterer data structure holdings samples to be clustered Globals: Tree kd-tree holding samples TempCluster array of temporary clusters CurrentTemp index of next temp cluster to be used Heap heap used to hold temp clusters - "best" on top Operation: This routine performs a bottoms-up clustering on the samples held in the kd-tree of the Clusterer data structure. The result is a cluster tree. Each node in the tree represents a cluster which conceptually contains a subset of the samples. More precisely, the cluster contains all of the samples which are contained in its two sub-clusters. The leaves of the tree are the individual samples themselves; they have no sub-clusters. The root node of the tree conceptually contains all of the samples. Return: None (the Clusterer data structure is changed) Exceptions: None History: 5/29/89, DSJ, Created.

uinT16 DegreesOfFreedom ( DISTRIBUTION  Distribution,
uinT16  HistogramBuckets 
)
BOOL8 DistributionOK ( BUCKETS Buckets  ) 
void FillBuckets ( BUCKETS Buckets,
CLUSTER Cluster,
uinT16  Dim,
PARAM_DESC ParamDesc,
FLOAT32  Mean,
FLOAT32  StdDev 
)
CLUSTER * FindNearestNeighbor ( KDTREE Tree,
CLUSTER Cluster,
FLOAT32 Distance 
)

FindNearestNeighbor ********************************************************* Parameters: Tree kd-tree to search in for nearest neighbor Cluster cluster whose nearest neighbor is to be found Distance ptr to variable to report distance found Globals: none Operation: This routine searches the specified kd-tree for the nearest neighbor of the specified cluster. It actually uses the kd routines to find the 2 nearest neighbors since one of them will be the original cluster. A pointer to the nearest neighbor is returned, if it can be found, otherwise NULL is returned. The distance between the 2 nodes is placed in the specified variable. Return: Pointer to the nearest neighbor of Cluster, or NULL Exceptions: none History: 5/29/89, DSJ, Created. 7/13/89, DSJ, Removed visibility of kd-tree node data struct

void FreeBuckets ( BUCKETS Buckets  ) 
void FreeCluster ( CLUSTER Cluster  ) 
void FreeClusterer ( CLUSTERER Clusterer  ) 

FreeClusterer ************************************************************* Parameters: Clusterer pointer to data structure to be freed Globals: None Operation: This routine frees all of the memory allocated to the specified data structure. It will not, however, free the memory used by the prototype list. The pointers to the clusters for each prototype in the list will be set to NULL to indicate that the cluster data structures no longer exist. Any sample lists that have been obtained via calls to GetSamples are no longer valid. Return: None Exceptions: None History: 6/6/89, DSJ, Created.

void FreeProtoList ( LIST ProtoList  ) 

FreeProtoList ************************************************************ Parameters: ProtoList pointer to list of prototypes to be freed Globals: None Operation: This routine frees all of the memory allocated to the specified list of prototypes. The clusters which are pointed to by the prototypes are not freed. Return: None Exceptions: None History: 6/6/89, DSJ, Created.

void FreePrototype ( void *  arg  ) 

FreePrototype ************************************************************ Parameters: Prototype prototype data structure to be deallocated Globals: None Operation: This routine deallocates the memory consumed by the specified prototype and modifies the corresponding cluster so that it is no longer marked as a prototype. The cluster is NOT deallocated by this routine. Return: None Exceptions: None History: 5/30/89, DSJ, Created.

void FreeStatistics ( STATISTICS Statistics  ) 
BUCKETS * GetBuckets ( DISTRIBUTION  Distribution,
uinT32  SampleCount,
FLOAT64  Confidence 
)

GetBuckets ************************************************************** Parameters: Distribution type of probability distribution to test for SampleCount number of samples that are available Confidence probability of a Type I error Globals: none Operation: This routine returns a histogram data structure which can be used by other routines to place samples into histogram buckets, and then apply a goodness of fit test to the histogram data to determine if the samples belong to the specified probability distribution. The routine keeps a list of bucket data structures which have already been created so that it minimizes the computation time needed to create a new bucket. Return: Bucket data structure Exceptions: none History: Thu Aug 3 12:58:10 1989, DSJ, Created.

BOOL8 Independent ( PARAM_DESC  ParamDesc[],
inT16  N,
FLOAT32 CoVariance,
FLOAT32  Independence 
)

Independent *************************************************************** Parameters: ParamDesc descriptions of each feature space dimension N number of dimensions CoVariance ptr to a covariance matrix Independence max off-diagonal correlation coefficient Globals: None Operation: This routine returns TRUE if the specified covariance matrix indicates that all N dimensions are independent of one another. One dimension is judged to be independent of another when the magnitude of the corresponding correlation coefficient is less than the specified Independence factor. The correlation coefficient is calculated as: (see Duda and Hart, pg. 247) coeff[ij] = stddev[ij] / sqrt (stddev[ii] * stddev[jj]) The covariance matrix is assumed to be symmetric (which should always be true). Return: TRUE if dimensions are independent, FALSE otherwise Exceptions: None History: 6/4/89, DSJ, Created.

void InitBuckets ( BUCKETS Buckets  ) 
FLOAT64 Integral ( FLOAT64  f1,
FLOAT64  f2,
FLOAT64  Dx 
)
double InvertMatrix ( const float *  input,
int  size,
float *  inv 
)
int ListEntryMatch ( void *  arg1,
void *  arg2 
)
BUCKETS * MakeBuckets ( DISTRIBUTION  Distribution,
uinT32  SampleCount,
FLOAT64  Confidence 
)

Makebuckets ************************************************************* Parameters: Distribution type of probability distribution to test for SampleCount number of samples that are available Confidence probability of a Type I error Globals: None Operation: This routine creates a histogram data structure which can be used by other routines to place samples into histogram buckets, and then apply a goodness of fit test to the histogram data to determine if the samples belong to the specified probability distribution. The buckets are allocated in such a way that the expected frequency of samples in each bucket is approximately the same. In order to make this possible, a mapping table is computed which maps "normalized" samples into the appropriate bucket. Return: Pointer to new histogram data structure Exceptions: None History: 6/4/89, DSJ, Created.

CLUSTERER* MakeClusterer ( inT16  SampleSize,
PARAM_DESC  ParamDesc[] 
)

MakeClusterer ********************************************************** Parameters: SampleSize number of dimensions in feature space ParamDesc description of each dimension Globals: None Operation: This routine creates a new clusterer data structure, initializes it, and returns a pointer to it. Return: pointer to the new clusterer data structure Exceptions: None History: 5/29/89, DSJ, Created.

PROTOTYPE * MakeDegenerateProto ( uinT16  N,
CLUSTER Cluster,
STATISTICS Statistics,
PROTOSTYLE  Style,
inT32  MinSamples 
)

MakeDegenerateProto ****************************************************** Parameters: N number of dimensions Cluster cluster being analyzed Statistics statistical info about cluster Style type of prototype to be generated MinSamples minimum number of samples in a cluster Globals: None Operation: This routine checks for clusters which are degenerate and therefore cannot be analyzed in a statistically valid way. A cluster is defined as degenerate if it does not have at least MINSAMPLESNEEDED samples in it. If the cluster is found to be degenerate, a prototype of the specified style is generated and marked as insignificant. A cluster is also degenerate if it does not have at least MinSamples samples in it. If the cluster is not degenerate, NULL is returned. Return: Pointer to degenerate prototype or NULL. Exceptions: None History: 6/20/89, DSJ, Created. 7/12/89, DSJ, Changed name and added check for 0 stddev. 8/8/89, DSJ, Removed check for 0 stddev (handled elsewhere).

void MakeDimRandom ( uinT16  i,
PROTOTYPE Proto,
PARAM_DESC ParamDesc 
)
void MakeDimUniform ( uinT16  i,
PROTOTYPE Proto,
STATISTICS Statistics 
)

MakeDimUniform *********************************************************** Parameters: i index of dimension to be changed Proto prototype whose dimension is to be altered Statistics statistical info about prototype Globals: None Operation: This routine alters the ith dimension of the specified mixed prototype to be uniform. Return: None Exceptions: None History: 6/20/89, DSJ, Created.

PROTOTYPE * MakeEllipticalProto ( CLUSTERER Clusterer,
CLUSTER Cluster,
STATISTICS Statistics,
BUCKETS Buckets 
)

MakeEllipticalProto **************************************************** Parameters: Clusterer data struct containing samples being clustered Cluster cluster to be made into an elliptical prototype Statistics statistical info about cluster Buckets histogram struct used to analyze distribution Globals: None Operation: This routine tests the specified cluster to see if it can be approximated by an elliptical normal distribution. If it can be, then a new prototype is formed and returned to the caller. If it can't be, then NULL is returned to the caller. Return: Pointer to new elliptical prototype or NULL. Exceptions: None History: 6/12/89, DSJ, Created.

PROTOTYPE * MakeMixedProto ( CLUSTERER Clusterer,
CLUSTER Cluster,
STATISTICS Statistics,
BUCKETS NormalBuckets,
FLOAT64  Confidence 
)

MakeMixedProto *********************************************************** Parameters: Clusterer data struct containing samples being clustered Cluster cluster to be made into a prototype Statistics statistical info about cluster NormalBuckets histogram struct used to analyze distribution Confidence confidence level for alternate distributions Globals: None Operation: This routine tests each dimension of the specified cluster to see what distribution would best approximate that dimension. Each dimension is compared to the following distributions in order: normal, random, uniform. If each dimension can be represented by one of these distributions, then a new prototype is formed and returned to the caller. If it can't be, then NULL is returned to the caller. Return: Pointer to new mixed prototype or NULL. Exceptions: None History: 6/12/89, DSJ, Created.

CLUSTER * MakeNewCluster ( CLUSTERER Clusterer,
TEMPCLUSTER TempCluster 
)

MakeNewCluster ************************************************************* Parameters: Clusterer current clustering environment TempCluster potential cluster to make permanent Globals: none Operation: This routine creates a new permanent cluster from the clusters specified in TempCluster. The 2 clusters in TempCluster are marked as "clustered" and deleted from the kd-tree. The new cluster is then added to the kd-tree. Return: Pointer to the new permanent cluster Exceptions: none History: 5/29/89, DSJ, Created. 7/13/89, DSJ, Removed visibility of kd-tree node data struct

void MakePotentialClusters ( CLUSTER Cluster,
VISIT  Order,
inT32  Level 
)

MakePotentialClusters ************************************************** Parameters: Cluster current cluster being visited in kd-tree walk Order order in which cluster is being visited Level level of this cluster in the kd-tree Globals: Tree kd-tree to be searched for neighbors TempCluster array of temporary clusters CurrentTemp index of next temp cluster to be used Heap heap used to hold temp clusters - "best" on top Operation: This routine is designed to be used in concert with the KDWalk routine. It will create a potential cluster for each sample in the kd-tree that is being walked. This potential cluster will then be pushed on the heap. Return: none Exceptions: none History: 5/29/89, DSJ, Created. 7/13/89, DSJ, Removed visibility of kd-tree node data struct.

PROTOTYPE * MakePrototype ( CLUSTERER Clusterer,
CLUSTERCONFIG Config,
CLUSTER Cluster 
)

MakePrototype *********************************************************** Parameters: Clusterer data structure holding cluster tree Config parameters used to control prototype generation Cluster cluster to be made into a prototype Globals: None Operation: This routine attempts to create a prototype from the specified cluster that conforms to the distribution specified in Config. If there are too few samples in the cluster to perform a statistical analysis, then a prototype is generated but labelled as insignificant. If the dimensions of the cluster are not independent, no prototype is generated and NULL is returned. If a prototype can be found that matches the desired distribution then a pointer to it is returned, otherwise NULL is returned. Return: Pointer to new prototype or NULL Exceptions: None History: 6/19/89, DSJ, Created.

SAMPLE* MakeSample ( CLUSTERER Clusterer,
FLOAT32  Feature[],
inT32  CharID 
)

MakeSample *********************************************************** Parameters: Clusterer clusterer data structure to add sample to Feature feature to be added to clusterer CharID unique ident. of char that sample came from Globals: None Operation: This routine creates a new sample data structure to hold the specified feature. This sample is added to the clusterer data structure (so that it knows which samples are to be clustered later), and a pointer to the sample is returned to the caller. Return: Pointer to the new sample data structure Exceptions: ALREADYCLUSTERED MakeSample can't be called after ClusterSamples has been called History: 5/29/89, DSJ, Created.

PROTOTYPE * MakeSphericalProto ( CLUSTERER Clusterer,
CLUSTER Cluster,
STATISTICS Statistics,
BUCKETS Buckets 
)
FLOAT32 Mean ( PROTOTYPE Proto,
uinT16  Dimension 
)

Mean *********************************************************** Parameters: Proto prototype to return mean of Dimension dimension whose mean is to be returned Globals: none Operation: This routine returns the mean of the specified prototype in the indicated dimension. Return: Mean of Prototype in Dimension Exceptions: none History: 7/6/89, DSJ, Created.

inT32 MergeClusters ( inT16  N,
register PARAM_DESC  ParamDesc[],
register inT32  n1,
register inT32  n2,
register FLOAT32  m[],
register FLOAT32  m1[],
register FLOAT32  m2[] 
)

MergeClusters ************************************************************ Parameters: N # of dimensions (size of arrays) ParamDesc array of dimension descriptions n1, n2 number of samples in each old cluster m array to hold mean of new cluster m1, m2 arrays containing means of old clusters Globals: None Operation: This routine merges two clusters into one larger cluster. To do this it computes the number of samples in the new cluster and the mean of the new cluster. The ParamDesc information is used to ensure that circular dimensions are handled correctly. Return: The number of samples in the new cluster. Exceptions: None History: 5/31/89, DSJ, Created.

BOOL8 MultipleCharSamples ( CLUSTERER Clusterer,
CLUSTER Cluster,
FLOAT32  MaxIllegal 
)
CHISTRUCT * NewChiStruct ( uinT16  DegreesOfFreedom,
FLOAT64  Alpha 
)
PROTOTYPE * NewEllipticalProto ( inT16  N,
CLUSTER Cluster,
STATISTICS Statistics 
)

NewEllipticalProto ******************************************************* Parameters: N number of dimensions Cluster cluster to be made into an elliptical prototype Statistics statistical info about samples in cluster Globals: None Operation: This routine creates an elliptical prototype data structure to approximate the samples in the specified cluster. Elliptical prototypes have a variance for each dimension. All dimensions are normally distributed and independent. Return: Pointer to a new elliptical prototype data structure Exceptions: None History: 6/19/89, DSJ, Created.

PROTOTYPE * NewMixedProto ( inT16  N,
CLUSTER Cluster,
STATISTICS Statistics 
)

MewMixedProto ************************************************************ Parameters: N number of dimensions Cluster cluster to be made into a mixed prototype Statistics statistical info about samples in cluster Globals: None Operation: This routine creates a mixed prototype data structure to approximate the samples in the specified cluster. Mixed prototypes can have different distributions for each dimension. All dimensions are independent. The structure is initially filled in as though it were an elliptical prototype. The actual distributions of the dimensions can be altered by other routines. Return: Pointer to a new mixed prototype data structure Exceptions: None History: 6/19/89, DSJ, Created.

PROTOTYPE * NewSimpleProto ( inT16  N,
CLUSTER Cluster 
)

NewSimpleProto *********************************************************** Parameters: N number of dimensions Cluster cluster to be made into a prototype Globals: None Operation: This routine allocates memory to hold a simple prototype data structure, i.e. one without independent distributions and variances for each dimension. Return: Pointer to new simple prototype Exceptions: None History: 6/19/89, DSJ, Created.

PROTOTYPE * NewSphericalProto ( uinT16  N,
CLUSTER Cluster,
STATISTICS Statistics 
)

NewSpericalProto ********************************************************* Parameters: N number of dimensions Cluster cluster to be made into a spherical prototype Statistics statistical info about samples in cluster Globals: None Operation: This routine creates a spherical prototype data structure to approximate the samples in the specified cluster. Spherical prototypes have a single variance which is common across all dimensions. All dimensions are normally distributed and independent. Return: Pointer to a new spherical prototype data structure Exceptions: None History: 6/19/89, DSJ, Created.

CLUSTER* NextSample ( LIST SearchState  ) 

NextSample ************************************************************ Parameters: SearchState ptr to list containing clusters to be searched Globals: None Operation: This routine is used to find all of the samples which belong to a cluster. It starts by removing the top cluster on the cluster list (SearchState). If this cluster is a leaf it is returned. Otherwise, the right subcluster is pushed on the list and we continue the search in the left subcluster. This continues until a leaf is found. If all samples have been found, NULL is returned. InitSampleSearch() must be called before NextSample() to initialize the search. Return: Pointer to the next leaf cluster (sample) or NULL. Exceptions: None History: 6/16/89, DSJ, Created.

uinT16 NormalBucket ( PARAM_DESC ParamDesc,
FLOAT32  x,
FLOAT32  Mean,
FLOAT32  StdDev 
)
FLOAT64 NormalDensity ( inT32  x  ) 
int NumBucketsMatch ( void *  arg1,
void *  arg2 
)
uinT16 OptimumNumberOfBuckets ( uinT32  SampleCount  ) 
FLOAT64 Solve ( SOLVEFUNC  Function,
void *  FunctionParams,
FLOAT64  InitialGuess,
FLOAT64  Accuracy 
)
FLOAT32 StandardDeviation ( PROTOTYPE Proto,
uinT16  Dimension 
)

StandardDeviation ************************************************* Parameters: Proto prototype to return standard deviation of Dimension dimension whose stddev is to be returned Globals: none Operation: This routine returns the standard deviation of the prototype in the indicated dimension. Return: Standard deviation of Prototype in Dimension Exceptions: none History: 7/6/89, DSJ, Created.

PROTOTYPE * TestEllipticalProto ( CLUSTERER Clusterer,
CLUSTERCONFIG Config,
CLUSTER Cluster,
STATISTICS Statistics 
)

TestEllipticalProto **************************************************** Parameters: Clusterer data struct containing samples being clustered Config provides the magic number of samples that make a good cluster Cluster cluster to be made into an elliptical prototype Statistics statistical info about cluster Globals: None Operation: This routine tests the specified cluster to see if ** there is a statistically significant difference between the sub-clusters that would be made if the cluster were to be split. If not, then a new prototype is formed and returned to the caller. If there is, then NULL is returned to the caller. Return: Pointer to new elliptical prototype or NULL.

uinT16 UniformBucket ( PARAM_DESC ParamDesc,
FLOAT32  x,
FLOAT32  Mean,
FLOAT32  StdDev 
)
FLOAT64 UniformDensity ( inT32  x  ) 

Variable Documentation

double FTable[FTABLE_Y][FTABLE_X]
Generated on Sun Jul 18 17:10:50 2010 for Tesseract by  doxygen 1.6.3