21 June 2018 8:13:37.449 AM BINS_TEST FORTRAN90 version Test the BINS library. 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 Using random seed = 990328650 Generate some random values C and put them in bins. C Bin Bin_Min Bin_Max 18.1655 6 18.0000 20.0000 10.3371 2 10.0000 12.0000 17.9333 5 16.0000 18.0000 22.5511 7 20.0000 0.179769+309 22.8593 7 20.0000 0.179769+309 14.0209 4 14.0000 16.0000 11.9819 2 10.0000 12.0000 16.8325 5 16.0000 18.0000 16.1304 5 16.0000 18.0000 20.0251 7 20.0000 0.179769+309 18.0909 6 18.0000 20.0000 16.0693 5 16.0000 18.0000 14.1836 4 14.0000 16.0000 16.1947 5 16.0000 18.0000 20.9066 7 20.0000 0.179769+309 13.5553 3 12.0000 14.0000 15.2232 4 14.0000 16.0000 13.3690 3 12.0000 14.0000 20.0145 7 20.0000 0.179769+309 20.6710 7 20.0000 0.179769+309 15.1810 4 14.0000 16.0000 9.33213 1 -0.179769+309 10.0000 17.0290 5 16.0000 18.0000 19.0180 6 18.0000 20.0000 13.2808 3 12.0000 14.0000 22.2959 7 20.0000 0.179769+309 9.66997 1 -0.179769+309 10.0000 10.1424 2 10.0000 12.0000 15.0665 4 14.0000 16.0000 19.8354 6 18.0000 20.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 Using random seed = 990328650 Generate some random values C and put them in bins. C Bin Bin_Min Bin_Max 18.1655 5 18.0000 20.0000 10.3371 1 10.0000 12.0000 17.9333 4 16.0000 18.0000 22.5511 5 18.0000 20.0000 22.8593 5 18.0000 20.0000 14.0209 3 14.0000 16.0000 11.9819 1 10.0000 12.0000 16.8325 4 16.0000 18.0000 16.1304 4 16.0000 18.0000 20.0251 5 18.0000 20.0000 18.0909 5 18.0000 20.0000 16.0693 4 16.0000 18.0000 14.1836 3 14.0000 16.0000 16.1947 4 16.0000 18.0000 20.9066 5 18.0000 20.0000 13.5553 2 12.0000 14.0000 15.2232 3 14.0000 16.0000 13.3690 2 12.0000 14.0000 20.0145 5 18.0000 20.0000 20.6710 5 18.0000 20.0000 15.1810 3 14.0000 16.0000 9.33213 1 10.0000 12.0000 17.0290 4 16.0000 18.0000 19.0180 5 18.0000 20.0000 13.2808 2 12.0000 14.0000 22.2959 5 18.0000 20.0000 9.66997 1 10.0000 12.0000 10.1424 1 10.0000 12.0000 15.0665 3 14.0000 16.0000 19.8354 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 16.5541 7 15.0000 0.179769+309 1.58358 2 0.00000 4.00000 16.2444 7 15.0000 0.179769+309 20.3116 7 20.0000 0.179769+309 22.8125 7 15.0000 0.179769+309 7.23211 3 4.00000 8.00000 8.30920 3 7.00000 9.00000 11.5432 4 8.00000 12.0000 13.8405 6 13.0000 15.0000 16.4384 6 16.0000 20.0000 16.4546 7 15.0000 0.179769+309 10.3730 4 8.00000 12.0000 11.2448 5 11.0000 13.0000 10.5652 4 8.00000 12.0000 20.2087 7 15.0000 0.179769+309 6.51806 3 4.00000 8.00000 12.6309 5 11.0000 13.0000 6.23249 3 4.00000 8.00000 19.0193 7 15.0000 0.179769+309 17.4289 6 16.0000 20.0000 12.5747 5 11.0000 13.0000 0.425920E-01 2 0.00000 4.00000 15.0387 7 15.0000 0.179769+309 14.8943 5 12.0000 16.0000 10.0411 4 9.00000 11.0000 19.9204 6 16.0000 20.0000 5.22662 2 5.00000 7.00000 1.28499 2 0.00000 4.00000 12.4220 5 11.0000 13.0000 16.1476 6 16.0000 20.0000 5.51404 2 5.00000 7.00000 13.5102 5 12.0000 16.0000 21.0779 7 15.0000 0.179769+309 16.0092 6 16.0000 20.0000 4.01749 1 -0.179769+309 5.00000 -0.914970 1 -0.179769+309 0.00000 20.4801 7 15.0000 0.179769+309 7.15664 3 4.00000 8.00000 5.30924 2 5.00000 7.00000 11.1676 4 8.00000 12.0000 4.48331 1 -0.179769+309 5.00000 9.58157 4 8.00000 12.0000 5.17056 2 5.00000 7.00000 -1.32728 1 -0.179769+309 0.00000 14.7122 6 13.0000 15.0000 5.69587 3 4.00000 8.00000 16.4079 7 15.0000 0.179769+309 4.61143 3 4.00000 8.00000 7.54240 3 7.00000 9.00000 2.67007 2 0.00000 4.00000 15.1234 7 15.0000 0.179769+309 18.6817 6 16.0000 20.0000 21.1936 7 15.0000 0.179769+309 -1.23099 1 -0.179769+309 0.00000 21.9731 7 15.0000 0.179769+309 -1.93689 1 -0.179769+309 0.00000 5.40070 2 5.00000 7.00000 7.80633 3 4.00000 8.00000 20.3996 7 15.0000 0.179769+309 14.9823 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 18.1655 4.13132 2 10.3371 9.06921 3 17.9333 11.1351 4 22.5511 10.0471 5 22.8593 3.45787 6 14.0209 3.42458 7 11.9819 10.8660 8 16.8325 6.58303 9 16.1304 4.03916 10 20.0251 8.15254 11 18.0909 3.66749 12 16.0693 7.53192 13 14.1836 3.97675 14 16.1947 3.26324 15 20.9066 8.27048 16 13.5553 6.01143 17 15.2232 9.03353 18 13.3690 5.58708 19 20.0145 5.04408 20 20.6710 4.82742 21 15.1810 8.45553 22 9.33213 11.0928 23 17.0290 11.1871 24 19.0180 3.30092 25 13.2808 11.5379 26 22.2959 3.02470 27 9.66997 4.08031 28 10.1424 6.83726 29 15.0665 10.8298 30 19.8354 9.64526 The BIN_START array: Col 1 2 3 4 Row 1 27 -1 -1 22 2 6 16 2 7 3 1 8 12 3 4 5 19 10 4 The BIN_LAST array: Col 1 2 3 4 Row 1 27 -1 -1 22 2 6 16 2 7 3 1 8 12 3 4 5 19 10 4 The BIN_NEXT array: 1 9 2 0 3 23 4 0 5 20 6 13 7 25 8 0 9 11 10 15 11 14 12 17 13 0 14 24 15 0 16 18 17 21 18 28 19 0 20 26 21 30 22 0 23 29 24 0 25 0 26 0 27 0 28 0 29 0 30 0 Contents of bin number 1 1 1 27 9.66997 4.08031 Contents of bin number 1 2 Contents of bin number 1 3 Contents of bin number 1 4 1 22 9.33213 11.0928 Contents of bin number 2 1 1 6 14.0209 3.42458 2 13 14.1836 3.97675 Contents of bin number 2 2 1 16 13.5553 6.01143 2 18 13.3690 5.58708 3 28 10.1424 6.83726 Contents of bin number 2 3 1 2 10.3371 9.06921 Contents of bin number 2 4 1 7 11.9819 10.8660 2 25 13.2808 11.5379 Contents of bin number 3 1 1 1 18.1655 4.13132 2 9 16.1304 4.03916 3 11 18.0909 3.66749 4 14 16.1947 3.26324 5 24 19.0180 3.30092 Contents of bin number 3 2 1 8 16.8325 6.58303 Contents of bin number 3 3 1 12 16.0693 7.53192 2 17 15.2232 9.03353 3 21 15.1810 8.45553 4 30 19.8354 9.64526 Contents of bin number 3 4 1 3 17.9333 11.1351 2 23 17.0290 11.1871 3 29 15.0665 10.8298 Contents of bin number 4 1 1 5 22.8593 3.45787 2 20 20.6710 4.82742 3 26 22.2959 3.02470 Contents of bin number 4 2 1 19 20.0145 5.04408 Contents of bin number 4 3 1 10 20.0251 8.15254 2 15 20.9066 8.27048 Contents of bin number 4 4 1 4 22.5511 10.0471 Call R82VEC_BINNED_REORDER to reorder the array. The data vector, sorted by bins: 1 9.66997 4.08031 2 9.33213 11.0928 3 14.0209 3.42458 4 14.1836 3.97675 5 13.5553 6.01143 6 13.3690 5.58708 7 10.1424 6.83726 8 10.3371 9.06921 9 11.9819 10.8660 10 13.2808 11.5379 11 18.1655 4.13132 12 16.1304 4.03916 13 18.0909 3.66749 14 16.1947 3.26324 15 19.0180 3.30092 16 16.8325 6.58303 17 16.0693 7.53192 18 15.2232 9.03353 19 15.1810 8.45553 20 19.8354 9.64526 21 17.9333 11.1351 22 17.0290 11.1871 23 15.0665 10.8298 24 22.8593 3.45787 25 20.6710 4.82742 26 22.2959 3.02470 27 20.0145 5.04408 28 20.0251 8.15254 29 20.9066 8.27048 30 22.5511 10.0471 The BIN_START array: Col 1 2 3 4 Row 1 1 -1 -1 2 2 3 5 8 9 3 11 16 17 21 4 24 27 28 30 The BIN_LAST array: Col 1 2 3 4 Row 1 1 -1 -1 2 2 4 7 8 10 3 15 16 20 23 4 26 27 29 30 The BIN_NEXT array: 1 0 2 0 3 4 4 0 5 6 6 7 7 0 8 0 9 10 10 0 11 12 12 13 13 14 14 15 15 0 16 0 17 18 18 19 19 20 20 0 21 22 22 23 23 0 24 25 25 26 26 0 27 0 28 29 29 0 30 0 The data vector, with sorted bins: 1 9.66997 4.08031 2 9.33213 11.0928 3 14.0209 3.42458 4 14.1836 3.97675 5 10.1424 6.83726 6 13.3690 5.58708 7 13.5553 6.01143 8 10.3371 9.06921 9 11.9819 10.8660 10 13.2808 11.5379 11 16.1304 4.03916 12 16.1947 3.26324 13 18.0909 3.66749 14 18.1655 4.13132 15 19.0180 3.30092 16 16.8325 6.58303 17 15.1810 8.45553 18 15.2232 9.03353 19 16.0693 7.53192 20 19.8354 9.64526 21 15.0665 10.8298 22 17.0290 11.1871 23 17.9333 11.1351 24 20.6710 4.82742 25 22.2959 3.02470 26 22.8593 3.45787 27 20.0145 5.04408 28 20.0251 8.15254 29 20.9066 8.27048 30 22.5511 10.0471 TEST05 R82VEC_PART_QUICK_A reorders an R82VEC as part of a quick sort. Using initial random number seed = 123456789 Before rearrangment: 1 2.18418 2.40131 2 9.56318 2.75467 3 8.29509 2.79729 4 5.61695 2.00184 5 4.15307 2.89750 6 0.661187 2.35075 7 2.57578 2.09454 8 1.09957 2.01362 9 0.438290 2.85910 10 6.33966 2.84085 11 0.617272 2.12310 12 4.49539 2.00751 Rearranged array Left index = 4 Key index = 5 Right index = 6 Left half: 1 0.617272 2.12310 2 0.438290 2.85910 3 1.09957 2.01362 4 0.661187 2.35075 Key: 1 2.18418 2.40131 Right half: 1 2.57578 2.09454 2 4.15307 2.89750 3 5.61695 2.00184 4 6.33966 2.84085 5 8.29509 2.79729 6 4.49539 2.00751 7 9.56318 2.75467 TEST05 R82VEC_PART_QUICK_A reorders an R82VEC as part of a quick sort. Using initial random number seed = 16132679 Before rearrangment: 1 2.60303 2.18895 2 9.12484 2.76149 3 1.13664 2.39699 4 3.51629 2.18531 5 8.22887 2.57437 6 2.67132 2.36703 7 6.92066 2.61720 8 5.61662 2.36153 9 8.61216 2.21293 10 4.53794 2.71447 11 9.11977 2.11771 12 5.97917 2.29933 Rearranged array Left index = 1 Key index = 2 Right index = 3 Left half: 1 1.13664 2.39699 Key: 1 2.60303 2.18895 Right half: 1 3.51629 2.18531 2 8.22887 2.57437 3 2.67132 2.36703 4 6.92066 2.61720 5 5.61662 2.36153 6 8.61216 2.21293 7 4.53794 2.71447 8 9.11977 2.11771 9 5.97917 2.29933 10 9.12484 2.76149 TEST07 R83VEC_PART_QUICK_A reorders an R83VEC as part of a quick sort. Using initial random number seed = 123456789 Before rearrangment: 1 2.18418 2.40131 1.52061 2 9.56318 2.75467 2.82497 3 8.29509 2.79729 1.22733 4 5.61695 2.00184 1.70326 5 4.15307 2.89750 2.64577 6 0.661187 2.35075 1.53426 7 2.57578 2.09454 2.38413 8 1.09957 2.01362 2.12332 9 0.438290 2.85910 2.72243 10 6.33966 2.84085 1.90759 11 0.617272 2.12310 2.82395 12 4.49539 2.00751 2.19583 Rearranged array Left index = 4 Key index = 5 Right index = 6 Left half: 1 0.617272 2.12310 2.82395 2 0.438290 2.85910 2.72243 3 1.09957 2.01362 2.12332 4 0.661187 2.35075 1.53426 Key: 1 2.18418 2.40131 1.52061 Right half: 1 2.57578 2.09454 2.38413 2 4.15307 2.89750 2.64577 3 5.61695 2.00184 1.70326 4 6.33966 2.84085 1.90759 5 8.29509 2.79729 1.22733 6 4.49539 2.00751 2.19583 7 9.56318 2.75467 2.82497 TEST08 R83VEC_SORT_QUICK_A sorts an R83VEC using quick sort. Using initial random number seed = 123456789 Before rearrangment: 1 2.18418 2.40131 1.52061 2 9.56318 2.75467 2.82497 3 4.15307 2.79729 1.22733 4 4.49539 2.00751 1.70326 5 4.15307 2.89750 2.64577 6 0.661187 2.35075 1.53426 7 0.617272 2.12310 2.82395 8 1.09957 2.01362 2.12332 9 0.438290 2.85910 2.72243 10 6.33966 2.84085 1.90759 11 0.617272 2.12310 2.82395 12 4.49539 2.00751 2.19583 Sorted array: 1 0.438290 2.85910 2.72243 2 0.617272 2.12310 2.82395 3 0.617272 2.12310 2.82395 4 0.661187 2.35075 1.53426 5 1.09957 2.01362 2.12332 6 2.18418 2.40131 1.52061 7 4.15307 2.79729 1.22733 8 4.15307 2.89750 2.64577 9 4.49539 2.00751 1.70326 10 4.49539 2.00751 2.19583 11 6.33966 2.84085 1.90759 12 9.56318 2.75467 2.82497 TEST09 R8VEC_BIN computes bins for an R8VEC. The vector to be binned: 1 6.8101401 2 0.25501808E-01 3 6.6088898 4 10.610929 5 10.878099 6 3.2181502 7 1.4509820 8 5.6548490 9 5.0463153 10 8.4217139 11 6.7454628 12 4.9934170 13 3.3591421 14 5.1020519 15 9.1856854 16 2.8145570 17 4.2601091 18 2.6531453 19 8.4125651 20 8.9815686 21 4.2235470 22 -0.84549145 23 5.8251650 24 7.5489723 25 2.5766877 Number of bins is 5 Bin minimum is 0.00000 Bin maximum is 10.0000 Lower Limit Upper Limit Count 0.0000 0.0000 1 0.0000 2.0000 2 2.0000 4.0000 5 4.0000 6.0000 7 6.0000 8.0000 4 8.0000 10.0000 4 10.0000 2 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 18.165546 2 10.337117 3 17.933334 4 22.551072 5 22.859346 6 14.020943 7 11.981902 8 16.832518 9 16.130364 10 20.025054 11 18.090919 12 16.069327 13 14.183626 14 16.194675 15 20.906560 16 13.555258 17 15.223203 18 13.369014 19 20.014498 20 20.671041 21 15.181016 22 9.3321252 23 17.029037 24 19.018045 25 13.280793 26 22.295928 27 9.6699674 28 10.142385 29 15.066510 30 19.835359 The BIN_START array: 1 22 2 2 3 16 4 6 5 3 6 1 7 4 The BIN_LAST array: 1 27 2 28 3 25 4 29 5 23 6 30 7 26 The BIN_NEXT array: 1 11 2 7 3 8 4 5 5 10 6 13 7 28 8 9 9 12 10 15 11 24 12 14 13 17 14 23 15 19 16 18 17 21 18 25 19 20 20 26 21 29 22 27 23 0 24 30 25 0 26 0 27 0 28 0 29 0 30 0 Contents of bin number 1 1 22 9.33213 2 27 9.66997 Contents of bin number 2 1 2 10.3371 2 7 11.9819 3 28 10.1424 Contents of bin number 3 1 16 13.5553 2 18 13.3690 3 25 13.2808 Contents of bin number 4 1 6 14.0209 2 13 14.1836 3 17 15.2232 4 21 15.1810 5 29 15.0665 Contents of bin number 5 1 3 17.9333 2 8 16.8325 3 9 16.1304 4 12 16.0693 5 14 16.1947 6 23 17.0290 Contents of bin number 6 1 1 18.1655 2 11 18.0909 3 24 19.0180 4 30 19.8354 Contents of bin number 7 1 4 22.5511 2 5 22.8593 3 10 20.0251 4 15 20.9066 5 19 20.0145 6 20 20.6710 7 26 22.2959 Call R8VEC_BINNED_REORDER to reorder the array. The data vector A: 1 9.3321252 2 9.6699674 3 10.337117 4 11.981902 5 10.142385 6 13.555258 7 13.369014 8 13.280793 9 14.020943 10 14.183626 11 15.223203 12 15.181016 13 15.066510 14 17.933334 15 16.832518 16 16.130364 17 16.069327 18 16.194675 19 17.029037 20 18.165546 21 18.090919 22 19.018045 23 19.835359 24 22.551072 25 22.859346 26 20.025054 27 20.906560 28 20.014498 29 20.671041 30 22.295928 The BIN_START array: 1 1 2 3 3 6 4 9 5 14 6 20 7 24 The BIN_LAST array: 1 2 2 5 3 8 4 13 5 19 6 23 7 30 The BIN_NEXT array: 1 2 2 0 3 4 4 5 5 0 6 7 7 8 8 0 9 10 10 11 11 12 12 13 13 0 14 15 15 16 16 17 17 18 18 19 19 0 20 21 21 22 22 23 23 0 24 25 25 26 26 27 27 28 28 29 29 30 30 0 The sorted data vector A: 1 9.3321252 2 9.6699674 3 10.142385 4 10.337117 5 11.981902 6 13.280793 7 13.369014 8 13.555258 9 14.020943 10 14.183626 11 15.066510 12 15.181016 13 15.223203 14 16.069327 15 16.130364 16 16.194675 17 16.832518 18 17.029037 19 17.933334 20 18.090919 21 18.165546 22 19.018045 23 19.835359 24 20.014498 25 20.025054 26 20.671041 27 20.906560 28 22.295928 29 22.551072 30 22.859346 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 -------------------- -------------------- ---------- 14.9508 4.3521 14.9991 4.2166 0.1438 1000 14.9508 4.3521 14.9991 4.2166 0.1438 13 14.9508 4.3521 14.9991 4.2166 0.1438 13 14.9508 4.3521 15.8243 2.2894 0.1438 59 2.4729 0.5079 2.5180 0.6927 0.1902 1000 2.4729 0.5079 2.5180 0.6927 0.1902 92 2.4729 0.5079 2.5180 0.6927 0.1902 92 2.4729 0.5079 2.6648 0.2484 0.1902 14 8.1566 2.1458 8.2568 2.0666 0.1277 1000 8.1566 2.1458 8.2568 2.0666 0.1277 9 8.1566 2.1458 8.2568 2.0666 0.1277 9 8.1566 2.1458 9.6967 0.9044 0.1277 10 18.7061 3.4669 18.8883 3.4484 0.1832 1000 18.7061 3.4669 18.8883 3.4484 0.1832 46 18.7061 3.4669 18.8883 3.4484 0.1832 46 18.7061 3.4669 19.1350 1.9987 0.1832 6 15.9852 0.6162 15.6757 0.5363 0.3196 1000 15.9852 0.6162 15.6757 0.5363 0.3196 99 15.9852 0.6162 15.6757 0.5363 0.3196 99 15.9852 0.6162 15.4120 2.9001 0.3196 55 4.7382 3.6001 4.9253 3.6185 0.1880 1000 4.7382 3.6001 4.9253 3.6185 0.1880 93 4.7382 3.6001 4.9253 3.6185 0.1880 93 4.7382 3.6001 5.8095 1.7666 0.1880 8 7.5550 4.0715 7.6969 4.2623 0.2378 1000 7.5550 4.0715 7.6969 4.2623 0.2378 91 7.5550 4.0715 7.6969 4.2623 0.2378 91 7.5550 4.0715 6.6506 4.7919 0.2378 60 16.5715 4.3991 16.3617 4.5427 0.2542 1000 16.5715 4.3991 16.3617 4.5427 0.2542 87 16.5715 4.3991 16.3617 4.5427 0.2542 87 16.5715 4.3991 16.6025 2.4562 0.2542 6 5.1075 0.2936 5.1662 0.3285 0.0683 1000 5.1075 0.2936 5.1662 0.3285 0.0683 9 5.1075 0.2936 5.1662 0.3285 0.0683 9 5.1075 0.2936 5.8754 2.4802 0.0683 9 17.9588 3.3774 18.1511 3.6014 0.2953 1000 17.9588 3.3774 18.1511 3.6014 0.2953 69 17.9588 3.3774 18.1511 3.6014 0.2953 69 17.9588 3.3774 18.6141 1.9460 0.2953 78 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 -------------------- ------------------------------------ 7.4754 4.8468 0.2041 0.2041 0.2041 0.2041 8.7042 0.3605 0.1910 0.1910 0.1910 0.1910 1.2365 9.2229 0.0853 0.0853 0.0853 0.0853 1.0159 9.2763 0.1436 0.1436 0.1436 0.1436 4.0783 7.1919 0.2873 0.2873 0.2873 0.2873 4.2916 4.4874 0.0474 0.0474 0.0474 0.0474 9.3531 0.4123 0.0239 0.0239 0.0239 0.0239 6.9339 9.8958 0.2983 0.2983 0.2983 0.2983 7.9926 9.3159 0.2977 0.2977 0.2977 0.2977 1.2324 1.6629 0.1478 0.1478 0.1478 0.1478 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 -------------------- ------------------------------------ 2.9902 12.1170 0.1954 0.1954 0.1954 0.1954 3.4817 0.9013 0.0764 0.0764 0.0764 0.0764 0.4946 23.0572 0.0395 0.0395 0.0395 0.0395 0.4064 23.1908 0.1855 0.1855 0.1855 0.1855 1.6313 17.9798 0.1164 0.1164 0.1164 0.1164 1.7167 11.2186 0.0197 0.0197 0.0197 0.0197 3.7412 1.0308 0.0586 0.0586 0.0586 0.0586 2.7736 24.7396 0.1899 0.1899 0.1899 0.1899 3.1970 23.2897 0.2805 0.2805 0.2805 0.2805 0.4929 4.1572 0.2869 0.2869 0.2869 0.2869 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.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 ----------------------------- -------------------- ---------- 6.0435 8.2578 8.9217 0.3736 0.3736 4096 7 3.3103 9.4387 7.8419 0.2349 0.2349 4096 7 6.6906 6.1998 9.4486 0.3432 0.3432 4096 7 8.1085 0.6709 3.1854 0.4333 0.4333 4096 20 9.3259 5.0737 6.4339 0.2743 0.2743 4096 3 9.8900 4.4102 4.2415 0.3369 0.3369 4096 4 0.8175 3.0704 7.4605 0.1155 0.1155 4096 4 9.4071 3.9908 8.6950 0.1957 0.1957 4096 5 4.8975 2.8356 6.3092 0.1013 0.1013 4096 8 2.7082 7.8060 9.4692 0.2601 0.2601 4096 6 Naive and bin codes computed the same results. Naive code time = 0.370000E-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 -0.9224 2.9930 Naive -1.0000 3.0000 0.0779 3 Delaunay -1.0000 3.0000 0.0779 3 XD 6.5701 3.2889 Naive 7.0000 4.0000 0.8310 7 Delaunay 7.0000 4.0000 0.8310 7 XD 5.7761 1.9414 Naive 6.0000 4.0000 2.0707 13 Delaunay 6.0000 4.0000 2.0707 13 XD 6.4137 4.7453 Naive 6.0000 4.0000 0.8525 13 Delaunay 6.0000 4.0000 0.8525 13 XD 4.7126 5.5281 Naive 5.0000 6.0000 0.5525 8 Delaunay 5.0000 6.0000 0.5525 8 XD -0.9843 2.8790 Naive -1.0000 3.0000 0.1220 3 Delaunay -1.0000 3.0000 0.1220 3 XD 0.1322 0.5990 Naive 0.0000 0.0000 0.6134 1 Delaunay 0.0000 0.0000 0.6134 1 XD 8.6345 6.0623 Naive 9.0000 5.0000 1.1235 6 Delaunay 9.0000 5.0000 1.1235 6 XD 2.2279 1.9898 Naive 2.0000 2.0000 0.2281 2 Delaunay 2.0000 2.0000 0.2281 2 XD 2.3587 1.9504 Naive 2.0000 2.0000 0.3622 2 Delaunay 2.0000 2.0000 0.3622 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. 21 June 2018 8:13:37.495 AM