18 May 2007 9:31:36.511 AM BINS_PRB FORTRAN90 version Tests the routines in 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 = ************ Generate some random values C and put them in bins. C Bin Bin_Min Bin_Max 22.7944 7 20.0000 0.179769+309 16.8044 5 16.0000 18.0000 9.02362 1 -0.179769+309 10.0000 21.9345 7 20.0000 0.179769+309 9.37241 1 -0.179769+309 10.0000 19.0876 6 18.0000 20.0000 12.5473 3 12.0000 14.0000 9.25546 1 -0.179769+309 10.0000 18.5166 6 18.0000 20.0000 15.7571 4 14.0000 16.0000 16.8349 5 16.0000 18.0000 11.0517 2 10.0000 12.0000 12.1825 3 12.0000 14.0000 12.6107 3 12.0000 14.0000 10.7678 2 10.0000 12.0000 10.6019 2 10.0000 12.0000 13.5394 3 12.0000 14.0000 19.3781 6 18.0000 20.0000 19.2236 6 18.0000 20.0000 17.8808 5 16.0000 18.0000 10.3211 2 10.0000 12.0000 19.2565 6 18.0000 20.0000 16.0608 5 16.0000 18.0000 21.3860 7 20.0000 0.179769+309 17.1736 5 16.0000 18.0000 17.8794 5 16.0000 18.0000 15.8432 4 14.0000 16.0000 9.03955 1 -0.179769+309 10.0000 19.7430 6 18.0000 20.0000 18.0604 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 = ************ Generate some random values C and put them in bins. C Bin Bin_Min Bin_Max 10.2628 1 10.0000 12.0000 14.0660 3 14.0000 16.0000 18.8213 5 18.0000 20.0000 21.8434 5 18.0000 20.0000 9.41869 1 10.0000 12.0000 16.8930 4 16.0000 18.0000 13.4812 2 12.0000 14.0000 14.8634 3 14.0000 16.0000 10.9298 1 10.0000 12.0000 18.6358 5 18.0000 20.0000 9.29841 1 10.0000 12.0000 20.3850 5 18.0000 20.0000 21.9193 5 18.0000 20.0000 9.74771 1 10.0000 12.0000 11.7229 1 10.0000 12.0000 14.0959 3 14.0000 16.0000 11.8402 1 10.0000 12.0000 19.9974 5 18.0000 20.0000 17.7025 4 16.0000 18.0000 12.6468 2 12.0000 14.0000 17.1858 4 16.0000 18.0000 13.6592 2 12.0000 14.0000 22.3222 5 18.0000 20.0000 15.5608 3 14.0000 16.0000 16.8727 4 16.0000 18.0000 16.6211 4 16.0000 18.0000 18.2469 5 18.0000 20.0000 12.4294 2 12.0000 14.0000 8.20234 1 10.0000 12.0000 18.6739 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) = .000000 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 6.01708 2 5.00000 7.00000 7.30116 3 4.00000 8.00000 17.4284 7 15.0000 0.179769+309 19.2266 6 16.0000 20.0000 4.89158 1 -0.179769+309 5.00000 11.6360 4 8.00000 12.0000 10.3082 4 9.00000 11.0000 8.52386 4 8.00000 12.0000 6.90636 2 5.00000 7.00000 14.3083 5 12.0000 16.0000 4.73121 1 -0.179769+309 5.00000 16.9903 6 16.0000 20.0000 21.5591 7 15.0000 0.179769+309 .679818 2 .000000 4.00000 7.96389 3 7.00000 9.00000 7.34705 3 4.00000 8.00000 8.12025 3 7.00000 9.00000 16.3960 6 16.0000 20.0000 15.9366 7 15.0000 0.179769+309 5.12513 3 4.00000 8.00000 15.2477 7 15.0000 0.179769+309 6.67745 3 4.00000 8.00000 22.0962 7 15.0000 0.179769+309 9.59318 4 8.00000 12.0000 14.8303 6 13.0000 15.0000 11.2191 4 8.00000 12.0000 16.6625 7 15.0000 0.179769+309 4.79177 3 4.00000 8.00000 3.26978 1 -0.179769+309 5.00000 14.3667 5 12.0000 16.0000 18.8509 7 15.0000 0.179769+309 5.17441 3 4.00000 8.00000 15.4373 7 15.0000 0.179769+309 13.1737 5 12.0000 16.0000 3.88939 1 -0.179769+309 5.00000 7.20660 3 4.00000 8.00000 15.5075 7 15.0000 0.179769+309 12.8166 5 12.0000 16.0000 4.58673 1 -0.179769+309 5.00000 7.34991 3 4.00000 8.00000 9.90163 4 9.00000 11.0000 16.1010 6 16.0000 20.0000 5.17340 2 5.00000 7.00000 7.51170 3 4.00000 8.00000 14.4553 6 13.0000 15.0000 9.40822 4 8.00000 12.0000 11.6617 5 11.0000 13.0000 17.0056 6 16.0000 20.0000 5.86469 2 5.00000 7.00000 5.94366 3 4.00000 8.00000 17.8433 7 15.0000 0.179769+309 10.6326 4 8.00000 12.0000 5.00862 2 5.00000 7.00000 19.6509 6 16.0000 20.0000 5.92806 2 5.00000 7.00000 11.6951 4 8.00000 12.0000 13.2701 6 13.0000 15.0000 9.81001 4 8.00000 12.0000 3.67757 1 -0.179769+309 5.00000 7.15909 3 4.00000 8.00000 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.7313 4.84193 2 11.3275 9.36533 3 13.6190 11.0971 4 21.7524 11.7708 5 9.46497 3.36953 6 14.6985 3.68603 7 14.4150 4.09339 8 20.4713 10.5663 9 18.3429 9.63314 10 21.5145 3.26765 11 16.7619 10.3879 12 14.7183 8.19807 13 16.6561 3.93471 14 21.8847 7.61537 15 12.6781 11.5895 16 17.5899 6.14985 17 10.1409 4.46203 18 20.6167 5.34840 19 16.1814 7.63351 20 22.4128 10.4620 21 9.05046 10.7327 22 8.06191 5.89803 23 13.5835 11.2133 24 9.73550 10.4335 25 16.5719 9.43563 26 15.3629 4.59929 27 20.6506 8.19836 28 15.8193 8.75403 29 11.6616 5.95456 30 19.2874 7.23477 The BIN_START array: Col 1 2 3 4 Row 1 5 22 -1 21 2 1 29 2 3 3 13 16 9 11 4 10 18 14 4 The BIN_LAST array: Col 1 2 3 4 Row 1 5 22 -1 21 2 1 29 2 3 3 13 16 9 11 4 10 18 14 4 The BIN_NEXT array: 1 6 2 12 3 15 4 8 5 0 6 7 7 17 8 20 9 19 10 0 11 0 12 0 13 26 14 27 15 23 16 30 17 0 18 0 19 25 20 0 21 24 22 0 23 0 24 0 25 28 26 0 27 0 28 0 29 0 30 0 Contents of bin number 1 1 1 5 9.46497 3.36953 Contents of bin number 1 2 1 22 8.06191 5.89803 Contents of bin number 1 3 Contents of bin number 1 4 1 21 9.05046 10.7327 2 24 9.73550 10.4335 Contents of bin number 2 1 1 1 12.7313 4.84193 2 6 14.6985 3.68603 3 7 14.4150 4.09339 4 17 10.1409 4.46203 Contents of bin number 2 2 1 29 11.6616 5.95456 Contents of bin number 2 3 1 2 11.3275 9.36533 2 12 14.7183 8.19807 Contents of bin number 2 4 1 3 13.6190 11.0971 2 15 12.6781 11.5895 3 23 13.5835 11.2133 Contents of bin number 3 1 1 13 16.6561 3.93471 2 26 15.3629 4.59929 Contents of bin number 3 2 1 16 17.5899 6.14985 2 30 19.2874 7.23477 Contents of bin number 3 3 1 9 18.3429 9.63314 2 19 16.1814 7.63351 3 25 16.5719 9.43563 4 28 15.8193 8.75403 Contents of bin number 3 4 1 11 16.7619 10.3879 Contents of bin number 4 1 1 10 21.5145 3.26765 Contents of bin number 4 2 1 18 20.6167 5.34840 Contents of bin number 4 3 1 14 21.8847 7.61537 2 27 20.6506 8.19836 Contents of bin number 4 4 1 4 21.7524 11.7708 2 8 20.4713 10.5663 3 20 22.4128 10.4620 Call R82VEC_BINNED_REORDER to reorder the array. The data vector, sorted by bins: 1 9.46497 3.36953 2 8.06191 5.89803 3 9.05046 10.7327 4 9.73550 10.4335 5 12.7313 4.84193 6 14.6985 3.68603 7 14.4150 4.09339 8 10.1409 4.46203 9 11.6616 5.95456 10 11.3275 9.36533 11 14.7183 8.19807 12 13.6190 11.0971 13 12.6781 11.5895 14 13.5835 11.2133 15 16.6561 3.93471 16 15.3629 4.59929 17 17.5899 6.14985 18 19.2874 7.23477 19 18.3429 9.63314 20 16.1814 7.63351 21 16.5719 9.43563 22 15.8193 8.75403 23 16.7619 10.3879 24 21.5145 3.26765 25 20.6167 5.34840 26 21.8847 7.61537 27 20.6506 8.19836 28 21.7524 11.7708 29 20.4713 10.5663 30 22.4128 10.4620 The BIN_START array: Col 1 2 3 4 Row 1 1 2 -1 3 2 5 9 10 12 3 15 17 19 23 4 24 25 26 28 The BIN_LAST array: Col 1 2 3 4 Row 1 1 2 -1 4 2 8 9 11 14 3 16 18 22 23 4 24 25 27 30 The BIN_NEXT array: 1 0 2 0 3 4 4 0 5 6 6 7 7 8 8 0 9 0 10 11 11 0 12 13 13 14 14 0 15 16 16 0 17 18 18 0 19 20 20 21 21 22 22 0 23 0 24 0 25 0 26 27 27 0 28 29 29 30 30 0 The data vector, with sorted bins: 1 9.46497 3.36953 2 8.06191 5.89803 3 9.05046 10.7327 4 9.73550 10.4335 5 10.1409 4.46203 6 12.7313 4.84193 7 14.4150 4.09339 8 14.6985 3.68603 9 11.6616 5.95456 10 11.3275 9.36533 11 14.7183 8.19807 12 12.6781 11.5895 13 13.5835 11.2133 14 13.6190 11.0971 15 15.3629 4.59929 16 16.6561 3.93471 17 17.5899 6.14985 18 19.2874 7.23477 19 15.8193 8.75403 20 16.1814 7.63351 21 16.5719 9.43563 22 18.3429 9.63314 23 16.7619 10.3879 24 21.5145 3.26765 25 20.6167 5.34840 26 20.6506 8.19836 27 21.8847 7.61537 28 20.4713 10.5663 29 21.7524 11.7708 30 22.4128 10.4620 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 .661187 2.35075 7 2.57578 2.09454 8 1.09957 2.01362 9 .438290 2.85910 10 6.33966 2.84085 11 .617272 2.12310 12 4.49539 2.00751 Rearranged array Left index = 4 Key index = 5 Right index = 6 Left half: 1 .617272 2.12310 2 .438290 2.85910 3 1.09957 2.01362 4 .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 .661187 2.35075 1.53426 7 2.57578 2.09454 2.38413 8 1.09957 2.01362 2.12332 9 .438290 2.85910 2.72243 10 6.33966 2.84085 1.90759 11 .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 .617272 2.12310 2.82395 2 .438290 2.85910 2.72243 3 1.09957 2.01362 2.12332 4 .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 .661187 2.35075 1.53426 7 .617272 2.12310 2.82395 8 1.09957 2.01362 2.12332 9 .438290 2.85910 2.72243 10 6.33966 2.84085 1.90759 11 .617272 2.12310 2.82395 12 4.49539 2.00751 2.19583 Sorted array: 1 .438290 2.85910 2.72243 2 .617272 2.12310 2.82395 3 .617272 2.12310 2.82395 4 .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 a DVEC. The vector to be binned: 1 10.657522 2 .97055926 3 4.1894257 4 10.678264 5 -1.4218775 6 3.5045858 7 5.5739632 8 10.598798 9 2.0010942 10 8.3901051 11 8.4961429 12 9.6730916 13 4.6512887 14 -.79068391 15 3.9755847 16 4.6514854 17 2.5148379 18 10.881171 19 2.8485517 20 3.6086067 21 -1.1467369 22 -.20638832 23 9.2315772 24 7.1184855 25 8.3856916 Number of bins is 5 Bin minimum is .000000 Bin maximum is 10.0000 Lower Limit Upper Limit Count 0.0000 0.0000 4 0.0000 2.0000 1 2.0000 4.0000 6 4.0000 6.0000 4 6.0000 8.0000 1 8.0000 10.0000 5 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 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 10.133391 2 13.899327 3 22.988217 4 19.970748 5 20.365726 6 13.763430 7 18.975714 8 21.826026 9 17.026198 10 16.308733 11 17.870406 12 14.919987 13 17.225266 14 17.046138 15 21.435430 16 22.266254 17 20.937443 18 22.604255 19 16.705574 20 12.585836 21 12.141482 22 13.886688 23 20.561459 24 18.448340 25 8.2443670 26 20.076706 27 16.200288 28 10.248667 29 16.353273 30 16.463017 The BIN_START array: 1 25 2 1 3 2 4 12 5 9 6 4 7 3 The BIN_LAST array: 1 25 2 28 3 22 4 12 5 30 6 24 7 26 The BIN_NEXT array: 1 28 2 6 3 5 4 7 5 8 6 20 7 24 8 15 9 10 10 11 11 13 12 0 13 14 14 19 15 16 16 17 17 18 18 23 19 27 20 21 21 22 22 0 23 26 24 0 25 0 26 0 27 29 28 0 29 30 30 0 Contents of bin number 1 1 25 8.24437 Contents of bin number 2 1 1 10.1334 2 28 10.2487 Contents of bin number 3 1 2 13.8993 2 6 13.7634 3 20 12.5858 4 21 12.1415 5 22 13.8867 Contents of bin number 4 1 12 14.9200 Contents of bin number 5 1 9 17.0262 2 10 16.3087 3 11 17.8704 4 13 17.2253 5 14 17.0461 6 19 16.7056 7 27 16.2003 8 29 16.3533 9 30 16.4630 Contents of bin number 6 1 4 19.9707 2 7 18.9757 3 24 18.4483 Contents of bin number 7 1 3 22.9882 2 5 20.3657 3 8 21.8260 4 15 21.4354 5 16 22.2663 6 17 20.9374 7 18 22.6043 8 23 20.5615 9 26 20.0767 Call R8VEC_BINNED_REORDER to reorder the array. The data vector A: 1 8.2443670 2 10.133391 3 10.248667 4 13.899327 5 13.763430 6 12.585836 7 12.141482 8 13.886688 9 14.919987 10 17.026198 11 16.308733 12 17.870406 13 17.225266 14 17.046138 15 16.705574 16 16.200288 17 16.353273 18 16.463017 19 19.970748 20 18.975714 21 18.448340 22 22.988217 23 20.365726 24 21.826026 25 21.435430 26 22.266254 27 20.937443 28 22.604255 29 20.561459 30 20.076706 The BIN_START array: 1 1 2 2 3 4 4 9 5 10 6 19 7 22 The BIN_LAST array: 1 1 2 3 3 8 4 9 5 18 6 21 7 30 The BIN_NEXT array: 1 0 2 3 3 0 4 5 5 6 6 7 7 8 8 0 9 0 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 0 19 20 20 21 21 0 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.2443670 2 10.133391 3 10.248667 4 12.141482 5 12.585836 6 13.763430 7 13.886688 8 13.899327 9 14.919987 10 16.200288 11 16.308733 12 16.353273 13 16.463017 14 16.705574 15 17.026198 16 17.046138 17 17.225266 18 17.870406 19 18.448340 20 18.975714 21 19.970748 22 20.076706 23 20.365726 24 20.561459 25 20.937443 26 21.435430 27 21.826026 28 22.266254 29 22.604255 30 22.988217 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: .000000 20.0000 The Y coordinate range: .000000 5.00000 Test point X range: .000000 20.0000 Test point Y range: .000000 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: .000000 10.0000 The Y coordinate range: .000000 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.156000E-01 Bin code time = 0.100000E-02 Bin2 code time = 0.900000E-03 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: .000000 4.00000 The Y coordinate range: .000000 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.156000E-01 Bin code time = 0.200000E-02 Bin2 code time = 0.100000E-02 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: .000000 10.0000 The Y coordinate range: .000000 10.0000 The Z coordinate range: .000000 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 = .768500 Bin code time = 0.186000E-01 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 .000000 .000000 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_2d. DEBUG: Returned from triangulation_sample_2d. 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 .000000 Test point is 8.00000 11.0000 Nearest point is 6.00000 9.00000 Distance is 2.82843 BINS_PRB Normal end of execution. 18 May 2007 9:31:37.423 AM