07-Jan-2022 18:35:57 cvt_test(): MATLAB version Test CVT(). TEST01 CVT computes a Centroidal Voronoi Tessellation. Step SEED L2-Change Energy 1 9.566160e-01 4.566102e-02 2 4.133417e-01 2.699132e-02 3 2.681424e-01 2.365580e-02 4 2.054055e-01 2.219508e-02 5 1.799606e-01 2.107736e-02 6 1.876979e-01 2.045361e-02 7 1.661074e-01 1.909518e-02 8 1.588587e-01 1.852531e-02 9 1.419813e-01 1.809293e-02 10 1.077924e-01 1.787366e-02 11 9.461735e-02 1.766651e-02 12 9.350802e-02 1.752575e-02 13 7.389380e-02 1.725088e-02 14 5.755398e-02 1.714404e-02 15 5.492836e-02 1.713062e-02 16 4.572839e-02 1.717964e-02 17 4.885480e-02 1.726822e-02 18 4.956290e-02 1.711826e-02 19 4.967130e-02 1.712241e-02 20 5.434188e-02 1.713947e-02 21 4.317489e-02 1.705467e-02 22 4.471504e-02 1.708735e-02 23 3.212881e-02 1.722750e-02 24 5.105548e-02 1.697576e-02 25 3.886972e-02 1.701180e-02 26 5.070231e-02 1.705504e-02 27 4.004804e-02 1.715188e-02 28 3.922156e-02 1.712478e-02 29 4.761066e-02 1.693179e-02 30 3.800446e-02 1.691344e-02 31 5.719079e-02 1.713197e-02 32 4.003705e-02 1.722490e-02 33 3.883398e-02 1.695466e-02 34 3.756471e-02 1.705109e-02 35 3.349123e-02 1.709128e-02 36 4.252064e-02 1.706879e-02 37 4.299079e-02 1.706116e-02 38 4.971095e-02 1.703210e-02 39 4.827325e-02 1.711795e-02 40 3.102926e-02 1.692954e-02 Dimension DIM_NUM = 2 Number of points N = 10 INIT = "uniform". Max iterations IT_MAX = 40 IT_FIXED (fixed samples) = 1 Iterations IT_NUM = 40 Difference IT_DIFF = 0.031029 CVT ENERGY = 0.016930 SAMPLE = "uniform". Samples SAMPLE_NUM = 10000 Sampling BATCH size = 1000 EPSILON (unit roundoff) = 2.220446e-16 Generators (rows): Row: 1 2 Col 1: 0.819093 0.628587 2: 0.163056 0.499605 3: 0.491152 0.17072 4: 0.167615 0.166677 5: 0.833304 0.881086 6: 0.160592 0.829786 7: 0.81618 0.379556 8: 0.836026 0.128089 9: 0.477099 0.507418 10: 0.491733 0.833438 TEST02 CVT computes a Centroidal Voronoi Tessellation. Repeat test 1, but with twice the number of iterations. Step SEED L2-Change Energy 1 1.104906e+00 4.931726e-02 2 4.074559e-01 2.513017e-02 3 2.620225e-01 2.186368e-02 4 1.868840e-01 2.023828e-02 5 1.289816e-01 1.966260e-02 6 1.247020e-01 1.938249e-02 7 7.704087e-02 1.901892e-02 8 6.782777e-02 1.894807e-02 9 8.506659e-02 1.864033e-02 10 7.718191e-02 1.870772e-02 11 7.430601e-02 1.886166e-02 12 7.554571e-02 1.858508e-02 13 6.740539e-02 1.862717e-02 14 6.203960e-02 1.823924e-02 15 5.560828e-02 1.817865e-02 16 6.271070e-02 1.849540e-02 17 7.792892e-02 1.823007e-02 18 8.509825e-02 1.802415e-02 19 7.933383e-02 1.784407e-02 20 7.000757e-02 1.759196e-02 21 6.312361e-02 1.733389e-02 22 5.605045e-02 1.741329e-02 23 5.486321e-02 1.728063e-02 24 6.708731e-02 1.726597e-02 25 5.510692e-02 1.711551e-02 26 5.653982e-02 1.719574e-02 27 4.774715e-02 1.727232e-02 28 6.557388e-02 1.730022e-02 29 6.051310e-02 1.713008e-02 30 5.308840e-02 1.702246e-02 31 4.370511e-02 1.717052e-02 32 3.749962e-02 1.703239e-02 33 4.686762e-02 1.724324e-02 34 3.832065e-02 1.710722e-02 35 3.599146e-02 1.710654e-02 36 4.879158e-02 1.695427e-02 37 4.781636e-02 1.706024e-02 38 4.737695e-02 1.734790e-02 39 4.262360e-02 1.708182e-02 40 4.490479e-02 1.730505e-02 41 4.686922e-02 1.728426e-02 42 3.365977e-02 1.694878e-02 43 4.944924e-02 1.714445e-02 44 4.694258e-02 1.696989e-02 45 4.784367e-02 1.708645e-02 46 5.518883e-02 1.710103e-02 47 4.892588e-02 1.702693e-02 48 5.296178e-02 1.712318e-02 49 4.867719e-02 1.710164e-02 50 6.332477e-02 1.693376e-02 51 5.435142e-02 1.705225e-02 52 4.285502e-02 1.701410e-02 53 3.864307e-02 1.711455e-02 54 3.039540e-02 1.702858e-02 55 4.314028e-02 1.703366e-02 56 4.125368e-02 1.699574e-02 57 3.391944e-02 1.714511e-02 58 3.328497e-02 1.679820e-02 59 5.368174e-02 1.696450e-02 60 5.857500e-02 1.717778e-02 61 4.620411e-02 1.711588e-02 62 4.591646e-02 1.709818e-02 63 4.704272e-02 1.717792e-02 64 3.965679e-02 1.702980e-02 65 4.880504e-02 1.699886e-02 66 3.423242e-02 1.690200e-02 67 3.791775e-02 1.707959e-02 68 3.567940e-02 1.705266e-02 69 4.967503e-02 1.707338e-02 70 6.343820e-02 1.709811e-02 71 4.401587e-02 1.707687e-02 72 3.417306e-02 1.720302e-02 73 4.747398e-02 1.719820e-02 74 3.561671e-02 1.702259e-02 75 3.780354e-02 1.691200e-02 76 4.646948e-02 1.725312e-02 77 6.086407e-02 1.700950e-02 78 6.257359e-02 1.707662e-02 79 4.574842e-02 1.700387e-02 80 4.201096e-02 1.714447e-02 Dimension DIM_NUM = 2 Number of points N = 10 INIT = "uniform". Max iterations IT_MAX = 80 IT_FIXED (fixed samples) = 1 Iterations IT_NUM = 80 Difference IT_DIFF = 0.042011 CVT ENERGY = 0.017144 SAMPLE = "uniform". Samples SAMPLE_NUM = 10000 Sampling BATCH size = 1000 EPSILON (unit roundoff) = 2.220446e-16 Generators (rows): Row: 1 2 Col 1: 0.883182 0.17395 2: 0.377689 0.187903 3: 0.834067 0.510828 4: 0.162876 0.83954 5: 0.162744 0.512924 6: 0.501363 0.512517 7: 0.826812 0.835542 8: 0.123282 0.165266 9: 0.486767 0.8341 10: 0.630835 0.180014 TEST03 CVT computes a Centroidal Voronoi Tessellation. Repeat test 1, but with 100 times the sample points. Step SEED L2-Change Energy 1 9.808295e-01 5.518940e-02 2 4.141259e-01 2.482065e-02 3 2.460466e-01 2.032978e-02 4 1.716983e-01 1.889078e-02 5 1.311748e-01 1.810778e-02 6 1.023787e-01 1.771065e-02 7 7.771570e-02 1.748188e-02 8 5.906170e-02 1.734423e-02 9 4.466057e-02 1.724378e-02 10 3.264287e-02 1.721026e-02 11 2.892828e-02 1.716261e-02 12 2.278308e-02 1.712074e-02 13 2.010650e-02 1.711995e-02 14 1.827316e-02 1.710337e-02 15 1.737333e-02 1.708796e-02 16 1.395933e-02 1.708715e-02 17 1.334667e-02 1.707604e-02 18 1.201910e-02 1.709186e-02 19 8.861547e-03 1.709572e-02 20 1.015744e-02 1.705863e-02 21 7.641653e-03 1.708602e-02 22 9.495634e-03 1.703631e-02 23 8.744559e-03 1.704413e-02 24 8.208394e-03 1.706292e-02 25 7.181352e-03 1.707170e-02 26 6.880831e-03 1.706338e-02 27 6.390984e-03 1.706348e-02 28 5.480896e-03 1.705779e-02 29 7.034915e-03 1.706895e-02 30 5.253360e-03 1.704581e-02 31 5.344603e-03 1.706458e-02 32 5.741105e-03 1.704646e-02 33 4.273512e-03 1.704951e-02 34 5.035544e-03 1.708811e-02 35 5.585610e-03 1.707300e-02 36 4.887447e-03 1.705792e-02 37 5.505117e-03 1.706224e-02 38 5.098842e-03 1.707878e-02 39 4.944828e-03 1.706913e-02 40 3.965373e-03 1.703101e-02 Dimension DIM_NUM = 2 Number of points N = 10 INIT = "uniform". Max iterations IT_MAX = 40 IT_FIXED (fixed samples) = 1 Iterations IT_NUM = 40 Difference IT_DIFF = 0.003965 CVT ENERGY = 0.017031 SAMPLE = "uniform". Samples SAMPLE_NUM = 1000000 Sampling BATCH size = 1000 EPSILON (unit roundoff) = 2.220446e-16 Generators (rows): Row: 1 2 Col 1: 0.832587 0.8349 2: 0.121608 0.169304 3: 0.877992 0.16864 4: 0.372292 0.181225 5: 0.166399 0.835469 6: 0.498304 0.840871 7: 0.627319 0.180532 8: 0.501347 0.519551 9: 0.166227 0.507931 10: 0.834715 0.507124 TEST05 CVT computes a Centroidal Voronoi Tessellation. Repeat test 1, but with grid sampling. Step SEED L2-Change Energy 1 7.748970e-01 3.189711e-02 2 3.474433e-01 2.353120e-02 3 2.565299e-01 2.095872e-02 4 2.196813e-01 1.944159e-02 5 1.453283e-01 1.823838e-02 6 1.172535e-01 1.793143e-02 7 8.407577e-02 1.763026e-02 8 9.029593e-02 1.743805e-02 9 7.042551e-02 1.741022e-02 10 6.104511e-02 1.737282e-02 11 6.917980e-02 1.749073e-02 12 7.365500e-02 1.728053e-02 13 6.008766e-02 1.721618e-02 14 4.725693e-02 1.703896e-02 15 4.834881e-02 1.720732e-02 16 4.789740e-02 1.707701e-02 17 5.181170e-02 1.726689e-02 18 4.089154e-02 1.724291e-02 19 3.860110e-02 1.706158e-02 20 5.462521e-02 1.708827e-02 21 4.480082e-02 1.721204e-02 22 3.987032e-02 1.710488e-02 23 4.286647e-02 1.707959e-02 24 4.883307e-02 1.687029e-02 25 3.605927e-02 1.705877e-02 26 4.109609e-02 1.710570e-02 27 4.262938e-02 1.716882e-02 28 4.451510e-02 1.711755e-02 29 5.008338e-02 1.708421e-02 30 4.769617e-02 1.731020e-02 31 5.144960e-02 1.696228e-02 32 5.297673e-02 1.711856e-02 33 4.937400e-02 1.704338e-02 34 2.427748e-02 1.690298e-02 35 3.634892e-02 1.708424e-02 36 4.720584e-02 1.689314e-02 37 4.297671e-02 1.706081e-02 38 5.370811e-02 1.702189e-02 39 3.788914e-02 1.688493e-02 40 4.584571e-02 1.710940e-02 Dimension DIM_NUM = 2 Number of points N = 10 INIT = "uniform". Max iterations IT_MAX = 40 IT_FIXED (fixed samples) = 1 Iterations IT_NUM = 40 Difference IT_DIFF = 0.045846 CVT ENERGY = 0.017109 SAMPLE = "grid". Samples SAMPLE_NUM = 10000 Sampling BATCH size = 1000 EPSILON (unit roundoff) = 2.220446e-16 Generators (rows): Row: 1 2 Col 1: 0.840965 0.494304 2: 0.170348 0.117653 3: 0.518923 0.504763 4: 0.185848 0.370534 5: 0.183764 0.629773 6: 0.50687 0.168147 7: 0.836989 0.834873 8: 0.164293 0.877561 9: 0.50607 0.836879 10: 0.833277 0.167247 TEST06 CVT computes a Centroidal Voronoi Tessellation. Repeat test 1, but with MATLAB RANDOM sampling. Step SEED L2-Change Energy 1 1.082909e+00 4.864953e-02 2 3.057954e-01 2.244160e-02 3 1.729173e-01 2.072102e-02 4 1.457444e-01 1.991844e-02 5 1.189564e-01 1.987239e-02 6 1.079285e-01 1.933361e-02 7 1.049357e-01 1.910574e-02 8 7.397487e-02 1.874267e-02 9 1.019302e-01 1.908152e-02 10 9.225243e-02 1.900289e-02 11 8.968147e-02 1.872848e-02 12 7.676514e-02 1.813952e-02 13 8.347909e-02 1.825055e-02 14 9.761864e-02 1.830196e-02 15 1.021388e-01 1.782075e-02 16 1.015848e-01 1.779591e-02 17 8.814659e-02 1.761952e-02 18 7.029791e-02 1.745412e-02 19 4.706271e-02 1.726025e-02 20 6.609116e-02 1.732824e-02 21 7.574910e-02 1.736620e-02 22 6.280229e-02 1.719931e-02 23 5.831710e-02 1.716279e-02 24 5.230320e-02 1.707482e-02 25 4.873301e-02 1.724083e-02 26 5.832363e-02 1.699905e-02 27 5.049480e-02 1.695614e-02 28 3.924844e-02 1.706637e-02 29 3.447497e-02 1.684109e-02 30 3.401571e-02 1.694728e-02 31 3.574761e-02 1.691673e-02 32 3.633847e-02 1.706863e-02 33 4.743541e-02 1.691814e-02 34 5.111982e-02 1.705296e-02 35 4.467794e-02 1.704810e-02 36 4.020733e-02 1.704599e-02 37 4.259699e-02 1.710983e-02 38 4.865108e-02 1.684496e-02 39 4.833915e-02 1.674330e-02 40 3.291521e-02 1.695232e-02 Dimension DIM_NUM = 2 Number of points N = 10 INIT = "uniform". Max iterations IT_MAX = 40 IT_FIXED (fixed samples) = 1 Iterations IT_NUM = 40 Difference IT_DIFF = 0.032915 CVT ENERGY = 0.016952 SAMPLE = "random". Samples SAMPLE_NUM = 10000 Sampling BATCH size = 1000 EPSILON (unit roundoff) = 2.220446e-16 Generators (rows): Row: 1 2 Col 1: 0.117304 0.500718 2: 0.165261 0.166591 3: 0.508168 0.831087 4: 0.635381 0.481873 5: 0.836982 0.156815 6: 0.170791 0.837635 7: 0.88206 0.506239 8: 0.491301 0.15829 9: 0.371312 0.498308 10: 0.833507 0.83376 TEST08 CVT computes a Centroidal Voronoi Tessellation. Repeat test 1 with a different batch size. Step SEED L2-Change Energy 1 5.327321e-01 2.698843e-02 2 2.333591e-01 2.133607e-02 3 1.613710e-01 2.002524e-02 4 1.391617e-01 1.968798e-02 5 1.269551e-01 1.901761e-02 6 1.177686e-01 1.881536e-02 7 7.020334e-02 1.857034e-02 8 8.686095e-02 1.857415e-02 9 7.909380e-02 1.871255e-02 10 6.540563e-02 1.836698e-02 11 5.392044e-02 1.833435e-02 12 6.651598e-02 1.834136e-02 13 5.774796e-02 1.814933e-02 14 6.801847e-02 1.810401e-02 15 5.465006e-02 1.815521e-02 16 4.810822e-02 1.806871e-02 17 4.460641e-02 1.808829e-02 18 5.341179e-02 1.792980e-02 19 5.403109e-02 1.815898e-02 20 5.558804e-02 1.802066e-02 21 7.610006e-02 1.799268e-02 22 8.191233e-02 1.788747e-02 23 8.060136e-02 1.770772e-02 24 6.906424e-02 1.756769e-02 25 7.355220e-02 1.742877e-02 26 6.599090e-02 1.762622e-02 27 6.092413e-02 1.742335e-02 28 6.775981e-02 1.731489e-02 29 6.819001e-02 1.754871e-02 30 6.216300e-02 1.724398e-02 31 3.996500e-02 1.702215e-02 32 5.100211e-02 1.741457e-02 33 5.867321e-02 1.724540e-02 34 6.611209e-02 1.720381e-02 35 6.321536e-02 1.698226e-02 36 5.407576e-02 1.720385e-02 37 7.109088e-02 1.730501e-02 38 5.126146e-02 1.713585e-02 39 4.682084e-02 1.696579e-02 40 5.165036e-02 1.724815e-02 Dimension DIM_NUM = 2 Number of points N = 10 INIT = "uniform". Max iterations IT_MAX = 40 IT_FIXED (fixed samples) = 1 Iterations IT_NUM = 40 Difference IT_DIFF = 0.051650 CVT ENERGY = 0.017248 SAMPLE = "uniform". Samples SAMPLE_NUM = 10000 Sampling BATCH size = 5 EPSILON (unit roundoff) = 2.220446e-16 Generators (rows): Row: 1 2 Col 1: 0.150184 0.171387 2: 0.82841 0.878427 3: 0.160171 0.841147 4: 0.500058 0.479619 5: 0.477552 0.163197 6: 0.812087 0.118831 7: 0.835749 0.35344 8: 0.16838 0.509597 9: 0.822437 0.623215 10: 0.485532 0.825681 TEST09 CVT computes a Centroidal Voronoi Tessellation. Repeat test 1, but with IT_FIXED = IT_MAX. Step SEED L2-Change Energy 1 6.038342e-01 3.316619e-02 2 4.418539e-01 2.427332e-02 3 3.240618e-01 2.059432e-02 4 1.820161e-01 1.865113e-02 5 1.330330e-01 1.799544e-02 6 9.513935e-02 1.772557e-02 7 8.028516e-02 1.763095e-02 8 5.726394e-02 1.768829e-02 9 6.793284e-02 1.730821e-02 10 6.043800e-02 1.723581e-02 11 5.763999e-02 1.711872e-02 12 4.533798e-02 1.753587e-02 13 4.029455e-02 1.717689e-02 14 6.670365e-02 1.726889e-02 15 5.961944e-02 1.729476e-02 16 4.887454e-02 1.725928e-02 17 5.182938e-02 1.713751e-02 18 4.969417e-02 1.704730e-02 19 4.751468e-02 1.720649e-02 20 4.154626e-02 1.717353e-02 21 4.568757e-02 1.710015e-02 22 5.219820e-02 1.712842e-02 23 5.946995e-02 1.714498e-02 24 4.298588e-02 1.699257e-02 25 4.493107e-02 1.686167e-02 26 4.164070e-02 1.716935e-02 27 5.506212e-02 1.706289e-02 28 4.635838e-02 1.701774e-02 29 3.143921e-02 1.698300e-02 30 3.850314e-02 1.709335e-02 31 3.542273e-02 1.685001e-02 32 4.461568e-02 1.703931e-02 33 4.403738e-02 1.720363e-02 34 4.165590e-02 1.695636e-02 35 4.171367e-02 1.711449e-02 36 3.232424e-02 1.711059e-02 37 3.180738e-02 1.717108e-02 38 4.941979e-02 1.707908e-02 39 4.074394e-02 1.701467e-02 40 4.142881e-02 1.710431e-02 Dimension DIM_NUM = 2 Number of points N = 10 INIT = "uniform". Max iterations IT_MAX = 40 IT_FIXED (fixed samples) = 40 Iterations IT_NUM = 40 Difference IT_DIFF = 0.041429 CVT ENERGY = 0.017104 SAMPLE = "uniform". Samples SAMPLE_NUM = 10000 Sampling BATCH size = 1000 EPSILON (unit roundoff) = 2.220446e-16 Generators (rows): Row: 1 2 Col 1: 0.818888 0.628905 2: 0.483168 0.498347 3: 0.833254 0.123836 4: 0.165239 0.830319 5: 0.162017 0.496637 6: 0.161893 0.16326 7: 0.816627 0.371338 8: 0.492759 0.163164 9: 0.491011 0.831323 10: 0.832696 0.876496 TEST10 CVT computes a Centroidal Voronoi Tessellation. Compute 100 points in 3D. Step SEED L2-Change Energy 1 5.216615e+00 1.832335e-02 2 2.643880e+00 1.408484e-02 3 1.798155e+00 1.316836e-02 4 1.724056e+00 1.274157e-02 5 1.397950e+00 1.242508e-02 6 1.334920e+00 1.231185e-02 7 1.317929e+00 1.219975e-02 8 1.186546e+00 1.215508e-02 9 1.274845e+00 1.198913e-02 10 1.265929e+00 1.203698e-02 11 1.175583e+00 1.202598e-02 12 1.161488e+00 1.187037e-02 13 1.175922e+00 1.190752e-02 14 1.134871e+00 1.178352e-02 15 1.137529e+00 1.184420e-02 16 1.217671e+00 1.181312e-02 17 1.254958e+00 1.185458e-02 18 1.066560e+00 1.177801e-02 19 1.150125e+00 1.164730e-02 20 1.223374e+00 1.163152e-02 21 1.222306e+00 1.177984e-02 22 1.214321e+00 1.166869e-02 23 1.110106e+00 1.175273e-02 24 1.226822e+00 1.163997e-02 25 1.097743e+00 1.161756e-02 26 1.128897e+00 1.165513e-02 27 1.147313e+00 1.171769e-02 28 1.048147e+00 1.170518e-02 29 1.138389e+00 1.163480e-02 30 1.134603e+00 1.162939e-02 31 1.169225e+00 1.170576e-02 32 1.141054e+00 1.168430e-02 33 1.039207e+00 1.169010e-02 34 1.189801e+00 1.159641e-02 35 1.148966e+00 1.164846e-02 36 1.175673e+00 1.164327e-02 37 1.149481e+00 1.162902e-02 38 1.168184e+00 1.146654e-02 39 1.210655e+00 1.165826e-02 40 1.198207e+00 1.157663e-02 Dimension DIM_NUM = 3 Number of points N = 100 INIT = "uniform". Max iterations IT_MAX = 40 IT_FIXED (fixed samples) = 1 Iterations IT_NUM = 40 Difference IT_DIFF = 1.198207 CVT ENERGY = 0.011577 SAMPLE = "uniform". Samples SAMPLE_NUM = 10000 Sampling BATCH size = 1000 EPSILON (unit roundoff) = 2.220446e-16 First 10 generators (rows) Row: 1 2 3 Col 1: 0.494189 0.708568 0.603952 2: 0.519443 0.105791 0.753409 3: 0.892674 0.377841 0.907242 4: 0.111968 0.126601 0.898547 5: 0.685504 0.103183 0.290494 6: 0.300395 0.534051 0.0967797 7: 0.891239 0.522119 0.43829 8: 0.532724 0.329172 0.293614 9: 0.660945 0.503607 0.528112 10: 0.494729 0.540569 0.376693 TEST11 CVT computes a Centroidal Voronoi Tessellation. In this test, we initialize the generators to grid points; this is an unstable CVT solution. Initial generators (rows): Row: 1 2 Col 1: 0.125 0.125 2: 0.125 0.375 3: 0.125 0.625 4: 0.125 0.875 5: 0.375 0.125 6: 0.375 0.375 7: 0.375 0.625 8: 0.375 0.875 9: 0.625 0.125 10: 0.625 0.375 11: 0.625 0.625 12: 0.625 0.875 13: 0.875 0.125 14: 0.875 0.375 15: 0.875 0.625 16: 0.875 0.875 Step SEED L2-Change Energy 1 2.300248e-01 1.059688e-02 2 1.839391e-01 1.047247e-02 3 1.707196e-01 1.056535e-02 4 1.596785e-01 1.002065e-02 5 2.131716e-01 1.035331e-02 6 2.026156e-01 1.058295e-02 7 2.244526e-01 1.053979e-02 8 2.140158e-01 1.006320e-02 9 2.019302e-01 1.001829e-02 10 2.311363e-01 1.055962e-02 11 2.013549e-01 1.038539e-02 12 1.856006e-01 1.041511e-02 13 2.062198e-01 1.042257e-02 14 1.993219e-01 1.055807e-02 15 2.029696e-01 1.048233e-02 16 2.054469e-01 1.052319e-02 17 2.402038e-01 1.072144e-02 18 2.142536e-01 1.046978e-02 19 2.320349e-01 1.028681e-02 20 2.483780e-01 1.068674e-02 21 1.969661e-01 1.052155e-02 22 2.147289e-01 1.052845e-02 23 1.864368e-01 1.027451e-02 24 2.044406e-01 1.061203e-02 25 1.872269e-01 1.050478e-02 26 2.416533e-01 1.024787e-02 27 2.239930e-01 1.063901e-02 28 2.755007e-01 1.057015e-02 29 2.200814e-01 1.026541e-02 30 2.171599e-01 1.043185e-02 31 2.299099e-01 9.981668e-03 32 1.407374e-01 1.018051e-02 33 2.131091e-01 1.055754e-02 34 2.208959e-01 1.084840e-02 35 1.859525e-01 1.062652e-02 36 2.342681e-01 1.066271e-02 37 1.624242e-01 1.076523e-02 38 2.280730e-01 1.073036e-02 39 1.810852e-01 1.076707e-02 40 2.007892e-01 1.073084e-02 Dimension DIM_NUM = 2 Number of points N = 16 INIT = "user initialization". Max iterations IT_MAX = 40 IT_FIXED (fixed samples) = 1 Iterations IT_NUM = 40 Difference IT_DIFF = 0.200789 CVT ENERGY = 0.010731 SAMPLE = "uniform". Samples SAMPLE_NUM = 1000 Sampling BATCH size = 1000 EPSILON (unit roundoff) = 2.220446e-16 Generators (rows): Row: 1 2 Col 1: 0.148763 0.111806 2: 0.0945718 0.36872 3: 0.126313 0.601798 4: 0.122451 0.861927 5: 0.417243 0.119093 6: 0.312354 0.346602 7: 0.417225 0.604128 8: 0.350614 0.876853 9: 0.657272 0.126343 10: 0.563713 0.349991 11: 0.671228 0.623049 12: 0.592385 0.856627 13: 0.893106 0.149885 14: 0.859519 0.38727 15: 0.903886 0.663579 16: 0.853315 0.883664 TEST13 CVT computes a Centroidal Voronoi Tessellation. In this example, we call the "USER" routine, which allows the user to define the geometry and density implicitly, by returning sample points. Step SEED L2-Change Energy 1 2.436053e+00 3.709189e-03 2 1.142931e+00 2.404607e-03 3 7.206148e-01 2.094359e-03 4 6.225599e-01 2.014341e-03 5 5.170168e-01 1.955717e-03 6 5.111621e-01 1.921079e-03 7 5.478587e-01 1.875837e-03 8 5.063042e-01 1.873171e-03 9 4.824564e-01 1.871272e-03 10 4.444397e-01 1.859085e-03 11 4.650305e-01 1.816128e-03 12 4.016365e-01 1.790030e-03 13 4.617137e-01 1.825040e-03 14 4.321762e-01 1.812810e-03 15 4.412513e-01 1.780538e-03 16 4.473392e-01 1.805036e-03 17 4.285081e-01 1.770323e-03 18 3.922684e-01 1.777155e-03 19 4.039277e-01 1.767486e-03 20 4.342944e-01 1.783352e-03 21 4.005373e-01 1.760412e-03 22 4.613127e-01 1.741897e-03 23 4.346695e-01 1.723743e-03 24 4.178260e-01 1.756665e-03 25 4.387414e-01 1.765144e-03 26 4.273362e-01 1.746382e-03 27 4.172796e-01 1.764782e-03 28 4.228549e-01 1.741656e-03 29 4.038533e-01 1.739650e-03 30 4.338713e-01 1.727939e-03 31 4.252591e-01 1.741259e-03 32 4.531317e-01 1.732615e-03 33 4.248623e-01 1.724138e-03 34 4.418361e-01 1.729595e-03 35 3.902065e-01 1.727303e-03 36 4.048241e-01 1.715120e-03 37 4.292340e-01 1.718696e-03 38 4.077127e-01 1.730552e-03 39 4.343620e-01 1.717254e-03 40 4.462261e-01 1.724536e-03 Dimension DIM_NUM = 2 Number of points N = 100 INIT = "user". Max iterations IT_MAX = 40 IT_FIXED (fixed samples) = 1 Iterations IT_NUM = 40 Difference IT_DIFF = 0.446226 CVT ENERGY = 0.001725 SAMPLE = "user". Samples SAMPLE_NUM = 10000 Sampling BATCH size = 1000 EPSILON (unit roundoff) = 2.220446e-16 TEST14 Generate a CVT in the interval [0,1] using 10 points. Exact answer: { 0.05, 0.15, 0.25, ..., 0.85, 0.95 } It turns out that, for a fixed number of points N, a 1D problem will converge much more slowly than for cases where the dimension is higher. Step SEED L2-Change Energy 1 3.119372e-01 8.477793e-03 2 1.146585e-01 3.047505e-03 3 7.960914e-02 2.474594e-03 4 5.913319e-02 2.171623e-03 5 5.284360e-02 1.977664e-03 6 4.612250e-02 1.841792e-03 7 4.343985e-02 1.735636e-03 8 4.091976e-02 1.653787e-03 9 4.026296e-02 1.599112e-03 10 3.857767e-02 1.544223e-03 11 3.736424e-02 1.483801e-03 12 3.437478e-02 1.437301e-03 13 3.310356e-02 1.402378e-03 14 3.217219e-02 1.367155e-03 15 3.134037e-02 1.339696e-03 16 3.063565e-02 1.306953e-03 17 2.888432e-02 1.281667e-03 18 2.844738e-02 1.266507e-03 19 2.846853e-02 1.235402e-03 20 2.811901e-02 1.214786e-03 21 2.505622e-02 1.196898e-03 22 2.584771e-02 1.183677e-03 23 2.611534e-02 1.153746e-03 24 2.528545e-02 1.142356e-03 25 2.588564e-02 1.124167e-03 26 2.368220e-02 1.107745e-03 27 2.368386e-02 1.098931e-03 28 2.153052e-02 1.081316e-03 29 2.143970e-02 1.068713e-03 30 2.042517e-02 1.053354e-03 31 2.109276e-02 1.052154e-03 32 2.219684e-02 1.033693e-03 33 1.992672e-02 1.030723e-03 34 1.861344e-02 1.010945e-03 35 1.836923e-02 1.007812e-03 36 1.734420e-02 9.923239e-04 37 1.740249e-02 9.954032e-04 38 1.617869e-02 9.836361e-04 39 1.695498e-02 9.821624e-04 40 1.594766e-02 9.657648e-04 41 1.658404e-02 9.609236e-04 42 1.430014e-02 9.557677e-04 43 1.625623e-02 9.463363e-04 44 1.630141e-02 9.487241e-04 45 1.561869e-02 9.407108e-04 46 1.435106e-02 9.363971e-04 47 1.475588e-02 9.233029e-04 48 1.384393e-02 9.229807e-04 49 1.349594e-02 9.248298e-04 50 1.281858e-02 9.132266e-04 Dimension DIM_NUM = 1 Number of points N = 10 INIT = "uniform". Max iterations IT_MAX = 50 IT_FIXED (fixed samples) = 1 Iterations IT_NUM = 50 Difference IT_DIFF = 0.012819 CVT ENERGY = 0.000913 SAMPLE = "uniform". Samples SAMPLE_NUM = 100000 Sampling BATCH size = 10000 EPSILON (unit roundoff) = 2.220446e-16 Generators (rows): Row: 1 Col 1: 0.0379143 2: 0.113924 3: 0.194334 4: 0.279061 5: 0.370906 6: 0.471072 7: 0.578241 8: 0.693129 9: 0.813428 10: 0.936936 cvt_test(): Normal end of execution. 07-Jan-2022 18:41:56