61 const int TAB_SIZE = 97;
64 static double y, v[TAB_SIZE];
67 if (RAN_DIVISOR < 0) {
68 cout <<
"RAN_DIVISOR " << RAN_DIVISOR << endl;
85 for (j = 0; j < TAB_SIZE; j++)
88 for (j = 0; j < TAB_SIZE; j++)
100 j = int(TAB_SIZE * (y / RAN_DIVISOR));
103 return y / RAN_DIVISOR;
153 r = v1 * v1 + v2 * v2;
155 double fac =
sqrt(-2.0 *
log(r) / r);
183 const double b = 1.4142136;
187 if (sign < 0.5) laprand = -laprand;
201 for (
int i = 0; i < n; i++) {
202 for (
int d = 0;
d <
dim;
d++) {
220 for (
int i = 0; i < n; i++) {
221 for (
int d = 0;
d <
dim;
d++) {
237 for (
int i = 0; i < n; i++) {
238 for (
int d = 0;
d <
dim;
d++) {
256 double std_dev_w =
sqrt(1.0 - correlation * correlation);
257 for (
int i = 0; i < n; i++) {
260 for (
int d = 1;
d <
dim;
d++) {
261 previous = correlation*previous + std_dev_w*
annRanGauss();
280 double corr_sq = correlation * correlation;
282 for (
int i = 0; i < n; i++) {
285 for (
int d = 1;
d <
dim;
d++) {
291 previous = correlation * previous + wn;
324 if (clusters == NULL || new_clust) {
325 if (clusters != NULL)
329 for (
int i = 0; i < n_clus; i++) {
330 for (
int d = 0;
d <
dim;
d++) {
336 for (
int i = 0; i < n; i++) {
338 for (
int d = 0;
d <
dim;
d++) {
398 for (
int i = 0; i < n; i++) {
399 for (
int d = 0;
d <
dim;
d++) {
419 if (control == NULL || new_clust) {
420 if (control != NULL) {
425 for (
int c = 0; c < n_clus; c++) {
427 for (
int d = 0;
d <
dim;
d++) {
429 double Prob = ((double) n_dim)/((double) (dim-
d));
441 for (
int c = 0; c < n_clus; c++) {
442 int pick = (n+c)/n_clus;
444 genOrthFlat(pa+offset, pick, dim, control[c], std_dev);
496 for (
int i = 0; i < n; i++) {
497 for (
int d = 0;
d <
dim;
d++) {
509 double std_dev_small,
517 if (centers == NULL || new_clust) {
526 for (
int i = 0; i < n_clus; i++) {
527 for (
int d = 0;
d <
dim;
d++) {
531 for (
int c = 0; c < n_clus; c++) {
533 for (
int d = 0;
d <
dim;
d++) {
535 double Prob = ((double) n_dim)/((double) (dim-
d));
538 std_dev[c][
d] =
annRanUnif(std_dev_lo, std_dev_hi);
542 std_dev[c][
d] = std_dev_small;
549 for (
int c = 0; c < n_clus; c++) {
550 int pick = (n+c)/n_clus;
552 genGauss(pa+offset, pick, dim, centers[c], std_dev[c]);
588 for (
int i = 0; i < n; i++) {
590 for (
int d = 0;
d <
dim;
d++) {
static void genGauss(ANNpointArray pa, int n, int dim, double *center, double *std_dev)
static double annRanLaplace()
void annClusGaussPts(ANNpointArray pa, int n, int dim, int n_clus, ANNbool new_clust, double std_dev)
void annCoGaussPts(ANNpointArray pa, int n, int dim, double correlation)
INLINE Rall1d< T, V, S > log(const Rall1d< T, V, S > &arg)
void annLaplacePts(ANNpointArray pa, int n, int dim)
DLL_API ANNpointArray annAllocPts(int n, int dim)
void annPlanted(ANNpointArray pa, int n, int dim, ANNpointArray src, int n_src, double std_dev)
void annClusOrthFlats(ANNpointArray pa, int n, int dim, int n_clus, ANNbool new_clust, double std_dev, int max_dim)
static double annRanGauss()
void annUniformPts(ANNpointArray pa, int n, int dim)
static int annRanInt(int n)
DLL_API void annDeallocPts(ANNpointArray &pa)
void annGaussPts(ANNpointArray pa, int n, int dim, double std_dev)
void annCoLaplacePts(ANNpointArray pa, int n, int dim, double correlation)
INLINE Rall1d< T, V, S > sqrt(const Rall1d< T, V, S > &arg)
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)
static double annRanUnif(double lo, double hi)
static void genOrthFlat(ANNpointArray pa, int n, int dim, double *control, double std_dev)