queso-0.53.0
Functions | Variables
ANN.cpp File Reference
#include <cstdlib>
#include <ANN/ANNx.h>
#include <ANN/ANNperf.h>
Include dependency graph for ANN.cpp:

Go to the source code of this file.

Functions

ANNdist annDist (int dim, ANNpoint p, ANNpoint q)
 
void annPrintPt (ANNpoint pt, int dim, std::ostream &out)
 
ANNpoint annAllocPt (int dim, ANNcoord c)
 
ANNpointArray annAllocPts (int n, int dim)
 
void annDeallocPt (ANNpoint &p)
 
void annDeallocPts (ANNpointArray &pa)
 
ANNpoint annCopyPt (int dim, ANNpoint source)
 
void annAssignRect (int dim, ANNorthRect &dest, const ANNorthRect &source)
 
void annError (const char *msg, ANNerr level)
 
void annMaxPtsVisit (int maxPts)
 

Variables

int ANNmaxPtsVisited = 0
 
int ANNptsVisited
 

Function Documentation

ANNpoint annAllocPt ( int  dim,
ANNcoord  c 
)

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
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
void annAssignRect ( int  dim,
ANNorthRect dest,
const ANNorthRect source 
)

Definition at line 148 of file ANN.cpp.

References dim, ANNorthRect::hi, and ANNorthRect::lo.

Referenced by annBnds2Box(), and tryCentroidShrink().

149 {
150  for (int i = 0; i < dim; i++) {
151  dest.lo[i] = source.lo[i];
152  dest.hi[i] = source.hi[i];
153  }
154 }
ANNpoint lo
Definition: ANNx.h:93
int dim
Definition: ann2fig.cpp:81
ANNpoint hi
Definition: ANNx.h:94
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
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 }
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 }
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
void annError ( const char *  msg,
ANNerr  level 
)

Definition at line 169 of file ANN.cpp.

References ANNabort.

Referenced by ANNbd_tree::ANNbd_tree(), ANNkd_tree::ANNkd_tree(), ANNbruteForce::annkSearch(), ANNkd_tree::annkSearch(), annReadDump(), annReadTree(), ANNpr_queue::insert(), and selectDecomp().

170 {
171  if (level == ANNabort) {
172  cerr << "ANN: ERROR------->" << msg << "<-------------ERROR\n";
173  exit(1);
174  }
175  else {
176  cerr << "ANN: WARNING----->" << msg << "<-------------WARNING\n";
177  }
178 }
Definition: ANNx.h:48
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
void annPrintPt ( ANNpoint  pt,
int  dim,
std::ostream &  out 
)

Definition at line 70 of file ANN.cpp.

References dim.

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

74 {
75  for (int j = 0; j < dim; j++) {
76  out << pt[j];
77  if (j < dim-1) out << " ";
78  }
79 }
int dim
Definition: ann2fig.cpp:81

Variable Documentation

int ANNmaxPtsVisited = 0
int ANNptsVisited

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