queso-0.53.0
rand.h
Go to the documentation of this file.
1 //----------------------------------------------------------------------
2 // File: rand.h
3 // Programmer: Sunil Arya and David Mount
4 // Description: Basic include file for random point generators
5 // Last modified: 08/04/06 (Version 1.1.1)
6 //----------------------------------------------------------------------
7 // Copyright (c) 1997-2005 University of Maryland and Sunil Arya and
8 // David Mount. All Rights Reserved.
9 //
10 // This software and related documentation is part of the Approximate
11 // Nearest Neighbor Library (ANN). This software is provided under
12 // the provisions of the Lesser GNU Public License (LGPL). See the
13 // file ../ReadMe.txt for further information.
14 //
15 // The University of Maryland (U.M.) and the authors make no
16 // representations about the suitability or fitness of this software for
17 // any purpose. It is provided "as is" without express or implied
18 // warranty.
19 //----------------------------------------------------------------------
20 // History:
21 // Revision 0.1 03/04/98
22 // Initial release
23 // Revision 1.0 04/01/05
24 // Added annClusOrthFlats distribution
25 // Changed procedure names to avoid namespace conflicts
26 // Added annClusFlats distribution
27 // Revision 1.1.1 08/04/06
28 // Added planted distribution
29 //----------------------------------------------------------------------
30 
31 #ifndef rand_H
32 #define rand_H
33 
34 //----------------------------------------------------------------------
35 // Basic includes
36 //----------------------------------------------------------------------
37 #include <cstdlib> // standard includes (rand/random)
38 #include <cmath> // math routines
39 #include <ANN/ANN.h> // basic ANN includes
40 
41 //----------------------------------------------------------------------
42 // Although random/srandom is a more reliable random number generator,
43 // many systems do not have it. If it is not available, set the
44 // preprocessor symbol ANN_NO_RANDOM, and this will substitute the use
45 // of rand/srand for them.
46 //----------------------------------------------------------------------
47 #ifdef ANN_NO_RANDOM // for systems not having random()
48  #define ANN_RAND rand
49  #define ANN_SRAND srand
50  #define ANN_RAND_MAX RAND_MAX
51 #else // otherwise use rand()
52  #define ANN_RAND random
53  #define ANN_SRAND srandom
54  #define ANN_RAND_MAX 2147483647UL // 2**{31} - 1
55  // #define ANN_RAND_MAX 1073741824UL // 2**{30}
56 #endif
57 
58 //----------------------------------------------------------------------
59 // Globals
60 //----------------------------------------------------------------------
61 extern int annIdum; // random number seed
62 
63 //----------------------------------------------------------------------
64 // External entry points
65 //----------------------------------------------------------------------
66 
67 void annUniformPts( // uniform distribution
68  ANNpointArray pa, // point array (modified)
69  int n, // number of points
70  int dim); // dimension
71 
72 void annGaussPts( // Gaussian distribution
73  ANNpointArray pa, // point array (modified)
74  int n, // number of points
75  int dim, // dimension
76  double std_dev); // standard deviation
77 
78 void annCoGaussPts( // correlated-Gaussian distribution
79  ANNpointArray pa, // point array (modified)
80  int n, // number of points
81  int dim, // dimension
82  double correlation); // correlation
83 
84 void annLaplacePts( // Laplacian distribution
85  ANNpointArray pa, // point array (modified)
86  int n, // number of points
87  int dim); // dimension
88 
89 void annCoLaplacePts( // correlated-Laplacian distribution
90  ANNpointArray pa, // point array (modified)
91  int n, // number of points
92  int dim, // dimension
93  double correlation); // correlation
94 
95 void annClusGaussPts( // clustered-Gaussian distribution
96  ANNpointArray pa, // point array (modified)
97  int n, // number of points
98  int dim, // dimension
99  int n_clus, // number of colors (clusters)
100  ANNbool new_clust, // generate new cluster centers
101  double std_dev); // standard deviation within clusters
102 
103 void annClusOrthFlats( // clustered along orthogonal flats
104  ANNpointArray pa, // point array (modified)
105  int n, // number of points
106  int dim, // dimension
107  int n_clus, // number of colors
108  ANNbool new_clust, // generate new clusters.
109  double std_dev, // standard deviation within clusters
110  int max_dim); // maximum dimension of the flats
111 
112 void annClusEllipsoids( // clustered around ellipsoids
113  ANNpointArray pa, // point array (modified)
114  int n, // number of points
115  int dim, // dimension
116  int n_clus, // number of colors
117  ANNbool new_clust, // generate new clusters.
118  double std_dev_small, // small standard deviation
119  double std_dev_lo, // low standard deviation for ellipses
120  double std_dev_hi, // high standard deviation for ellipses
121  int max_dim); // maximum dimension of the flats
122 
123 void annPlanted( // planted nearest neighbors
124  ANNpointArray pa, // point array (modified)
125  int n, // number of points
126  int dim, // dimension
127  ANNpointArray src, // source point array
128  int n_src, // source size
129  double std_dev); // standard deviation about source
130 
131 #endif
ANNbool
Definition: ANN.h:132
void annClusGaussPts(ANNpointArray pa, int n, int dim, int n_clus, ANNbool new_clust, double std_dev)
Definition: rand.cpp:314
double std_dev_lo
Definition: ann_test.cpp:481
void annPlanted(ANNpointArray pa, int n, int dim, ANNpointArray src, int n_src, double std_dev)
Definition: rand.cpp:580
ANNpoint * ANNpointArray
Definition: ANN.h:376
void annClusEllipsoids(ANNpointArray pa, int n, int dim, int n_clus, ANNbool new_clust, double std_dev_small, double std_dev_lo, double std_dev_hi, int max_dim)
Definition: rand.cpp:503
void annLaplacePts(ANNpointArray pa, int n, int dim)
Definition: rand.cpp:232
void annGaussPts(ANNpointArray pa, int n, int dim, double std_dev)
Definition: rand.cpp:214
int annIdum
Definition: rand.cpp:42
void annCoGaussPts(ANNpointArray pa, int n, int dim, double correlation)
Definition: rand.cpp:250
int max_dim
Definition: ann_test.cpp:477
int dim
Definition: ann2fig.cpp:81
ANNbool new_clust
Definition: ann_test.cpp:476
double std_dev
Definition: ann_test.cpp:480
void annUniformPts(ANNpointArray pa, int n, int dim)
Definition: rand.cpp:196
double std_dev_hi
Definition: ann_test.cpp:482
void annCoLaplacePts(ANNpointArray pa, int n, int dim, double correlation)
Definition: rand.cpp:273
void annClusOrthFlats(ANNpointArray pa, int n, int dim, int n_clus, ANNbool new_clust, double std_dev, int max_dim)
Definition: rand.cpp:408

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