14-May-2025 12:48:27 cvt_box_test(): MATLAB/Octave version 6.4.0. Test cvt_box(). output = cvt_box_final.txt cvt_box(): Generate and animate a constrained 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, * NPP, the number of points to place on the boundary. * INIT_STRING, initialize the points: ** file, read data from a file; ** 'GRID', by picking points from a grid; ** 'RAND', using MATLAB's RAND function; ** 'UNIFORM', using a simple uniform RNG; * IT_MAX, the maximum number of iterations. * IT_FIXED, the number of iterative steps to take using a fixed set of sampling points. * SAMPLE_STRING, how to conduct the sampling. ** 'GRID', by picking points from a grid; ** '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; * MOVIE_NAME is the name of the file in which the movie is stored; * OUTPUT, a file into which the final generator data is stored. 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. NDIM = 2 N is the number of points to generate. User input N = 100 NPP is the number of sample points used to check the boundary. User input NPP = 1000 INIT_STRING is the method of initializing the data: file read data from a file; 'GRID' by picking points from a grid; 'RAND' using MATLAB's RAND function; 'UNIFORM' using a simple uniform RNG; User input INIT_STRING = "rand". User input INIT = "-1". 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. User input IT_MAX = 50 IT_FIXED is the number of consecutive iterations to take with a fixed set of sample points. Setting IT_FIXED to 1 means a new set of sample points is generated on every iterative step; Setting IT_FIXED equal to IT_MAX means a single set of sample points is used for the entire iteration. Any value between 1 and IT_MAX is reasonable. User input IT_FIXED = 1 SAMPLE_STRING is the method of sampling the region: 'GRID' by picking points from a grid; 'RAND' using MATLAB's RAND function; 'UNIFORM' using a simple uniform RNG; User input SAMPLE_STRING = "rand". Numeric value of SAMPLE = -1 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. User input SAMPLE_NUM = 100000 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. BATCH = 1000 MOVIE_NAME is the name of the file in which the movie is stored; User input MOVIE_NAME = cvt_box_test.avi OUTPUT is a file into which the data is stored; OUTPUT = "cvt_box_final.txt". Energy Energy after Iteration of CVT projection 0 0.003258 0.003671 1 0.002151 0.002671 Graphics saved as "cvt_box_initial.png" 2 0.002024 0.002442 3 0.001972 0.002375 4 0.001940 0.002296 5 0.001911 0.002240 6 0.001893 0.002205 7 0.001878 0.002183 8 0.001871 0.002161 9 0.001867 0.002150 10 0.001859 0.002141 11 0.001845 0.002125 12 0.001844 0.002134 13 0.001847 0.002118 14 0.001842 0.002117 15 0.001845 0.002104 16 0.001840 0.002142 17 0.001835 0.002134 18 0.001837 0.002116 19 0.001845 0.002120 20 0.001847 0.002116 21 0.001837 0.002112 22 0.001839 0.002109 23 0.001844 0.002103 24 0.001832 0.002091 25 0.001834 0.002099 26 0.001840 0.002093 27 0.001833 0.002094 28 0.001826 0.002086 29 0.001832 0.002088 30 0.001826 0.002080 31 0.001825 0.002088 32 0.001831 0.002081 33 0.001816 0.002072 34 0.001823 0.002077 35 0.001827 0.002069 36 0.001830 0.002065 37 0.001826 0.002078 38 0.001827 0.002068 39 0.001827 0.002061 40 0.001818 0.002073 41 0.001823 0.002072 42 0.001818 0.002062 43 0.001816 0.002063 44 0.001828 0.002067 45 0.001819 0.002064 46 0.001822 0.002065 47 0.001811 0.002064 48 0.001809 0.002068 49 0.001819 0.002057 50 0.001817 0.002059 Graphics saved as "cvt_box_final.png" Final generator set saved in file "cvt_box_final.txt". Animation created as "cvt_box.gif" cvt_box(): Normal end of execution. cvt_box_test(): Normal end of execution. 14-May-2025 13:02:20