26-Sep-2024 21:01:36 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.003412 0.004092 1 0.002225 0.002943 Graphics saved as "cvt_box_initial.png" 2 0.002046 0.002608 3 0.001965 0.002440 4 0.001905 0.002342 5 0.001881 0.002273 6 0.001853 0.002259 7 0.001852 0.002198 8 0.001843 0.002174 9 0.001834 0.002153 10 0.001829 0.002196 11 0.001824 0.002161 12 0.001816 0.002144 13 0.001822 0.002129 14 0.001812 0.002118 15 0.001815 0.002116 16 0.001815 0.002108 17 0.001808 0.002104 18 0.001811 0.002085 19 0.001809 0.002072 20 0.001805 0.002078 21 0.001799 0.002062 22 0.001804 0.002070 23 0.001801 0.002066 24 0.001800 0.002068 25 0.001802 0.002050 26 0.001792 0.002054 27 0.001807 0.002053 28 0.001798 0.002052 29 0.001805 0.002052 30 0.001799 0.002048 31 0.001798 0.002046 32 0.001803 0.002046 33 0.001805 0.002049 34 0.001806 0.002047 35 0.001803 0.002048 36 0.001807 0.002040 37 0.001803 0.002047 38 0.001797 0.002046 39 0.001802 0.002042 40 0.001795 0.002043 41 0.001800 0.002041 42 0.001795 0.002041 43 0.001796 0.002041 44 0.001800 0.002037 45 0.001794 0.002039 46 0.001800 0.002035 47 0.001797 0.002034 48 0.001799 0.002037 49 0.001800 0.002032 50 0.001797 0.002038 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. 26-Sep-2024 21:15:42