queso-0.57.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
ANN.cpp File Reference

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 QUESO::normalizeANN_XY().

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: ann_test.cpp:472
ANNpointArray annAllocPts ( int  n,
int  dim 
)

Definition at line 117 of file ANN.cpp.

References dim.

Referenced by annClusEllipsoids(), annClusGaussPts(), annClusOrthFlats(), annReadDump(), QUESO::computeMI_ANN(), QUESO::estimateCE_ANN(), QUESO::BaseVectorRV< V, M >::estimateENT_ANN(), QUESO::estimateKL_ANN(), QUESO::estimateMI_ANN(), generatePts(), 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 }
ANNpoint * ANNpointArray
Definition: ANN.h:376
double ANNcoord
Definition: ANN.h:158
ANNcoord * ANNpoint
Definition: ANN.h:375
int dim
Definition: ann_test.cpp:472
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 hi
Definition: ANNx.h:94
ANNpoint lo
Definition: ANNx.h:93
int dim
Definition: ann_test.cpp:472
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: ann_test.cpp:472
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(), QUESO::computeMI_ANN(), QUESO::estimateCE_ANN(), QUESO::BaseVectorRV< V, M >::estimateENT_ANN(), QUESO::estimateKL_ANN(), QUESO::estimateMI_ANN(), 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 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 }
double ANNcoord
Definition: ANN.h:158
int dim
Definition: ann_test.cpp:472
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(), 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.

Referenced by main().

199 {
200  ANNmaxPtsVisited = maxPts;
201 }
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: ann_test.cpp:472

Variable Documentation

int ANNmaxPtsVisited = 0

Definition at line 190 of file ANN.cpp.

Referenced by ANNkd_tree::annkPriSearch(), and annMaxPtsVisit().

int ANNptsVisited

Definition at line 191 of file ANN.cpp.

Referenced by ANNkd_tree::annkPriSearch(), and ANNkd_tree::annkSearch().


Generated on Tue Jun 5 2018 19:48:56 for queso-0.57.1 by  doxygen 1.8.5