ann_test.cpp File Reference

#include <ctime>
#include <cmath>
#include <string>
#include <fstream>
#include <ANN/ANN.h>
#include <ANN/ANNx.h>
#include <ANN/ANNperf.h>
#include "rand.h"

Go to the source code of this file.

Defines

#define CLOCKS_PER_SEC   1000000
#define log2(x)   (log(x)/log(2.0))

Enumerations

enum  Distrib {
  UNIFORM, GAUSS, LAPLACE, CO_GAUSS,
  CO_LAPLACE, CLUS_GAUSS, CLUS_ORTH_FLATS, CLUS_ELLIPSOIDS,
  PLANTED, N_DISTRIBS
}
enum  PtType { DATA, QUERY }
enum  StatLev {
  SILENT, EXEC_TIME, PREP_STATS, QUERY_STATS,
  QUERY_RES, SHOW_PTS, SHOW_STRUCT, N_STAT_LEVELS
}

Functions

void doValidation ()
void Error (char *msg, ANNerr level)
void generatePts (ANNpointArray &pa, int n, PtType type, ANNbool new_clust, ANNpointArray src=NULL, int n_src=0)
ANNbool getDirective (istream &in, char *directive)
void getTrueNN ()
void initGlobals ()
int lookUp (const char *arg, const char(*table)[STRING_LEN], int size)
int main (int argc, char **argv)
void printPoint (ANNpoint p, int dim)
void readPts (ANNpointArray &pa, int &n, char *file_nm, PtType type)
ANNbool skipComment (istream &in)
void treeStats (ostream &out, ANNbool verbose)

Variables

ANNdistArray apx_dists
ANNidxArray apx_nn_idx
int * apx_pts_in_range
int bucket_size
double corr_coef
ANNpointArray data_pts
int data_size
const int def_bucket_size = 1
const double def_corr_coef = 0.05
const int def_data_size = 100
const int def_dim = 2
const Distrib def_distr = UNIFORM
const double def_epsilon = 0.0
const int def_max_dim = 1
const int def_max_visit = 0
const int def_n_color = 5
const int def_near_neigh = 1
const ANNbool def_new_clust = ANNfalse
const int def_query_size = 100
const int def_rad_bound = 0
const int def_seed = 0
const ANNshrinkRule def_shrink = ANN_BD_NONE
const ANNsplitRule def_split = ANN_KD_SUGGEST
const StatLev def_stats = QUERY_STATS
const double def_std_dev = 1.00
const int def_true_nn = def_near_neigh + extra_nn
const ANNbool def_validate = ANNfalse
int dim
Distrib distr
const char distr_table [N_DISTRIBS][STRING_LEN]
double epsilon
const double ERR = 0.00001
const int extra_nn = 10
int max_dim
int * max_pts_in_range
int max_pts_visit
int * min_pts_in_range
int n_color
const int N_SHRINK_RULES = 4
const int N_SPLIT_RULES = 6
int near_neigh
ANNbool new_clust
ANNpointArray query_pts
int query_size
double radius_bound
ANNshrinkRule shrink
const char shrink_table [N_SHRINK_RULES][STRING_LEN]
ANNsplitRule split
const char split_table [N_SPLIT_RULES][STRING_LEN]
const char stat_table [N_STAT_LEVELS][STRING_LEN]
StatLev stats
double std_dev
double std_dev_hi
double std_dev_lo
const int STRING_LEN = 500
ANNbd_treethe_tree
ANNdistArray true_dists
int true_nn
ANNidxArray true_nn_idx
ANNbool valid_dirty
ANNbool validate

Define Documentation

#define CLOCKS_PER_SEC   1000000

Definition at line 49 of file ann_test.cpp.

Referenced by main().

#define log2 (  )     (log(x)/log(2.0))

Definition at line 1566 of file ann_test.cpp.

Referenced by treeStats().


Enumeration Type Documentation

enum Distrib
Enumerator:
UNIFORM 
GAUSS 
LAPLACE 
CO_GAUSS 
CO_LAPLACE 
CLUS_GAUSS 
CLUS_ORTH_FLATS 
CLUS_ELLIPSOIDS 
PLANTED 
N_DISTRIBS 

