9 May 2025 8:57:15.594 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 15.2482 4 14.0000 16.0000 10.8383 2 10.0000 12.0000 11.3701 2 10.0000 12.0000 14.8382 4 14.0000 16.0000 14.5900 4 14.0000 16.0000 17.4309 5 16.0000 18.0000 20.7843 7 20.0000 0.179769+309 12.8639 3 12.0000 14.0000 18.1294 6 18.0000 20.0000 14.9555 4 14.0000 16.0000 18.1666 6 18.0000 20.0000 9.49519 1 -0.179769+309 10.0000 14.2459 4 14.0000 16.0000 12.0373 3 12.0000 14.0000 21.9615 7 20.0000 0.179769+309 12.8133 3 12.0000 14.0000 18.2109 6 18.0000 20.0000 9.16026 1 -0.179769+309 10.0000 21.1394 7 20.0000 0.179769+309 19.8281 6 18.0000 20.0000 18.8694 6 18.0000 20.0000 14.9732 4 14.0000 16.0000 22.4622 7 20.0000 0.179769+309 16.9295 5 16.0000 18.0000 15.2416 4 14.0000 16.0000 17.7378 5 16.0000 18.0000 8.29513 1 -0.179769+309 10.0000 13.8882 3 12.0000 14.0000 15.4252 4 14.0000 16.0000 9.72087 1 -0.179769+309 10.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 20.1530 5 18.0000 20.0000 9.46693 1 10.0000 12.0000 18.7183 5 18.0000 20.0000 18.9593 5 18.0000 20.0000 22.8525 5 18.0000 20.0000 8.98117 1 10.0000 12.0000 20.9258 5 18.0000 20.0000 15.5547 3 14.0000 16.0000 13.0922 2 12.0000 14.0000 16.3207 4 16.0000 18.0000 13.0119 2 12.0000 14.0000 20.1067 5 18.0000 20.0000 13.0616 2 12.0000 14.0000 19.4432 5 18.0000 20.0000 15.3489 3 14.0000 16.0000 16.4782 4 16.0000 18.0000 13.6419 2 12.0000 14.0000 12.0216 2 12.0000 14.0000 19.9052 5 18.0000 20.0000 10.2736 1 10.0000 12.0000 11.1587 1 10.0000 12.0000 20.4991 5 18.0000 20.0000 10.2792 1 10.0000 12.0000 20.2063 5 18.0000 20.0000 10.7925 1 10.0000 12.0000 21.6888 5 18.0000 20.0000 19.5472 5 18.0000 20.0000 17.2947 4 16.0000 18.0000 16.0549 4 16.0000 18.0000 12.2380 2 12.0000 14.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 13.3520 5 12.0000 16.0000 3.00000 1 -0.179769+309 5.00000 5.68350 3 4.00000 8.00000 3.00000 1 -0.179769+309 5.00000 18.2008 6 16.0000 20.0000 3.00000 1 -0.179769+309 5.00000 14.0149 5 12.0000 16.0000 3.00000 1 -0.179769+309 5.00000 12.8258 5 12.0000 16.0000 3.00000 1 -0.179769+309 5.00000 16.2356 6 16.0000 20.0000 3.00000 1 -0.179769+309 5.00000 7.21171 3 4.00000 8.00000 3.00000 1 -0.179769+309 5.00000 19.5701 6 16.0000 20.0000 3.00000 1 -0.179769+309 5.00000 14.2861 5 12.0000 16.0000 3.00000 1 -0.179769+309 5.00000 9.79846 4 8.00000 12.0000 3.00000 1 -0.179769+309 5.00000 15.1162 5 12.0000 16.0000 3.00000 1 -0.179769+309 5.00000 3.56743 2 0.00000 4.00000 3.00000 1 -0.179769+309 5.00000 8.41132 4 8.00000 12.0000 3.00000 1 -0.179769+309 5.00000 11.4615 4 8.00000 12.0000 3.00000 1 -0.179769+309 5.00000 1.69644 2 0.00000 4.00000 3.00000 1 -0.179769+309 5.00000 20.3614 7 20.0000 0.179769+309 3.00000 1 -0.179769+309 5.00000 19.3660 6 16.0000 20.0000 3.00000 1 -0.179769+309 5.00000 2.24328 2 0.00000 4.00000 3.00000 1 -0.179769+309 5.00000 19.0629 6 16.0000 20.0000 3.00000 1 -0.179769+309 5.00000 -0.104927 1 -0.179769+309 0.00000 3.00000 1 -0.179769+309 5.00000 7.31938 3 4.00000 8.00000 3.00000 1 -0.179769+309 5.00000 0.852395 2 0.00000 4.00000 3.00000 1 -0.179769+309 5.00000 18.6662 6 16.0000 20.0000 3.00000 1 -0.179769+309 5.00000 5.79820 3 4.00000 8.00000 3.00000 1 -0.179769+309 5.00000 18.5633 6 16.0000 20.0000 3.00000 1 -0.179769+309 5.00000 4.85566 3 4.00000 8.00000 3.00000 1 -0.179769+309 5.00000 7.42549 3 4.00000 8.00000 3.00000 1 -0.179769+309 5.00000 4.95498 3 4.00000 8.00000 3.00000 1 -0.179769+309 5.00000 2.12289 2 0.00000 4.00000 3.00000 1 -0.179769+309 5.00000 9.44879 4 8.00000 12.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 19.1889 9.01456 2 17.4630 8.91005 3 9.29947 6.37033 4 19.6331 7.27955 5 15.2138 8.44568 6 9.46461 8.41098 7 11.0546 7.94175 8 17.6915 9.24544 9 13.1836 6.00160 10 21.6372 4.00688 11 14.8397 10.9538 12 21.8947 9.63385 13 17.4730 9.31516 14 16.0531 6.62415 15 16.6324 7.72321 16 21.7777 5.38588 17 16.0784 8.04757 18 20.9495 6.56091 19 17.1926 3.81084 20 13.5818 8.38047 21 11.8444 6.68242 22 8.00848 9.82045 23 12.5895 8.98803 24 10.8267 9.35878 25 8.17851 10.5351 26 22.4902 5.05296 27 17.9284 6.28421 28 20.7701 7.94708 29 16.9599 4.55047 30 8.11921 4.99716 The BIN_START array: Col 1 2 3 4 Row 1 30 3 6 25 2 -1 9 7 11 3 19 4 1 -1 4 10 16 12 -1 The BIN_LAST array: Col 1 2 3 4 Row 1 30 3 6 25 2 -1 9 7 11 3 19 4 1 -1 4 10 16 12 -1 The BIN_NEXT array: 1 2 2 5 3 0 4 14 5 8 6 22 7 20 8 13 9 21 10 0 11 0 12 28 13 15 14 27 15 17 16 18 17 0 18 26 19 29 20 23 21 0 22 0 23 24 24 0 25 0 26 0 27 0 28 0 29 0 30 0 Contents of bin number 1 1 1 30 8.11921 4.99716 Contents of bin number 1 2 1 3 9.29947 6.37033 Contents of bin number 1 3 1 6 9.46461 8.41098 2 22 8.00848 9.82045 Contents of bin number 1 4 1 25 8.17851 10.5351 Contents of bin number 2 1 Contents of bin number 2 2 1 9 13.1836 6.00160 2 21 11.8444 6.68242 Contents of bin number 2 3 1 7 11.0546 7.94175 2 20 13.5818 8.38047 3 23 12.5895 8.98803 4 24 10.8267 9.35878 Contents of bin number 2 4 1 11 14.8397 10.9538 Contents of bin number 3 1 1 19 17.1926 3.81084 2 29 16.9599 4.55047 Contents of bin number 3 2 1 4 19.6331 7.27955 2 14 16.0531 6.62415 3 27 17.9284 6.28421 Contents of bin number 3 3 1 1 19.1889 9.01456 2 2 17.4630 8.91005 3 5 15.2138 8.44568 4 8 17.6915 9.24544 5 13 17.4730 9.31516 6 15 16.6324 7.72321 7 17 16.0784 8.04757 Contents of bin number 3 4 Contents of bin number 4 1 1 10 21.6372 4.00688 Contents of bin number 4 2 1 16 21.7777 5.38588 2 18 20.9495 6.56091 3 26 22.4902 5.05296 Contents of bin number 4 3 1 12 21.8947 9.63385 2 28 20.7701 7.94708 Contents of bin number 4 4 Call R82VEC_BINNED_REORDER to reorder the array. The data vector, sorted by bins: 1 8.11921 4.99716 2 9.29947 6.37033 3 9.46461 8.41098 4 8.00848 9.82045 5 8.17851 10.5351 6 13.1836 6.00160 7 11.8444 6.68242 8 11.0546 7.94175 9 13.5818 8.38047 10 12.5895 8.98803 11 10.8267 9.35878 12 14.8397 10.9538 13 17.1926 3.81084 14 16.9599 4.55047 15 19.6331 7.27955 16 16.0531 6.62415 17 17.9284 6.28421 18 19.1889 9.01456 19 17.4630 8.91005 20 15.2138 8.44568 21 17.6915 9.24544 22 17.4730 9.31516 23 16.6324 7.72321 24 16.0784 8.04757 25 21.6372 4.00688 26 21.7777 5.38588 27 20.9495 6.56091 28 22.4902 5.05296 29 21.8947 9.63385 30 20.7701 7.94708 The BIN_START array: Col 1 2 3 4 Row 1 1 2 3 5 2 -1 6 8 12 3 13 15 18 -1 4 25 26 29 -1 The BIN_LAST array: Col 1 2 3 4 Row 1 1 2 4 5 2 -1 7 11 12 3 14 17 24 -1 4 25 28 30 -1 The BIN_NEXT array: 1 0 2 0 3 4 4 0 5 0 6 7 7 0 8 9 9 10 10 11 11 0 12 0 13 14 14 0 15 16 16 17 17 0 18 19 19 20 20 21 21 22 22 23 23 24 24 0 25 0 26 27 27 28 28 0 29 30 30 0 The data vector, with sorted bins: 1 8.11921 4.99716 2 9.29947 6.37033 3 8.00848 9.82045 4 9.46461 8.41098 5 8.17851 10.5351 6 11.8444 6.68242 7 13.1836 6.00160 8 10.8267 9.35878 9 11.0546 7.94175 10 12.5895 8.98803 11 13.5818 8.38047 12 14.8397 10.9538 13 16.9599 4.55047 14 17.1926 3.81084 15 16.0531 6.62415 16 17.9284 6.28421 17 19.6331 7.27955 18 15.2138 8.44568 19 16.0784 8.04757 20 16.6324 7.72321 21 17.4630 8.91005 22 17.4730 9.31516 23 17.6915 9.24544 24 19.1889 9.01456 25 21.6372 4.00688 26 20.9495 6.56091 27 21.7777 5.38588 28 22.4902 5.05296 29 20.7701 7.94708 30 21.8947 9.63385 TEST05 R82VEC_PART_QUICK_A reorders an R82VEC as part of a quick sort. Before rearrangment: 1 1.48274 2.64985 2 6.54050 2.18512 3 6.86945 2.81911 4 2.35262 2.65515 5 7.58899 2.29617 6 4.71436 2.33849 7 6.08021 2.26388 8 4.07585 2.73813 9 4.48265 2.24192 10 6.62193 2.71631 11 5.23230 2.24401 12 4.69217 2.24999 Rearranged array Left index = 0 Key index = 1 Right index = 2 Left half: Key: 1 1.48274 2.64985 Right half: 1 6.86945 2.81911 2 2.35262 2.65515 3 7.58899 2.29617 4 4.71436 2.33849 5 6.08021 2.26388 6 4.07585 2.73813 7 4.48265 2.24192 8 6.62193 2.71631 9 5.23230 2.24401 10 4.69217 2.24999 11 6.54050 2.18512 TEST05 R82VEC_PART_QUICK_A reorders an R82VEC as part of a quick sort. Before rearrangment: 1 7.02258 2.60204 2 4.52288 2.34265 3 7.14596 2.52824 4 2.06560 2.05689 5 6.11341 2.42063 6 9.73684 2.39805 7 4.57377 2.22825 8 3.48167 2.19067 9 8.07842 2.35822 10 2.47540 2.21527 11 0.207058 2.49627 12 2.82785 2.59376 Rearranged array Left index = 8 Key index = 9 Right index = 10 Left half: 1 4.52288 2.34265 2 2.82785 2.59376 3 2.06560 2.05689 4 6.11341 2.42063 5 0.207058 2.49627 6 4.57377 2.22825 7 3.48167 2.19067 8 2.47540 2.21527 Key: 1 7.02258 2.60204 Right half: 1 8.07842 2.35822 2 9.73684 2.39805 3 7.14596 2.52824 TEST07 R83VEC_PART_QUICK_A reorders an R83VEC as part of a quick sort. Before rearrangment: 1 2.57085 2.04309 1.42710 2 1.64381 2.51041 1.33798 3 3.04688 2.94291 1.43585 4 9.91948 2.23992 1.91152 5 7.78762 2.43919 1.95776 6 7.47735 2.81246 1.59219 7 6.02096 2.23706 1.85279 8 1.85695 2.02735 1.88786 9 7.20198 2.99256 2.80302 10 6.06993 2.41683 2.94529 11 6.30217 2.23929 2.96146 12 7.97592 2.67866 2.84904 Rearranged array Left index = 2 Key index = 3 Right index = 4 Left half: 1 1.64381 2.51041 1.33798 2 1.85695 2.02735 1.88786 Key: 1 2.57085 2.04309 1.42710 Right half: 1 7.78762 2.43919 1.95776 2 7.47735 2.81246 1.59219 3 6.02096 2.23706 1.85279 4 9.91948 2.23992 1.91152 5 7.20198 2.99256 2.80302 6 6.06993 2.41683 2.94529 7 6.30217 2.23929 2.96146 8 7.97592 2.67866 2.84904 9 3.04688 2.94291 1.43585 TEST08 R83VEC_SORT_QUICK_A sorts an R83VEC using quick sort. Before rearrangment: 1 9.67191 2.93502 1.79989 2 7.41260 2.94028 1.02103 3 1.84745 2.41851 1.90828 4 1.39221 2.46742 1.51804 5 1.84745 2.78940 1.49977 6 9.94914 2.46333 2.66608 7 9.51062 2.80333 2.32151 8 8.75718 2.69358 1.17218 9 0.346580E-01 2.34692 1.75830 10 5.05269 2.58183 2.08539 11 9.51062 2.80333 2.32151 12 1.39221 2.46742 1.95138 Sorted array: 1 0.346580E-01 2.34692 1.75830 2 1.39221 2.46742 1.51804 3 1.39221 2.46742 1.95138 4 1.84745 2.41851 1.90828 5 1.84745 2.78940 1.49977 6 5.05269 2.58183 2.08539 7 7.41260 2.94028 1.02103 8 8.75718 2.69358 1.17218 9 9.51062 2.80333 2.32151 10 9.51062 2.80333 2.32151 11 9.67191 2.93502 1.79989 12 9.94914 2.46333 2.66608 TEST09 R8VEC_BIN computes bins for an R8VEC. The vector to be binned: 1 -0.88629021 2 9.1192021 3 8.9361832 4 10.892551 5 6.3119014 6 2.4127616 7 8.5910534 8 4.7650518 9 -0.31728903 10 7.4580772 11 0.89784793E-01 12 0.17883012 13 4.7098815 14 -1.4117299 15 -1.7040899 16 4.1098852 17 0.19803415 18 5.0043631 19 -0.49637435 20 2.6142921 21 8.9095824 22 7.4124445 23 2.0443433 24 8.3534208 25 1.3117550 Number of bins is 5 Bin minimum is 0.00000 Bin maximum is 10.0000 Lower Limit Upper Limit Count 0.0000 0.0000 5 0.0000 2.0000 4 2.0000 4.0000 3 4.0000 6.0000 4 6.0000 8.0000 3 8.0000 10.0000 5 10.0000 1 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 13.888743 2 11.419093 3 14.526829 4 15.909518 5 17.602021 6 17.236066 7 10.235624 8 19.153444 9 17.155528 10 10.792515 11 16.516496 12 17.226874 13 14.065325 14 13.668293 15 11.461886 16 21.451551 17 15.350343 18 16.220758 19 11.140918 20 10.260610 21 16.092301 22 17.091841 23 10.791157 24 11.246536 25 19.673041 26 9.7534345 27 13.456343 28 11.907869 29 22.133409 30 12.075614 The BIN_START array: 1 26 2 2 3 1 4 3 5 5 6 8 7 16 The BIN_LAST array: 1 26 2 28 3 30 4 17 5 22 6 25 7 29 The BIN_NEXT array: 1 14 2 7 3 4 4 13 5 6 6 9 7 10 8 25 9 11 10 15 11 12 12 18 13 17 14 27 15 19 16 29 17 0 18 21 19 20 20 23 21 22 22 0 23 24 24 28 25 0 26 0 27 30 28 0 29 0 30 0 Contents of bin number 1 1 26 9.75343 Contents of bin number 2 1 2 11.4191 2 7 10.2356 3 10 10.7925 4 15 11.4619 5 19 11.1409 6 20 10.2606 7 23 10.7912 8 24 11.2465 9 28 11.9079 Contents of bin number 3 1 1 13.8887 2 14 13.6683 3 27 13.4563 4 30 12.0756 Contents of bin number 4 1 3 14.5268 2 4 15.9095 3 13 14.0653 4 17 15.3503 Contents of bin number 5 1 5 17.6020 2 6 17.2361 3 9 17.1555 4 11 16.5165 5 12 17.2269 6 18 16.2208 7 21 16.0923 8 22 17.0918 Contents of bin number 6 1 8 19.1534 2 25 19.6730 Contents of bin number 7 1 16 21.4516 2 29 22.1334 Call R8VEC_BINNED_REORDER to reorder the array. The data vector A: 1 9.7534345 2 11.419093 3 10.235624 4 10.792515 5 11.461886 6 11.140918 7 10.260610 8 10.791157 9 11.246536 10 11.907869 11 13.888743 12 13.668293 13 13.456343 14 12.075614 15 14.526829 16 15.909518 17 14.065325 18 15.350343 19 17.602021 20 17.236066 21 17.155528 22 16.516496 23 17.226874 24 16.220758 25 16.092301 26 17.091841 27 19.153444 28 19.673041 29 21.451551 30 22.133409 The BIN_START array: 1 1 2 2 3 11 4 15 5 19 6 27 7 29 The BIN_LAST array: 1 1 2 10 3 14 4 18 5 26 6 28 7 30 The BIN_NEXT array: 1 0 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 0 11 12 12 13 13 14 14 0 15 16 16 17 17 18 18 0 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 0 27 28 28 0 29 30 30 0 The sorted data vector A: 1 9.7534345 2 10.235624 3 10.260610 4 10.791157 5 10.792515 6 11.140918 7 11.246536 8 11.419093 9 11.461886 10 11.907869 11 12.075614 12 13.456343 13 13.668293 14 13.888743 15 14.065325 16 14.526829 17 15.350343 18 15.909518 19 16.092301 20 16.220758 21 16.516496 22 17.091841 23 17.155528 24 17.226874 25 17.236066 26 17.602021 27 19.153444 28 19.673041 29 21.451551 30 22.133409 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.9045 2.9399 10.0139 2.9158 0.1120 1000 9.9045 2.9399 10.0139 2.9158 0.1120 101 9.9045 2.9399 10.0139 2.9158 0.1120 101 9.9045 2.9399 10.0835 1.1723 0.1120 89 10.7532 0.4929 10.6243 0.5563 0.1436 1000 10.7532 0.4929 10.6243 0.5563 0.1436 67 10.7532 0.4929 10.6243 0.5563 0.1436 67 10.7532 0.4929 11.7408 0.1035 0.1436 10 3.6454 0.6077 3.4214 0.3495 0.3419 1000 3.6454 0.6077 3.4214 0.3495 0.3419 60 3.6454 0.6077 3.4214 0.3495 0.3419 60 3.6454 0.6077 3.3882 2.7054 0.3419 6 19.3364 3.6506 19.2153 3.5760 0.1422 1000 19.3364 3.6506 19.2153 3.5760 0.1422 9 19.3364 3.6506 19.2153 3.5760 0.1422 9 19.3364 3.6506 19.7852 3.6091 0.1422 9 16.0328 1.8322 16.0005 1.7907 0.0526 1000 16.0328 1.8322 16.0005 1.7907 0.0526 96 16.0328 1.8322 16.0005 1.7907 0.0526 96 16.0328 1.8322 17.3124 0.3176 0.0526 112 3.0362 4.8797 2.9450 4.5127 0.3782 1000 3.0362 4.8797 2.9450 4.5127 0.3782 69 3.0362 4.8797 2.9450 4.5127 0.3782 69 3.0362 4.8797 2.5667 2.9387 0.3782 62 16.5366 0.8814 16.5972 0.6260 0.2625 1000 16.5366 0.8814 16.5972 0.6260 0.2625 109 16.5366 0.8814 16.5972 0.6260 0.2625 109 16.5366 0.8814 16.8706 0.0613 0.2625 85 3.3609 1.0564 3.3383 0.8885 0.1694 1000 3.3609 1.0564 3.3383 0.8885 0.1694 68 3.3609 1.0564 3.3383 0.8885 0.1694 68 3.3609 1.0564 3.2426 2.7468 0.1694 76 17.6516 0.5824 17.7191 0.6691 0.1099 1000 17.6516 0.5824 17.7191 0.6691 0.1099 109 17.6516 0.5824 17.7191 0.6691 0.1099 109 17.6516 0.5824 16.4279 3.2818 0.1099 21 4.0584 3.9575 4.0138 3.7339 0.2280 1000 4.0584 3.9575 4.0138 3.7339 0.2280 94 4.0584 3.9575 4.0138 3.7339 0.2280 94 4.0584 3.9575 4.7206 1.5114 0.2280 97 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 -------------------- ------------------------------------ 0.2901 4.6831 0.1466 0.1466 0.1466 0.1466 9.6857 9.8413 0.1484 0.1484 0.1484 0.1484 2.4230 1.2879 0.1056 0.1056 0.1056 0.1056 6.3629 9.6598 0.0273 0.0273 0.0273 0.0273 0.1564 1.7687 0.0768 0.0768 0.0768 0.0768 9.1940 9.7215 0.1547 0.1547 0.1547 0.1547 1.6162 6.6995 0.1482 0.1482 0.1482 0.1482 2.3845 0.1758 0.1316 0.1316 0.1316 0.1316 9.0184 2.3022 0.1147 0.1147 0.1147 0.1147 3.4492 7.8534 0.2033 0.2033 0.2033 0.2033 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.100000E-02 Bin code time = 0.00000 Bin2 code time = 0.00000 Bin3 code time = 0.00000 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 -------------------- ------------------------------------ 1.3500 1.5209 0.1590 0.1590 0.1590 0.1590 1.6211 15.6368 0.3037 0.3037 0.3037 0.3037 2.3100 4.0552 0.1205 0.1205 0.1205 0.1205 0.6725 15.8096 0.2719 0.2719 0.2719 0.2719 2.7537 5.3028 0.1501 0.1501 0.1501 0.1501 3.3895 7.4046 0.4126 0.4126 0.4126 0.4126 1.5742 19.2804 0.1378 0.1378 0.1378 0.1378 1.0758 17.6492 0.1831 0.1831 0.1831 0.1831 1.4798 2.6651 0.2500 0.2500 0.2500 0.2500 2.1704 14.4084 0.0740 0.0740 0.0740 0.0740 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.100000E-02 Bin2 code time = 0.00000 Bin3 code time = 0.00000 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.6665 2.0285 1.8449 0.3283 0.3283 4096 3 1.8093 0.2952 1.8158 0.3977 0.3977 4096 13 5.6161 0.6699 6.7004 0.4613 0.4613 4096 24 8.9087 0.1477 0.6468 0.0451 0.0451 4096 4 0.2609 7.3734 3.2533 0.7232 0.7232 4096 20 4.5850 5.9441 0.3016 0.2723 0.2723 4096 2 0.1068 5.9838 4.6907 0.4925 0.4925 4096 11 4.0922 6.6295 4.3663 0.4018 0.4018 4096 16 2.5966 4.8972 6.0459 0.2900 0.2900 4096 1 2.6411 6.9721 2.6733 0.3074 0.3074 4096 5 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 2.7715 1.7661 Naive 2.0000 2.0000 0.8062 2 Delaunay 2.0000 2.0000 0.8062 2 XD 7.2348 3.3109 Naive 7.0000 4.0000 0.7280 7 Delaunay 7.0000 4.0000 0.7280 7 XD 3.7667 1.7491 Naive 2.0000 2.0000 1.7844 2 Delaunay 2.0000 2.0000 1.7844 2 XD 6.7241 2.6981 Naive 7.0000 4.0000 1.3308 7 Delaunay 7.0000 4.0000 1.3308 7 XD 7.9204 7.8425 Naive 8.0000 8.0000 0.1765 10 Delaunay 8.0000 8.0000 0.1765 10 XD 5.1809 3.1706 Naive 6.0000 4.0000 1.1656 13 Delaunay 6.0000 4.0000 1.1656 13 XD 10.4906 5.9096 Naive 11.0000 7.0000 1.2035 11 Delaunay 11.0000 7.0000 1.2035 11 XD 6.6508 5.5559 Naive 6.0000 7.0000 1.5840 9 Delaunay 6.0000 7.0000 1.5840 9 XD 0.2555 1.4862 Naive 0.0000 0.0000 1.5080 1 Delaunay 0.0000 0.0000 1.5080 1 XD 2.4149 3.9817 Naive 2.0000 2.0000 2.0247 2 Delaunay 2.0000 2.0000 2.0247 2 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. 9 May 2025 8:57:15.621 PM