6 October 2025 6:02:37.062 PM bins_test(): Fortran90 version Test bins(). TEST01 R8_TO_BIN_EVEN puts a number into a bin. BIN_TO_R8_EVEN returns the bin limits. The bins are equally spaced between A and B, with two extra bins, for things less than A, or greater than B. A = 10.0000 B = 20.0000 Total number of bins = 7 Generate some random values C and put them in bins. C Bin Bin_Min Bin_Max 14.8831 4 14.0000 16.0000 11.1845 2 10.0000 12.0000 20.4195 7 20.0000 0.179769+309 20.6009 7 20.0000 0.179769+309 21.0640 7 20.0000 0.179769+309 11.0773 2 10.0000 12.0000 13.7075 3 12.0000 14.0000 22.0678 7 20.0000 0.179769+309 20.6025 7 20.0000 0.179769+309 8.49092 1 -0.179769+309 10.0000 12.8454 3 12.0000 14.0000 8.17466 1 -0.179769+309 10.0000 19.4657 6 18.0000 20.0000 11.2683 2 10.0000 12.0000 16.4587 5 16.0000 18.0000 10.0647 2 10.0000 12.0000 22.8032 7 20.0000 0.179769+309 17.1692 5 16.0000 18.0000 13.1919 3 12.0000 14.0000 16.9624 5 16.0000 18.0000 18.0580 6 18.0000 20.0000 10.8621 2 10.0000 12.0000 12.8969 3 12.0000 14.0000 12.1491 3 12.0000 14.0000 13.2811 3 12.0000 14.0000 14.4753 4 14.0000 16.0000 20.6527 7 20.0000 0.179769+309 19.2706 6 18.0000 20.0000 22.9947 7 20.0000 0.179769+309 17.8617 5 16.0000 18.0000 TEST02 BIN_TO_R8_EVEN2 returns the bin limits. R8_TO_BIN_EVEN2 puts a number into a bin. The bins are equally spaced between A and B. A = 10.0000 B = 20.0000 Total number of bins = 5 Generate some random values C and put them in bins. C Bin Bin_Min Bin_Max 9.52373 1 10.0000 12.0000 18.6277 5 18.0000 20.0000 15.9134 3 14.0000 16.0000 16.8583 4 16.0000 18.0000 21.6228 5 18.0000 20.0000 12.3604 2 12.0000 14.0000 21.0610 5 18.0000 20.0000 14.5339 3 14.0000 16.0000 11.3774 1 10.0000 12.0000 10.7752 1 10.0000 12.0000 13.3225 2 12.0000 14.0000 11.0724 1 10.0000 12.0000 16.6608 4 16.0000 18.0000 20.0561 5 18.0000 20.0000 20.4645 5 18.0000 20.0000 14.3298 3 14.0000 16.0000 14.1314 3 14.0000 16.0000 11.8477 1 10.0000 12.0000 20.9164 5 18.0000 20.0000 9.57920 1 10.0000 12.0000 10.4994 1 10.0000 12.0000 14.1416 3 14.0000 16.0000 9.23451 1 10.0000 12.0000 21.4659 5 18.0000 20.0000 20.2971 5 18.0000 20.0000 19.9007 5 18.0000 20.0000 15.8331 3 14.0000 16.0000 19.0258 5 18.0000 20.0000 13.5465 2 12.0000 14.0000 19.1256 5 18.0000 20.0000 TEST03 BIN_TO_R82_EVEN returns the bin limits. R82_TO_BIN_EVEN puts a R82 number into a bin. The bins are equally spaced between A and B, with two extra bins, for things less than A, or greater than B. A(1) = 5.00000 B(1) = 15.0000 A(2) = 0.00000 B(2) = 20.0000 Total number of bins = 7 Generate some random values C and put them in bins. We list the X and Y components on separate lines. C Bin Bin_Min Bin_Max 3.00000 1 -0.179769+309 5.00000 17.7340 6 16.0000 20.0000 3.00000 1 -0.179769+309 5.00000 3.81641 2 0.00000 4.00000 3.00000 1 -0.179769+309 5.00000 2.23168 2 0.00000 4.00000 3.00000 1 -0.179769+309 5.00000 13.3437 5 12.0000 16.0000 3.00000 1 -0.179769+309 5.00000 19.0651 6 16.0000 20.0000 3.00000 1 -0.179769+309 5.00000 2.77316 2 0.00000 4.00000 3.00000 1 -0.179769+309 5.00000 15.3452 5 12.0000 16.0000 3.00000 1 -0.179769+309 5.00000 0.895594 2 0.00000 4.00000 3.00000 1 -0.179769+309 5.00000 4.13770 3 4.00000 8.00000 3.00000 1 -0.179769+309 5.00000 1.72154 2 0.00000 4.00000 3.00000 1 -0.179769+309 5.00000 0.739572 2 0.00000 4.00000 3.00000 1 -0.179769+309 5.00000 0.184221 2 0.00000 4.00000 3.00000 1 -0.179769+309 5.00000 3.17677 2 0.00000 4.00000 3.00000 1 -0.179769+309 5.00000 20.2945 7 20.0000 0.179769+309 3.00000 1 -0.179769+309 5.00000 14.6142 5 12.0000 16.0000 3.00000 1 -0.179769+309 5.00000 12.5480 5 12.0000 16.0000 3.00000 1 -0.179769+309 5.00000 13.5956 5 12.0000 16.0000 3.00000 1 -0.179769+309 5.00000 6.35894 3 4.00000 8.00000 3.00000 1 -0.179769+309 5.00000 1.00434 2 0.00000 4.00000 3.00000 1 -0.179769+309 5.00000 2.18616 2 0.00000 4.00000 3.00000 1 -0.179769+309 5.00000 5.49256 3 4.00000 8.00000 3.00000 1 -0.179769+309 5.00000 18.1579 6 16.0000 20.0000 3.00000 1 -0.179769+309 5.00000 1.18622 2 0.00000 4.00000 3.00000 1 -0.179769+309 5.00000 -1.44548 1 -0.179769+309 0.00000 3.00000 1 -0.179769+309 5.00000 9.11643 4 8.00000 12.0000 3.00000 1 -0.179769+309 5.00000 16.7905 6 16.0000 20.0000 3.00000 1 -0.179769+309 5.00000 2.84353 2 0.00000 4.00000 3.00000 1 -0.179769+309 5.00000 9.07214 4 8.00000 12.0000 3.00000 1 -0.179769+309 5.00000 9.98678 4 8.00000 12.0000 3.00000 1 -0.179769+309 5.00000 14.5594 5 12.0000 16.0000 TEST04 R82VEC_BIN_EVEN constructs evenly spaced bins and assigns each element of a R82VEC to a bin. R82VEC_BINNED_REORDER can reorder the array to correspond to the bin ordering. R82VEC_BINNED_SORT_A can sort the individual bins after the array has been reordered. The bins are equally spaced between BIN_MIN and BIN_MAX, with two extra bins, for things less than BIN_MIN, or greater than BIN_MAX. Component 1 range: 10.0000 20.0000 Component 2 range: 5.00000 10.0000 Number of bins per row and column = 4 The data vector A to be binned: 1 12.6499 5.68125 2 18.7566 7.09807 3 11.6315 4.73107 4 17.9512 9.46946 5 22.0447 4.74594 6 18.5022 8.58459 7 12.2200 5.17957 8 18.0104 5.79041 9 9.87785 7.28326 10 11.7779 10.7328 11 15.9880 11.9979 12 14.7670 11.0685 13 13.6631 4.14028 14 20.4420 7.17291 15 20.7173 4.91724 16 19.7578 9.95396 17 8.08311 5.35086 18 10.6302 6.53403 19 8.44973 11.7642 20 22.8234 6.63747 21 15.7126 10.2044 22 22.8048 9.67875 23 18.0135 5.49759 24 12.1377 10.8607 25 22.1806 4.83790 26 18.2917 9.43397 27 14.7470 10.0504 28 20.5387 9.13301 29 17.6970 7.11687 30 22.4488 10.7062 The BIN_START array: Col 1 2 3 4 Row 1 -1 9 -1 19 2 3 1 -1 10 3 -1 2 4 11 4 5 14 22 30 The BIN_LAST array: Col 1 2 3 4 Row 1 -1 9 -1 19 2 3 1 -1 10 3 -1 2 4 11 4 5 14 22 30 The BIN_NEXT array: 1 7 2 8 3 13 4 6 5 15 6 16 7 18 8 23 9 17 10 12 11 21 12 24 13 0 14 20 15 25 16 26 17 0 18 0 19 0 20 0 21 0 22 28 23 29 24 27 25 0 26 0 27 0 28 0 29 0 30 0 Contents of bin number 1 1 Contents of bin number 1 2 1 9 9.87785 7.28326 2 17 8.08311 5.35086 Contents of bin number 1 3 Contents of bin number 1 4 1 19 8.44973 11.7642 Contents of bin number 2 1 1 3 11.6315 4.73107 2 13 13.6631 4.14028 Contents of bin number 2 2 1 1 12.6499 5.68125 2 7 12.2200 5.17957 3 18 10.6302 6.53403 Contents of bin number 2 3 Contents of bin number 2 4 1 10 11.7779 10.7328 2 12 14.7670 11.0685 3 24 12.1377 10.8607 4 27 14.7470 10.0504 Contents of bin number 3 1 Contents of bin number 3 2 1 2 18.7566 7.09807 2 8 18.0104 5.79041 3 23 18.0135 5.49759 4 29 17.6970 7.11687 Contents of bin number 3 3 1 4 17.9512 9.46946 2 6 18.5022 8.58459 3 16 19.7578 9.95396 4 26 18.2917 9.43397 Contents of bin number 3 4 1 11 15.9880 11.9979 2 21 15.7126 10.2044 Contents of bin number 4 1 1 5 22.0447 4.74594 2 15 20.7173 4.91724 3 25 22.1806 4.83790 Contents of bin number 4 2 1 14 20.4420 7.17291 2 20 22.8234 6.63747 Contents of bin number 4 3 1 22 22.8048 9.67875 2 28 20.5387 9.13301 Contents of bin number 4 4 1 30 22.4488 10.7062 Call R82VEC_BINNED_REORDER to reorder the array. The data vector, sorted by bins: 1 9.87785 7.28326 2 8.08311 5.35086 3 8.44973 11.7642 4 11.6315 4.73107 5 13.6631 4.14028 6 12.6499 5.68125 7 12.2200 5.17957 8 10.6302 6.53403 9 11.7779 10.7328 10 14.7670 11.0685 11 12.1377 10.8607 12 14.7470 10.0504 13 18.7566 7.09807 14 18.0104 5.79041 15 18.0135 5.49759 16 17.6970 7.11687 17 17.9512 9.46946 18 18.5022 8.58459 19 19.7578 9.95396 20 18.2917 9.43397 21 15.9880 11.9979 22 15.7126 10.2044 23 22.0447 4.74594 24 20.7173 4.91724 25 22.1806 4.83790 26 20.4420 7.17291 27 22.8234 6.63747 28 22.8048 9.67875 29 20.5387 9.13301 30 22.4488 10.7062 The BIN_START array: Col 1 2 3 4 Row 1 -1 1 -1 3 2 4 6 -1 9 3 -1 13 17 21 4 23 26 28 30 The BIN_LAST array: Col 1 2 3 4 Row 1 -1 2 -1 3 2 5 8 -1 12 3 -1 16 20 22 4 25 27 29 30 The BIN_NEXT array: 1 2 2 0 3 0 4 5 5 0 6 7 7 8 8 0 9 10 10 11 11 12 12 0 13 14 14 15 15 16 16 0 17 18 18 19 19 20 20 0 21 22 22 0 23 24 24 25 25 0 26 27 27 0 28 29 29 0 30 0 The data vector, with sorted bins: 1 8.08311 5.35086 2 9.87785 7.28326 3 8.44973 11.7642 4 11.6315 4.73107 5 13.6631 4.14028 6 10.6302 6.53403 7 12.2200 5.17957 8 12.6499 5.68125 9 11.7779 10.7328 10 12.1377 10.8607 11 14.7470 10.0504 12 14.7670 11.0685 13 17.6970 7.11687 14 18.0104 5.79041 15 18.0135 5.49759 16 18.7566 7.09807 17 17.9512 9.46946 18 18.2917 9.43397 19 18.5022 8.58459 20 19.7578 9.95396 21 15.7126 10.2044 22 15.9880 11.9979 23 20.7173 4.91724 24 22.0447 4.74594 25 22.1806 4.83790 26 20.4420 7.17291 27 22.8234 6.63747 28 20.5387 9.13301 29 22.8048 9.67875 30 22.4488 10.7062 TEST05 R82VEC_PART_QUICK_A reorders an R82VEC as part of a quick sort. Before rearrangment: 1 7.92208 2.14737 2 7.03048 2.35255 3 0.537855 2.54558 4 5.15025 2.36817 5 7.60638 2.25492 6 9.21571 2.93080 7 5.21485 2.76985 8 8.43278 2.48541 9 6.84887 2.80533 10 3.02924 2.69249 11 9.67751 2.42954 12 6.80854 2.24052 Rearranged array Left index = 8 Key index = 9 Right index = 10 Left half: 1 7.03048 2.35255 2 0.537855 2.54558 3 5.15025 2.36817 4 7.60638 2.25492 5 6.80854 2.24052 6 5.21485 2.76985 7 3.02924 2.69249 8 6.84887 2.80533 Key: 1 7.92208 2.14737 Right half: 1 9.67751 2.42954 2 8.43278 2.48541 3 9.21571 2.93080 TEST05 R82VEC_PART_QUICK_A reorders an R82VEC as part of a quick sort. Before rearrangment: 1 3.31108 2.15390 2 0.264609 2.93770 3 8.53566 2.50133 4 4.27797 2.21413 5 2.38612 2.42612 6 8.94048 2.83604 7 9.98084 2.13438 8 8.28957 2.64146 9 3.60014 2.28961 10 7.17719 2.01370 11 3.19159 2.22010 12 9.86158 2.49633 Rearranged array Left index = 3 Key index = 4 Right index = 5 Left half: 1 0.264609 2.93770 2 3.19159 2.22010 3 2.38612 2.42612 Key: 1 3.31108 2.15390 Right half: 1 8.94048 2.83604 2 9.98084 2.13438 3 8.28957 2.64146 4 3.60014 2.28961 5 7.17719 2.01370 6 4.27797 2.21413 7 9.86158 2.49633 8 8.53566 2.50133 TEST07 R83VEC_PART_QUICK_A reorders an R83VEC as part of a quick sort. Before rearrangment: 1 9.19196 2.88207 2.08747 2 0.946068 2.29344 2.42748 3 6.41412 2.75159 1.16375 4 5.56459 2.30815 2.63285 5 3.55961 2.16032 1.74927 6 0.445612 2.20013 2.02866 7 4.06782 2.55672 2.82289 8 3.35281 2.47069 2.86519 9 7.43526 2.82430 1.65105 10 6.43396 2.13602 1.39676 11 6.38357 2.65280 1.32932 12 2.59485 2.50446 1.69619 Rearranged array Left index = 11 Key index = 12 Right index = 13 Left half: 1 0.946068 2.29344 2.42748 2 6.41412 2.75159 1.16375 3 5.56459 2.30815 2.63285 4 3.55961 2.16032 1.74927 5 0.445612 2.20013 2.02866 6 4.06782 2.55672 2.82289 7 3.35281 2.47069 2.86519 8 7.43526 2.82430 1.65105 9 6.43396 2.13602 1.39676 10 6.38357 2.65280 1.32932 11 2.59485 2.50446 1.69619 Key: 1 9.19196 2.88207 2.08747 Right half: TEST08 R83VEC_SORT_QUICK_A sorts an R83VEC using quick sort. Before rearrangment: 1 6.42837 2.94661 1.13230 2 2.77837 2.12910 1.92878 3 3.17250 2.26148 1.88746 4 6.91527 2.58176 1.96246 5 3.17250 2.46734 2.79074 6 6.01945 2.73861 1.74169 7 5.37861 2.96344 1.82632 8 9.97965 2.47062 2.43255 9 7.36291 2.12462 2.22475 10 1.48653 2.87221 2.73355 11 5.37861 2.96344 1.82632 12 6.91527 2.58176 2.85798 Sorted array: 1 1.48653 2.87221 2.73355 2 2.77837 2.12910 1.92878 3 3.17250 2.26148 1.88746 4 3.17250 2.46734 2.79074 5 5.37861 2.96344 1.82632 6 5.37861 2.96344 1.82632 7 6.01945 2.73861 1.74169 8 6.42837 2.94661 1.13230 9 6.91527 2.58176 1.96246 10 6.91527 2.58176 2.85798 11 7.36291 2.12462 2.22475 12 9.97965 2.47062 2.43255 TEST09 R8VEC_BIN computes bins for an R8VEC. The vector to be binned: 1 9.5231843 2 1.0125272 3 5.2871119 4 0.19814505 5 -1.0518749 6 7.1002354 7 4.5376555 8 7.5469895 9 0.36697376E-01 10 5.2956221 11 0.86165327 12 8.3906343 13 10.822286 14 3.1399860 15 3.9399484 16 0.36221108 17 2.8593660 18 -1.0751617 19 -0.47989769 20 10.214818 21 10.999047 22 2.8498813 23 3.0145725 24 10.292324 25 6.4863479 Number of bins is 5 Bin minimum is 0.00000 Bin maximum is 10.0000 Lower Limit Upper Limit Count 0.0000 0.0000 3 0.0000 2.0000 5 2.0000 4.0000 5 4.0000 6.0000 3 6.0000 8.0000 3 8.0000 10.0000 2 10.0000 4 TEST10 R8VEC_BIN_EVEN constructs evenly spaced bins and assigns each element of a DVEC to a bin. R8VEC_BINNED_REORDER can reorder the array to correspond to the bin ordering. R8VEC_BINNED_SORT_A can sort the array once it has been reordered. The bins are equally spaced between BIN_MIN and BIN_MAX, with two extra bins, for things less than BIN_MIN, or greater than BIN_MAX. BIN_MIN = 10.0000 BIN_MAX = 20.0000 Total number of bins = 7 The data vector A to be binned: 1 16.144613 2 9.6783014 3 10.208445 4 18.196350 5 13.844029 6 11.565526 7 12.733170 8 10.002793 9 10.500197 10 9.1494614 11 12.844836 12 16.275450 13 19.186961 14 20.557928 15 14.588536 16 17.090256 17 11.213540 18 19.847718 19 17.500870 20 15.037901 21 10.926645 22 21.284243 23 9.0634987 24 19.837372 25 18.314620 26 18.154579 27 21.731176 28 12.738913 29 11.511990 30 10.502065 The BIN_START array: 1 2 2 3 3 5 4 15 5 1 6 4 7 14 The BIN_LAST array: 1 23 2 30 3 28 4 20 5 19 6 26 7 27 The BIN_NEXT array: 1 12 2 10 3 6 4 13 5 7 6 8 7 11 8 9 9 17 10 23 11 28 12 16 13 18 14 22 15 20 16 19 17 21 18 24 19 0 20 0 21 29 22 27 23 0 24 25 25 26 26 0 27 0 28 0 29 30 30 0 Contents of bin number 1 1 2 9.67830 2 10 9.14946 3 23 9.06350 Contents of bin number 2 1 3 10.2084 2 6 11.5655 3 8 10.0028 4 9 10.5002 5 17 11.2135 6 21 10.9266 7 29 11.5120 8 30 10.5021 Contents of bin number 3 1 5 13.8440 2 7 12.7332 3 11 12.8448 4 28 12.7389 Contents of bin number 4 1 15 14.5885 2 20 15.0379 Contents of bin number 5 1 1 16.1446 2 12 16.2755 3 16 17.0903 4 19 17.5009 Contents of bin number 6 1 4 18.1964 2 13 19.1870 3 18 19.8477 4 24 19.8374 5 25 18.3146 6 26 18.1546 Contents of bin number 7 1 14 20.5579 2 22 21.2842 3 27 21.7312 Call R8VEC_BINNED_REORDER to reorder the array. The data vector A: 1 9.6783014 2 9.1494614 3 9.0634987 4 10.208445 5 11.565526 6 10.002793 7 10.500197 8 11.213540 9 10.926645 10 11.511990 11 10.502065 12 13.844029 13 12.733170 14 12.844836 15 12.738913 16 14.588536 17 15.037901 18 16.144613 19 16.275450 20 17.090256 21 17.500870 22 18.196350 23 19.186961 24 19.847718 25 19.837372 26 18.314620 27 18.154579 28 20.557928 29 21.284243 30 21.731176 The BIN_START array: 1 1 2 4 3 12 4 16 5 18 6 22 7 28 The BIN_LAST array: 1 3 2 11 3 15 4 17 5 21 6 27 7 30 The BIN_NEXT array: 1 2 2 3 3 0 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 0 12 13 13 14 14 15 15 0 16 17 17 0 18 19 19 20 20 21 21 0 22 23 23 24 24 25 25 26 26 27 27 0 28 29 29 30 30 0 The sorted data vector A: 1 9.0634987 2 9.1494614 3 9.6783014 4 10.002793 5 10.208445 6 10.500197 7 10.502065 8 10.926645 9 11.213540 10 11.511990 11 11.565526 12 12.733170 13 12.738913 14 12.844836 15 13.844029 16 14.588536 17 15.037901 18 16.144613 19 16.275450 20 17.090256 21 17.500870 22 18.154579 23 18.196350 24 18.314620 25 19.186961 26 19.837372 27 19.847718 28 20.557928 29 21.284243 30 21.731176 TEST11 Given a point in 2D, we want to find its nearest neighbor among points in a set. POINTS_NEAREST_POINT_NAIVE_2D uses a naive algorithm. POINTS_NEAREST_POINT_BINS_2D and POINTS_NEAREST_POINT_BINS_2D_2 use bins, but require the same number in each direction. POINTS_NEAREST_POINT_BINS_2D_3 uses bins, and can use a different number in each direction. The number of points in the pointset is 1000 POINTS_NEAREST_POINT_BINS_2D and POINTS_NEAREST_POINT_BINS_2D_2 use 10 bins in each direction. POINTS_NEAREST_POINT_BINS_2D_3 uses 20 5 bins in each direction. The X coordinate range: 0.00000 20.0000 The Y coordinate range: 0.00000 5.00000 Test point X range: 0.00000 20.0000 Test point Y range: 0.00000 5.00000 Test point Neighbor point Distance -------------------- -------------------- ---------- 9.1304 0.7889 8.9869 0.8057 0.1445 1000 9.1304 0.7889 8.9869 0.8057 0.1445 12 9.1304 0.7889 8.9869 0.8057 0.1445 12 9.1304 0.7889 8.2465 0.8405 0.1445 67 3.0737 2.0779 2.9875 2.1560 0.1163 1000 3.0737 2.0779 2.9875 2.1560 0.1163 86 3.0737 2.0779 2.9875 2.1560 0.1163 86 3.0737 2.0779 3.5653 1.3525 0.1163 93 8.9660 0.9387 8.9304 0.8490 0.0965 1000 8.9660 0.9387 8.9304 0.8490 0.0965 83 8.9660 0.9387 8.9304 0.8490 0.0965 83 8.9660 0.9387 8.1691 0.6236 0.0965 70 14.6499 1.6662 14.4760 1.7459 0.1913 1000 14.6499 1.6662 14.4760 1.7459 0.1913 95 14.6499 1.6662 14.4760 1.7459 0.1913 95 14.6499 1.6662 15.2501 0.6768 0.1913 11 7.7962 3.3751 7.6941 3.3126 0.1197 1000 7.7962 3.3751 7.6941 3.3126 0.1197 7 7.7962 3.3751 7.6941 3.3126 0.1197 7 7.7962 3.3751 7.7423 4.3822 0.1197 10 7.6787 0.8229 7.4245 0.9441 0.2816 1000 7.6787 0.8229 7.4245 0.9441 0.2816 90 7.6787 0.8229 7.4245 0.9441 0.2816 90 7.6787 0.8229 7.7383 2.1653 0.2816 66 3.8975 3.3877 3.8105 3.5388 0.1744 1000 3.8975 3.3877 3.8105 3.5388 0.1744 88 3.8975 3.3877 3.8105 3.5388 0.1744 88 3.8975 3.3877 2.2328 4.6674 0.1744 87 15.1749 3.7893 15.1572 3.8088 0.0263 1000 15.1749 3.7893 15.1572 3.8088 0.0263 14 15.1749 3.7893 15.1572 3.8088 0.0263 14 15.1749 3.7893 15.8385 3.6245 0.0263 13 6.1369 3.4350 6.1275 3.5624 0.1278 1000 6.1369 3.4350 6.1275 3.5624 0.1278 92 6.1369 3.4350 6.1275 3.5624 0.1278 92 6.1369 3.4350 6.6972 1.6078 0.1278 7 0.0154 4.8468 0.5545 4.6831 0.5634 1000 0.0154 4.8468 0.5545 4.6831 0.5634 86 0.0154 4.8468 0.5545 4.6831 0.5634 86 0.0154 4.8468 0.1251 2.4991 0.5634 29 TEST12 Given a point set in 2D, and a set of test points, for each testpoint, find the nearest neighbor in the point set. POINTS_NEAREST_POINTS_NAIVE_2D uses a naive algorithm. POINTS_NEAREST_POINTS_BINS_2D uses equal bins. POINTS_NEAREST_POINTS_BINS_2D_2 uses equal bins. POINTS_NEAREST_POINTS_BINS_2D_3 uses variable bins. The number of points in the pointset is 1000 The number of points in the test set is 100 POINTS_NEAREST_POINTS_BINS_2D and POINTS_NEAREST_POINTS_BINS_2D_2 use 10 bins in each direction. POINTS_NEAREST_POINTS_BINS_2D_3 uses 10 10 bins in each direction. The X coordinate range: 0.00000 10.0000 The Y coordinate range: 0.00000 10.0000 Print results for up to first 10 points... Test point Distance Naive Bins Bins2 Bins3 -------------------- ------------------------------------ 5.5207 1.4865 0.1932 0.1932 0.1932 0.1932 8.2485 6.0451 0.1091 0.1091 0.1091 0.1091 3.8682 4.0835 0.1072 0.1072 0.1072 0.1072 9.2659 6.5025 0.2658 0.2658 0.2658 0.2658 0.9288 0.0626 0.1910 0.1910 0.1910 0.1910 4.8728 2.5220 0.2095 0.2095 0.2095 0.2095 6.2578 1.9954 0.0254 0.0254 0.0254 0.0254 1.5700 9.9347 0.0257 0.0257 0.0257 0.0257 6.0015 0.6367 0.1822 0.1822 0.1822 0.1822 7.3542 8.9409 0.2026 0.2026 0.2026 0.2026 Naive and bin1 codes computed the same results. Naive and bin2 codes computed the same results. Naive and bin3 codes computed the same results. Naive code time = 0.00000 Bin code time = 0.00000 Bin2 code time = 0.00000 Bin3 code time = 0.100000E-02 TEST13 Given a point set in 2D, and a set of test points, for each testpoint, find the nearest neighbor in the point set. In this test, the region is RECTANGULAR. The BINS and BINS2 codes will end up using rectangular bins; We will set the BINS3 code to use the same number of bins, but they will be square. This should mean that BINS3 finds a match faster. POINTS_NEAREST_POINTS_NAIVE_2D uses a naive algorithm. POINTS_NEAREST_POINTS_BINS_2D uses bins. POINTS_NEAREST_POINTS_BINS_2D_2 uses bins. POINTS_NEAREST_POINTS_BINS_2D_3 uses bins. The number of points in the pointset is 1000 The number of bins used in each direction is 10 The number of points in the test set is 100 The X coordinate range: 0.00000 4.00000 The Y coordinate range: 0.00000 25.0000 Print results for up to first 10 points... Test point Distance Naive Bins Bins2 Bins3 -------------------- ------------------------------------ 3.2373 9.1501 0.1565 0.1565 0.1565 0.1565 2.1355 17.8948 0.1650 0.1650 0.1650 0.1650 3.0409 22.8253 0.2061 0.2061 0.2061 0.2061 1.9641 23.7541 0.0611 0.0611 0.0611 0.0611 1.2752 0.7676 0.2947 0.2947 0.2947 0.2947 2.8079 20.0603 0.1290 0.1290 0.1290 0.1290 0.3995 8.3694 0.0528 0.0528 0.0528 0.0528 2.1864 11.4214 0.1498 0.1498 0.1498 0.1498 3.1507 23.5796 0.0936 0.0936 0.0936 0.0936 0.7000 8.9835 0.3237 0.3237 0.3237 0.3237 Naive and bin1 codes computed the same results. Naive and bin2 codes computed the same results. Naive and bin3 codes computed the same results. Naive code time = 0.00000 Bin code time = 0.00000 Bin2 code time = 0.00000 Bin3 code time = 0.100000E-02 TEST14 Given a point set in 3D, and a set of test points, for each testpoint, find the nearest neighbor in the point set. POINTS_NEAREST_POINTS_NAIVE_3D uses a naive algorithm. POINTS_NEAREST_POINTS_BINS_3D_2 uses bins. The number of points in the pointset is 4096 The number of bins used in each direction is 32 The number of points in the test set is 1000 The X coordinate range: 0.00000 10.0000 The Y coordinate range: 0.00000 10.0000 The Z coordinate range: 0.00000 10.0000 Print up to the first 10 points. Test point Distance Comparisons Naive Bins Naive Bins ----------------------------- -------------------- ---------- 1.5106 4.0299 6.5300 0.3687 0.3687 4096 15 3.6022 3.3630 3.1836 0.2284 0.2284 4096 2 8.9214 4.4362 6.1675 0.3136 0.3136 4096 2 1.5007 6.1602 2.6284 0.4896 0.4896 4096 19 7.4928 2.2192 2.7105 0.5063 0.5063 4096 15 4.6046 4.4442 2.2359 0.4924 0.4924 4096 16 2.0369 9.4402 5.6023 0.2849 0.2849 4096 5 9.3135 4.1607 6.0359 0.4326 0.4326 4096 9 0.3564 8.2417 0.7389 0.5680 0.5680 4096 5 3.0206 5.7543 3.2380 0.3370 0.3370 4096 6 Naive and bin codes computed the same results. Naive code time = 0.200000E-01 Bin code time = 0.200000E-02 TEST15 Given a point set XC, and a single point XD, find the nearest point in XC to XD. POINTS_NEAREST_POINT_NAIVE_2D uses a naive method. POINTS_NEAREST_POINT_DEL_2D uses the Delaunay triangulation TRIANGULATION_PRINT prints a triangulation. TRIANGULATION_PRINT Information defining a triangulation. The number of points is 13 Point coordinates Row 1 2 Col 1 0.00000 0.00000 2 2.00000 2.00000 3 -1.00000 3.00000 4 -2.00000 2.00000 5 8.00000 2.00000 6 9.00000 5.00000 7 7.00000 4.00000 8 5.00000 6.00000 9 6.00000 7.00000 10 8.00000 8.00000 11 11.0000 7.00000 12 10.0000 4.00000 13 6.00000 4.00000 The number of triangles is 16 Sets of three points are used as vertices of the triangles. For each triangle, the points are listed in counterclockwise order. Triangle nodes: Row 1 2 3 Col 1 3 4 1 2 3 1 2 3 3 2 8 On each side of a given triangle, there is either another triangle, or a piece of the convex hull. For each triangle, we list the indices of the three neighbors, or (if negative) the codes of the segments of the convex hull. Triangle neighbors Row 1 2 3 Col 1 -4 -13 2 2 1 4 3 3 2 5 7 The number of boundary points is 8 The segments that make up the convex hull can be determined from the negative entries of the triangle neighbor list. # Tri Side N1 N2 1 1 2 4 1 2 4 2 1 5 3 14 2 5 12 4 1 1 3 4 5 7 3 9 3 6 15 3 12 11 7 16 3 11 10 8 13 1 10 9 DEBUG: About to call triangulation_sample. DEBUG: Returned from triangulation_sample. X Y Distance Index XD 5.1871 2.8423 Naive 6.0000 4.0000 1.4146 13 Delaunay 6.0000 4.0000 1.4146 13 XD 2.7794 1.5484 Naive 2.0000 2.0000 0.9008 2 Delaunay 2.0000 2.0000 0.9008 2 XD 8.4650 6.5343 Naive 8.0000 8.0000 1.5377 10 Delaunay 8.0000 8.0000 1.5377 10 XD 8.7463 7.3026 Naive 8.0000 8.0000 1.0214 10 Delaunay 8.0000 8.0000 1.0214 10 XD 2.6054 1.6715 Naive 2.0000 2.0000 0.6888 2 Delaunay 2.0000 2.0000 0.6888 2 XD 0.7533 3.8830 Naive -1.0000 3.0000 1.9631 3 Delaunay -1.0000 3.0000 1.9631 3 XD 2.0326 1.9889 Naive 2.0000 2.0000 0.0344 2 Delaunay 2.0000 2.0000 0.0344 2 XD 5.5686 4.6993 Naive 6.0000 4.0000 0.8217 13 Delaunay 6.0000 4.0000 0.8217 13 XD 1.3647 4.3373 Naive 2.0000 2.0000 2.4221 2 Delaunay 2.0000 2.0000 2.4221 2 XD 8.1617 6.7674 Naive 8.0000 8.0000 1.2432 10 Delaunay 8.0000 8.0000 1.2432 10 TEST16 POINTS_NEAREST_POINT_NAIVE_ND computes the nearest point in a set of points, to a given point, in ND. The spatial dimension NDIM is 2 The number of points N is 12 The set of points: Col 1 2 3 4 5 Row 1 7.00000 4.00000 5.00000 2.00000 6.00000 2 3.00000 7.00000 13.0000 7.00000 9.00000 Col 6 7 8 9 10 Row 1 12.0000 3.00000 6.00000 3.00000 8.00000 2 8.00000 4.00000 6.00000 10.0000 7.00000 Col 11 12 Row 1 5.00000 10.0000 2 13.0000 6.00000 Test point is 7.00000 1.00000 Nearest point is 7.00000 3.00000 Distance is 2.00000 Test point is 4.00000 7.00000 Nearest point is 4.00000 7.00000 Distance is 0.00000 Test point is 8.00000 11.0000 Nearest point is 6.00000 9.00000 Distance is 2.82843 bins_test(): Normal end of execution. 6 October 2025 6:02:37.088 PM