cvt_dataset 23-Aug-2004 16:11:48 CVT_DATASET (MATLAB version) Generate a CVT dataset. 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; ** 'RAND', using MATLAB's RAND 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; ** 'RAND', using MATLAB's RAND function; ** 'UNIFORM', using a simple uniform RNG; * SAMPLE_NUM, the number of sample points. * BATCH, the number of sampling points to create 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: * * NDIM is the spatial dimension. Any value less than 1 terminates execution. Enter NDIM: 2 User input NDIM = 2 N is the number of points to generate. Any value less than 1 terminates execution. Enter N: 85 User input N = 85 SEED is a seed for the random number generation. Any value less than 0 terminates execution. Enter SEED: 123456789 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; 'RAND' using MATLAB's RAND function; 'UNIFORM' using a simple uniform RNG; (A blank value terminates execution). (Be sure to INCLUDE QUOTES around the string! Enter INIT: 'UNIFORM' 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: 40 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: 0.0 User input IT_TOL = 0.000000 SAMPLE is the method of sampling the region: 'GRID' by picking points from a grid; 'HALTON' from a Halton sequence; 'RAND' using MATLAB's RAND function; 'UNIFORM' using a simple uniform RNG; (A blank value terminates execution). (Be sure to INCLUDE QUOTES around the string! Enter SAMPLE: 'RANDOM' User input SAMPLE = "RANDOM". 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: 10000 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: 1000 User input BATCH = 1000 Step L2-Change 1 2.680166e+000 2 1.168146e+000 3 7.049335e-001 4 5.867777e-001 5 5.273730e-001 6 4.879558e-001 7 4.224032e-001 8 4.194828e-001 9 4.089314e-001 10 4.033531e-001 11 3.949572e-001 12 4.176402e-001 13 3.698721e-001 14 3.819681e-001 15 3.561412e-001 16 3.755075e-001 17 3.746719e-001 18 3.949829e-001 19 3.696782e-001 20 3.565880e-001 21 3.316307e-001 22 4.085070e-001 23 3.723574e-001 24 3.549149e-001 25 4.032986e-001 26 3.740282e-001 27 3.645458e-001 28 3.600326e-001 29 3.512155e-001 30 3.081823e-001 31 3.681735e-001 32 3.563632e-001 33 4.005875e-001 34 3.965961e-001 35 3.760615e-001 36 3.379663e-001 37 3.709122e-001 38 3.764774e-001 39 3.566693e-001 40 3.669001e-001 The data was written to the file "cvt_2_85.txt". * * * Ready to generate a new dataset: * * NDIM is the spatial dimension. Any value less than 1 terminates execution. Enter NDIM: -1 User input NDIM = -1 CVT_DATASET The input value of NDIM = -1 is interpreted as a request for termination. Normal end of execution. Final value of SEED = 1835092263 23-Aug-2004 16:12:36