Definition at line 317 of file ann_test.cpp.

enum PtType
Enumerator:
DATA 
QUERY 

Definition at line 287 of file ann_test.cpp.

enum StatLev
Enumerator:
SILENT 
EXEC_TIME 
PREP_STATS 
QUERY_STATS 
QUERY_RES 
SHOW_PTS 
SHOW_STRUCT 
N_STAT_LEVELS 

Definition at line 293 of file ann_test.cpp.


Function Documentation

void doValidation (  ) 

Definition at line 1463 of file ann_test.cpp.

References ann_average_err, ANN_DBL_MAX, ANN_NULL_IDX, ann_rank_err, ANN_ROOT, ANNabort, ERR, and Error().

Referenced by main().

void Error ( char *  msg,
ANNerr  level 
)

Definition at line 372 of file ann_test.cpp.

References ANNabort.

void generatePts ( ANNpointArray pa,
int  n,
PtType  type,
ANNbool  new_clust,
ANNpointArray  src = NULL,
int  n_src = 0 
)
ANNbool getDirective ( istream &  in,
char *  directive 
)

Definition at line 607 of file ann_test.cpp.

References ANNfalse, ANNtrue, and skipComment().

Referenced by main().

void getTrueNN (  ) 

Definition at line 1370 of file ann_test.cpp.

References ANN_POW, ANNfalse, ANNbruteForce::annkFRSearch(), ANNbruteForce::annkSearch(), and SILENT.

Referenced by main().

void initGlobals (  ) 

Definition at line 546 of file ann_test.cpp.

References annIdum, ANNtrue, def_shrink, and def_split.

Referenced by main().

int lookUp ( const char *  arg,
const char(*)  table[STRING_LEN],
int  size 
)

Definition at line 397 of file ann_test.cpp.

Referenced by main().

int main ( int  argc,
char **  argv 
)
void printPoint ( ANNpoint  p,
int  dim 
)

Definition at line 385 of file ann_test.cpp.

Referenced by generatePts(), and readPts().

void readPts ( ANNpointArray pa,
int &  n,
char *  file_nm,
PtType  type 
)

Definition at line 1279 of file ann_test.cpp.

References ANNabort, annAllocPts(), annDeallocPts(), ANNwarn, DATA, Error(), printPoint(), QUERY, QUERY_RES, SHOW_PTS, and SILENT.

Referenced by main().

ANNbool skipComment ( istream &  in  ) 

Definition at line 590 of file ann_test.cpp.

References ANNfalse, and ANNtrue.

Referenced by getDirective().

void treeStats ( ostream &  out,
ANNbool  verbose 
)

Variable Documentation

Definition at line 533 of file ann_test.cpp.

Definition at line 532 of file ann_test.cpp.

Definition at line 534 of file ann_test.cpp.

Definition at line 479 of file ann_test.cpp.

double corr_coef

Definition at line 475 of file ann_test.cpp.

Definition at line 529 of file ann_test.cpp.

int data_size

Definition at line 469 of file ann_test.cpp.

const int def_bucket_size = 1

Definition at line 448 of file ann_test.cpp.

const double def_corr_coef = 0.05

Definition at line 447 of file ann_test.cpp.

const int def_data_size = 100

Definition at line 440 of file ann_test.cpp.

const int def_dim = 2

Definition at line 439 of file ann_test.cpp.

const Distrib def_distr = UNIFORM

Definition at line 445 of file ann_test.cpp.

const double def_epsilon = 0.0

Definition at line 449 of file ann_test.cpp.

const int def_max_dim = 1

Definition at line 444 of file ann_test.cpp.

const int def_max_visit = 0

Definition at line 451 of file ann_test.cpp.

const int def_n_color = 5

Definition at line 442 of file ann_test.cpp.

const int def_near_neigh = 1

Definition at line 450 of file ann_test.cpp.

const ANNbool def_new_clust = ANNfalse

