23 August 2004 09:30:38 AM
CVT_DATASET (C++ version)
Generate a CVT dataset.
Compiled on Aug 23 2004 at 08:56:51
This program is meant to be used interactively.
It is also possible to prepare a simple input
file beforehand and use it in batch mode.
The program requests input values from the user:
* NDIM, the spatial dimension,
* N, the number of points to generate,
* SEED, a seed to use for random number generation,
* INIT, initialize the points:
** file, read data from a file;
** GRID, by picking points from a grid;
** HALTON, from a Halton sequence;
** RANDOM, using FORTRAN RANDOM function;
** UNIFORM, using a simple uniform RNG;
* IT_MAX, the maximum number of iterations.
* IT_TOL, the iteration tolerance.
* SAMPLE, how to conduct the sampling.
** GRID, by picking points from a grid;
** HALTON, from a Halton sequence;
** RANDOM, using FORTRAN RANDOM function;
** UNIFORM, using a simple uniform RNG;
* SAMPLE_NUM, the number of sample points.
* BATCH, the number of sample points to generate at one time.
The program generates the data, writes it to the file
cvt_NDIM_N.txt
where "NDIM" and "N" are the numeric values specified
by the user, and then asks the user for more input.
To indicate that no further computations are
desired, it is enough to input a nonsensical value,
such as -1.
*
*
* Ready to generate a new dataset:
*
*
Enter NDIM, the spatial dimension:
(0 or any negative value terminates execution).
User input NDIM = 3
Enter N, the number of points to generate:
(0 or any negative value terminates execution).
User input N = 100
Enter SEED, a seed for the random number generator:
(Any negative value terminates execution).
User input SEED = 123456789
INIT is the method of initializing the data:
file read data from a file;
GRID by picking points from a grid;
HALTON from a Halton sequence;
RANDOM using C++ RANDOM function;
UNIFORM using a simple uniform RNG;
(A blank value terminates execution).
Enter INIT:
User input INIT = "uniform".
IT_MAX is the maximum number of iterations.
An iteration carries out the following steps:
* the Voronoi region associated with each
generator is estimated by sampling;
* the centroid of each Voronoi region is estimated.
* the generator is replaced by the centroid.
If "enough" sampling points are used,
and "enough" iterations are taken, this process
will converge.
(A negative value terminates execution).
Enter IT_MAX:
User input IT_MAX = 40
IT_TOL is the iteration tolerance.
Each iteration replaces the generators by the
centroids. The L2 norm of the difference between
these two sets of points is an indirect measure
of convergence.
If this L2 norm falls below IT_TOL, the iteration
is presumed to have converged, and is terminated
early.
A zero value is acceptable, and simply means that
early termination will not occur.
(A negative value terminates execution).
Enter IT_TOL:
User input IT_TOL = 1e-06
SAMPLE is the method of sampling the region:
GRID by picking points from a grid;
HALTON from a Halton sequence;
RANDOM using C++ RANDOM function;
UNIFORM using a simple uniform RNG;
(A blank value terminates execution).
Enter SAMPLE:
User input SAMPLE = "uniform".
SAMPLE_NUM is the number of sample points.
The Voronoi regions will be explored by generating
SAMPLE_NUM points. For each sample point, the
nearest generator is found. Using more points
gives a better estimate of these regions.
SAMPLE_NUM should be much larger than N, the
number of generators.
(A zero or negative value terminates execution.)
Enter SAMPLE_NUM:
User input SAMPLE_NUM = 10000
BATCH is the number of sample points to create at one time.
BATCH should be between 1 and SAMPLE_NUM.
It is FASTER to set BATCH to SAMPLE_NUM;
setting BATCH to 1 requires the least memory.
(A zero or negative value terminates execution.)
Enter BATCH:
User input BATCH = 1000
Step L2-Change
1 5.57587
2 2.49933
3 1.78588
4 1.45927
5 1.32221
6 1.32483
7 1.25293
8 1.28869
9 1.35712
10 1.20834
11 1.19038
12 1.2008
13 1.24234
14 1.21881
15 1.18209
16 1.2187
17 1.12158
18 1.1179
19 1.18605
20 1.22924
21 1.13968
22 1.10846
23 1.16705
24 1.17188
25 1.16875
26 1.1955
27 1.21857
28 1.11309
29 1.06732
30 1.13039
31 1.0458
32 1.13412
33 1.17763
34 1.20557
35 1.06589
36 1.18568
37 1.2447
38 1.11724
39 1.19059
40 1.11009
The data was written to the file "cvt_3_100.txt
*
*
* Ready to generate a new dataset:
*
*
Enter NDIM, the spatial dimension:
(0 or any negative value terminates execution).
User input NDIM = -1
CVT_DATASET
The input value of NDIM = -1
is interpreted as a request for termination.
Normal end of execution.
23 August 2004 09:30:42 AM