23 August 2004 08:57:29 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 = 2 Enter N, the number of points to generate: (0 or any negative value terminates execution). User input N = 85 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 = 80 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 = 0 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 2.66515 2 1.20232 3 0.746827 4 0.612783 5 0.525226 6 0.485817 7 0.429536 8 0.420463 9 0.410356 10 0.369926 11 0.360934 12 0.364311 13 0.385216 14 0.383809 15 0.43249 16 0.367047 17 0.351476 18 0.381335 19 0.400692 20 0.354278 21 0.387441 22 0.349824 23 0.34518 24 0.379246 25 0.334083 26 0.355243 27 0.330493 28 0.366379 29 0.375606 30 0.358379 31 0.395065 32 0.37396 33 0.374133 34 0.366095 35 0.37883 36 0.385337 37 0.348548 38 0.359711 39 0.373866 40 0.359189 41 0.372439 42 0.327721 43 0.337503 44 0.376744 45 0.36718 46 0.370433 47 0.35075 48 0.380803 49 0.389762 50 0.376577 51 0.374596 52 0.346327 53 0.367658 54 0.365838 55 0.361473 56 0.368281 57 0.361398 58 0.391831 59 0.368604 60 0.354992 61 0.356474 62 0.328765 63 0.326162 64 0.334973 65 0.380889 66 0.341992 67 0.378203 68 0.383813 69 0.342927 70 0.358924 71 0.331395 72 0.359287 73 0.364461 74 0.361004 75 0.384474 76 0.349278 77 0.384296 78 0.3464 79 0.335266 80 0.351778 The data was written to the file "cvt_2_85.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 08:57:33 AM