10 September 2023 8:15:13.957 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 = 1191628716 Generate some random values C and put them in bins. C Bin Bin_Min Bin_Max 9.89527 1 -0.100000E+31 10.0000 16.8578 5 16.0000 18.0000 21.3505 7 20.0000 0.100000E+31 19.9576 6 18.0000 20.0000 8.66496 1 -0.100000E+31 10.0000 8.90821 1 -0.100000E+31 10.0000 17.2157 5 16.0000 18.0000 21.4925 7 20.0000 0.100000E+31 21.0575 7 20.0000 0.100000E+31 14.6644 4 14.0000 16.0000 10.7386 2 10.0000 12.0000 15.7507 4 14.0000 16.0000 14.4256 4 14.0000 16.0000 18.1587 6 18.0000 20.0000 15.8505 4 14.0000 16.0000 11.7340 2 10.0000 12.0000 19.8823 6 18.0000 20.0000 19.2548 6 18.0000 20.0000 17.0504 5 16.0000 18.0000 18.0322 6 18.0000 20.0000 18.3675 6 18.0000 20.0000 14.2096 4 14.0000 16.0000 18.2221 6 18.0000 20.0000 15.9808 4 14.0000 16.0000 11.8767 2 10.0000 12.0000 17.8769 5 16.0000 18.0000 18.3577 6 18.0000 20.0000 14.1835 4 14.0000 16.0000 14.9174 4 14.0000 16.0000 18.9395 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 = 1191628716 Generate some random values C and put them in bins. C Bin Bin_Min Bin_Max 9.89527 1 10.0000 12.0000 16.8578 4 16.0000 18.0000 21.3505 5 18.0000 20.0000 19.9576 5 18.0000 20.0000 8.66496 1 10.0000 12.0000 8.90821 1 10.0000 12.0000 17.2157 4 16.0000 18.0000 21.4925 5 18.0000 20.0000 21.0575 5 18.0000 20.0000 14.6644 3 14.0000 16.0000 10.7386 1 10.0000 12.0000 15.7507 3 14.0000 16.0000 14.4256 3 14.0000 16.0000 18.1587 5 18.0000 20.0000 15.8505 3 14.0000 16.0000 11.7340 1 10.0000 12.0000 19.8823 5 18.0000 20.0000 19.2548 5 18.0000 20.0000 17.0504 4 16.0000 18.0000 18.0322 5 18.0000 20.0000 18.3675 5 18.0000 20.0000 14.2096 3 14.0000 16.0000 18.2221 5 18.0000 20.0000 15.9808 3 14.0000 16.0000 11.8767 1 10.0000 12.0000 17.8769 4 16.0000 18.0000 18.3577 5 18.0000 20.0000 14.1835 3 14.0000 16.0000 14.9174 3 14.0000 16.0000 18.9395 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 5.52703 2 5.00000 7.00000 11.5820 4 8.00000 12.0000 20.8007 7 15.0000 0.100000E+31 16.3349 6 16.0000 20.0000 3.88661 1 -0.100000E+31 5.00000 -0.607418 1 -0.100000E+31 0.00000 15.2876 7 15.0000 0.100000E+31 18.6885 6 16.0000 20.0000 20.4099 7 15.0000 0.100000E+31 8.21867 4 8.00000 12.0000 6.65147 2 5.00000 7.00000 9.88444 4 8.00000 12.0000 11.5675 5 11.0000 13.0000 13.5767 5 12.0000 16.0000 13.4674 6 13.0000 15.0000 3.72543 2 0.00000 4.00000 18.8431 7 15.0000 0.100000E+31 15.2573 5 12.0000 16.0000 15.0672 7 15.0000 0.100000E+31 13.3826 5 12.0000 16.0000 16.8233 7 15.0000 0.100000E+31 7.52143 3 4.00000 8.00000 16.6295 7 15.0000 0.100000E+31 10.2373 4 8.00000 12.0000 8.16887 3 7.00000 9.00000 13.1445 5 12.0000 16.0000 16.8102 7 15.0000 0.100000E+31 7.48144 3 4.00000 8.00000 12.2232 5 11.0000 13.0000 14.7740 5 12.0000 16.0000 10.6889 4 9.00000 11.0000 6.46657 3 4.00000 8.00000 20.0078 7 15.0000 0.100000E+31 10.0754 4 8.00000 12.0000 22.9862 7 15.0000 0.100000E+31 7.90414 3 4.00000 8.00000 9.87826 4 9.00000 11.0000 1.29424 2 0.00000 4.00000 7.63866 3 7.00000 9.00000 0.344270 2 0.00000 4.00000 4.00192 1 -0.100000E+31 5.00000 20.2357 7 20.0000 0.100000E+31 12.6047 5 11.0000 13.0000 5.65894 3 4.00000 8.00000 16.6745 7 15.0000 0.100000E+31 6.49703 3 4.00000 8.00000 5.24152 2 5.00000 7.00000 13.1881 5 12.0000 16.0000 13.7122 6 13.0000 15.0000 20.1666 7 20.0000 0.100000E+31 22.6260 7 15.0000 0.100000E+31 14.6737 5 12.0000 16.0000 5.04692 2 5.00000 7.00000 0.998326 2 0.00000 4.00000 22.8899 7 15.0000 0.100000E+31 8.02469 4 8.00000 12.0000 11.6109 5 11.0000 13.0000 1.56179 2 0.00000 4.00000 17.7723 7 15.0000 0.100000E+31 18.0316 6 16.0000 20.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 9.89527 6.46001 2 16.8578 6.31300 3 21.3505 10.6535 4 19.9576 7.72517 5 8.66496 11.9938 6 8.90821 6.87553 7 17.2157 6.09522 8 21.4925 4.28905 9 21.0575 5.08740 10 14.6644 3.91732 11 10.7386 3.45087 12 15.7507 11.7009 13 14.4256 7.32213 14 18.1587 5.99697 15 15.8505 9.15353 16 11.7340 6.32492 17 19.8823 4.00868 18 19.2548 8.94317 19 17.0504 7.82047 20 18.0322 11.6739 21 18.3675 11.8317 22 14.2096 9.52448 23 18.2221 3.92111 24 15.9808 4.17326 25 11.8767 11.9504 26 17.8769 6.92270 27 18.3577 6.87490 28 14.1835 4.39374 29 14.9174 9.64752 30 18.9395 10.8384 The BIN_START array: Col 1 2 3 4 Row 1 -1 1 -1 5 2 10 13 22 25 3 17 2 4 12 4 8 9 -1 3 The BIN_LAST array: Col 1 2 3 4 Row 1 -1 1 -1 5 2 10 13 22 25 3 17 2 4 12 4 8 9 -1 3 The BIN_NEXT array: 1 6 2 7 3 0 4 15 5 0 6 0 7 14 8 0 9 0 10 11 11 28 12 20 13 16 14 26 15 18 16 0 17 23 18 19 19 0 20 21 21 30 22 29 23 24 24 0 25 0 26 27 27 0 28 0 29 0 30 0 Contents of bin number 1 1 Contents of bin number 1 2 1 1 9.89527 6.46001 2 6 8.90821 6.87553 Contents of bin number 1 3 Contents of bin number 1 4 1 5 8.66496 11.9938 Contents of bin number 2 1 1 10 14.6644 3.91732 2 11 10.7386 3.45087 3 28 14.1835 4.39374 Contents of bin number 2 2 1 13 14.4256 7.32213 2 16 11.7340 6.32492 Contents of bin number 2 3 1 22 14.2096 9.52448 2 29 14.9174 9.64752 Contents of bin number 2 4 1 25 11.8767 11.9504 Contents of bin number 3 1 1 17 19.8823 4.00868 2 23 18.2221 3.92111 3 24 15.9808 4.17326 Contents of bin number 3 2 1 2 16.8578 6.31300 2 7 17.2157 6.09522 3 14 18.1587 5.99697 4 26 17.8769 6.92270 5 27 18.3577 6.87490 Contents of bin number 3 3 1 4 19.9576 7.72517 2 15 15.8505 9.15353 3 18 19.2548 8.94317 4 19 17.0504 7.82047 Contents of bin number 3 4 1 12 15.7507 11.7009 2 20 18.0322 11.6739 3 21 18.3675 11.8317 4 30 18.9395 10.8384 Contents of bin number 4 1 1 8 21.4925 4.28905 Contents of bin number 4 2 1 9 21.0575 5.08740 Contents of bin number 4 3 Contents of bin number 4 4 1 3 21.3505 10.6535 Call R82VEC_BINNED_REORDER to reorder the array. The data vector, sorted by bins: 1 9.89527 6.46001 2 8.90821 6.87553 3 8.66496 11.9938 4 14.6644 3.91732 5 10.7386 3.45087 6 14.1835 4.39374 7 14.4256 7.32213 8 11.7340 6.32492 9 14.2096 9.52448 10 14.9174 9.64752 11 11.8767 11.9504 12 19.8823 4.00868 13 18.2221 3.92111 14 15.9808 4.17326 15 16.8578 6.31300 16 17.2157 6.09522 17 18.1587 5.99697 18 17.8769 6.92270 19 18.3577 6.87490 20 19.9576 7.72517 21 15.8505 9.15353 22 19.2548 8.94317 23 17.0504 7.82047 24 15.7507 11.7009 25 18.0322 11.6739 26 18.3675 11.8317 27 18.9395 10.8384 28 21.4925 4.28905 29 21.0575 5.08740 30 21.3505 10.6535 The BIN_START array: Col 1 2 3 4 Row 1 -1 1 -1 3 2 4 7 9 11 3 12 15 20 24 4 28 29 -1 30 The BIN_LAST array: Col 1 2 3 4 Row 1 -1 2 -1 3 2 6 8 10 11 3 14 19 23 27 4 28 29 -1 30 The BIN_NEXT array: 1 2 2 0 3 0 4 5 5 6 6 0 7 8 8 0 9 10 10 0 11 0 12 13 13 14 14 0 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 0 28 0 29 0 30 0 The data vector, with sorted bins: 1 8.90821 6.87553 2 9.89527 6.46001 3 8.66496 11.9938 4 10.7386 3.45087 5 14.1835 4.39374 6 14.6644 3.91732 7 11.7340 6.32492 8 14.4256 7.32213 9 14.2096 9.52448 10 14.9174 9.64752 11 11.8767 11.9504 12 15.9808 4.17326 13 18.2221 3.92111 14 19.8823 4.00868 15 16.8578 6.31300 16 17.2157 6.09522 17 17.8769 6.92270 18 18.1587 5.99697 19 18.3577 6.87490 20 15.8505 9.15353 21 17.0504 7.82047 22 19.2548 8.94317 23 19.9576 7.72517 24 15.7507 11.7009 25 18.0322 11.6739 26 18.3675 11.8317 27 18.9395 10.8384 28 21.4925 4.28905 29 21.0575 5.08740 30 21.3505 10.6535 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 -0.35742983 2 5.6767758 3 9.5704387 4 8.3632163 5 -1.4237052 6 -1.2128883 7 5.9869515 8 9.6934799 9 9.3164619 10 3.7757704 11 0.37345852 12 4.7172945 13 3.5688585 14 6.8042366 15 4.8037863 16 1.2361098 17 8.2980160 18 7.7541408 19 5.8436779 20 6.6945312 21 6.9851480 22 3.3816778 23 6.8591609 24 4.9167228 25 1.3597644 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 3 2.0000 4.0000 3 4.0000 6.0000 6 6.0000 8.0000 5 8.0000 10.0000 5 10.0000 0 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 9.8952733 2 16.857818 3 21.350506 4 19.957557 5 8.6649556 6 8.9082058 7 17.215713 8 21.492477 9 21.057456 10 14.664350 11 10.738606 12 15.750724 13 14.425606 14 18.158734 15 15.850523 16 11.733973 17 19.882326 18 19.254778 19 17.050398 20 18.032151 21 18.367478 22 14.209628 23 18.222109 24 15.980834 25 11.876651 26 17.876858 27 18.357660 28 14.183550 29 14.917412 30 18.939535 The BIN_START array: 1 1 2 11 3 -1 4 10 5 2 6 4 7 3 The BIN_LAST array: 1 6 2 25 3 -1 4 29 5 26 6 30 7 9 The BIN_NEXT array: 1 5 2 7 3 8 4 14 5 6 6 0 7 19 8 9 9 0 10 12 11 16 12 13 13 15 14 17 15 22 16 25 17 18 18 20 19 26 20 21 21 23 22 24 23 27 24 28 25 0 26 0 27 30 28 29 29 0 30 0 Contents of bin number 1 1 1 9.89527 2 5 8.66496 3 6 8.90821 Contents of bin number 2 1 11 10.7386 2 16 11.7340 3 25 11.8767 Contents of bin number 3 Contents of bin number 4 1 10 14.6644 2 12 15.7507 3 13 14.4256 4 15 15.8505 5 22 14.2096 6 24 15.9808 7 28 14.1835 8 29 14.9174 Contents of bin number 5 1 2 16.8578 2 7 17.2157 3 19 17.0504 4 26 17.8769 Contents of bin number 6 1 4 19.9576 2 14 18.1587 3 17 19.8823 4 18 19.2548 5 20 18.0322 6 21 18.3675 7 23 18.2221 8 27 18.3577 9 30 18.9395 Contents of bin number 7 1 3 21.3505 2 8 21.4925 3 9 21.0575 Call R8VEC_BINNED_REORDER to reorder the array. The data vector A: 1 9.8952733 2 8.6649556 3 8.9082058 4 10.738606 5 11.733973 6 11.876651 7 14.664350 8 15.750724 9 14.425606 10 15.850523 11 14.209628 12 15.980834 13 14.183550 14 14.917412 15 16.857818 16 17.215713 17 17.050398 18 17.876858 19 19.957557 20 18.158734 21 19.882326 22 19.254778 23 18.032151 24 18.367478 25 18.222109 26 18.357660 27 18.939535 28 21.350506 29 21.492477 30 21.057456 The BIN_START array: 1 1 2 4 3 -1 4 7 5 15 6 19 7 28 The BIN_LAST array: 1 3 2 6 3 -1 4 14 5 18 6 27 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 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 27 27 0 28 29 29 30 30 0 The sorted data vector A: 1 8.6649556 2 8.9082058 3 9.8952733 4 10.738606 5 11.733973 6 11.876651 7 14.183550 8 14.209628 9 14.425606 10 14.664350 11 14.917412 12 15.750724 13 15.850523 14 15.980834 15 16.857818 16 17.050398 17 17.215713 18 17.876858 19 18.032151 20 18.158734 21 18.222109 22 18.357660 23 18.367478 24 18.939535 25 19.254778 26 19.882326 27 19.957557 28 21.057456 29 21.350506 30 21.492477 bins_test(): Normal end of execution. 10 September 2023 8:15:13.958 PM