queso-0.53.0
Classes | Macros | Typedefs | Enumerations | Functions | Variables
ANN.h File Reference
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <cstring>
#include <climits>
#include <cfloat>
Include dependency graph for ANN.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  ANNpointSet
 
class  ANNbruteForce
 
class  ANNkd_tree
 
class  ANNbd_tree
 

Macros

#define DLL_API
 
#define ANNversion   "1.1.2"
 
#define ANNversionCmt   ""
 
#define ANNcopyright   "David M. Mount and Sunil Arya"
 
#define ANNlatestRev   "Jan 27, 2010"
 
#define ANN_POW(v)   fabs(v)
 
#define ANN_ROOT(x)   (x)
 
#define ANN_SUM(x, y)   ((x) > (y) ? (x) : (y))
 
#define ANN_DIFF(x, y)   (y)
 

Typedefs

typedef double ANNcoord
 
typedef double ANNdist
 
typedef int ANNidx
 
typedef ANNcoordANNpoint
 
typedef ANNpointANNpointArray
 
typedef ANNdistANNdistArray
 
typedef ANNidxANNidxArray
 
typedef ANNkd_nodeANNkd_ptr
 

Enumerations

enum  ANNbool { ANNfalse = 0, ANNtrue = 1 }
 
enum  ANNsplitRule {
  ANN_KD_STD = 0, ANN_KD_MIDPT = 1, ANN_KD_FAIR = 2, ANN_KD_SL_MIDPT = 3,
  ANN_KD_SL_FAIR = 4, ANN_KD_SUGGEST = 5
}
 
enum  ANNshrinkRule { ANN_BD_NONE = 0, ANN_BD_SIMPLE = 1, ANN_BD_CENTROID = 2, ANN_BD_SUGGEST = 3 }
 

Functions

DLL_API ANNdist annDist (int dim, ANNpoint p, ANNpoint q)
 
DLL_API ANNpoint annAllocPt (int dim, ANNcoord c=0)
 
DLL_API ANNpointArray annAllocPts (int n, int dim)
 
DLL_API void annDeallocPt (ANNpoint &p)
 
DLL_API void annDeallocPts (ANNpointArray &pa)
 
DLL_API ANNpoint annCopyPt (int dim, ANNpoint source)
 
DLL_API void annMaxPtsVisit (int maxPts)
 
DLL_API void annClose ()
 

Variables

const double ANN_DBL_MAX = DBL_MAX
 
const ANNidx ANN_NULL_IDX = -1
 
const ANNdist ANN_DIST_INF = ANN_DBL_MAX
 
const int ANNcoordPrec = 15
 
const ANNbool ANN_ALLOW_SELF_MATCH = ANNtrue
 
const int ANN_N_SPLIT_RULES = 6
 
const int ANN_N_SHRINK_RULES = 4
 

Macro Definition Documentation

#define ANN_DIFF (   x,
 
)    (y)
#define ANN_POW (   v)    fabs(v)
#define ANN_ROOT (   x)    (x)

Definition at line 361 of file ANN.h.

Referenced by doValidation(), and main().

#define ANN_SUM (   x,
 
)    ((x) > (y) ? (x) : (y))
#define ANNcopyright   "David M. Mount and Sunil Arya"

Definition at line 123 of file ANN.h.

Referenced by main().

#define ANNlatestRev   "Jan 27, 2010"

Definition at line 124 of file ANN.h.

Referenced by main().

#define ANNversion   "1.1.2"

Definition at line 121 of file ANN.h.

Referenced by ANNkd_tree::Dump(), main(), and ANNkd_tree::Print().

#define ANNversionCmt   ""

Definition at line 122 of file ANN.h.

Referenced by main().

#define DLL_API

Definition at line 85 of file ANN.h.

Typedef Documentation

typedef double ANNcoord

Definition at line 158 of file ANN.h.

typedef double ANNdist

Definition at line 159 of file ANN.h.

Definition at line 377 of file ANN.h.

typedef int ANNidx

Definition at line 175 of file ANN.h.

typedef ANNidx* ANNidxArray

Definition at line 378 of file ANN.h.

Definition at line 702 of file ANN.h.

typedef ANNcoord* ANNpoint

Definition at line 375 of file ANN.h.

Definition at line 376 of file ANN.h.

Enumeration Type Documentation

enum ANNbool
Enumerator
ANNfalse 
ANNtrue 

Definition at line 132 of file ANN.h.

132 {ANNfalse = 0, ANNtrue = 1}; // ANN boolean type (non ANSI C++)
Definition: ANN.h:132
Definition: ANN.h:132
Enumerator
ANN_BD_NONE 
ANN_BD_SIMPLE 
ANN_BD_CENTROID 
ANN_BD_SUGGEST 

Definition at line 605 of file ANN.h.

605  {
606  ANN_BD_NONE = 0, // no shrinking at all (just kd-tree)
607  ANN_BD_SIMPLE = 1, // simple splitting
608  ANN_BD_CENTROID = 2, // centroid splitting
609  ANN_BD_SUGGEST = 3}; // the authors' suggested choice
Enumerator
ANN_KD_STD 
ANN_KD_MIDPT 
ANN_KD_FAIR 
ANN_KD_SL_MIDPT 
ANN_KD_SL_FAIR 
ANN_KD_SUGGEST 

Definition at line 596 of file ANN.h.

596  {
597  ANN_KD_STD = 0, // the optimized kd-splitting rule
598  ANN_KD_MIDPT = 1, // midpoint split
599  ANN_KD_FAIR = 2, // fair split
600  ANN_KD_SL_MIDPT = 3, // sliding midpoint splitting method
601  ANN_KD_SL_FAIR = 4, // sliding fair split method
602  ANN_KD_SUGGEST = 5}; // the authors' suggestion for best

