7 October 2025 1:02:22.170 PM bins_test(): Fortran77 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 = 773219039 Generate some random values C and put them in bins. C Bin Bin_Min Bin_Max 15.4658 4 14.0000 16.0000 10.1037 2 10.0000 12.0000 9.36393 1 -0.100000E+31 10.0000 11.6461 2 10.0000 12.0000 12.8378 3 12.0000 14.0000 17.4924 5 16.0000 18.0000 22.0923 7 20.0000 0.100000E+31 22.8189 7 20.0000 0.100000E+31 9.75709 1 -0.100000E+31 10.0000 19.3924 6 18.0000 20.0000 20.1682 7 20.0000 0.100000E+31 8.76875 1 -0.100000E+31 10.0000 13.4496 3 12.0000 14.0000 9.17368 1 -0.100000E+31 10.0000 9.08745 1 -0.100000E+31 10.0000 14.7309 4 14.0000 16.0000 19.7247 6 18.0000 20.0000 10.1634 2 10.0000 12.0000 8.21389 1 -0.100000E+31 10.0000 17.8807 5 16.0000 18.0000 22.4937 7 20.0000 0.100000E+31 17.9421 5 16.0000 18.0000 19.7481 6 18.0000 20.0000 12.5596 3 12.0000 14.0000 21.6899 7 20.0000 0.100000E+31 8.39935 1 -0.100000E+31 10.0000 14.7995 4 14.0000 16.0000 17.1890 5 16.0000 18.0000 21.9340 7 20.0000 0.100000E+31 16.8845 5 16.0000 18.0000 TEST02 BIN_TO_R8_EVEN2 returns the bin limits. R8_TO_BIN_EVEN2 puts a number into a bin. The bins are equally spaced between A and B. A = 10.0000 B = 20.0000 Total number of bins = 5 Using random seed = 773219039 Generate some random values C and put them in bins. C Bin Bin_Min Bin_Max 15.4658 3 14.0000 16.0000 10.1037 1 10.0000 12.0000 9.36393 1 10.0000 12.0000 11.6461 1 10.0000 12.0000 12.8378 2 12.0000 14.0000 17.4924 4 16.0000 18.0000 22.0923 5 18.0000 20.0000 22.8189 5 18.0000 20.0000 9.75709 1 10.0000 12.0000 19.3924 5 18.0000 20.0000 20.1682 5 18.0000 20.0000 8.76875 1 10.0000 12.0000 13.4496 2 12.0000 14.0000 9.17368 1 10.0000 12.0000 9.08745 1 10.0000 12.0000 14.7309 3 14.0000 16.0000 19.7247 5 18.0000 20.0000 10.1634 1 10.0000 12.0000 8.21389 1 10.0000 12.0000 17.8807 4 16.0000 18.0000 22.4937 5 18.0000 20.0000 17.9421 4 16.0000 18.0000 19.7481 5 18.0000 20.0000 12.5596 2 12.0000 14.0000 21.6899 5 18.0000 20.0000 8.39935 1 10.0000 12.0000 14.7995 3 14.0000 16.0000 17.1890 4 16.0000 18.0000 21.9340 5 18.0000 20.0000 16.8845 4 16.0000 18.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.9544 5 11.0000 13.0000 1.22563 2 0.00000 4.00000 4.81858 1 -0.100000E+31 5.00000 3.59067 2 0.00000 4.00000 9.45045 4 9.00000 11.0000 12.5550 5 12.0000 16.0000 21.7898 7 15.0000 0.100000E+31 20.7224 7 20.0000 0.100000E+31 5.34279 2 5.00000 7.00000 15.4684 5 12.0000 16.0000 19.2243 7 15.0000 0.100000E+31 -0.821244 1 -0.100000E+31 0.00000 10.2661 4 9.00000 11.0000 -0.200353 1 -0.100000E+31 0.00000 4.44993 1 -0.100000E+31 5.00000 8.32076 4 8.00000 12.0000 18.6329 7 15.0000 0.100000E+31 1.31721 2 0.00000 4.00000 3.28519 1 -0.100000E+31 5.00000 13.1504 5 12.0000 16.0000 22.3249 7 15.0000 0.100000E+31 13.2445 5 12.0000 16.0000 18.6641 7 15.0000 0.100000E+31 4.99143 3 4.00000 8.00000 21.2531 7 15.0000 0.100000E+31 -1.38767 1 -0.100000E+31 0.00000 12.0660 5 11.0000 13.0000 12.0897 5 12.0000 16.0000 21.5787 7 15.0000 0.100000E+31 11.6228 4 8.00000 12.0000 17.6579 7 15.0000 0.100000E+31 15.7855 5 12.0000 16.0000 13.8737 6 13.0000 15.0000 13.5396 5 12.0000 16.0000 11.4880 5 11.0000 13.0000 18.5894 6 16.0000 20.0000 12.9269 5 11.0000 13.0000 -1.15174 1 -0.100000E+31 0.00000 20.1142 7 15.0000 0.100000E+31 18.4241 6 16.0000 20.0000 17.3917 7 15.0000 0.100000E+31 -0.259829 1 -0.100000E+31 0.00000 15.2208 7 15.0000 0.100000E+31 15.2801 5 12.0000 16.0000 8.23182 3 7.00000 9.00000 10.9358 4 8.00000 12.0000 17.5865 7 15.0000 0.100000E+31 15.3310 5 12.0000 16.0000 11.5425 5 11.0000 13.0000 13.7820 5 12.0000 16.0000 13.9588 6 13.0000 15.0000 3.44395 2 0.00000 4.00000 5.15847 2 5.00000 7.00000 18.1003 6 16.0000 20.0000 3.91092 1 -0.100000E+31 5.00000 9.31231 4 8.00000 12.0000 9.99023 4 9.00000 11.0000 3.54453 2 0.00000 4.00000 15.0809 7 15.0000 0.100000E+31 1.31265 2 0.00000 4.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 15.4658 9.59606 2 10.1037 9.95953 3 9.36393 7.89314 4 11.6461 9.08073 5 12.8378 6.81960 6 17.4924 11.0567 7 22.0923 7.46709 8 22.8189 3.33193 9 9.75709 10.7014 10 19.3924 10.9921 11 20.1682 9.47627 12 8.76875 3.68094 13 13.4496 8.49936 14 9.17368 9.76179 15 9.08745 5.35432 16 14.7309 8.06185 17 19.7247 9.56392 18 10.1634 9.78169 19 8.21389 6.84412 20 17.8807 9.17558 21 22.4937 7.93146 22 17.9421 5.13024 23 19.7481 3.97131 24 12.5596 10.8653 25 21.6899 3.40991 26 8.39935 7.42656 27 14.7995 6.14560 28 17.1890 5.16960 29 21.9340 8.43638 30 16.8845 4.29626 The BIN_START array: Col 1 2 3 4 Row 1 12 15 3 9 2 -1 5 2 24 3 23 22 1 6 4 8 7 11 -1 The BIN_LAST array: Col 1 2 3 4 Row 1 12 15 3 9 2 -1 5 2 24 3 23 22 1 6 4 8 7 11 -1 The BIN_NEXT array: 1 17 2 4 3 14 4 13 5 27 6 10 7 0 8 25 9 0 10 0 11 21 12 0 13 16 14 0 15 19 16 18 17 20 18 0 19 26 20 0 21 29 22 28 23 30 24 0 25 0 26 0 27 0 28 0 29 0 30 0 Contents of bin number 1 1 1 12 8.76875 3.68094 Contents of bin number 1 2 1 15 9.08745 5.35432 2 19 8.21389 6.84412 3 26 8.39935 7.42656 Contents of bin number 1 3 1 3 9.36393 7.89314 2 14 9.17368 9.76179 Contents of bin number 1 4 1 9 9.75709 10.7014 Contents of bin number 2 1 Contents of bin number 2 2 1 5 12.8378 6.81960 2 27 14.7995 6.14560 Contents of bin number 2 3 1 2 10.1037 9.95953 2 4 11.6461 9.08073 3 13 13.4496 8.49936 4 16 14.7309 8.06185 5 18 10.1634 9.78169 Contents of bin number 2 4 1 24 12.5596 10.8653 Contents of bin number 3 1 1 23 19.7481 3.97131 2 30 16.8845 4.29626 Contents of bin number 3 2 1 22 17.9421 5.13024 2 28 17.1890 5.16960 Contents of bin number 3 3 1 1 15.4658 9.59606 2 17 19.7247 9.56392 3 20 17.8807 9.17558 Contents of bin number 3 4 1 6 17.4924 11.0567 2 10 19.3924 10.9921 Contents of bin number 4 1 1 8 22.8189 3.33193 2 25 21.6899 3.40991 Contents of bin number 4 2 1 7 22.0923 7.46709 Contents of bin number 4 3 1 11 20.1682 9.47627 2 21 22.4937 7.93146 3 29 21.9340 8.43638 Contents of bin number 4 4 Call R82VEC_BINNED_REORDER to reorder the array. The data vector, sorted by bins: 1 8.76875 3.68094 2 9.08745 5.35432 3 8.21389 6.84412 4 8.39935 7.42656 5 9.36393 7.89314 6 9.17368 9.76179 7 9.75709 10.7014 8 12.8378 6.81960 9 14.7995 6.14560 10 10.1037 9.95953 11 11.6461 9.08073 12 13.4496 8.49936 13 14.7309 8.06185 14 10.1634 9.78169 15 12.5596 10.8653 16 19.7481 3.97131 17 16.8845 4.29626 18 17.9421 5.13024 19 17.1890 5.16960 20 15.4658 9.59606 21 19.7247 9.56392 22 17.8807 9.17558 23 17.4924 11.0567 24 19.3924 10.9921 25 22.8189 3.33193 26 21.6899 3.40991 27 22.0923 7.46709 28 20.1682 9.47627 29 22.4937 7.93146 30 21.9340 8.43638 The BIN_START array: Col 1 2 3 4 Row 1 1 2 5 7 2 -1 8 10 15 3 16 18 20 23 4 25 27 28 -1 The BIN_LAST array: Col 1 2 3 4 Row 1 1 4 6 7 2 -1 9 14 15 3 17 19 22 24 4 26 27 30 -1 The BIN_NEXT array: 1 0 2 3 3 4 4 0 5 6 6 0 7 0 8 9 9 0 10 11 11 12 12 13 13 14 14 0 15 0 16 17 17 0 18 19 19 0 20 21 21 22 22 0 23 24 24 0 25 26 26 0 27 0 28 29 29 30 30 0 The data vector, with sorted bins: 1 8.76875 3.68094 2 8.21389 6.84412 3 8.39935 7.42656 4 9.08745 5.35432 5 9.17368 9.76179 6 9.36393 7.89314 7 9.75709 10.7014 8 12.8378 6.81960 9 14.7995 6.14560 10 10.1037 9.95953 11 10.1634 9.78169 12 11.6461 9.08073 13 13.4496 8.49936 14 14.7309 8.06185 15 12.5596 10.8653 16 16.8845 4.29626 17 19.7481 3.97131 18 17.1890 5.16960 19 17.9421 5.13024 20 15.4658 9.59606 21 17.8807 9.17558 22 19.7247 9.56392 23 17.4924 11.0567 24 19.3924 10.9921 25 21.6899 3.40991 26 22.8189 3.33193 27 22.0923 7.46709 28 20.1682 9.47627 29 21.9340 8.43638 30 22.4937 7.93146 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 TEST09 R8VEC_BIN computes bins for an R8VEC. The vector to be binned: 1 1.9219258 2 3.8068169 3 2.1719915 4 7.6607830 5 9.7806580 6 5.5196172 7 7.2069793 8 0.70101670 9 10.987665 10 -1.3147928 11 9.2777484 12 3.1181494 13 10.737244 14 1.8665694 15 9.4322933 16 0.55313733 17 8.5791310 18 0.45435722 19 -0.61827270 20 2.6908143 21 4.5167042 22 -0.75188321 23 6.0989125 24 6.4215874 25 8.6190931 Number of bins is 5 Bin minimum is 0.00000 Bin maximum is 10.0000 Lower Limit Upper Limit Count 0.0000 0.0000 3 0.0000 2.0000 5 2.0000 4.0000 4 4.0000 6.0000 2 6.0000 8.0000 4 8.0000 10.0000 5 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 12.525299 2 14.700173 3 12.813836 4 19.147057 5 21.593067 6 16.676481 7 18.623438 8 11.116558 9 22.985767 10 8.7906237 11 21.012787 12 13.905557 13 22.696820 14 12.461426 15 21.191108 16 10.945928 17 20.206690 18 10.831951 19 9.5943007 20 13.412478 21 15.519274 22 9.4401348 23 17.344899 24 17.717216 25 20.252800 26 20.804396 27 21.479622 28 15.005876 29 20.757674 30 16.234245 The BIN_START array: 1 10 2 8 3 1 4 2 5 6 6 4 7 5 The BIN_LAST array: 1 22 2 18 3 20 4 28 5 30 6 7 7 29 The BIN_NEXT array: 1 3 2 21 3 12 4 7 5 9 6 23 7 0 8 16 9 11 10 19 11 13 12 14 13 15 14 20 15 17 16 18 17 25 18 0 19 22 20 0 21 28 22 0 23 24 24 30 25 26 26 27 27 29 28 0 29 0 30 0 Contents of bin number 1 1 10 8.79062 2 19 9.59430 3 22 9.44013 Contents of bin number 2 1 8 11.1166 2 16 10.9459 3 18 10.8320 Contents of bin number 3 1 1 12.5253 2 3 12.8138 3 12 13.9056 4 14 12.4614 5 20 13.4125 Contents of bin number 4 1 2 14.7002 2 21 15.5193 3 28 15.0059 Contents of bin number 5 1 6 16.6765 2 23 17.3449 3 24 17.7172 4 30 16.2342 Contents of bin number 6 1 4 19.1471 2 7 18.6234 Contents of bin number 7 1 5 21.5931 2 9 22.9858 3 11 21.0128 4 13 22.6968 5 15 21.1911 6 17 20.2067 7 25 20.2528 8 26 20.8044 9 27 21.4796 10 29 20.7577 Call R8VEC_BINNED_REORDER to reorder the array. The data vector A: 1 8.7906237 2 9.5943007 3 9.4401348 4 11.116558 5 10.945928 6 10.831951 7 12.525299 8 12.813836 9 13.905557 10 12.461426 11 13.412478 12 14.700173 13 15.519274 14 15.005876 15 16.676481 16 17.344899 17 17.717216 18 16.234245 19 19.147057 20 18.623438 21 21.593067 22 22.985767 23 21.012787 24 22.696820 25 21.191108 26 20.206690 27 20.252800 28 20.804396 29 21.479622 30 20.757674 The BIN_START array: 1 1 2 4 3 7 4 12 5 15 6 19 7 21 The BIN_LAST array: 1 3 2 6 3 11 4 14 5 18 6 20 7 30 The BIN_NEXT array: 1 2 2 3 3 0 4 5 5 6 6 0 7 8 8 9 9 10 10 11 11 0 12 13 13 14 14 0 15 16 16 17 17 18 18 0 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.7906237 2 9.4401348 3 9.5943007 4 10.831951 5 10.945928 6 11.116558 7 12.461426 8 12.525299 9 12.813836 10 13.412478 11 13.905557 12 14.700173 13 15.005876 14 15.519274 15 16.234245 16 16.676481 17 17.344899 18 17.717216 19 18.623438 20 19.147057 21 20.206690 22 20.252800 23 20.757674 24 20.804396 25 21.012787 26 21.191108 27 21.479622 28 21.593067 29 22.696820 30 22.985767 bins_test(): Normal end of execution. 7 October 2025 1:02:22.171 PM