26 August 2024 7:03:25.815 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 Using random seed = 1283542390 Generate some random values C and put them in bins. C Bin Bin_Min Bin_Max 15.1506 4 14.0000 16.0000 22.5289 7 20.0000 0.179769+309 10.2040 2 10.0000 12.0000 15.5426 4 14.0000 16.0000 11.3257 2 10.0000 12.0000 12.9802 3 12.0000 14.0000 9.98861 1 -0.179769+309 10.0000 10.6375 2 10.0000 12.0000 11.9890 2 10.0000 12.0000 16.5787 5 16.0000 18.0000 9.66949 1 -0.179769+309 10.0000 17.1385 5 16.0000 18.0000 13.3436 3 12.0000 14.0000 13.6064 3 12.0000 14.0000 20.2754 7 20.0000 0.179769+309 10.0531 2 10.0000 12.0000 15.2830 4 14.0000 16.0000 12.9218 3 12.0000 14.0000 19.0001 6 18.0000 20.0000 12.4628 3 12.0000 14.0000 14.7058 4 14.0000 16.0000 17.1496 5 16.0000 18.0000 20.3995 7 20.0000 0.179769+309 10.7926 2 10.0000 12.0000 22.7336 7 20.0000 0.179769+309 16.1410 5 16.0000 18.0000 18.1857 6 18.0000 20.0000 19.0309 6 18.0000 20.0000 18.9646 6 18.0000 20.0000 14.5843 4 14.0000 16.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 = 1283542390 Generate some random values C and put them in bins. C Bin Bin_Min Bin_Max 15.1506 3 14.0000 16.0000 22.5289 5 18.0000 20.0000 10.2040 1 10.0000 12.0000 15.5426 3 14.0000 16.0000 11.3257 1 10.0000 12.0000 12.9802 2 12.0000 14.0000 9.98861 1 10.0000 12.0000 10.6375 1 10.0000 12.0000 11.9890 1 10.0000 12.0000 16.5787 4 16.0000 18.0000 9.66949 1 10.0000 12.0000 17.1385 4 16.0000 18.0000 13.3436 2 12.0000 14.0000 13.6064 2 12.0000 14.0000 20.2754 5 18.0000 20.0000 10.0531 1 10.0000 12.0000 15.2830 3 14.0000 16.0000 12.9218 2 12.0000 14.0000 19.0001 5 18.0000 20.0000 12.4628 2 12.0000 14.0000 14.7058 3 14.0000 16.0000 17.1496 4 16.0000 18.0000 20.3995 5 18.0000 20.0000 10.7926 1 10.0000 12.0000 22.7336 5 18.0000 20.0000 16.1410 4 16.0000 18.0000 18.1857 5 18.0000 20.0000 19.0309 5 18.0000 20.0000 18.9646 5 18.0000 20.0000 14.5843 3 14.0000 16.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 12.5341 5 11.0000 13.0000 20.2776 7 20.0000 0.179769+309 5.93866 2 5.00000 7.00000 9.56531 4 8.00000 12.0000 7.43426 3 7.00000 9.00000 5.63629 3 4.00000 8.00000 5.65149 2 5.00000 7.00000 2.04421 2 0.00000 4.00000 8.31870 3 7.00000 9.00000 11.1540 4 8.00000 12.0000 5.22599 2 5.00000 7.00000 12.0123 5 12.0000 16.0000 10.1249 4 9.00000 11.0000 6.59653 3 4.00000 8.00000 19.3672 7 15.0000 0.179769+309 1.14816 2 0.00000 4.00000 12.7106 5 11.0000 13.0000 5.54679 3 4.00000 8.00000 17.6669 7 15.0000 0.179769+309 4.84300 3 4.00000 8.00000 11.9410 5 11.0000 13.0000 12.0294 5 12.0000 16.0000 19.5326 7 15.0000 0.179769+309 2.28194 2 0.00000 4.00000 22.6448 7 15.0000 0.179769+309 10.4828 4 8.00000 12.0000 16.5809 7 15.0000 0.179769+309 14.9140 5 12.0000 16.0000 17.6194 7 15.0000 0.179769+309 8.09585 4 8.00000 12.0000 11.6696 5 11.0000 13.0000 9.75762 4 8.00000 12.0000 18.0073 7 15.0000 0.179769+309 6.38381 3 4.00000 8.00000 10.5279 4 9.00000 11.0000 -0.416798E-02 1 -0.179769+309 0.00000 11.6511 5 11.0000 13.0000 20.0604 7 20.0000 0.179769+309 11.1544 5 11.0000 13.0000 11.3996 4 8.00000 12.0000 15.9299 7 15.0000 0.179769+309 13.2366 5 12.0000 16.0000 22.3966 7 15.0000 0.179769+309 19.9813 6 16.0000 20.0000 14.3714 6 13.0000 15.0000 19.1412 6 16.0000 20.0000 16.5744 7 15.0000 0.179769+309 4.01927 3 4.00000 8.00000 13.3464 6 13.0000 15.0000 12.5512 5 12.0000 16.0000 5.35430 2 5.00000 7.00000 7.95962 3 4.00000 8.00000 20.7008 7 15.0000 0.179769+309 17.0987 6 16.0000 20.0000 6.64131 2 5.00000 7.00000 20.3904 7 20.0000 0.179769+309 14.3613 6 13.0000 15.0000 8.14697 4 8.00000 12.0000 18.8252 7 15.0000 0.179769+309 14.7710 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 15.1506 6.90133 2 22.5289 7.60081 3 10.2040 9.75327 4 15.5426 6.28062 5 11.3257 6.38756 6 12.9802 3.78098 7 9.98861 6.89300 8 10.6375 11.6323 9 11.9890 6.66950 10 16.5787 8.24334 11 9.66949 8.81847 12 17.1385 8.96214 13 13.3436 11.7285 14 13.6064 11.6014 15 20.2754 8.11711 16 10.0531 11.2726 17 15.2830 9.10849 18 12.9218 5.35537 19 19.0001 7.65590 20 12.4628 8.69394 21 14.7058 4.05943 22 17.1496 6.89724 23 20.3995 10.9653 24 10.7926 10.4734 25 22.7336 4.63859 26 16.1410 11.7615 27 18.1857 8.11257 28 19.0309 6.97056 29 18.9646 10.1214 30 14.5843 9.56258 The BIN_START array: Col 1 2 3 4 Row 1 -1 7 11 -1 2 6 5 3 8 3 -1 1 10 26 4 25 -1 2 23 The BIN_LAST array: Col 1 2 3 4 Row 1 -1 7 11 -1 2 6 5 3 8 3 -1 1 10 26 4 25 -1 2 23 The BIN_NEXT array: 1 4 2 15 3 20 4 22 5 9 6 21 7 0 8 13 9 18 10 12 11 0 12 17 13 14 14 16 15 0 16 24 17 19 18 0 19 27 20 30 21 0 22 28 23 0 24 0 25 0 26 29 27 0 28 0 29 0 30 0 Contents of bin number 1 1 Contents of bin number 1 2 1 7 9.98861 6.89300 Contents of bin number 1 3 1 11 9.66949 8.81847 Contents of bin number 1 4 Contents of bin number 2 1 1 6 12.9802 3.78098 2 21 14.7058 4.05943 Contents of bin number 2 2 1 5 11.3257 6.38756 2 9 11.9890 6.66950 3 18 12.9218 5.35537 Contents of bin number 2 3 1 3 10.2040 9.75327 2 20 12.4628 8.69394 3 30 14.5843 9.56258 Contents of bin number 2 4 1 8 10.6375 11.6323 2 13 13.3436 11.7285 3 14 13.6064 11.6014 4 16 10.0531 11.2726 5 24 10.7926 10.4734 Contents of bin number 3 1 Contents of bin number 3 2 1 1 15.1506 6.90133 2 4 15.5426 6.28062 3 22 17.1496 6.89724 4 28 19.0309 6.97056 Contents of bin number 3 3 1 10 16.5787 8.24334 2 12 17.1385 8.96214 3 17 15.2830 9.10849 4 19 19.0001 7.65590 5 27 18.1857 8.11257 Contents of bin number 3 4 1 26 16.1410 11.7615 2 29 18.9646 10.1214 Contents of bin number 4 1 1 25 22.7336 4.63859 Contents of bin number 4 2 Contents of bin number 4 3 1 2 22.5289 7.60081 2 15 20.2754 8.11711 Contents of bin number 4 4 1 23 20.3995 10.9653 Call R82VEC_BINNED_REORDER to reorder the array. The data vector, sorted by bins: 1 9.98861 6.89300 2 9.66949 8.81847 3 12.9802 3.78098 4 14.7058 4.05943 5 11.3257 6.38756 6 11.9890 6.66950 7 12.9218 5.35537 8 10.2040 9.75327 9 12.4628 8.69394 10 14.5843 9.56258 11 10.6375 11.6323 12 13.3436 11.7285 13 13.6064 11.6014 14 10.0531 11.2726 15 10.7926 10.4734 16 15.1506 6.90133 17 15.5426 6.28062 18 17.1496 6.89724 19 19.0309 6.97056 20 16.5787 8.24334 21 17.1385 8.96214 22 15.2830 9.10849 23 19.0001 7.65590 24 18.1857 8.11257 25 16.1410 11.7615 26 18.9646 10.1214 27 22.7336 4.63859 28 22.5289 7.60081 29 20.2754 8.11711 30 20.3995 10.9653 The BIN_START array: Col 1 2 3 4 Row 1 -1 1 2 -1 2 3 5 8 11 3 -1 16 20 25 4 27 -1 28 30 The BIN_LAST array: Col 1 2 3 4 Row 1 -1 1 2 -1 2 4 7 10 15 3 -1 19 24 26 4 27 -1 29 30 The BIN_NEXT array: 1 0 2 0 3 4 4 0 5 6 6 7 7 0 8 9 9 10 10 0 11 12 12 13 13 14 14 15 15 0 16 17 17 18 18 19 19 0 20 21 21 22 22 23 23 24 24 0 25 26 26 0 27 0 28 29 29 0 30 0 The data vector, with sorted bins: 1 9.98861 6.89300 2 9.66949 8.81847 3 12.9802 3.78098 4 14.7058 4.05943 5 11.3257 6.38756 6 11.9890 6.66950 7 12.9218 5.35537 8 10.2040 9.75327 9 12.4628 8.69394 10 14.5843 9.56258 11 10.0531 11.2726 12 10.6375 11.6323 13 10.7926 10.4734 14 13.3436 11.7285 15 13.6064 11.6014 16 15.1506 6.90133 17 15.5426 6.28062 18 17.1496 6.89724 19 19.0309 6.97056 20 15.2830 9.10849 21 16.5787 8.24334 22 17.1385 8.96214 23 18.1857 8.11257 24 19.0001 7.65590 25 16.1410 11.7615 26 18.9646 10.1214 27 22.7336 4.63859 28 20.2754 8.11711 29 22.5289 7.60081 30 20.3995 10.9653 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 1.6487520 2 1.5753496 3 2.9000439 4 -1.9622496 5 8.4701380 6 1.6090151 7 9.7170907 8 3.1438045 9 -0.77988539E-01 10 9.2466341 11 0.17887618 12 10.371907 13 10.645428 14 5.7082840 15 6.1284881 16 9.4990617 17 4.7296272 18 2.8449890 19 8.7298147 20 10.995345 21 10.767214 22 -1.4387063 23 6.6634670 24 4.8901365 25 9.5236988 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 4 2.0000 4.0000 3 4.0000 6.0000 3 6.0000 8.0000 2 8.0000 10.0000 6 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 12.210098 2 12.125403 3 13.653897 4 8.0435581 5 20.080928 6 12.164248 7 21.519720 8 13.935159 9 10.217706 10 20.976885 11 10.514088 12 22.275278 13 22.590878 14 16.894174 15 17.379025 16 21.268148 17 15.764955 18 13.590372 19 20.380555 20 22.994629 21 22.731400 22 8.6476466 23 17.996308 24 15.950157 25 21.296576 26 13.546015 27 9.8658207 28 16.847789 29 17.788239 30 13.934044 The BIN_START array: 1 4 2 9 3 1 4 17 5 14 6 -1 7 5 The BIN_LAST array: 1 27 2 11 3 30 4 24 5 29 6 -1 7 25 The BIN_NEXT array: 1 2 2 3 3 6 4 22 5 7 6 8 7 10 8 18 9 11 10 12 11 0 12 13 13 16 14 15 15 23 16 19 17 24 18 26 19 20 20 21 21 25 22 27 23 28 24 0 25 0 26 30 27 0 28 29 29 0 30 0 Contents of bin number 1 1 4 8.04356 2 22 8.64765 3 27 9.86582 Contents of bin number 2 1 9 10.2177 2 11 10.5141 Contents of bin number 3 1 1 12.2101 2 2 12.1254 3 3 13.6539 4 6 12.1642 5 8 13.9352 6 18 13.5904 7 26 13.5460 8 30 13.9340 Contents of bin number 4 1 17 15.7650 2 24 15.9502 Contents of bin number 5 1 14 16.8942 2 15 17.3790 3 23 17.9963 4 28 16.8478 5 29 17.7882 Contents of bin number 6 Contents of bin number 7 1 5 20.0809 2 7 21.5197 3 10 20.9769 4 12 22.2753 5 13 22.5909 6 16 21.2681 7 19 20.3806 8 20 22.9946 9 21 22.7314 10 25 21.2966 Call R8VEC_BINNED_REORDER to reorder the array. The data vector A: 1 8.0435581 2 8.6476466 3 9.8658207 4 10.217706 5 10.514088 6 12.210098 7 12.125403 8 13.653897 9 12.164248 10 13.935159 11 13.590372 12 13.546015 13 13.934044 14 15.764955 15 15.950157 16 16.894174 17 17.379025 18 17.996308 19 16.847789 20 17.788239 21 20.080928 22 21.519720 23 20.976885 24 22.275278 25 22.590878 26 21.268148 27 20.380555 28 22.994629 29 22.731400 30 21.296576 The BIN_START array: 1 1 2 4 3 6 4 14 5 16 6 -1 7 21 The BIN_LAST array: 1 3 2 5 3 13 4 15 5 20 6 -1 7 30 The BIN_NEXT array: 1 2 2 3 3 0 4 5 5 0 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 0 14 15 15 0 16 17 17 18 18 19 19 20 20 0 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 0 The sorted data vector A: 1 8.0435581 2 8.6476466 3 9.8658207 4 10.217706 5 10.514088 6 12.125403 7 12.164248 8 12.210098 9 13.546015 10 13.590372 11 13.653897 12 13.934044 13 13.935159 14 15.764955 15 15.950157 16 16.847789 17 16.894174 18 17.379025 19 17.788239 20 17.996308 21 20.080928 22 20.380555 23 20.976885 24 21.268148 25 21.296576 26 21.519720 27 22.275278 28 22.590878 29 22.731400 30 22.994629 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.00000 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.270000E-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.0000 0.0000 Naive 0.0000 0.0000 0.0000 1 Delaunay 0.0000 0.0000 0.0000 1 XD 0.0000 0.0000 Naive 0.0000 0.0000 0.0000 1 Delaunay 0.0000 0.0000 0.0000 1 XD 0.0000 0.0000 Naive 0.0000 0.0000 0.0000 1 Delaunay 0.0000 0.0000 0.0000 1 XD 0.0000 0.0000 Naive 0.0000 0.0000 0.0000 1 Delaunay 0.0000 0.0000 0.0000 1 XD 0.0000 0.0000 Naive 0.0000 0.0000 0.0000 1 Delaunay 0.0000 0.0000 0.0000 1 XD 0.0000 0.0000 Naive 0.0000 0.0000 0.0000 1 Delaunay 0.0000 0.0000 0.0000 1 XD 0.0000 0.0000 Naive 0.0000 0.0000 0.0000 1 Delaunay 0.0000 0.0000 0.0000 1 XD 0.0000 0.0000 Naive 0.0000 0.0000 0.0000 1 Delaunay 0.0000 0.0000 0.0000 1 XD 0.0000 0.0000 Naive 0.0000 0.0000 0.0000 1 Delaunay 0.0000 0.0000 0.0000 1 XD 0.0000 0.0000 Naive 0.0000 0.0000 0.0000 1 Delaunay 0.0000 0.0000 0.0000 1 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. 26 August 2024 7:03:25.849 PM