Function Documentation

DLL_API ANNpoint annAllocPt ( int  dim,
ANNcoord  c = 0 
)

Definition at line 110 of file ANN.cpp.

References dim.

Referenced by ANNorthRect::ANNorthRect(), annReadDump(), and main().

111 {
112  ANNpoint p = new ANNcoord[dim];
113  for (int i = 0; i < dim; i++) p[i] = c;
114  return p;
115 }
double ANNcoord
Definition: ANN.h:158
ANNcoord * ANNpoint
Definition: ANN.h:375
int dim
Definition: ann2fig.cpp:81
DLL_API ANNpointArray annAllocPts ( int  n,
int  dim 
)

Definition at line 117 of file ANN.cpp.

References dim.

Referenced by annClusEllipsoids(), annClusGaussPts(), annClusOrthFlats(), annReadDump(), generatePts(), main(), readANN(), and readPts().

118 {
119  ANNpointArray pa = new ANNpoint[n]; // allocate points
120  ANNpoint p = new ANNcoord[n*dim]; // allocate space for coords
121  for (int i = 0; i < n; i++) {
122  pa[i] = &(p[i*dim]);
123  }
124  return pa;
125 }
double ANNcoord
Definition: ANN.h:158
ANNpoint * ANNpointArray
Definition: ANN.h:376
ANNcoord * ANNpoint
Definition: ANN.h:375
int dim
Definition: ann2fig.cpp:81
DLL_API void annClose ( )

Definition at line 221 of file kd_tree.cpp.

References KD_TRIVIAL.

Referenced by main().

222 {
223  if (KD_TRIVIAL != NULL) {
224  delete KD_TRIVIAL;
225  KD_TRIVIAL = NULL;
226  }
227 }
ANNkd_leaf * KD_TRIVIAL
Definition: kd_tree.cpp:50
DLL_API ANNpoint annCopyPt ( int  dim,
ANNpoint  source 
)

Definition at line 140 of file ANN.cpp.

References dim.

Referenced by ANNbd_tree::ANNbd_tree(), ANNkd_tree::ANNkd_tree(), and ANNorthRect::ANNorthRect().

141 {
142  ANNpoint p = new ANNcoord[dim];
143  for (int i = 0; i < dim; i++) p[i] = source[i];
144  return p;
145 }
double ANNcoord
Definition: ANN.h:158
ANNcoord * ANNpoint
Definition: ANN.h:375
int dim
Definition: ann2fig.cpp:81
DLL_API void annDeallocPt ( ANNpoint p)

Definition at line 127 of file ANN.cpp.

Referenced by ANNkd_tree::~ANNkd_tree(), and ANNorthRect::~ANNorthRect().

128 {
129  delete [] p;
130  p = NULL;
131 }
DLL_API void annDeallocPts ( ANNpointArray pa)

Definition at line 133 of file ANN.cpp.

Referenced by annClusEllipsoids(), annClusGaussPts(), annClusOrthFlats(), generatePts(), main(), and readPts().

134 {
135  delete [] pa[0]; // dealloc coordinate storage
136  delete [] pa; // dealloc points
137  pa = NULL;
138 }
DLL_API ANNdist annDist ( int  dim,
ANNpoint  p,
ANNpoint  q 
)

Definition at line 46 of file ANN.cpp.

References ANN_COORD, ANN_FLOP, ANN_POW, ANN_PTS, ANN_SUM, and dim.

Referenced by ANNbruteForce::annkFRSearch(), and ANNbruteForce::annkSearch().

50 {
51  register int d;
52  register ANNcoord diff;
53  register ANNcoord dist;
54 
55  dist = 0;
56  for (d = 0; d < dim; d++) {
57  diff = p[d] - q[d];
58  dist = ANN_SUM(dist, ANN_POW(diff));
59  }
60  ANN_FLOP(3*dim) // performance counts
61  ANN_PTS(1)
62  ANN_COORD(dim)
63  return dist;
64 }
#define ANN_PTS(n)
Definition: ANNperf.h:135
double ANNcoord
Definition: ANN.h:158
#define ANN_SUM(x, y)
Definition: ANN.h:362
#define ANN_FLOP(n)
Definition: ANNperf.h:131
#define ANN_COORD(n)
Definition: ANNperf.h:136
int dim
Definition: ann2fig.cpp:81
#define ANN_POW(v)
Definition: ANN.h:360
DLL_API void annMaxPtsVisit ( int  maxPts)

Definition at line 197 of file ANN.cpp.

References ANNmaxPtsVisited, and maxPts.

Referenced by main().

199 {
201 }
int maxPts
Definition: ann_sample.cpp:56
int ANNmaxPtsVisited
Definition: ANN.cpp:190

Variable Documentation

const ANNbool ANN_ALLOW_SELF_MATCH = ANNtrue
const double ANN_DBL_MAX = DBL_MAX

Definition at line 118 of file ANN.h.

Referenced by doValidation(), and ANNsampStat::reset().

const ANNdist ANN_DIST_INF = ANN_DBL_MAX

Definition at line 199 of file ANN.h.

const int ANN_N_SHRINK_RULES = 4

Definition at line 610 of file ANN.h.

const int ANN_N_SPLIT_RULES = 6

Definition at line 603 of file ANN.h.

const ANNidx ANN_NULL_IDX = -1

Definition at line 176 of file ANN.h.

Referenced by doValidation(), and main().

const int ANNcoordPrec = 15

Definition at line 222 of file ANN.h.

Referenced by ANNkd_tree::Dump().


Generated on Thu Jun 11 2015 13:52:33 for queso-0.53.0 by  doxygen 1.8.5