Definition at line 443 of file ann_test.cpp.

const int def_query_size = 100

Definition at line 441 of file ann_test.cpp.

const int def_rad_bound = 0

Definition at line 452 of file ann_test.cpp.

const int def_seed = 0

Definition at line 455 of file ann_test.cpp.

const ANNshrinkRule def_shrink = ANN_BD_NONE

Definition at line 462 of file ann_test.cpp.

Referenced by initGlobals().

const ANNsplitRule def_split = ANN_KD_SUGGEST

Definition at line 460 of file ann_test.cpp.

Referenced by initGlobals().

const StatLev def_stats = QUERY_STATS

Definition at line 458 of file ann_test.cpp.

const double def_std_dev = 1.00

Definition at line 446 of file ann_test.cpp.

Definition at line 454 of file ann_test.cpp.

const ANNbool def_validate = ANNfalse

Definition at line 456 of file ann_test.cpp.

int dim

Definition at line 468 of file ann_test.cpp.

Definition at line 474 of file ann_test.cpp.

const char distr_table[N_DISTRIBS][STRING_LEN]
Initial value:
 {
                "uniform",                                              
                "gauss",                                                
                "laplace",                                              
                "co_gauss",                                             
                "co_laplace",                                   
                "clus_gauss",                                   
                "clus_orth_flats",                              
                "clus_ellipsoids",                              
                "planted"}

Definition at line 330 of file ann_test.cpp.

Referenced by generatePts(), and main().

double epsilon
const double ERR = 0.00001

Definition at line 281 of file ann_test.cpp.

const int extra_nn = 10

Definition at line 437 of file ann_test.cpp.

int max_dim

Definition at line 473 of file ann_test.cpp.

Referenced by annMaxSpread().

Definition at line 538 of file ann_test.cpp.

Definition at line 482 of file ann_test.cpp.

Definition at line 537 of file ann_test.cpp.

int n_color

Definition at line 471 of file ann_test.cpp.

const int N_SHRINK_RULES = 4

Definition at line 358 of file ann_test.cpp.

Referenced by main().

const int N_SPLIT_RULES = 6

Definition at line 345 of file ann_test.cpp.

Referenced by main().

Definition at line 481 of file ann_test.cpp.

Definition at line 472 of file ann_test.cpp.

Definition at line 530 of file ann_test.cpp.

Definition at line 470 of file ann_test.cpp.

double radius_bound

Definition at line 483 of file ann_test.cpp.

Definition at line 488 of file ann_test.cpp.

Initial value:
 {
                "none",                                                 
                "simple",                                               
                "centroid",                                             
                "suggest"}

Definition at line 359 of file ann_test.cpp.

Referenced by main().

ANNsplitRule split
Initial value:
 {
                "standard",                                             
                "midpt",                                                
                "fair",                                                 
                "sl_midpt",                                             
                "sl_fair",                                              
                "suggest"}

Definition at line 346 of file ann_test.cpp.

Referenced by main().

const char stat_table[N_STAT_LEVELS][STRING_LEN]
Initial value:
 {
                "silent",                                               
                "exec_time",                                    
                "prep_stats",                                   
                "query_stats",                                  
                "query_res",                                    
                "show_pts",                                             
                "show_struct"}

Definition at line 304 of file ann_test.cpp.

Referenced by main().

Definition at line 486 of file ann_test.cpp.

double std_dev

Definition at line 476 of file ann_test.cpp.

Referenced by annClusEllipsoids().

double std_dev_hi

Definition at line 478 of file ann_test.cpp.

double std_dev_lo

Definition at line 477 of file ann_test.cpp.

const int STRING_LEN = 500

Definition at line 280 of file ann_test.cpp.

Definition at line 531 of file ann_test.cpp.

Definition at line 536 of file ann_test.cpp.

int true_nn

Definition at line 484 of file ann_test.cpp.

Definition at line 535 of file ann_test.cpp.

Definition at line 540 of file ann_test.cpp.


Generated on Wed Nov 23 19:01:12 2011 for FreeCAD by  doxygen 1.6.1