23 June 2024 02:00:44 PM r8lib_test(): C++ version Test r8lib(). I4INT_TO_R8INT_TEST For data in an interval, I4INT_TO_R8INT converts an integer to a real; Integer interval: [1, 11] Real interval: [100, 200] R I(R) R(I(R)) 113.394 2 110 209.321 12 210 192.836 10 190 158.02 7 160 138.99 5 140 93.5954 0 90 118.485 3 120 99.2944 1 100 90.6978 0 90 167.416 8 170 PERM0_CHECK_TEST PERM0_CHECK checks a permutation of 0, ..., N-1. Permutation 1: 5 2 3 4 1 PERM0_CHECK - Fatal error! Permutation is missing value 0 Check = 0 Permutation 2: 4 1 3 0 2 Check = 1 Permutation 3: 0 2 1 3 2 PERM0_CHECK - Fatal error! Permutation is missing value 4 Check = 0 PERM0_UNIFORM_TEST PERM0_UNIFORM randomly selects a permutation of 0,...,N-1. 2 9 8 6 3 5 7 4 0 1 0 5 1 8 3 2 9 4 7 6 8 0 2 3 5 9 6 1 4 7 6 0 8 1 9 7 3 4 2 5 5 4 6 0 3 8 2 7 9 1 perm1_check_test(): perm1_check() checks a permutation of 1, ..., N. Permutation 1: 5 2 3 4 1 Check = 1 Permutation 2: 4 1 3 0 2 PERM1_CHECK - Fatal error! Permutation is missing value 5 Check = 0 Permutation 3: 0 2 1 3 2 PERM1_CHECK - Fatal error! Permutation is missing value 4 Check = 0 PERM1_UNIFORM_TEST PERM1_UNIFORM randomly selects a permutation of 1,...,N. 3 10 9 7 4 6 8 5 1 2 1 6 2 9 4 3 10 5 8 7 9 1 3 4 6 10 7 2 5 8 7 1 9 2 10 8 4 5 3 6 6 5 7 1 4 9 3 8 10 2 R8_ABS_TEST R8_ABS returns the absolute value of an R8. X R8_ABS(X) -1.25265 1.25265 4.65054 4.65054 3.63607 3.63607 1.49356 1.49356 0.322457 0.322457 -2.47105 2.47105 -0.939378 0.939378 -2.12035 2.12035 -2.64937 2.64937 2.07173 2.07173 R8_ACOS_TEST R8_ACOS computes the arc-cosine of an angle. C R8_ACOS(C) ACOS(C) -1.16667 3.14159 -1 3.14159 3.14159 -0.833333 2.55591 2.55591 -0.666667 2.30052 2.30052 -0.5 2.0944 2.0944 -0.333333 1.91063 1.91063 -0.166667 1.73824 1.73824 0 1.5708 1.5708 0.166667 1.40335 1.40335 0.333333 1.23096 1.23096 0.5 1.0472 1.0472 0.666667 0.841069 0.841069 0.833333 0.585686 0.585686 1 0 0 1.16667 0 R8_ACOSH_TEST R8_ACOSH computes the arc-hyperbolic-cosine of an angle. X A=R8_ACOSH(X) COSH(A) 1 0 1 1.5 0.962424 1.5 2 1.31696 2 2.5 1.5668 2.5 3 1.76275 3 3.5 1.92485 3.5 4 2.06344 4 4.5 2.18464 4.5 5 2.29243 5 R8_ASINH_TEST R8_ASINH computes the inverse hyperbolic sine of a given value. X R8_ASINH(X) SINH(R8_ASINH(X)) 1 0.881374 1 1.2 1.01597 1.2 1.4 1.13798 1.4 1.6 1.24898 1.6 1.8 1.35044 1.8 2 1.44364 2 2.2 1.52966 2.2 2.4 1.60944 2.4 2.6 1.68374 2.6 2.8 1.75323 2.8 3 1.81845 3 R8_ATAN_TEST R8_ATAN computes the arc-tangent given Y and X; ATAN2 is the system version of this routine. X Y ATAN2(Y,X) R8_ATAN(Y,X) 1 0 0 0 1 1 0.785398 0.785398 0 1 1.5708 1.5708 -1 1 2.35619 2.35619 -1 0 3.14159 3.14159 -1 -1 -2.35619 3.92699 0 -1 -1.5708 4.71239 1 -1 -0.785398 5.49779 R8_ATANH_TEST R8_ATANH computes the inverse hyperbolic tangent of a given value. X R8_ATANH(X) TANH(R8_ATANH(X)) -0.2 -0.202733 -0.2 -0.1 -0.100335 -0.1 0 0 0 0.1 0.100335 0.1 0.2 0.202733 0.2 0.3 0.30952 0.3 0.4 0.423649 0.4 0.5 0.549306 0.5 0.6 0.693147 0.6 0.7 0.867301 0.7 0.8 1.09861 0.8 0.9 1.47222 0.9 R8_BIG_TEST R8_BIG returns a 'big' R8 value; R8_BIG = 1e+30 R8_CAS_TEST R8_CAS evaluates the casine of a number. X R8_CAS ( X ) 0 1 0.261799 1.22474 0.523599 1.36603 0.785398 1.41421 1.0472 1.36603 1.309 1.22474 1.5708 1 1.8326 0.707107 2.0944 0.366025 2.35619 1.11022e-16 2.61799 -0.366025 2.87979 -0.707107 3.14159 -1 R8_CEILING_TEST R8_CEILING rounds a value up. X R8_CEILING(X) -1.2 -1 -1 -1 -0.8 0 -0.6 0 -0.4 0 -0.2 0 0 0 0.2 1 0.4 1 0.6 1 0.8 1 1 1 1.2 2 R8_CHOOSE_TEST R8_CHOOSE evaluates C(N,K). N K CNK 0 0 1 1 0 1 1 1 1 2 0 1 2 1 2 2 2 1 3 0 1 3 1 3 3 2 3 3 3 1 4 0 1 4 1 4 4 2 6 4 3 4 4 4 1 5 0 1 5 1 5 5 2 10 5 3 10 5 4 5 5 5 1 R8_COSD_TEST R8_COSD computes the cosine of an angle given in degrees. ANGLE R8_COSD(ANGLE) 0 1 15 0.965926 30 0.866025 45 0.707107 60 0.5 75 0.258819 90 6.12323e-17 105 -0.258819 120 -0.5 135 -0.707107 150 -0.866025 165 -0.965926 180 -1 195 -0.965926 210 -0.866025 225 -0.707107 240 -0.5 255 -0.258819 270 -1.83697e-16 285 0.258819 300 0.5 315 0.707107 330 0.866025 345 0.965926 360 1 R8_COTD_TEST R8_COTD computes the cotangent of an angle given in degrees. ANGLE R8_COTD(ANGLE) 0 Undefined 15 3.73205 30 1.73205 45 1 60 0.57735 75 0.267949 90 6.12323e-17 105 -0.267949 120 -0.57735 135 -1 150 -1.73205 165 -3.73205 180 Undefined 195 3.73205 210 1.73205 225 1 240 0.57735 255 0.267949 270 1.83697e-16 285 -0.267949 300 -0.57735 315 -1 330 -1.73205 345 -3.73205 360 Undefined R8_CSCD_TEST R8_CSCD computes the cosecant of an angle given in degrees. ANGLE R8_CSCD(ANGLE) 0 Undefined 15 3.8637 30 2 45 1.41421 60 1.1547 75 1.03528 90 1 105 1.03528 120 1.1547 135 1.41421 150 2 165 3.8637 180 Undefined 195 -3.8637 210 -2 225 -1.41421 240 -1.1547 255 -1.03528 270 -1 285 -1.03528 300 -1.1547 315 -1.41421 330 -2 345 -3.8637 360 Undefined r8_cube_root_test() r8_cube_root() computes the cube root of an R8. X Y Y^3 -10 -2.15443 -10 -9.98029 -2.15302 -9.98029 -9.16738 -2.0929 -9.16738 -6.46715 -1.86311 -6.46715 -2.70796 -1.39384 -2.70796 -8.17339 -2.01435 -8.17339 -8.15405 -2.01276 -8.15405 -0.255656 -0.634675 -0.255656 0.535006 0.811807 0.535006 -0.911332 -0.969525 -0.911332 R8_DIFF_TEST R8_DIFF computes a difference X-Y to a given number of binary places. For this test, we use 3 binary places. X Y X-Y R8_DIFF(X,Y) 1 0.0625 0.9375 0.875 1 0.125 0.875 0.875 1 0.25 0.75 0.75 1 0.5 0.5 0.5 1 0.874 0.126 0.125 1 0.876 0.124 0.125 1 0.9 0.1 0.125 1 0.95 0.05 0 1 0.99 0.01 0 1 1 0 0 1 1.01 -0.01 0 1 1.05 -0.05 0 1 1.1 -0.1 -0.1375 1 3 -2 -1.875 1 10 -9 -8.75 R8_DIGIT_TEST R8_DIGIT extracts decimal digits. Here, we get digits of 3.14159 -2 -1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 0 0 0 3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 1 1 5 9 R8_E_TEST R8_E returns the value of E. Compare E to (1+1/n)^n R8_E = 2.71828 N Estimate Error 1 2 0.718282 2 2.25 0.468282 4 2.44141 0.276876 8 2.56578 0.152497 16 2.63793 0.0803533 32 2.67699 0.0412917 64 2.69734 0.0209369 128 2.70774 0.0105428 256 2.71299 0.0052902 512 2.71563 0.00264983 1024 2.71696 0.0013261 2048 2.71762 0.000663346 4096 2.71795 0.000331747 8192 2.71812 0.000165892 16384 2.7182 8.29507e-05 32768 2.71824 4.14765e-05 65536 2.71826 2.07386e-05 131072 2.71827 1.03693e-05 262144 2.71828 5.18469e-06 524288 2.71828 2.59235e-06 1048576 2.71828 1.29618e-06 R8_EPSILON_TEST R8_EPSILON produces the R8 roundoff unit. R = R8_EPSILON() = 2.220446049250313e-16 ( 1 + R ) - 1 = 2.220446049250313e-16 ( 1 + (R/2) ) - 1 = 0 R8_EPSILON_COMPUTE_TEST R8_EPSILON_COMPUTE computes the R8 roundoff unit. R = R8_EPSILON_COMPUTE() = 2.220446049250313e-16 ( 1 + R ) - 1 = 2.220446049250313e-16 ( 1 + (R/2) ) - 1 = 0 r8_exp_test(): r8_exp() evaluates the exponential function of R8. It truncates very small or large arguments. X R8_EXP(X) -100 0 -75 0 -50 1.92875e-22 -25 1.38879e-11 -1 0.367879 0 1 1 2.71828 25 7.20049e+10 50 5.18471e+21 75 1e+30 100 1e+30 R8_FACTORIAL_TEST R8_FACTORIAL evaluates the factorial function. N Exact Computed 0 1 1 1 1 1 2 2 2 3 6 6 4 24 24 5 120 120 6 720 720 7 5040 5040 8 40320 40320 9 362880 362880 10 3628800 3628800 11 39916800 39916800 12 479001600 479001600 13 6227020800 6227020800 14 87178291200 87178291200 15 1307674368000 1307674368000 16 20922789888000 20922789888000 17 355687428096000 355687428096000 18 6402373705728000 6402373705728000 19 1.21645100408832e+17 1.21645100408832e+17 20 2.43290200817664e+18 2.43290200817664e+18 25 1.551121004333099e+25 1.551121004333099e+25 50 3.041409320171338e+64 3.041409320171338e+64 100 9.332621544394415e+157 9.33262154439441e+157 150 5.713383956445855e+262 5.71338395644585e+262 R8_FACTORIAL_STIRLING_TEST R8_FACTORIAL_STIRLING computes Stirling's approximate factorial function; N Factorial Factorial Stirling 1 1.00227 1 2 2.00065 2 3 6.0006 6 4 24.001 24 5 120.003 120 6 720.009 720 7 5040.04 5040 8 40320.2 40320 9 362881 362880 10 3.62881e+06 3.6288e+06 11 3.99169e+07 3.99168e+07 12 4.79002e+08 4.79002e+08 13 6.22703e+09 6.22702e+09 14 8.71784e+10 8.71783e+10 15 1.30768e+12 1.30767e+12 16 2.09228e+13 2.09228e+13 17 3.55688e+14 3.55687e+14 18 6.40238e+15 6.40237e+15 19 1.21645e+17 1.21645e+17 20 2.4329e+18 2.4329e+18 R8_FACTORIAL2_TEST R8_FACTORIAL2 evaluates the double factorial function. N Exact Computed 0 1 1 1 1 1 2 2 2 3 3 3 4 8 8 5 15 15 6 48 48 7 105 105 8 384 384 9 945 945 10 3840 3840 11 10395 10395 12 46080 46080 13 135135 135135 14 645120 645120 15 2027025 2027025 R8_FALL_TEST R8_FALL evaluates the falling factorial Fall(X,N). X N Exact Computed 5 4 120 120 5.25 4 163.16015625 163.16015625 5.5 4 216.5625 216.5625 5.75 4 281.66015625 281.66015625 6 4 360 360 7.5 0 1 1 7.5 1 7.5 7.5 7.5 2 48.75 48.75 7.5 3 268.125 268.125 7.5 4 1206.5625 1206.5625 7.5 5 4222.96875 4222.96875 7.5 6 10557.421875 10557.421875 7.5 7 15836.1328125 15836.1328125 7.5 8 7918.06640625 7918.06640625 7.5 9 -3959.033203125 -3959.033203125 R8_FRACTIONAL_TEST R8_FRACTIONAL returns the fractional part of an R8. X R8_FRACTIONAL ( X ) -1.25265 0.252654 4.65054 0.650541 3.63607 0.636074 1.49356 0.493564 0.322457 0.322457 -2.47105 0.47105 -0.939378 0.939378 -2.12035 0.120346 -2.64937 0.649368 2.07173 0.0717257 R8_HUGE_TEST R8_HUGE returns a 'huge' R8 value; R8_HUGE = 1.79769e+308 R8_IS_INF_TEST R8_IS_INF reports whether an R8 is infinite. R8_IS_INF(1.0) = 0 R8_IS_INF(1.0/0.0) = 0 R8_IS_INF(0.0/0.0) = 0 R8_IS_INF(0^0) = 0 R8_IS_INF(acos(-2)) = 0 R8_IS_INF(exp(1000)) = 0 R8_IS_INF(log(0)) = 0 R8_IS_INF(sqrt(-1)) = 0 R8_IS_NAN_TEST R8_IS_NAN reports whether an R8 is a NaN. R8_IS_NAN(1.0) = 0 R8_IS_NAN(1.0/0.0) = 0 R8_IS_NAN(0.0/0.0) = 1 R8_IS_NAN(0^0) = 0 R8_IS_NAN(acos(-2)) = 1 R8_IS_NAN(exp(1000)) = 0 R8_IS_NAN(log(0)) = 0 R8_IS_NAN(sqrt(-1)) = 1 R8_LOG_2_TEST R8_LOG_2: computes the logarithm base 2. X R8_LOG_2 0 -1e+30 1 0 2 1 3 1.58496 9 3.16993 10 3.32193 11 3.45943 99 6.62936 101 6.65821 -1 0 -2 1 -3 1.58496 -9 3.16993 0.5 -1 0.33 -1.59946 0.25 -2 0.2 -2.32193 0.01 -6.64386 R8_LOG_B_TEST R8_LOG_B computes the logarithm base B. X B R8_LOG_B 16 2 4 16 3 2.52372 16 4 2 16 5 1.72271 16 6 1.54741 16 7 1.42483 16 8 1.33333 16 16 1 16 32 0.8 16 256 0.5 R8_MANT_TEST R8_MANT decomposes a value. Number to be decomposed: X = -314.159 X = -1 * 1.22718 * 2 ^ 8 R8_MAX_TEST R8_MAX returns the maximum of two R8's. A B C=R8_MAX(A,B) -2.81582 4.56318 4.56318 3.29509 0.616954 3.29509 -0.846929 -4.33881 -0.846929 -2.42422 -3.90043 -2.42422 -4.56171 1.33966 1.33966 -4.38273 -0.50461 -0.50461 -0.986937 2.54673 2.54673 2.97287 -4.98162 2.97287 3.97504 -1.49248 3.97504 -4.05455 -4.86383 -4.05455 R8_MIN_TEST R8_MIN returns the minimum of two R8's. A B C=R8_MIN(A,B) -2.81582 4.56318 -2.81582 3.29509 0.616954 0.616954 -0.846929 -4.33881 -4.33881 -2.42422 -3.90043 -3.90043 -4.56171 1.33966 -4.56171 -4.38273 -0.50461 -4.38273 -0.986937 2.54673 -0.986937 2.97287 -4.98162 -4.98162 3.97504 -1.49248 -1.49248 -4.05455 -4.86383 -4.86383 R8_MOD_TEST R8_MOD returns the remainder after division. R8_MOD ( X, Y ) has the same sign as X. X Y FMOD(X,Y) R8_MOD(X,Y) -5.63163 9.12635 -5.63163 -5.63163 6.59018 1.23391 0.42064 0.42064 -1.69386 -8.67763 -1.69386 -1.69386 -4.84844 -7.80086 -4.84844 -4.84844 -9.12342 2.67931 -1.08548 -1.08548 -8.76546 -1.00922 -0.691689 -0.691689 -1.97387 5.09347 -1.97387 -1.97387 5.94574 -9.96323 5.94574 5.94574 7.95008 -2.98495 1.98017 1.98017 -8.1091 -9.72766 -8.1091 -8.1091 R8_MODP_TEST R8_MODP returns the remainder after division. R8_MODP ( X, Y ) is positive. X Y FMOD(X,Y) R8_MODP(X,Y) -5.63163 9.12635 -5.63163 3.49472 6.59018 1.23391 0.42064 0.42064 -1.69386 -8.67763 -1.69386 6.98377 -4.84844 -7.80086 -4.84844 2.95242 -9.12342 2.67931 -1.08548 1.59384 -8.76546 -1.00922 -0.691689 0.317532 -1.97387 5.09347 -1.97387 3.1196 5.94574 -9.96323 5.94574 5.94574 7.95008 -2.98495 1.98017 1.98017 -8.1091 -9.72766 -8.1091 1.61856 R8_MOP_TEST R8_MOP evaluates (-1.0)^I4 as an R8. I4 R8_MOP(I4) -57 -1 92 1 66 1 12 1 -17 -1 -87 -1 -49 -1 -78 1 -92 1 27 -1 R8_NINT_TEST R8_NINT produces the nearest integer. X R8_NINT(X) -5.63163 -6 9.12635 9 6.59018 7 1.23391 1 -1.69386 -2 -8.67763 -9 -4.84844 -5 -7.80086 -8 -9.12342 -9 2.67931 3 R8_NORMAL_01_TEST R8_NORMAL_01 generates normally distributed random values. Using initial random number seed = 123456789 1.67904 -0.56606 1.21293 1.26938 -1.66609 -2.24246 0.0396749 0.673068 -0.275127 2.164 0.297785 2.04454 1.39882 -1.24299 -0.0670837 -0.794396 -0.523768 -0.350567 0.1317 0.53738 R8_NTH_ROOT_TEST R8_NTH_ROOT computes the nth root of an R8. X -3 -2 -1 0 1 2 3 -3 -0.693361 -0.57735 -0.333333 1 -3 nan -1.44225 -2 -0.793701 -0.707107 -0.5 1 -2 nan -1.25992 -1 -1 -1 -1 1 -1 nan -1 0 nan nan nan 1 0 0 0 1 1 1 1 1 1 1 1 2 0.793701 0.707107 0.5 1 2 1.41421 1.25992 3 0.693361 0.57735 0.333333 1 3 1.73205 1.44225 R8_PI_TEST R8_PI returns the value of PI. R8_PI = 3.14159 4*atan(1) = 3.14159 R8_POWER_TEST R8_POWER computes R^P R P R^P 2 -5 0.03125 2 -4 0.0625 2 -3 0.125 2 -2 0.25 2 -1 0.5 2 0 1 2 1 2 2 2 4 2 3 8 2 4 16 2 5 32 R8_POWER_FAST_TEST R8_POWER_FAST computes R^P, economizing on multiplications. R P R^P Mults 2 -10 0.000976562 7 2 -9 0.00195312 7 2 -8 0.00390625 6 2 -7 0.0078125 7 2 -6 0.015625 6 2 -5 0.03125 6 2 -4 0.0625 5 2 -3 0.125 5 2 -2 0.25 4 2 -1 0.5 1 2 0 1 0 2 1 2 0 2 2 4 3 2 3 8 4 2 4 16 4 2 5 32 5 2 6 64 5 2 7 128 6 2 8 256 5 2 9 512 6 2 10 1024 6 2 11 2048 7 2 12 4096 6 2 13 8192 7 2 14 16384 7 2 15 32768 8 2 16 65536 6 2 17 131072 7 2 18 262144 7 2 19 524288 8 2 20 1.04858e+06 7 2 21 2.09715e+06 8 2 22 4.1943e+06 8 2 23 8.38861e+06 9 2 24 1.67772e+07 7 2 25 3.35544e+07 8 2 26 6.71089e+07 8 2 27 1.34218e+08 9 2 28 2.68435e+08 8 2 29 5.36871e+08 9 2 30 1.07374e+09 9 2 31 2.14748e+09 10 2 32 4.29497e+09 7 2 33 8.58993e+09 8 2 34 1.71799e+10 8 2 35 3.43597e+10 9 2 36 6.87195e+10 8 2 37 1.37439e+11 9 2 38 2.74878e+11 9 2 39 5.49756e+11 10 2 40 1.09951e+12 8 R8_RELU_TEST R8_RELU evaluates the ReLU function of an R8. This is max(x,0). X R8_RELU(X) -500 0 -50 0 -5 0 -4 0 -3 0 -2 0 -1 0 -0.5 0 -0.05 0 -0.005 0 -0.0005 0 0 0 0.0005 0.0005 0.005 0.005 0.05 0.05 0.5 0.5 1 1 2 2 3 3 4 4 5 5 50 50 500 500 5000 5000 50000 50000 R8_RISE_TEST R8_RISE evaluates the rising factorial Fall(X,N). X N Exact Computed 5 4 1680 1680 5.25 4 1962.59765625 1962.59765625 5.5 4 2279.0625 2279.0625 5.75 4 2631.97265625 2631.97265625 6 4 3024 3024 7.5 0 1 1 7.5 1 7.5 7.5 7.5 2 63.75 63.75 7.5 3 605.625 605.625 7.5 4 6359.0625 6359.0625 7.5 5 73129.21875 73129.21875 7.5 6 914115.234375 914115.234375 7.5 7 12340555.6640625 12340555.6640625 7.5 8 178938057.1289063 178938057.1289062 7.5 9 2773539885.498047 2773539885.498047 R8_ROUND2_TEST R8_ROUND2 rounds a number to a specified number of base 2 digits. Test effect on PI: X = 3.14159 NPLACE XROUND 0 0 1 2 2 3 3 3 4 3 5 3.125 6 3.125 7 3.125 8 3.140625 9 3.140625 10 3.140625 11 3.140625 12 3.140625 13 3.14111328125 14 3.141357421875 15 3.1414794921875 16 3.14154052734375 17 3.141571044921875 18 3.141586303710938 19 3.141586303710938 20 3.141590118408203 R8_ROUNDB_TEST R8_ROUNDB rounds a number to a specified number of base IBASE digits. Here, we will use IBASE = 3 Test effect on PI: X = 3.141592653589793 NPLACE XROUND 0 0 1 3 2 3 3 3 4 3.111111111111111 5 3.111111111111111 6 3.135802469135802 7 3.139917695473252 8 3.141289437585734 9 3.141289437585734 10 3.14144185337601 11 3.14154346390286 12 3.141577334078477 13 3.141588624137016 14 3.141592387489863 15 3.141592387489863 16 3.141592596565021 17 3.141592596565021 18 3.141592643026167 19 3.141592650769691 20 3.141592653350866 Try with a negative base: Input quantity is X = 121 to be rounded in base -3 Output value to 1 places is 81 Output value to 2 places is 108 Output value to 3 places is 117 Output value to 4 places is 120 Output value to 5 places is 121 R8_ROUNDX_TEST R8_ROUNDX rounds a number to a specified number of decimal digits. Test effect on PI: X = 3.141592653589793 NPLACE XROUND 0 0 1 3 2 3.1 3 3.14 4 3.141 5 3.1415 6 3.14159 7 3.141592 8 3.1415926 9 3.14159265 10 3.141592653 Test effect on random values: NPLACE X XROUND 0 0.2184182969823758 0 2 0.2184182969823758 0.21 4 0.2184182969823758 0.2184 6 0.2184182969823758 0.218418 8 0.2184182969823758 0.21841829 10 0.2184182969823758 0.2184182969 0 0.9563175765089297 0 2 0.9563175765089297 0.9500000000000001 4 0.9563175765089297 0.9563 6 0.9563175765089297 0.956317 8 0.9563175765089297 0.9563175700000001 10 0.9563175765089297 0.9563175765 0 0.8295092339327006 0 2 0.8295092339327006 0.8200000000000001 4 0.8295092339327006 0.8295 6 0.8295092339327006 0.8295089999999999 8 0.8295092339327006 0.82950923 10 0.8295092339327006 0.8295092339 0 0.5616954427668942 0 2 0.5616954427668942 0.5600000000000001 4 0.5616954427668942 0.5616 6 0.5616954427668942 0.5616949999999999 8 0.5616954427668942 0.56169544 10 0.5616954427668942 0.5616954427 0 0.4153070814759612 0 2 0.4153070814759612 0.41 4 0.4153070814759612 0.4153 6 0.4153070814759612 0.415307 8 0.4153070814759612 0.41530708 10 0.4153070814759612 0.4153070814 R8_SECD_TEST R8_SECD computes the secant of an angle given in degrees. ANGLE R8_SECD(ANGLE) 0 1 15 1.03528 30 1.1547 45 1.41421 60 2 75 3.8637 90 Undefined 105 -3.8637 120 -2 135 -1.41421 150 -1.1547 165 -1.03528 180 -1 195 -1.03528 210 -1.1547 225 -1.41421 240 -2 255 -3.8637 270 Undefined 285 3.8637 300 2 315 1.41421 330 1.1547 345 1.03528 360 1 r8_sigmoid_test r8_sigmoid evaluates the sigmoid function of R8. X R8_SIGMOID(L,B,M,X) -4 0.0179862 -2 0.119203 -1 0.268941 -0.5 0.377541 -0.25 0.437823 0 0.5 0.25 0.562177 0.5 0.622459 1 0.731059 2 0.880797 4 0.982014 R8_SIGN_TEST R8_SIGN returns the sign of an R8. R8 R8_SIGN(R8) -1.25 -1 -0.25 -1 0 1 0.5 1 9 1 r8_sign3_test(): r8_sign3() returns the three-way sign of an R8. R8 R8_SIGN3(R8) -1.25 -1 -0.25 -1 0 0 0.5 1 9 1 R8_SINCOS_SUM_TEST R8_SINCOS_SUM simplifies a linear sine and cosine sum -2.81582 * sin ( 3.29509 * x ) + 4.56318 * cos ( 3.29509 * x ) = 5.36203 * sin ( 3.29509 * x + 2.12368 ) = 5.36203 * cos ( 3.29509 * x + 0.552879 ) I X form 1 form 2 form 3 0 0 4.56318 4.56318 4.56318 1 0.314159 -0.0925808 -0.0925808 -0.0925808 2 0.628319 -4.65768 -4.65768 -4.65768 3 0.942478 -4.66168 -4.66168 -4.66168 4 1.25664 -0.100663 -0.100663 -0.100663 5 1.5708 4.55893 4.55893 4.55893 6 1.88496 4.75412 4.75412 4.75412 7 2.19911 0.293777 0.293777 0.293777 8 2.51327 -4.45425 -4.45425 -4.45425 9 2.82743 -4.84039 -4.84039 -4.84039 10 3.14159 -0.486508 -0.486508 -0.486508 R8_SIND_TEST R8_SIND computes the sine of an angle given in degrees. ANGLE R8_SIND(ANGLE) 0 0 15 0.258819 30 0.5 45 0.707107 60 0.866025 75 0.965926 90 1 105 0.965926 120 0.866025 135 0.707107 150 0.5 165 0.258819 180 1.22465e-16 195 -0.258819 210 -0.5 225 -0.707107 240 -0.866025 255 -0.965926 270 -1 285 -0.965926 300 -0.866025 315 -0.707107 330 -0.5 345 -0.258819 360 -2.44929e-16 R8_SOFTPLUS_TEST R8_SOFTPLUS evaluates the softplus function of an R8. This is a smoothed version of max(x,0). X R8_SOFTPLUS(X) -500 0 -50 0 -5 0.00671535 -4 0.0181499 -3 0.0485874 -2 0.126928 -1 0.313262 -0.5 0.474077 -0.05 0.66846 -0.005 0.69065 -0.0005 0.692897 0 0.693147 0.0005 0.693397 0.005 0.69565 0.05 0.71846 0.5 0.974077 1 1.31326 2 2.12693 3 3.04859 4 4.01815 5 5.00672 50 50 500 500 5000 5000 50000 50000 R8_SWAP_TEST R8_SWAP swaps two reals. Before swapping: X = 1 Y = 3.14159 After swapping: X = 3.14159 Y = 1 R8_SWAP3_TEST R8_SWAP3 swaps three reals. X Y Z Start: 1 3.14159 1952 Swap 1 3.14159 1952 1 Swap 2 1952 1 3.14159 Swap 3 1 3.14159 1952 R8_TAND_TEST R8_TAND computes the tangent of an angle given in degrees. ANGLE R8_TAND(ANGLE) 0 0 15 0.267949 30 0.57735 45 1 60 1.73205 75 3.73205 90 Undefined 105 -3.73205 120 -1.73205 135 -1 150 -0.57735 165 -0.267949 180 -1.22465e-16 195 0.267949 210 0.57735 225 1 240 1.73205 255 3.73205 270 Undefined 285 -3.73205 300 -1.73205 315 -1 330 -0.57735 345 -0.267949 360 -2.44929e-16 R8_TO_I4_TEST R8_TO_I4 finds an integer IX in [IXMIN,IXMAX] corresponding to X in [XMIN,XMAX]. XMIN 2.5 X = 3.5 XMAX = 5.5 IXMIN 10 IX = 20 IXMAX = 40 R8_TO_R8_DISCRETE_TEST R8_TO_R8_DISCRETE maps numbers to a discrete set of equally spaced numbers in an interval. Number of discrete values = 19 Real interval: 1 10 R RD 1.83944 1.94737 11.4321 10 9.78362 10 6.30204 6.21053 4.39899 4.31579 -0.140456 1 2.34851 2.42105 0.429438 1 -0.430223 1 7.24155 7.15789 -0.197546 1 4.84401 4.78947 4.21698 4.31579 8.81076 8.57895 9.36473 9.52632 R8_UNIFORM_01_TEST R8_UNIFORM_01 samples a uniform random distribution in [0,1]. distributed random numbers. Using initial random number seed = 123456789 First few values: 0 0.218418 1 0.956318 2 0.829509 3 0.561695 4 0.415307 5 0.0661187 6 0.257578 7 0.109957 8 0.043829 9 0.633966 Number of samples was 1000 Minimum value was 0.00183837 Maximum value was 0.997908 Average value was 0.50304 Variance was 0.0822497 R8_UNIFORM_AB_TEST R8_UNIFORM_AB produces a random real in a given range. Using range 10 <= A <= 25. I A 0 10.002 1 13.5421 2 22.6794 3 21.9558 4 10.8556 5 20.8346 6 21.9964 7 18.1105 8 18.2206 9 23.3467 R8_WALSH_1D_TEST R8_WALSH_1D evaluates 1D Walsh functions: X W(+2) W(+1) W(0) W(-1) W(-2) W(-3) 0 0 0 0 0 0 0 0.25 0 0 0 0 1 0 0.5 0 0 0 1 0 0 0.75 0 0 0 1 1 0 1 0 0 1 0 0 0 1.25 0 0 1 0 1 0 1.5 0 0 1 1 0 0 1.75 0 0 1 1 1 0 2 0 1 0 0 0 0 2.25 0 1 0 0 1 0 2.5 0 1 0 1 0 0 2.75 0 1 0 1 1 0 3 0 1 1 0 0 0 3.25 0 1 1 0 1 0 3.5 0 1 1 1 0 0 3.75 0 1 1 1 1 0 4 1 0 0 0 0 0 4.25 1 0 0 0 1 0 4.5 1 0 0 1 0 0 4.75 1 0 0 1 1 0 5 1 0 1 0 0 0 5.25 1 0 1 0 1 0 5.5 1 0 1 1 0 0 5.75 1 0 1 1 1 0 6 1 1 0 0 0 0 6.25 1 1 0 0 1 0 6.5 1 1 0 1 0 0 6.75 1 1 0 1 1 0 7 1 1 1 0 0 0 7.25 1 1 1 0 1 0 7.5 1 1 1 1 0 0 7.75 1 1 1 1 1 0 8 0 0 0 0 0 0 R8_WRAP_TEST R8_WRAP "wraps" an R8 to lie within an interval: Wrapping interval is 3, 6.5 R R8_WRAP ( R ) 1.05785615775 4.55785615775 11.3884460711 4.38844607113 9.61312927506 6.11312927506 5.86373619874 5.86373619874 3.81429914066 3.81429914066 -1.07433771118 5.92566228882 1.60608909335 5.10608909335 -0.460604890545 3.03939510945 -1.38639403109 5.61360596891 6.87551997223 3.37551997223 -1.13581879308 5.86418120692 4.2935454443 4.2935454443 3.61828794097 3.61828794097 8.5654288099 5.0654288099 9.16201735749 5.66201735749 -1.97426280378 5.02573719622 10.5650568526 3.5650568526 2.91053273173 6.41053273173 -0.676373497036 6.32362650296 -1.80936351783 5.19063648217 R82COL_PRINT_PART_TEST R82COL_PRINT_PART prints part of an R82COL. Output with MAX_PRINT = 2 0: 11 12 1: 21 22 ...more entries... Output with MAX_PRINT = 5 0: 11 12 1: 21 22 2: 31 32 ........ .............. .............. 9: 101 102 Output with MAX_PRINT = 25 0 11 12 1 21 22 2 31 32 3 41 42 4 51 52 5 61 62 6 71 72 7 81 82 8 91 92 9 101 102 R82ROW_ORDER_TYPE_TEST R82ROW_ORDER_TYPE classifies an R8VEC as -1: no order 0: all equal; 1: ascending; 2: strictly ascending; 3: descending; 4: strictly descending. Order type = -1 0: 1 3 1: 2 2 2: 1 0 3: 1 0 Order type = -1 0: 0 2 1: 0 1 2: 1 2 3: 2 0 Order type = -1 0: 3 1 1: 0 0 2: 3 3 3: 0 0 Order type = -1 0: 1 3 1: 0 1 2: 2 1 3: 2 2 Order type = -1 0: 3 1 1: 3 2 2: 1 2 3: 1 1 Order type = 4 0: 2 1 1: 2 1 2: 1 2 3: 0 1 Order type = -1 0: 2 2 1: 0 2 2: 0 2 3: 2 1 Order type = -1 0: 3 2 1: 2 1 2: 3 2 3: 0 2 Order type = -1 0: 0 1 1: 1 3 2: 0 0 3: 0 0 Order type = -1 0: 1 0 1: 1 1 2: 2 2 3: 2 1 R82ROW_PART_QUICK_A_TEST R82ROW_PART_QUICK_A reorders an R82ROW as part of a quick sort. Using initial random number seed = 123456789 Before rearrangment: 0: 0.436837 1.91264 1: 1.65902 1.12339 2: 0.830614 0.132237 3: 0.515156 0.219914 4: 0.087658 1.26793 5: 0.123454 0.899078 6: 0.802613 1.50935 7: 1.59457 0.00367674 8: 1.79501 0.701505 9: 0.18909 0.0272338 10: 1.71819 1.68169 11: 0.246208 0.0150247 Rearranged array Left index = 4 Key index = 5 Right index = 6 Left half: 0: 0.246208 0.0150247 1: 0.18909 0.0272338 2: 0.123454 0.899078 3: 0.087658 1.26793 Key: 0: 0.436837 1.91264 Right half: 0: 0.802613 1.50935 1: 1.59457 0.00367674 2: 1.79501 0.701505 3: 0.515156 0.219914 4: 1.71819 1.68169 5: 0.830614 0.132237 6: 1.65902 1.12339 R82ROW_PRINT_PART_TEST R82ROW_PRINT_PART prints part of an R82ROW. Output with MAX_PRINT = 2 0: 11 21 1: 12 22 ...more entries... Output with MAX_PRINT = 5 0: 11 21 1: 12 22 2: 13 23 ........ .............. .............. 9: 20 30 Output with MAX_PRINT = 25 0 11 21 1 12 22 2 13 23 3 14 24 4 15 25 5 16 26 6 17 27 7 18 28 8 19 29 9 20 30 R82ROW_SORT_HEAP_INDEX_A_TEST R82ROW_SORT_HEAP_INDEX_A index sorts an R82ROW using heapsort. Using initial random number seed = 123456789 Before rearrangement: 0: 2.18418 9.56318 1: 8.29509 3.50752 2: 0.43829 0.661187 3: 1.23104 1.09957 4: 0.43829 6.33966 5: 0.617272 9.56318 6: 8.59097 8.40847 7: 7.97287 0.0183837 8: 8.97504 3.50752 9: 0.945448 0.136169 10: 8.59097 8.40847 11: 1.23104 0.0751236 I Index A(Index) 0 2 0.43829 0.661187 1 4 0.43829 6.33966 2 5 0.617272 9.56318 3 9 0.945448 0.136169 4 11 1.23104 0.0751236 5 3 1.23104 1.09957 6 0 2.18418 9.56318 7 7 7.97287 0.0183837 8 1 8.29509 3.50752 9 6 8.59097 8.40847 10 10 8.59097 8.40847 11 8 8.97504 3.50752 After rearrangement by R82ROW_PERMUTE: 0: 0.43829 0.661187 1: 0.43829 6.33966 2: 0.617272 9.56318 3: 0.945448 0.136169 4: 1.23104 0.0751236 5: 1.23104 1.09957 6: 2.18418 9.56318 7: 7.97287 0.0183837 8: 8.29509 3.50752 9: 8.59097 8.40847 10: 8.59097 8.40847 11: 8.97504 3.50752 R82ROW_SORT_QUICK_A_TEST R82ROW_SORT_QUICK_A sorts an R82ROW as part of a quick sort. Using initial random number seed = 123456789 Before sorting: 0: 2.18418 9.56318 1: 8.29509 5.61695 2: 0.43829 0.661187 3: 1.23104 1.09957 4: 0.43829 6.33966 5: 0.617272 4.49539 6: 8.59097 8.40847 7: 7.97287 0.0183837 8: 8.97504 3.50752 9: 0.945448 0.136169 10: 8.59097 8.40847 11: 1.23104 0.0751236 Sorted array: 0: 0.43829 0.661187 1: 0.43829 6.33966 2: 0.617272 4.49539 3: 0.945448 0.136169 4: 1.23104 0.0751236 5: 1.23104 1.09957 6: 2.18418 9.56318 7: 7.97287 0.0183837 8: 8.29509 5.61695 9: 8.59097 8.40847 10: 8.59097 8.40847 11: 8.97504 3.50752 R83COL_PRINT_PART_TEST R83COL_PRINT_PART prints part of an R83COL. Output with MAX_PRINT = 2 0: 11 12 13 1: 21 22 23 ...more entries... Output with MAX_PRINT = 5 0: 11 12 13 1: 21 22 23 2: 31 32 33 ........ .............. .............. .............. 9: 101 102 103 Output with MAX_PRINT = 25 0 11 12 13 1 21 22 23 2 31 32 33 3 41 42 43 4 51 52 53 5 61 62 63 6 71 72 73 7 81 82 83 8 91 92 93 9 101 102 103 R83ROW_PRINT_PART_TEST R83ROW_PRINT_PART prints part of an R83ROW. Output with MAX_PRINT = 2 0: 11 21 31 1: 12 22 32 ...more entries... Output with MAX_PRINT = 5 0: 11 21 31 1: 12 22 32 2: 13 23 33 ........ .............. .............. .............. 9: 20 30 40 Output with MAX_PRINT = 25 0 11 21 31 1 12 22 32 2 13 23 33 3 14 24 34 4 15 25 35 5 16 26 36 6 17 27 37 7 18 28 38 8 19 29 39 9 20 30 40 R8BLOCK_EXPAND_LINEAR_TEST R8BLOCK_EXPAND_LINEAR linearly interpolates new data between old values in a 3D block. Original block: K = 1 1 2 3 1: 1 1 1 2: 2 4 8 3: 3 9 27 4: 4 16 64 K = 2 1 2 3 1: 2 2 2 2: 4 8 16 3: 6 18 54 4: 8 32 128 LFAT = 1 MFAT = 2 NFAT = 1 Fattened block: K = 1 1 2 3 4 5 1: 1 1 1 1 1 2: 1.5 1.83333 2.16667 2.5 3.16667 3: 2 2.66667 3.33333 4 5.33333 4: 2.5 3.83333 5.16667 6.5 10.1667 5: 3 5 7 9 15 6: 3.5 6.5 9.5 12.5 23.5 7: 4 8 12 16 32 6 7 1: 1 1 2: 3.83333 4.5 3: 6.66667 8 4: 13.8333 17.5 5: 21 27 6: 34.5 45.5 7: 48 64 K = 2 1 2 3 4 5 1: 1.5 1.5 1.5 1.5 1.5 2: 2.25 2.75 3.25 3.75 4.75 3: 3 4 5 6 8 4: 3.75 5.75 7.75 9.75 15.25 5: 4.5 7.5 10.5 13.5 22.5 6: 5.25 9.75 14.25 18.75 35.25 7: 6 12 18 24 48 6 7 1: 1.5 1.5 2: 5.75 6.75 3: 10 12 4: 20.75 26.25 5: 31.5 40.5 6: 51.75 68.25 7: 72 96 K = 3 1 2 3 4 5 1: 2 2 2 2 2 2: 3 3.66667 4.33333 5 6.33333 3: 4 5.33333 6.66667 8 10.6667 4: 5 7.66667 10.3333 13 20.3333 5: 6 10 14 18 30 6: 7 13 19 25 47 7: 8 16 24 32 64 6 7 1: 2 2 2: 7.66667 9 3: 13.3333 16 4: 27.6667 35 5: 42 54 6: 69 91 7: 96 128 R8BLOCK_NEW_TEST: R8BLOCK_NEW dynamically creates a 3D array. Array entries can be addressed using the notation "a[i][j][k]". Allocating memory for array A of size 2 by 3 by 2. Assigning values to A. Dynamically allocated matrix A: 0 1 10 11 20 21 100 101 110 111 120 121 R8BLOCK_PRINT_TEST R8BLOCK_PRINT prints an R8BLOCK. The 3D array: K = 1 1 2 3 1: 1 1 1 2: 2 4 8 3: 3 9 27 4: 4 16 64 K = 2 1 2 3 1: 2 2 2 2: 4 8 16 3: 6 18 54 4: 8 32 128 R8CMAT_TO_R8MAT_NEW_TEST R8CMAT_TO_R8MAT_NEW converts an R8CMAT to an R8MAT. Data is of order (5,4. The R8MAT A: Col: 0 1 2 3 Row 0: 11 12 13 14 1: 21 22 23 24 2: 31 32 33 34 3: 41 42 43 44 4: 51 52 53 54 The R8CMAT B: Col: 0 1 2 3 Row 0: 11 12 13 14 1: 21 22 23 24 2: 31 32 33 34 3: 41 42 43 44 4: 51 52 53 54 The R8MAT C: Col: 0 1 2 3 Row 0: 11 12 13 14 1: 21 22 23 24 2: 31 32 33 34 3: 41 42 43 44 4: 51 52 53 54 R8INT_TO_I4INT_TEST For data in an interval, R8INT_TO_I4INT converts a real to an integer. Integer interval: [1, 11] Real interval: [100, 200] R I(R) R(I(R)) 113.394 2 110 209.321 12 210 192.836 10 190 158.02 7 160 138.99 5 140 93.5954 0 90 118.485 3 120 99.2944 1 100 90.6978 0 90 167.416 8 170 R8MAT_CHOLESKY_FACTOR_TEST R8MAT_CHOLESKY_FACTOR determines the lower triangular Cholesky factorization of a positive definite symmetric matrix, Matrix to be factored: Col: 0 1 2 3 4 Row 0: 2 -1 0 0 0 1: -1 2 -1 0 0 2: 0 -1 2 -1 0 3: 0 0 -1 2 -1 4: 0 0 0 -1 2 Cholesky factor L: Col: 0 1 2 3 4 Row 0: 1.41421 0 0 0 0 1: -0.707107 1.22474 0 0 0 2: 0 -0.816497 1.1547 0 0 3: 0 0 -0.866025 1.11803 0 4: 0 0 0 -0.894427 1.09545 Product L * L': Col: 0 1 2 3 4 Row 0: 2 -1 0 0 0 1: -1 2 -1 0 0 2: 0 -1 2 -1 0 3: 0 0 -1 2 -1 4: 0 0 0 -1 2 R8MAT_CHOLESKY_INVERSE_TEST For a positive definite symmetric matrix, R8MAT_CHOLESKY_INVERSE computes the inverse. Matrix to be inverted: Col: 0 1 2 3 4 Row 0: 2 -1 0 0 0 1: -1 2 -1 0 0 2: 0 -1 2 -1 0 3: 0 0 -1 2 -1 4: 0 0 0 -1 2 Inverse matrix: Col: 0 1 2 3 4 Row 0: 0.833333 0.666667 0.5 0.333333 0.166667 1: 0.666667 1.33333 1 0.666667 0.333333 2: 0.5 1 1.5 1 0.5 3: 0.333333 0.666667 1 1.33333 0.666667 4: 0.166667 0.333333 0.5 0.666667 0.833333 Product inv(A) * A: Col: 0 1 2 3 4 Row 0: 1 2.22045e-16 0 -1.11022e-16 0 1: -6.66134e-16 1 2.22045e-16 -1.66533e-16 -1.11022e-16 2: -6.66134e-16 1.11022e-15 1 -2.22045e-16 0 3: -4.44089e-16 6.66134e-16 0 1 0 4: -1.66533e-16 2.22045e-16 0 -2.22045e-16 1 R8MAT_CHOLESKY_SOLVE_TEST For a positive definite symmetric matrix, R8MAT_CHOLESKY_SOLVE solves a linear system using the lower Cholesky factorization. Matrix to be factored: Col: 0 1 2 3 4 Row 0: 2 -1 0 0 0 1: -1 2 -1 0 0 2: 0 -1 2 -1 0 3: 0 0 -1 2 -1 4: 0 0 0 -1 2 Cholesky factor L: Col: 0 1 2 3 4 Row 0: 1.41421 0 0 0 0 1: -0.707107 1.22474 0 0 0 2: 0 -0.816497 1.1547 0 0 3: 0 0 -0.866025 1.11803 0 4: 0 0 0 -0.894427 1.09545 Product L * L': Col: 0 1 2 3 4 Row 0: 2 -1 0 0 0 1: -1 2 -1 0 0 2: 0 -1 2 -1 0 3: 0 0 -1 2 -1 4: 0 0 0 -1 2 Right hand side: 0: 0 1: 0 2: 0 3: 0 4: 6 Computed solution: 0: 1 1: 2 2: 3 3: 4 4: 5 R8MAT_CHOLESKY_SOLVE_UPPER_TEST For a positive definite symmetric matrix, R8MAT_CHOLESKY_SOLVE_UPPER solves a linear system using the upper Cholesky factorization. Matrix to be factored: Col: 0 1 2 3 4 Row 0: 2 -1 0 0 0 1: -1 2 -1 0 0 2: 0 -1 2 -1 0 3: 0 0 -1 2 -1 4: 0 0 0 -1 2 Cholesky factor R: Col: 0 1 2 3 4 Row 0: 1.41421 -0.707107 0 0 0 1: 0 1.22474 -0.816497 0 0 2: 0 0 1.1547 -0.866025 0 3: 0 0 0 1.11803 -0.894427 4: 0 0 0 0 1.09545 Product R' * R: Col: 0 1 2 3 4 Row 0: 2 -1 0 0 0 1: -1 2 -1 0 0 2: 0 -1 2 -1 0 3: 0 0 -1 2 -1 4: 0 0 0 -1 2 Right hand side: 0: 0 1: 0 2: 0 3: 0 4: 6 Computed solution: 0: 1 1: 2 2: 3 3: 4 4: 5 R8MAT_DET_2D_TEST R8MAT_DET_2D: determinant of a 2 by 2 matrix; Matrix: Col: 0 1 Row 0: 1 1 1: 1 10 R8MAT_DET_2D computes determinant:9 Exact determinant is 9 R8MAT_DET_3D_TEST R8MAT_DET_3D: determinant of a 3 by 3 matrix; Matrix: Col: 0 1 2 Row 0: 1 1 1 1: 1 10 100 2: 1 4 16 R8MAT_DET_3D computes determinant:-162 Exact determinant is -162 R8MAT_DET_4D_TEST R8MAT_DET_4D determinant of a 4 by 4 matrix; Matrix: Col: 0 1 2 3 Row 0: 1 1 1 1 1: 1 10 100 1000 2: 1 4 16 64 3: 1 2 4 8 R8MAT_DET_4D computes determinant:-2592 Exact determinant is -2592 R8MAT_DET_5D_TEST R8MAT_DET_5D determinant of a 5 by 5 matrix; Matrix: Col: 0 1 2 3 4 Row 0: 1 1 1 1 1 1: 1 10 100 1000 10000 2: 1 4 16 64 256 3: 1 2 4 8 16 4: 1 3 9 27 81 R8MAT_DET_5D computes determinant:-36288 Exact determinant is -36288 R8MAT_EXPAND_LINEAR_TEST R8MAT_EXPAND_LINEAR linearly interpolates new data between old values in a matrix. Original matrix: Col: 0 1 2 Row 0: 1 1 1 1: 2 4 8 2: 3 9 27 3: 4 16 64 MFAT = 2 NFAT = 1 Fattened matrix: Col: 0 1 2 3 4 Row 0: 1 1 1 1 1 1: 1.33333 1.66667 2 2.66667 3.33333 2: 1.66667 2.33333 3 4.33333 5.66667 3: 2 3 4 6 8 4: 2.33333 4 5.66667 10 14.3333 5: 2.66667 5 7.33333 14 20.6667 6: 3 6 9 18 27 7: 3.33333 7.33333 11.3333 25.3333 39.3333 8: 3.66667 8.66667 13.6667 32.6667 51.6667 9: 4 10 16 40 64 R8MAT_EXPAND_LINEAR2_TEST R8MAT_EXPAND_LINEAR2 fills in a large array by interpolating data from a small array. Original matrix has dimensions: M = 3, N = 2 Expanded matrix has dimensions: M2 = 10, N2 = 5 The little matrix A: Col: 0 1 Row 0: 11 12 1: 21 22 2: 31 32 Expanded array A2: Col: 0 1 2 3 4 Row 0: 11 11.25 11.5 11.75 12 1: 13.2222 13.4722 13.7222 13.9722 14.2222 2: 15.4444 15.6944 15.9444 16.1944 16.4444 3: 17.6667 17.9167 18.1667 18.4167 18.6667 4: 19.8889 20.1389 20.3889 20.6389 20.8889 5: 22.1111 22.3611 22.6111 22.8611 23.1111 6: 24.3333 24.5833 24.8333 25.0833 25.3333 7: 26.5556 26.8056 27.0556 27.3056 27.5556 8: 28.7778 29.0278 29.2778 29.5278 29.7778 9: 31 31.25 31.5 31.75 32 R8MAT_FS_NEW_TEST For a matrix in general storage, R8MAT_FS_NEW factors and solves a linear system. Matrix order N = 10 Solution: 0: 1 1: 2 2: 3 3: 4 4: 5 5: 6 6: 7 7: 8 8: 9 9: 10 R8MAT_FSS_NEW_TEST For a matrix in general storage, R8MAT_FSS_NEW factors and solves multiple linear systems. Matrix order N = 10 Number of systems NB = 3 Solutions: Col: 0 1 2 Row 0: 1 1 1 1: 1 2 2 2: 1 3 3 3: 1 4 1 4: 1 5 2 5: 1 6 3 6: 1 7 1 7: 1 8 2 8: 1 9 3 9: 1 10 1 R8MAT_GIVENS_POST_TEST R8MAT_GIVENS_POST computes a Givens postmultiplier rotation matrix. Matrix A: Col: 0 1 2 Row 0: 1 1 1 1: 1 2 4 2: 1 3 9 I = 3 J = 2 G Col: 0 1 2 Row 0: 1 0 0 1: 0 0.948683 0.316228 2: 0 -0.316228 0.948683 A*G Col: 0 1 2 Row 0: 1 0.632456 1.26491 1: 1 0.632456 4.42719 2: 1 -4.44089e-16 9.48683 R8MAT_GIVENS_PRE_TEST R8MAT_GIVENS_PRE computes a Givens premultiplier rotation matrix. Matrix A: Col: 0 1 2 Row 0: 1 1 1 1: 1 2 4 2: 1 3 9 I = 3 J = 2 G Col: 0 1 2 Row 0: 1 0 0 1: 0 0.5547 0.83205 2: 0 -0.83205 0.5547 G*A Col: 0 1 2 Row 0: 1 1 1 1: 1.38675 3.60555 9.70725 2: -0.27735 0 1.6641 R8MAT_HESS_TEST R8MAT_HESS estimates the Hessian matrix of a scalar function. Estimated jacobian: Col: 0 1 2 Row 0: 2 1 0 1: 1 2.381e-06 9.88032 2: 0 9.88032 -30.8503 Exact jacobian: Col: 0 1 2 Row 0: 2 1 0 1: 1 0 9.88032 2: 0 9.88032 -30.8503 R8MAT_HOUSE_AXH_TEST R8MAT_HOUSE_AXH multiplies a matrix A times a compact Householder matrix. Matrix A: Col: 0 1 2 3 4 Row 0: -2.81582 -4.33881 -4.38273 -4.98162 3.59097 1: 4.56318 -2.42422 -0.50461 3.97504 3.40847 2: 3.29509 -3.90043 -0.986937 -1.49248 -3.76896 3: 0.616954 -4.56171 2.54673 -4.05455 -4.92488 4: -0.846929 1.33966 2.97287 -4.86383 -2.39697 Compact vector V so H*A packs column 3: 0: 0 1: 0 2: -0.788819 3: 0.399863 4: 0.466771 Householder matrix H: Col: 0 1 2 3 4 Row 0: 1 0 0 0 0 1: 0 1 0 0 0 2: 0 0 -0.244469 0.630839 0.736395 3: 0 0 0.630839 0.680219 -0.373289 4: 0 0 0.736395 -0.373289 0.56425 Indirect product A*H: Col: 0 1 2 3 4 Row 0: -2.81582 -4.33881 0.573215 -7.49385 0.65837 1: 4.56318 -2.42422 5.14095 1.11322 0.0678026 2: 3.29509 -3.90043 -3.47568 -0.230898 -2.29629 3: 0.616954 -4.56171 -6.80702 0.686997 0.610057 4: -0.846929 1.33966 -5.56019 -0.538306 2.65233 Direct product A*H: Col: 0 1 2 3 4 Row 0: -2.81582 -4.33881 0.573215 -7.49385 0.65837 1: 4.56318 -2.42422 5.14095 1.11322 0.0678026 2: 3.29509 -3.90043 -3.47568 -0.230898 -2.29629 3: 0.616954 -4.56171 -6.80702 0.686997 0.610057 4: -0.846929 1.33966 -5.56019 -0.538306 2.65233 H*A should have packed column 3: Col: 0 1 2 3 4 Row 0: -2.81582 -4.33881 -4.38273 -4.98162 3.59097 1: 4.56318 -2.42422 -0.50461 3.97504 3.40847 2: -1.04002 -0.937652 4.03706 -5.7746 -3.95052 3: 2.81449 -6.06358 -2.22045e-16 -1.88388 -4.83284 4: 1.71831 -0.41352 0 -2.32995 -2.28953 R8MAT_HOUSE_FORM_TEST R8MAT_HOUSE_FORM forms a Householder matrix from its compact form. Compact vector form V: 0: 0 1: 0 2: 1 3: 2 4: 3 Householder matrix H: Col: 0 1 2 3 4 Row 0: 1 0 0 0 0 1: 0 1 0 0 0 2: 0 0 0.857143 -0.285714 -0.428571 3: 0 0 -0.285714 0.428571 -0.857143 4: 0 0 -0.428571 -0.857143 -0.285714 R8MAT_HOUSE_POST_TEST R8MAT_HOUSE_POST computes a Householder postmultiplier; Matrix A: Col: 0 1 2 3 4 Row 0: 1.09209 0.330594 0.308636 0.00919186 4.29548 1: 4.78159 1.28789 2.24769 4.48752 4.20424 2: 4.14755 0.549784 2.00653 1.75376 0.61552 3: 2.80848 0.219145 3.77337 0.472724 0.0375618 4: 2.07654 3.16983 3.98643 0.0680845 1.30151 I = 2 J = 3 Householder matrix H: Col: 0 1 2 3 4 Row 0: 1 0 0 0 0 1: 0 1 0 0 0 2: 0 0 -0.733626 -0.641208 -0.225046 3: 0 0 -0.641208 0.762839 -0.0832366 4: 0 0 -0.225046 -0.0832366 0.970786 Product A*H: Col: 0 1 2 3 4 Row 0: 1.09209 0.330594 -1.199 -0.548429 4.09978 1: 4.78159 1.28789 -5.47255 1.63207 3.20206 2: 4.14755 0.549784 -2.73509 -2.08167e-16 -1.11022e-16 3: 2.80848 0.219145 -3.07981 -2.06203 -0.852063 4: 2.07654 3.16983 -3.26111 -2.61253 0.360697 R8MAT_HOUSE_PRE_TEST R8MAT_HOUSE_PRE computes a Householder premultiplier; Matrix A: Col: 0 1 2 3 4 Row 0: 1.09209 0.330594 0.308636 0.00919186 4.29548 1: 4.78159 1.28789 2.24769 4.48752 4.20424 2: 4.14755 0.549784 2.00653 1.75376 0.61552 3: 2.80848 0.219145 3.77337 0.472724 0.0375618 4: 2.07654 3.16983 3.98643 0.0680845 1.30151 I = 2 J = 3 Householder matrix H: Col: 0 1 2 3 4 Row 0: 1 0 0 0 0 1: 0 -0.926857 -0.362224 -0.0976368 -0.0140622 2: 0 -0.362224 0.931907 -0.0183544 -0.00264351 3: 0 -0.0976368 -0.0183544 0.995053 -0.000712555 4: 0 -0.0140622 -0.00264351 -0.000712555 0.999897 Product H*A: Col: 0 1 2 3 4 Row 0: 1.09209 0.330594 0.308636 0.00919186 4.29548 1: -6.2376 -1.4588 -3.23458 -4.84165 -4.14165 2: 2.07608 0.0334418 0.975936 -1.96918e-16 -0.953397 3: 2.25012 0.0799658 3.49557 -3.43895e-17 -0.385337 4: 1.99612 3.14978 3.94643 0 1.24061 R8MAT_INDICATOR_NEW_TEST R8MAT_INDICATOR_NEW returns an indicator matrix. The indicator matrix: Col: 0 1 2 3 Row 0: 11 12 13 14 1: 21 22 23 24 2: 31 32 33 34 3: 41 42 43 44 4: 51 52 53 54 R8MAT_INVERSE_2D_TEST R8MAT_INVERSE_2D inverts a 2 by 2 matrix. Matrix A: Col: 0 1 Row 0: 1 2 1: 3 4 Inverse matrix B: Col: 0 1 Row 0: -2 1 1: 1.5 -0.5 C = A * B: Col: 0 1 Row 0: 1 0 1: 0 1 R8MAT_INVERSE_3D_TEST R8MAT_INVERSE_3D inverts a 3 by 3 matrix. Matrix A: Col: 0 1 2 Row 0: 3 2 1 1: 2 2 1 2: 0 1 1 Inverse matrix B: Col: 0 1 2 Row 0: 1 -1 0 1: -2 3 -1 2: 2 -3 2 C = A * B: Col: 0 1 2 Row 0: 1 0 0 1: 0 1 0 2: 0 0 1 R8MAT_INVERSE_4D_TEST R8MAT_INVERSE_4D inverts a 4 x 4 matrix. Matrix A: Col: 0 1 2 3 Row 0: 4 3 2 1 1: 3 3 2 1 2: 0 2 2 1 3: 0 0 1 1 Inverse matrix B: Col: 0 1 2 3 Row 0: 1 -1 0 -0 1: -3 4 -1 0 2: 6 -8 3 -1 3: -6 8 -3 2 C = A * B: Col: 0 1 2 3 Row 0: 1 0 0 0 1: 0 1 0 0 2: 0 0 1 0 3: 0 0 0 1 R8MAT_IS_INTEGER_TEST R8MAT_IS_INTEGER is TRUE if every entry of an R8MAT is an integer Example 1: Obviously integer Col: 0 1 2 Row 0: 1 2 3 1: 4 5 6 A is an integer matrix. Example 2: Obviously NOT integer Col: 0 1 2 Row 0: 1 2 3 1: 4 5 6.5 A is NOT an integer matrix. Example 3: Not obviously not integer Col: 0 1 2 Row 0: 1 2 3 1: 4 5 6 A is NOT an integer matrix. Example 4: Not obviously not integer Col: 0 1 2 Row 0: 1 2 3 1: 4 5 3e+08 A is NOT an integer matrix. R8MAT_JAC_TEST R8MAT_JAC estimates the M by N jacobian matrix of a nonlinear function. Estimated jacobian: Col: 0 1 2 3 Row 0: -0.83233 -0.41616 0 0 1: 0.70711 0 1 0 2: 1 2 3 4 Exact jacobian: Col: 0 1 2 3 Row 0: -0.832294 -0.416147 0 0 1: 0.707107 0 1 0 2: 1 2 3 4 R8MAT_KRONECKER_TEST R8MAT_KRONECKER computes the Kronecker product of two R8MAT's. Factor matrix A: Col: 0 1 2 Row 0: 1 2 3 1: 4 5 6 Factor matrix B: Col: 0 1 Row 0: 7 8 1: 9 10 2: 11 12 Kronecker product C = kron(A,B) Col: 0 1 2 3 4 Row 0: 7 8 14 16 21 1: 9 10 18 20 27 2: 11 12 22 24 33 3: 28 32 35 40 42 4: 36 40 45 50 54 5: 44 48 55 60 66 Col: 5 Row 0: 24 1: 30 2: 36 3: 48 4: 60 5: 72 R8MAT_L_INVERSE_TEST R8MAT_L_INVERSE inverts a lower triangular R8MAT. Matrix A to be inverted: Col: 0 1 2 3 Row 0: 1 0 0 0 1: 2 3 0 0 2: 4 5 6 0 3: 7 8 9 10 Inverse matrix B: Col: 0 1 2 3 Row 0: 1 0 0 0 1: -0.666667 0.333333 0 0 2: -0.111111 -0.277778 0.166667 0 3: -0.0666667 -0.0166667 -0.15 0.1 Product C = A * B: Col: 0 1 2 3 Row 0: 1 0 0 0 1: 0 1 0 0 2: 0 0 1 0 3: 0 0 0 1 R8MAT_L_PRINT_TEST R8MAT_L_PRINT prints a lower triangular R8MAT stored compactly. Only the (possibly) nonzero elements are printed. A 7 by 7 matrix. Col 1 2 3 4 5 6 7 Row 1 11 2 21 22 3 31 32 33 4 41 42 43 44 5 51 52 53 54 55 6 61 62 63 64 65 66 7 71 72 73 74 75 76 77 A 7 by 3 matrix. Col 1 2 3 Row 1 11 2 21 22 3 31 32 33 4 41 42 43 5 51 52 53 6 61 62 63 7 71 72 73 A 4 by 7 matrix. Col 1 2 3 4 Row 1 11 2 21 22 3 31 32 33 4 41 42 43 44 R8MAT_L_SOLVE_TEST R8MAT_L_SOLVE solves a lower triangular system. Input matrix A: Col: 0 1 2 3 Row 0: 1 0 0 0 1: 2 3 0 0 2: 4 5 6 0 3: 7 8 9 10 Right hand side b: 0: 1 1: 8 2: 32 3: 90 Solution x: 0: 1 1: 2 2: 3 3: 4 Norm of residual = 0 R8MAT_L1_INVERSE_TEST R8MAT_L1_INVERSE inverts a unit lower triangular R8MAT. Matrix A to be inverted: Col: 0 1 2 3 4 Row 0: 1 0 0 0 0 1: 2 1 0 0 0 2: 0 0 1 0 0 3: 5 0 3 1 0 4: 0 0 0 0 1 5: 75 0 0 6 4 Col: 5 Row 0: 0 1: 0 2: 0 3: 0 4: 0 5: 1 Inverse matrix B: Col: 0 1 2 3 4 Row 0: 1 0 0 0 0 1: -2 1 0 0 0 2: 0 0 1 0 0 3: -5 0 -3 1 0 4: 0 0 0 0 1 5: -45 0 18 -6 -4 Col: 5 Row 0: 0 1: 0 2: 0 3: 0 4: 0 5: 1 Product C = A * B: Col: 0 1 2 3 4 Row 0: 1 0 0 0 0 1: 0 1 0 0 0 2: 0 0 1 0 0 3: 0 0 0 1 0 4: 0 0 0 0 1 5: 0 0 0 0 0 Col: 5 Row 0: 0 1: 0 2: 0 3: 0 4: 0 5: 1 R8MAT_LT_SOLVE_TEST R8MAT_LT_SOLVE solves a transposed lower triangular system. Input matrix A: Col: 0 1 2 3 Row 0: 1 0 0 0 1: 2 3 0 0 2: 4 5 6 0 3: 7 8 9 10 Right hand side b: 0: 45 1: 53 2: 54 3: 40 Solution x: 0: 1 1: 2 2: 3 3: 4 Norm of residual (A'*x-b) = 0 R8MAT_LU_TEST R8MAT_LU computes the LU factors of an R8MAT. Matrix to be factored: Col: 0 1 2 3 4 Row 0: 1 1 1 1 1 1: 1 10 100 1000 10000 2: 1 4 16 64 256 3: 1 2 4 8 16 4: 1 3 9 27 81 P factor: Col: 0 1 2 3 4 Row 0: 1 0 0 0 0 1: 0 1 0 0 0 2: 0 0 1 0 0 3: 0 0 0 1 0 4: 0 0 0 0 1 L factor: Col: 0 1 2 3 4 Row 0: 1 0 0 0 0 1: 1 1 0 0 0 2: 1 0.333333 1 0 0 3: 1 0.111111 0.444444 1 0 4: 1 0.222222 0.777778 0.875 1 U factor: Col: 0 1 2 3 4 Row 0: 1 1 1 1 1 1: 0 9 99 999 9999 2: 0 0 -18 -270 -3078 3: 0 0 0 16 272 4: 0 0 0 0 14 P*L*U: Col: 0 1 2 3 4 Row 0: 1 1 1 1 1 1: 1 10 100 1000 10000 2: 1 4 16 64 256 3: 1 2 4 8 16 4: 1 3 9 27 81 R8MAT_MAX_TEST R8MAT_MAX computes the maximum value of an R8MAT. Random array: Col: 0 1 2 Row 0: 2.18418 0.661187 0.617272 1: 9.56318 2.57578 4.49539 2: 8.29509 1.09957 4.01306 3: 5.61695 0.43829 7.54673 4: 4.15307 6.33966 7.97287 Maximum value = 9.56318 R8MAT_MAX_INDEX_TEST R8MAT_MAX_INDEX locates the maximum entry of an R8MAT; Random array: Col: 0 1 2 Row 0: 2.18418 0.661187 0.617272 1: 9.56318 2.57578 4.49539 2: 8.29509 1.09957 4.01306 3: 5.61695 0.43829 7.54673 4: 4.15307 6.33966 7.97287 Maximum I,J indices 2 1 R8MAT_MAXCOL_MINROW_TEST R8MAT_MAXCOL_MINROW computes the maximum over columns of the mininum over rows; Random array: Col: 0 1 2 Row 0: 2.18418 0.661187 0.617272 1: 9.56318 2.57578 4.49539 2: 8.29509 1.09957 4.01306 3: 5.61695 0.43829 7.54673 4: 4.15307 6.33966 7.97287 MAXCOL_MINROW = 4.15307 R8MAT_MAXROW_MINCOL_TEST R8MAT_MAXROW_MINCOL computes the maximum over rows of the mininum over columns; Random array: Col: 0 1 2 Row 0: 2.18418 0.661187 0.617272 1: 9.56318 2.57578 4.49539 2: 8.29509 1.09957 4.01306 3: 5.61695 0.43829 7.54673 4: 4.15307 6.33966 7.97287 MAXROW_MINCOL = 2.18418 R8MAT_MIN_TESTn For a real matrix, R8MAT_MIN computes the minimum value; Random array: Col: 0 1 2 Row 0: 2.18418 0.661187 0.617272 1: 9.56318 2.57578 4.49539 2: 8.29509 1.09957 4.01306 3: 5.61695 0.43829 7.54673 4: 4.15307 6.33966 7.97287 Minimum value = 0.43829 R8MAT_MIN_INDEX_TEST R8MAT_MIN_INDEX locates the minimum entry of an R8MAT; Random array: Col: 0 1 2 Row 0: 2.18418 0.661187 0.617272 1: 9.56318 2.57578 4.49539 2: 8.29509 1.09957 4.01306 3: 5.61695 0.43829 7.54673 4: 4.15307 6.33966 7.97287 Minimum I,J indices 4 2 R8MAT_MINCOL_MAXROW_TEST R8MAT_MINCOL_MAXROW computes the minimum over columns of the maxinum over rows; Random array: Col: 0 1 2 Row 0: 2.18418 0.661187 0.617272 1: 9.56318 2.57578 4.49539 2: 8.29509 1.09957 4.01306 3: 5.61695 0.43829 7.54673 4: 4.15307 6.33966 7.97287 MINCOL_MAXROW = 2.18418 R8MAT_MINROW_MAXCOL_TEST R8MAT_MINROW_MAXCOL computes the minimum over rows of the maxinum over columns; Random array: Col: 0 1 2 Row 0: 2.18418 0.661187 0.617272 1: 9.56318 2.57578 4.49539 2: 8.29509 1.09957 4.01306 3: 5.61695 0.43829 7.54673 4: 4.15307 6.33966 7.97287 MINROW_MAXCOL = 6.33966 R8MAT_MM_TEST R8MAT_MM multiplies two (rectangular) matrices and returns the result as an argument. Matrix A: Col: 0 1 2 Row 0: 1 2 3 1: 4 5 6 Matrix B: Col: 0 1 2 3 Row 0: 1 4 0 -1 1: 2 5 0 2 2: 3 6 1 -1 Product C = A * B: Col: 0 1 2 3 Row 0: 14 32 3 0 1: 32 77 6 0 R8MAT_MM_NEW_TEST R8MAT_MM_NEW multiplies two (rectangular) matrices and returns the result as the function value. Matrix A: Col: 0 1 2 Row 0: 1 2 3 1: 4 5 6 Matrix B: Col: 0 1 2 3 Row 0: 1 4 0 -1 1: 2 5 0 2 2: 3 6 1 -1 Product C = A * B: Col: 0 1 2 3 Row 0: 14 32 3 0 1: 32 77 6 0 R8MAT_MV_NEW_TEST R8MAT_MV_NEW multiplies a (rectangular) matrix times a vector, and returns the result as the function value. Matrix A: Col: 0 1 2 Row 0: 1 2 3 1: 4 5 6 Vector B: 0: 1 1: 2 2: 3 Product C = A * B: 0: 14 1: 32 R8MAT_MV_TEST R8MAT_MV multiplies a (rectangular) matrix times a vector, and returns the result as an argument. Matrix A: Col: 0 1 2 Row 0: 1 2 3 1: 4 5 6 Vector B: 0: 1 1: 2 2: 3 Product C = A * B: 0: 14 1: 32 R8MAT_MTV_NEW_TEST R8MAT_MTV_NEW multiplies a transposed matrix times a vector, and returns the result as the function value. Matrix A: Col: 0 1 2 Row 0: 1 2 3 1: 4 5 6 Vector B: 0: 1 1: 2 Product C = A' * B: 0: 9 1: 12 2: 15 R8MAT_MTV_TEST R8MAT_MTV multiplies a transposed matrix times a vector, and returns the result as an argument. Matrix A: Col: 0 1 2 Row 0: 1 2 3 1: 4 5 6 Vector B: 0: 1 1: 2 Product C = A' * B: 0: 9 1: 12 2: 15 R8MAT_NINT_TEST R8MAT_NINT rounds an R8MAT. Matrix A: Col: 0 1 2 3 Row 0: -2.81582 -4.33881 -4.38273 -4.98162 1: 4.56318 -2.42422 -0.50461 3.97504 2: 3.29509 -3.90043 -0.986937 -1.49248 3: 0.616954 -4.56171 2.54673 -4.05455 4: -0.846929 1.33966 2.97287 -4.86383 Rounded matrix A: Col: 0 1 2 3 Row 0: -3 -4 -4 -5 1: 5 -2 -1 4 2: 3 -4 -1 -1 3: 1 -5 3 -4 4: -1 1 3 -5 R8MAT_NONZEROS_TEST R8MAT_NONZEROS counts nonzeros in an R8MAT. Matrix A: Col: 0 1 2 3 Row 0: 1 0 1 0 1: 0 0 0 0 2: 1 0 1 0 3: 0 0 0 0 4: 1 0 1 0 Expected nonzeros = 6 Computed nonzeros = 6 R8MAT_NORM_FRO_TEST R8MAT_NORM_FRO computes the Frobenius norm of a matrix. Matrix A: Col: 0 1 2 3 Row 0: 1 2 3 4 1: 5 6 7 8 2: 9 10 11 12 3: 13 14 15 16 4: 17 18 19 20 Expected Frobenius norm = 53.5724 Computed Frobenius norm = 53.5724 R8MAT_NORM_FRO_AFFINE_TEST R8MAT_NORM_FRO_AFFINE computes the Frobenius norm of the difference of two R8MAT's. Expected Frobenius norm = 2.1594 Computed Frobenius norm = 2.1594 R8MAT_NORM_L1_TEST R8MAT_NORM_L1 computes the L1 norm of a matrix. Matrix A: Col: 0 1 2 3 Row 0: -3 -4 -4 -5 1: 5 -2 -1 4 2: 3 -4 -1 -1 3: 1 -5 3 -4 4: -1 1 3 -5 L1 norm = 19 R8MAT_NULLSPACE_TEST R8MAT_NULLSPACE computes the nullspace of a matrix. Input A: Col: 0 1 2 3 4 Row 0: 1 3 0 2 6 1: -2 -6 0 -2 -8 2: 3 9 0 0 6 3: -1 -3 0 1 0 Col: 5 6 Row 0: 3 1 1: 3 1 2: 6 2 3: 9 3 Nullspace size is 4 Nullspace vectors: Col: 0 1 2 3 Row 0: -3 0 -2 0 1: 1 0 0 0 2: 0 1 0 0 3: 0 0 -2 0 4: 0 0 1 0 5: 0 0 0 -0.333333 6: 0 0 0 1 Product A * Nullspace vectors: Col: 0 1 2 3 Row 0: 0 0 0 0 1: 0 0 0 0 2: 0 0 0 0 3: 0 0 0 0 R8MAT_NULLSPACE_SIZE_TEST R8MAT_NULLSPACE_SIZE computes the size of the nullspace of a matrix. Input A: Col: 0 1 2 3 4 Row 0: 1 3 0 2 6 1: -2 -6 0 -2 -8 2: 3 9 0 0 6 3: -1 -3 0 1 0 Col: 5 6 Row 0: 3 1 1: 3 1 2: 6 2 3: 9 3 Nullspace size is 4 R8MAT_ORTH_UNIFORM_NEW_TEST R8MAT_ORTH_UNIFORM_NEW computes a random orthogonal matrix. Random orthogonal matrix A Col: 0 1 2 3 4 Row 0: -0.559743 -0.371903 -0.0337166 0.68224 0.285986 1: 0.188708 -0.906112 0.0432361 -0.368531 0.0752686 2: -0.404357 -0.0795868 -0.732356 -0.200174 -0.503733 3: -0.423174 0.184571 -0.114406 -0.542494 0.692437 4: 0.555425 0.0157436 -0.668999 0.253702 0.423476 AT*A Col: 0 1 2 3 4 Row 0: 1 -2.60209e-17 -1.66533e-16 5.55112e-17 2.22045e-16 1: -2.60209e-17 1 -2.60209e-17 -2.68882e-17 3.03577e-17 2: -1.66533e-16 -2.60209e-17 1 -1.94289e-16 -2.22045e-16 3: 5.55112e-17 -2.68882e-17 -1.94289e-16 1 1.38778e-17 4: 2.22045e-16 3.03577e-17 -2.22045e-16 1.38778e-17 1 R8MAT_PLOT_TEST R8MAT_PLOT prints a symbolic picture of a matrix. Typically, - for negative, 0 for zero, and + for positive entries or X for nonzero and 0 for zero. A plot of the matrix: 1234567890123456789012345678901234567890123456789012345678901234567890 1 -+00000000000000000000000000000000000000000000000000000000000000000000 2 +-+0000000000000000000000000000000000000000000000000000000000000000000 3 0+-+000000000000000000000000000000000000000000000000000000000000000000 4 00+-+00000000000000000000000000000000000000000000000000000000000000000 5 000+-+0000000000000000000000000000000000000000000000000000000000000000 6 0000+-+000000000000000000000000000000000000000000000000000000000000000 7 00000+-+00000000000000000000000000000000000000000000000000000000000000 8 000000+-+0000000000000000000000000000000000000000000000000000000000000 9 0000000+-+000000000000000000000000000000000000000000000000000000000000 10 00000000+-+00000000000000000000000000000000000000000000000000000000000 123456789012345678901234567890 1 00000000000000000000000000000+ 2 000000000000000000000000000000 3 000000000000000000000000000000 4 000000000000000000000000000000 5 000000000000000000000000000000 6 000000000000000000000000000000 7 000000000000000000000000000000 8 000000000000000000000000000000 9 000000000000000000000000000000 10 000000000000000000000000000000 R8MAT_POWER_METHOD_TEST R8MAT_POWER_METHOD applies the power method to a matrix. Estimated eigenvalue = 3.73198 Estimated eigenvector V: 0: 0.292877 1: -0.499987 2: 0.573126 3: -0.499987 4: 0.292877 Value of A*V: 0: 1.08574 1: -1.86598 2: 2.14622 3: -1.86598 4: 1.08574 R8MAT_PRINT_TEST R8MAT_PRINT prints an R8MAT. The R8MAT: Col: 0 1 2 3 Row 0: 11 12 13 14 1: 21 22 23 24 2: 31 32 33 34 3: 41 42 43 44 4: 51 52 53 54 5: 61 62 63 64 R8MAT_PRINT_SOME_TEST R8MAT_PRINT_SOME prints some of an R8MAT. The R8MAT, rows 2:4, cols 1:2: Col: 0 1 Row 1: 21 22 2: 31 32 3: 41 42 R8MAT_PRODUCT_ELEMENTWISE_TEST R8MAT_PRODUCT_ELEMENTWISE computes the elementwise product of two R8MATs. A: Col: 0 1 2 Row 0: 1 2 3 1: 4 5 6 B: Col: 0 1 2 Row 0: 1 3 5 1: 2 4 6 Elementwise product = 86 R8MAT_REF_TEST R8MAT_REF computes the row echelon form of a matrix. Input A: Col: 0 1 2 3 4 Row 0: 1 3 0 2 6 1: -2 -6 0 -2 -8 2: 3 9 0 0 6 3: -1 -3 0 1 0 Col: 5 6 Row 0: 3 1 1: 3 1 2: 6 2 3: 9 3 Pseudo-determinant = 48 REF form: Col: 0 1 2 3 4 Row 0: 1 3 0 2 6 1: 0 0 0 1 2 2: 0 0 0 0 0 3: 0 0 0 0 0 Col: 5 6 Row 0: 3 1 1: 4.5 1.5 2: 1 0.333333 3: 0 0 R8MAT_RREF_TEST R8MAT_RREF computes the reduced row echelon form of a matrix. Input A: Col: 0 1 2 3 4 Row 0: 1 3 0 2 6 1: -2 -6 0 -2 -8 2: 3 9 0 0 6 3: -1 -3 0 1 0 Col: 5 6 Row 0: 3 1 1: 3 1 2: 6 2 3: 9 3 Pseudo-determinant = 48 REF form: Col: 0 1 2 3 4 Row 0: 1 3 0 0 2 1: 0 0 0 1 2 2: 0 0 0 0 0 3: 0 0 0 0 0 Col: 5 6 Row 0: 0 0 1: 0 0 2: 1 0.333333 3: 0 0 R8MAT_SCALE_01_TEST R8MAT_SCALE_01 shifts and scales an R8MAT so that every column has min 0 and max 1. Matrix X: Col: 0 1 2 Row 0: -0.631634 -3.76546 12.1819 1: 14.1264 3.99078 11.8169 2: 11.5902 3.02613 -2.53792 3: 6.23391 10.0935 -4.84975 4: 3.30614 10.9457 0.20606 5: -3.67763 -4.96323 13.2497 6: 0.151556 12.9501 -2.72672 7: -2.80086 2.01505 2.03257 8: -4.12342 -3.1091 11.4577 9: 7.67931 -4.72766 0.342645 mean(X): 3.18539 2.64558 4.11732 sigma(X): 6.49767 6.82621 7.20369 xmax(X): 14.1264 12.9501 13.2497 xmin(X): -4.12342 -4.96323 -4.84975 Matrix XS: Col: 0 1 2 Row 0: 0.191333 0.0668652 0.941007 1: 1 0.499852 0.920841 2: 0.86103 0.446001 0.12773 3: 0.567532 0.840531 0 4: 0.407104 0.888109 0.279336 5: 0.0244274 0 1 6: 0.234248 1 0.117298 7: 0.0724697 0.389558 0.380251 8: 0 0.103506 0.900995 9: 0.646733 0.0131506 0.286882 mean(XS): 0.400488 0.424757 0.495434 sigma(XS): 0.356041 0.381069 0.398006 xmax(XS): 1 1 1 xmin(XS): 0 0 0 R8MAT_SCALE_AB_TEST R8MAT_SCALE_AB shifts and scales an R8MAT so that every column has min A and max B. Matrix X: Col: 0 1 2 Row 0: -0.631634 -3.76546 12.1819 1: 14.1264 3.99078 11.8169 2: 11.5902 3.02613 -2.53792 3: 6.23391 10.0935 -4.84975 4: 3.30614 10.9457 0.20606 5: -3.67763 -4.96323 13.2497 6: 0.151556 12.9501 -2.72672 7: -2.80086 2.01505 2.03257 8: -4.12342 -3.1091 11.4577 9: 7.67931 -4.72766 0.342645 mean(X): 3.18539 2.64558 4.11732 sigma(X): 6.49767 6.82621 7.20369 xmax(X): 14.1264 12.9501 13.2497 xmin(X): -4.12342 -4.96323 -4.84975 New scale interval = [-1,1] Matrix XS: Col: 0 1 2 Row 0: -0.617334 -0.86627 0.882014 1: 1 -0.000295324 0.841683 2: 0.72206 -0.107998 -0.744541 3: 0.135064 0.681063 -1 4: -0.185791 0.776218 -0.441329 5: -0.951145 -1 1 6: -0.531504 1 -0.765403 7: -0.855061 -0.220883 -0.239498 8: -1 -0.792989 0.801991 9: 0.293467 -0.973699 -0.426236 mean(XS): -0.199024 -0.150485 -0.00913195 sigma(XS): 0.712082 0.762139 0.796013 xmax(XS): 1 1 1 xmin(XS): -1 -1 -1 R8MAT_SOLVE_TEST R8MAT_SOLVE solves linear systems. The linear system: Col: 0 1 2 3 4 Row 0: 1 2 3 14 7 1: 4 5 6 32 16 2: 7 8 0 23 7 The computed solutions: 1 1 2 0 3 2 R8MAT_SOLVE_2D_TEST R8MAT_SOLVE_2D solves 2D linear systems. Solution / Computed: 0.415307 0.415307 0.0661187 0.0661187 Solution / Computed: 0.0617272 0.0617272 0.449539 0.449539 Solution / Computed: 0.897504 0.897504 0.350752 0.350752 Solution / Computed: 0.123104 0.123104 0.00751236 0.00751236 Solution / Computed: 0.822887 0.822887 0.267132 0.267132 R8MAT_SOLVE_3D_TEST R8MAT_SOLVE_3D solves 3D linear systems. Solution / Computed: 0.633966 0.633966 0.0617272 0.0617272 0.449539 0.449539 Solution / Computed: 0.840847 0.840847 0.123104 0.123104 0.00751236 0.00751236 Solution / Computed: 0.453794 0.453794 0.911977 0.911977 0.597917 0.597917 Solution / Computed: 0.714471 0.714471 0.117707 0.117707 0.299329 0.299329 Solution / Computed: 0.763537 0.763537 0.761731 0.761731 0.40697 0.40697 R8MAT_SOLVE2_TEST R8MAT_SOLVE2 is a linear solver. Right hand side: 0: 5 1: 11 The system is nonsingular. Computed solution: 0: 1 1: 2 Right hand side: 0: 4 1: 2 2: 2 R8MAT_SOLVE2 - Warning: Consistent singularity, equation = 3 The system is singular, but consistent. Computed solution: 0: 2 1: 0 2: 0 Right hand side: 0: 5 1: 11 2: 16 3: 15 The system is nonsingular. Computed solution: 0: -2 1: -6 2: 10 3: 7 Right hand side: 0: 13 1: 17 2: 20 R8MAT_SOLVE2 - Warning: Inconsistent singularity, equation = 2 The system is singular and inconsistent. Computed solution: 0: 6.42857 1: 0 2: 0.142857 R8MAT_STANDARDIZE_TEST R8MAT_STANDARDIZE shifts and scales an R8MAT so that every column has zero mean and unit standard deviation. Matrix X: Col: 0 1 2 Row 0: -0.631634 -3.76546 12.1819 1: 14.1264 3.99078 11.8169 2: 11.5902 3.02613 -2.53792 3: 6.23391 10.0935 -4.84975 4: 3.30614 10.9457 0.20606 5: -3.67763 -4.96323 13.2497 6: 0.151556 12.9501 -2.72672 7: -2.80086 2.01505 2.03257 8: -4.12342 -3.1091 11.4577 9: 7.67931 -4.72766 0.342645 mean(X): 3.18539 2.64558 4.11732 sigma(X): 6.49767 6.82621 7.20369 xmax(X): 14.1264 12.9501 13.2497 xmin(X): -4.12342 -4.96323 -4.84975 Matrix XS: Col: 0 1 2 Row 0: -0.587445 -0.939178 1.11951 1: 1.68383 0.197064 1.06885 2: 1.29351 0.0557479 -0.923866 3: 0.469171 1.09107 -1.24479 4: 0.0185836 1.21592 -0.542952 5: -1.05623 -1.11465 1.26773 6: -0.466911 1.50955 -0.950074 7: -0.921293 -0.0923692 -0.2894 8: -1.12484 -0.843027 1.01898 9: 0.691621 -1.08014 -0.523992 mean(XS): -2.22045e-17 -4.44089e-17 1.66533e-16 sigma(XS): 1 1 1 xmax(XS): 1.68383 1.50955 1.26773 xmin(XS): -1.12484 -1.11465 -1.24479 R8MAT_SYMM_JACOBI_TEST For a symmetric R8MAT: R8MAT_SYMM_JACOBI diagonalizes; Matrix to diagonalize: Col: 0 1 2 3 4 Row 0: 2.86409 -0.334105 -0.906958 -0.379152 1.04295 1: -0.334105 2.25488 0.0784356 0.631118 -0.225108 2: -0.906958 0.0784356 3.21422 -0.91655 -0.026989 3: -0.379152 0.631118 -0.91655 3.86102 0.916005 4: 1.04295 -0.225108 -0.026989 0.916005 2.80579 Computed Eigenvalues: 1 2 4 5 3 R8MAT_TO_R8CMAT_NEW_TEST R8MAT_TO_R8CMAT_NEW converts an R8MAT to an R8CMAT. Data is of order (5,4. The R8MAT A: Col: 0 1 2 3 Row 0: 11 12 13 14 1: 21 22 23 24 2: 31 32 33 34 3: 41 42 43 44 4: 51 52 53 54 The R8CMAT B: Col: 0 1 2 3 Row 0: 11 12 13 14 1: 21 22 23 24 2: 31 32 33 34 3: 41 42 43 44 4: 51 52 53 54 The R8MAT C: Col: 0 1 2 3 Row 0: 11 12 13 14 1: 21 22 23 24 2: 31 32 33 34 3: 41 42 43 44 4: 51 52 53 54 R8MAT_TO_R8PLU_TEST R8MAT_TO_R8PLU determines the compressed PLU factors of a real general matrix. Matrix order N = 5 The matrix A: Col: 0 1 2 3 4 Row 0: 0.218418 0.0661187 0.0617272 0.00183837 0.859097 1: 0.956318 0.257578 0.449539 0.897504 0.840847 2: 0.829509 0.109957 0.401306 0.350752 0.123104 3: 0.561695 0.043829 0.754673 0.0945448 0.00751236 4: 0.415307 0.633966 0.797287 0.0136169 0.260303 The pivot vector P: 0: 2 1: 5 2: 4 3: 4 4: 5 The compressed LU factors: Col: 0 1 2 3 4 Row 0: 0.956318 0.257578 0.449539 0.897504 0.840847 1: -0.228395 0.522106 0.602062 -0.376149 -0.104858 2: -0.867399 0.217324 0.614552 -0.510026 -0.507943 3: -0.587352 0.20582 -0.231419 -0.391459 -0.511487 4: -0.434277 -0.0139612 0.0803036 -0.610161 0.939815 The recovered matrix A2: Col: 0 1 2 3 4 Row 0: 0.218418 0.0661187 0.0617272 0.00183837 0.859097 1: 0.956318 0.257578 0.449539 0.897504 0.840847 2: 0.829509 0.109957 0.401306 0.350752 0.123104 3: 0.561695 0.043829 0.754673 0.0945448 0.00751236 4: 0.415307 0.633966 0.797287 0.0136169 0.260303 R8MAT_TO_R8RMAT_TEST R8MAT_TO_R8RMAT converts an R8MAT to an R8RMAT. Data is of order (5,4). The R8MAT A: Col: 0 1 2 3 Row 0: 11 12 13 14 1: 21 22 23 24 2: 31 32 33 34 3: 41 42 43 44 4: 51 52 53 54 The R8RMAT B: Col: 0 1 2 3 Row 0: 11 12 13 14 1: 21 22 23 24 2: 31 32 33 34 3: 41 42 43 44 4: 51 52 53 54 The R8MAT C: Col: 0 1 2 3 Row 0: 11 12 13 14 1: 21 22 23 24 2: 31 32 33 34 3: 41 42 43 44 4: 51 52 53 54 R8MAT_TRACE_TEST R8MAT_TRACE computes the trace of an R8MAT Matrix: Col: 0 1 2 3 Row 0: 4 3 2 1 1: 3 3 2 1 2: 0 2 2 1 3: 0 0 1 1 Trace is 10 R8MAT_TRANSPOSE_NEW_TEST R8MAT_TRANSPOSE_NEW transposes an R8MAT. Matrix A: Col: 0 1 2 3 Row 0: 11 12 13 14 1: 21 22 23 24 2: 31 32 33 34 3: 41 42 43 44 4: 51 52 53 54 Transposed matrix At: Col: 0 1 2 3 4 Row 0: 11 21 31 41 51 1: 12 22 32 42 52 2: 13 23 33 43 53 3: 14 24 34 44 54 R8MAT_TRANSPOSE_PRINT_TEST R8MAT_TRANSPOSE_PRINT prints an R8MAT, transposed. Matrix row order M = 7 Matrix column order N = 12 The transposed matrix A: Row: 0 1 2 3 4 Col 0: 101 201 301 401 501 1: 102 202 302 402 502 2: 103 203 303 403 503 3: 104 204 304 404 504 4: 105 205 305 405 505 5: 106 206 306 406 506 6: 107 207 307 407 507 7: 108 208 308 408 508 8: 109 209 309 409 509 9: 110 210 310 410 510 10: 111 211 311 411 511 11: 112 212 312 412 512 Row: 5 6 Col 0: 601 701 1: 602 702 2: 603 703 3: 604 704 4: 605 705 5: 606 706 6: 607 707 7: 608 708 8: 609 709 9: 610 710 10: 611 711 11: 612 712 R8MAT_TRANSPOSE_PRINT_SOME_TEST R8MAT_TRANSPOSE_PRINT_SOME prints some of an R8MAT, transposed. Matrix row order M = 7 Matrix column order N = 12 Rows 3:5, Cols 4:8: Row: 2 3 4 Col 3: 304 404 504 4: 305 405 505 5: 306 406 506 6: 307 407 507 7: 308 408 508 R8MAT_U_INVERSE_TEST R8MAT_U_INVERSE inverts an upper triangular R8MAT. Input matrix A Col: 0 1 2 3 Row 0: 1 2 4 7 1: 0 3 5 8 2: 0 0 6 9 3: 0 0 0 10 Inverse matrix B: Col: 0 1 2 3 Row 0: 1 -0.666667 -0.111111 -0.0666667 1: 0 0.333333 -0.277778 -0.0166667 2: 0 0 0.166667 -0.15 3: 0 0 0 0.1 Product C = A * B: Col: 0 1 2 3 Row 0: 1 0 0 0 1: 0 1 0 0 2: 0 0 1 1.11022e-16 3: 0 0 0 1 R8MAT_U_SOLVE_TEST R8MAT_U_SOLVE solves an upper triangular system. Input matrix A: Col: 0 1 2 3 Row 0: 1 2 4 7 1: 0 3 5 8 2: 0 0 6 9 3: 0 0 0 10 Right hand side b: 0: 45 1: 53 2: 54 3: 40 Solution x: 0: 1 1: 2 2: 3 3: 4 Norm of residual = 0 R8MAT_U1_INVERSE_TEST R8MAT_U1_INVERSE inverts a unit upper triangular R8MAT. Input matrix A Col: 0 1 2 3 4 Row 0: 1 2 0 5 0 1: 0 1 0 0 0 2: 0 0 1 3 0 3: 0 0 0 1 0 4: 0 0 0 0 1 5: 0 0 0 0 0 Col: 5 Row 0: 75 1: 0 2: 0 3: 6 4: 4 5: 1 Inverse matrix B: Col: 0 1 2 3 4 Row 0: 1 -2 0 -5 0 1: 0 1 0 0 0 2: 0 0 1 -3 0 3: 0 0 0 1 0 4: 0 0 0 0 1 5: 0 0 0 0 0 Col: 5 Row 0: -45 1: 0 2: 18 3: -6 4: -4 5: 1 Product C = A * B: Col: 0 1 2 3 4 Row 0: 1 0 0 0 0 1: 0 1 0 0 0 2: 0 0 1 0 0 3: 0 0 0 1 0 4: 0 0 0 0 1 5: 0 0 0 0 0 Col: 5 Row 0: 0 1: 0 2: 0 3: 0 4: 0 5: 1 R8MAT_UNIFORM_AB_NEW_TEST R8MAT_UNIFORM_AB_NEW returns a random R8MAT in [A,B]. The random R8MAT: Col: 0 1 2 3 Row 0: 3.74735 2.52895 2.49382 2.01471 1: 9.65054 4.06062 5.59631 9.18003 2: 8.63607 2.87965 5.21045 4.80602 3: 6.49356 2.35063 8.03739 2.75636 4: 5.32246 7.07173 8.3783 2.10894 R8MAT_UT_SOLVE_TEST R8MAT_UT_SOLVE solves a transposed upper triangular system. Input matrix A: Col: 0 1 2 3 Row 0: 1 2 4 7 1: 0 3 5 8 2: 0 0 6 9 3: 0 0 0 10 Right hand side b: 0: 1 1: 8 2: 32 3: 90 Solution x: 0: 1 1: 2 2: 3 3: 4 Norm of residual (A'*x-b) = 0 R8PLU_DET_TEST R8PLU_DET determines the determinant of an R8MAT from its compressed PLU factors. Matrix order N = 5 The matrix A: Col: 0 1 2 3 4 Row 0: 0.218418 0.0661187 0.0617272 0.00183837 0.859097 1: 0.956318 0.257578 0.449539 0.897504 0.840847 2: 0.829509 0.109957 0.401306 0.350752 0.123104 3: 0.561695 0.043829 0.754673 0.0945448 0.00751236 4: 0.415307 0.633966 0.797287 0.0136169 0.260303 The determinant = 0.112888 R8PLU_INVERSE_TEST R8PLU_INVERSE determines the inverse of an R8MAT from its compressed PLU factors. Matrix order N = 5 The matrix A: Col: 0 1 2 3 4 Row 0: 0.218418 0.0661187 0.0617272 0.00183837 0.859097 1: 0.956318 0.257578 0.449539 0.897504 0.840847 2: 0.829509 0.109957 0.401306 0.350752 0.123104 3: 0.561695 0.043829 0.754673 0.0945448 0.00751236 4: 0.415307 0.633966 0.797287 0.0136169 0.260303 The inverse B: Col: 0 1 2 3 4 Row 0: 0.625209 -1.0222 2.84978 -0.868794 -0.0840984 1: -0.471548 -0.149728 0.892032 -2.1207 1.67928 2: -0.274368 0.546937 -1.95265 2.05705 0.00285593 3: -1.39029 1.75848 -1.70625 0.283212 -0.293107 4: 1.06404 0.228349 -0.649235 0.235691 -0.107439 Product C = A * B: Col: 0 1 2 3 4 Row 0: 1 1.11022e-16 -1.11022e-16 0 -1.38778e-17 1: -2.22045e-16 1 1.11022e-16 -1.38778e-16 -2.77556e-17 2: -2.498e-16 3.53884e-16 1 -1.76942e-16 0 3: -3.01842e-16 3.60389e-16 -2.10769e-16 1 -1.01915e-17 4: -1.11022e-16 6.245e-17 -1.66533e-16 -1.94289e-16 1 R8PLU_MUL_TEST R8PLU_MUL computes the product A*x using the compressed PLU factors of A. Matrix order N = 5 The matrix A: Col: 0 1 2 3 4 Row 0: 0.218418 0.0661187 0.0617272 0.00183837 0.859097 1: 0.956318 0.257578 0.449539 0.897504 0.840847 2: 0.829509 0.109957 0.401306 0.350752 0.123104 3: 0.561695 0.043829 0.754673 0.0945448 0.00751236 4: 0.415307 0.633966 0.797287 0.0136169 0.260303 The right hand side B (computed from A): 0: 4.83868 1: 10.6143 2: 4.27187 3: 3.32911 4: 5.43108 The right hand side B (computed from PLU): 0: 4.83868 1: 10.6143 2: 4.27187 3: 3.32911 4: 5.43108 R8PLU_SOL_TEST R8PLU_SOL solves the linear system A*x=b using the compressed PLU factors of A. Matrix order N = 5 The matrix A: Col: 0 1 2 3 4 Row 0: 0.218418 0.0661187 0.0617272 0.00183837 0.859097 1: 0.956318 0.257578 0.449539 0.897504 0.840847 2: 0.829509 0.109957 0.401306 0.350752 0.123104 3: 0.561695 0.043829 0.754673 0.0945448 0.00751236 4: 0.415307 0.633966 0.797287 0.0136169 0.260303 The right hand side B (computed from A): 0: 4.83868 1: 10.6143 2: 4.27187 3: 3.32911 4: 5.43108 The computed solution X: 0: 1 1: 2 2: 3 3: 4 4: 5 R8PLU_TO_R8MAT_TEST R8PLU_TO_R8MAT determines the original matrix from the compressed PLU factors. Matrix order N = 5 The matrix A: Col: 0 1 2 3 4 Row 0: 0.218418 0.0661187 0.0617272 0.00183837 0.859097 1: 0.956318 0.257578 0.449539 0.897504 0.840847 2: 0.829509 0.109957 0.401306 0.350752 0.123104 3: 0.561695 0.043829 0.754673 0.0945448 0.00751236 4: 0.415307 0.633966 0.797287 0.0136169 0.260303 The pivot vector P: 0: 2 1: 5 2: 4 3: 4 4: 5 The compressed LU factors: Col: 0 1 2 3 4 Row 0: 0.956318 0.257578 0.449539 0.897504 0.840847 1: -0.228395 0.522106 0.602062 -0.376149 -0.104858 2: -0.867399 0.217324 0.614552 -0.510026 -0.507943 3: -0.587352 0.20582 -0.231419 -0.391459 -0.511487 4: -0.434277 -0.0139612 0.0803036 -0.610161 0.939815 The recovered matrix A2: Col: 0 1 2 3 4 Row 0: 0.218418 0.0661187 0.0617272 0.00183837 0.859097 1: 0.956318 0.257578 0.449539 0.897504 0.840847 2: 0.829509 0.109957 0.401306 0.350752 0.123104 3: 0.561695 0.043829 0.754673 0.0945448 0.00751236 4: 0.415307 0.633966 0.797287 0.0136169 0.260303 R8R8_INDEX_INSERT_UNIQUE_TEST R8R8VEC_INDEX_INSERT_UNIQUE inserts unique values into an index sorted array. Generate 30 random values: XVAL YVAL Index 1 2 3 2 3 2 3 2 1 3 2 1 4 1 2 4 1 2 1 2 3 5 3 1 6 4 2 7 1 1 8 4 3 7 1 1 1 2 3 4 1 2 2 3 2 2 3 2 6 4 2 6 4 2 1 2 3 3 2 1 2 3 2 2 3 2 9 2 2 4 1 2 10 3 3 4 1 2 11 1 3 2 3 2 8 4 3 2 3 2 Vector of unique X Y values: I X(I) Y(I) 1 2 3 2 3 2 3 2 1 4 1 2 5 3 1 6 4 2 7 1 1 8 4 3 9 2 2 10 3 3 11 1 3 X, Y sorted by index I INDX(I) X(INDX(I)) Y(INDX(I)) 1 7 1 1 2 4 1 2 3 11 1 3 4 3 2 1 5 9 2 2 6 1 2 3 7 5 3 1 8 2 3 2 9 10 3 3 10 6 4 2 11 8 4 3 R8R8R8VEC_INDEX_INSERT_UNIQUE_TEST R8R8R8VEC_INDEX_INSERT_UNIQUE inserts unique values into an index sorted array. Number of random values to generate = 30 XVAL YVAL ZVAL Index 2 3 3 1 3 2 1 2 2 1 1 3 3 1 2 4 2 3 3 1 1 3 2 5 1 1 4 6 4 1 1 7 2 3 1 8 2 3 2 9 3 2 4 10 2 3 3 1 2 3 2 9 2 2 2 11 3 2 2 12 3 1 2 4 3 3 1 13 3 1 3 14 3 2 4 10 3 3 2 15 4 2 1 16 3 1 2 4 2 3 1 8 1 1 1 17 2 1 2 18 2 2 3 19 3 1 3 14 3 2 4 10 4 3 3 20 1 2 2 21 Vector of unique X Y Z values: I X(I) Y(I) Z(I) 1 2 3 3 2 3 2 1 3 2 1 1 4 3 1 2 5 1 3 2 6 1 1 4 7 4 1 1 8 2 3 1 9 2 3 2 10 3 2 4 11 2 2 2 12 3 2 2 13 3 3 1 14 3 1 3 15 3 3 2 16 4 2 1 17 1 1 1 18 2 1 2 19 2 2 3 20 4 3 3 21 1 2 2 X Y Z sorted by index: I INDX(I) X(I) X(INDX(I)) 1 17 1 1 1 2 6 1 1 4 3 21 1 2 2 4 5 1 3 2 5 3 2 1 1 6 18 2 1 2 7 11 2 2 2 8 19 2 2 3 9 8 2 3 1 10 9 2 3 2 11 1 2 3 3 12 4 3 1 2 13 14 3 1 3 14 2 3 2 1 15 12 3 2 2 16 10 3 2 4 17 13 3 3 1 18 15 3 3 2 19 7 4 1 1 20 16 4 2 1 21 20 4 3 3 R8RMAT_NEW_TEST: R8RMAT_NEW dynamically creates a 2D array. Array entries can be addressed using the notation "a[i][j]". Allocating memory for array A of size 4 by 5. Assigning values to A. Dynamically allocated matrix A: 0 1 2 3 4 10 11 12 13 14 20 21 22 23 24 30 31 32 33 34 Dynamically allocated matrix B = A' * A: 1400 1460 1520 1580 1640 1460 1524 1588 1652 1716 1520 1588 1656 1724 1792 1580 1652 1724 1796 1868 1640 1716 1792 1868 1944 R8RMAT_TO_R8MAT_TEST R8RMAT_TO_R8MAT converts an R8RMAT to an R8MAT. Data is of order (5,4). The R8MAT A: Col: 0 1 2 3 Row 0: 11 12 13 14 1: 21 22 23 24 2: 31 32 33 34 3: 41 42 43 44 4: 51 52 53 54 The R8RMAT B: Col: 0 1 2 3 Row 0: 11 12 13 14 1: 21 22 23 24 2: 31 32 33 34 3: 41 42 43 44 4: 51 52 53 54 The R8MAT C: Col: 0 1 2 3 Row 0: 11 12 13 14 1: 21 22 23 24 2: 31 32 33 34 3: 41 42 43 44 4: 51 52 53 54 R8ROWS_TO_R8MAT_TEST R8ROWS_TO_R8MAT allows an R8MAT to be initialized by data stored ROW-WISE in a vector. The data vector: 0: 11 1: 12 2: 13 3: 14 4: 21 5: 22 6: 23 7: 24 8: 31 9: 32 10: 33 11: 34 The data copied into an array: Col: 0 1 2 3 Row 0: 11 12 13 14 1: 21 22 23 24 2: 31 32 33 34 R8SLMAT_PRINT_TEST R8SLMAT_PRINT prints a strictly lower triangular matrix stored compactly. Only the (possibly) nonzero elements are printed. R8SLMAT: Col 1 2 3 4 5 Row 2: 21 3: 31 32 4: 41 42 43 5: 51 52 53 54 6: 61 62 63 64 65 7: 71 72 73 74 75 Col 6 Row 7: 76 R8SLMAT: Col 1 2 3 Row 2: 21 3: 31 32 4: 41 42 43 5: 51 52 53 6: 61 62 63 7: 71 72 73 R8SLMAT: Col 1 2 3 Row 2: 21 3: 31 32 4: 41 42 43 R8VEC_AMAX_TEST For an R8VEC: R8VEC_AMAX: maximum magnitude entry; Input vector: 0: -5.63163 1: 9.12635 2: 6.59018 3: 1.23391 4: -1.69386 5: -8.67763 6: -4.84844 7: -7.80086 8: -9.12342 9: 2.67931 Maximum absolute: 9.12635 R8VEC_AMIN_TEST For an R8VEC: R8VEC_AMIN: minimum magnitude entry. Input vector: 0: -5.63163 1: 9.12635 2: 6.59018 3: 1.23391 4: -1.69386 5: -8.67763 6: -4.84844 7: -7.80086 8: -9.12342 9: 2.67931 Minimum absolute: 1.23391 R8VEC_APPEND_TEST R8VEC_APPEND appends a value to the end of an R8VEC; Initial array A: 0: 0.5 1: 1.5 2: 2.5 3: 3.5 4: 4.5 Array A after append: 0: 0.5 1: 1.5 2: 2.5 3: 3.5 4: 4.5 5: 17.25 R8VEC_APPEND_NEW_TEST R8VEC_APPEND_NEW appends a value to the end of an R8VEC; Vector after step 1 0: 1.5 Vector after step 2 0: 1.5 1: 2.5 Vector after step 3 0: 1.5 1: 2.5 2: 3.5 Vector after step 4 0: 1.5 1: 2.5 2: 3.5 3: 4.5 Vector after step 5 0: 1.5 1: 2.5 2: 3.5 3: 4.5 4: 5.5 R8VEC_BINARY_NEXT_TEST R8VEC_BINARY_NEXT generates the next binary vector. 0 0 0 0 0 1 0 1 0 0 1 1 1 0 0 1 0 1 1 1 0 1 1 1 R8VEC_BRACKET_TEST R8VEC_BRACKET finds a pair of entries in a sorted real array which bracket a value. The array (must be in ascending order!) 0: 1 1: 2 2: 3 3: 4 4: 5 5: 5 6: 7 7: 8 8: 9 9: 10 Search for XVAL = -10 X[1-1] = 1 X[2-1] = 2 Search for XVAL = 1 X[1-1] = 1 X[2-1] = 2 Search for XVAL = 4.5 X[4-1] = 4 X[5-1] = 5 Search for XVAL = 5 X[6-1] = 5 X[7-1] = 7 Search for XVAL = 10 X[9-1] = 9 X[10-1] = 10 Search for XVAL = 12 X[9-1] = 9 X[10-1] = 10 R8VEC_BRACKET2_TEST R8VEC_BRACKET2 finds a pair of entries in a sorted R8VEC which bracket a value. The array (must be in ascending order!) 0: 1 1: 2 2: 3 3: 4 4: 5 5: 5 6: 7 7: 8 8: 9 9: 10 Search for XVAL = -10 Start = 32767 Left = 1 Right = 2 X[1-1] = 1 X[2-1] = 2 Search for XVAL = 1 Start = 1 Left = 1 Right = 1 X[1-1] = 1 X[1-1] = 1 Search for XVAL = 4.5 Start = 1 Left = 4 Right = 5 X[4-1] = 4 X[5-1] = 5 Search for XVAL = 5 Start = 4 Left = 5 Right = 5 X[5-1] = 5 X[5-1] = 5 Search for XVAL = 10 Start = 5 Left = 9 Right = 10 X[9-1] = 9 X[10-1] = 10 Search for XVAL = 12 Start = 9 Left = 10 Right = -1 X[10-1] = 10 R8VEC_BRACKET3_TEST R8VEC_BRACKET3 finds a pair of entries in a sorted real array which bracket a value. The array (must be in ascending order!): 0: 1 1: 2 2: 3 3: 4 4: 5 5: 5 6: 7 7: 8 8: 9 9: 10 Search for XVAL = -10 Starting guess for interval is = 4 Nearest interval: X[0]= 1 X[1]= 2 Search for XVAL = 1 Starting guess for interval is = 0 Nearest interval: X[0]= 1 X[1]= 2 Search for XVAL = 4.5 Starting guess for interval is = 0 Nearest interval: X[3]= 4 X[4]= 5 Search for XVAL = 5 Starting guess for interval is = 3 Nearest interval: X[3]= 4 X[4]= 5 Search for XVAL = 10 Starting guess for interval is = 3 Nearest interval: X[8]= 9 X[9]= 10 Search for XVAL = 12 Starting guess for interval is = 8 Nearest interval: X[8]= 9 X[9]= 10 R8VEC_BRACKET5_TEST R8VEC_BRACKET5 finds a pair of entries in a sorted R8VEC which bracket a value. Sorted array: 0: 1 1: 2 2: 3 3: 4 4: 5 5: 5 6: 7 7: 8 8: 9 9: 10 LEFT RIGHT X(LEFT) XVAL X(RIGHT) -1 -10 (Not bracketed!) 0 1 1 1 2 3 4 4 4.5 5 5 6 5 5 7 8 9 9 10 10 -1 12 (Not bracketed!) R8VEC_CHEBY_EXTREME_NEW_TEST R8VEC_CHEBY_EXTREMEE_NEW computes N Chebyshev Extreme points in [R1,R2]. N = 5, R1 = -1, R2 = 1 Chebyshev points: 0: -1 1: -0.707107 2: 0 3: 0.707107 4: 1 N = 7, R1 = 0, R2 = 10 Chebyshev points: 0: 0 1: 0.669873 2: 2.5 3: 5 4: 7.5 5: 9.33013 6: 10 R8VEC_CHEBY_ZERO_NEW_TEST R8VEC_CHEBY_ZERO_NEW computes N Chebyshev Zero points in [R1,R2]. N = 5, R1 = -1, R2 = 1 Chebyshev points: 0: -0.951057 1: -0.587785 2: 0 3: 0.587785 4: 0.951057 N = 7, R1 = 0, R2 = 10 Chebyshev points: 0: 0.12536 1: 1.09084 2: 2.83058 3: 5 4: 7.16942 5: 8.90916 6: 9.87464 R8VEC_CONCATENATE_NEW_TEST R8VEC_CONCATENATE_NEW concatenates two R8VECs Array 1: 0: 91.1 1: 31.2 2: 71.3 3: 51.4 4: 31.5 Array 2: 0: 42.6 1: 22.7 2: 12.8 Array 3 = Array 1 + Array 2: 0: 91.1 1: 31.2 2: 71.3 3: 51.4 4: 31.5 5: 42.6 6: 22.7 7: 12.8 R8VEC_CONVOLUTION_TEST R8VEC_CONVOLUTION computes the convolution of two vectors. The factor X: 0: 1 1: 2 2: 3 3: 4 The factor Y: 0: -1 1: 5 2: 3 The convolution z = x star y: 0: -1 1: 3 2: 10 3: 17 4: 29 5: 12 Correct answer: 0: -1 1: 3 2: 10 3: 17 4: 29 5: 12 R8VEC_CONVOLUTION_CIRC_TEST R8VEC_CONVOLUTION_CIRC computes the circular convolution of two vectors. The factor X: 0: 1 1: 2 2: 3 3: 4 The factor Y: 0: 1 1: 2 2: 4 3: 8 The circular convolution z = xCCy: 0: 37 1: 44 2: 43 3: 26 Correct answer: 0: 37 1: 44 2: 43 3: 26 r8vec_correlation_test r8vec_correlation computes the correlation of two R8VEC's Vector v1: 0: 43 1: 21 2: 25 3: 42 4: 57 5: 59 Vector v2: 0: 99 1: 65 2: 79 3: 75 4: 87 5: 81 V1 V2 Correlation coefficient r = 0.529809 R8VEC_DIF_TEST R8VEC_DIF estimates derivatives. Estimate the derivative of order N = 4 Using H = 0.01 at argument X = 1 The difference coefficients: 0: 6.25e+06 1: -2.5e+07 2: 3.75e+07 3: -2.5e+07 4: 6.25e+06 Estimate is FDIF = 2.71846 R8VEC_DIFF_NORM_LI_TEST R8VEC_DIFF_NORM_LI computes the L-infinity norm of the difference of two R8VEC's Vector V1: 0: -5.63163 1: 9.12635 2: 6.59018 3: 1.23391 4: -1.69386 Vector V2: 0: -8.67763 1: -4.84844 2: -7.80086 3: -9.12342 4: 2.67931 L-Infinity norm of V1-V2 = 14.391 R8VEC_DIRECT_PRODUCT_TEST R8VEC_DIRECT_PRODUCT forms the entries of a direct product of a given number of R8VEC factors. J X(1) X(2) X(3) 0 1 50 800 1 2 50 800 2 3 50 800 3 4 50 800 4 1 60 800 5 2 60 800 6 3 60 800 7 4 60 800 8 1 70 800 9 2 70 800 10 3 70 800 11 4 70 800 12 1 50 900 13 2 50 900 14 3 50 900 15 4 50 900 16 1 60 900 17 2 60 900 18 3 60 900 19 4 60 900 20 1 70 900 21 2 70 900 22 3 70 900 23 4 70 900 R8VEC_DIRECT_PRODUCT2_TEST R8VEC_DIRECT_PRODUCT2 forms the entries of a direct product of a given number of R8VEC factors. J W(J) 0 418 1 627 2 1045 3 1463 4 494 5 741 6 1235 7 1729 8 646 9 969 10 1615 11 2261 12 462 13 693 14 1155 15 1617 16 546 17 819 18 1365 19 1911 20 714 21 1071 22 1785 23 2499 R8VEC_DOT_PRODUCT_TEST R8VEC_DOT_PRODUCT computes the dot product of two R8VEC's. V1 and V2: 0: 0.218418 0.0617272 1: 0.956318 0.449539 2: 0.829509 0.401306 3: 0.561695 0.754673 4: 0.415307 0.797287 5: 0.0661187 0.00183837 6: 0.257578 0.897504 7: 0.109957 0.350752 8: 0.043829 0.0945448 9: 0.633966 0.0136169 V1 dot V2 = 1.81393 R8VEC_EVEN_TEST R8VEC_EVEN computes N evenly spaced values between XLO and XHI. XLO = 0 XHI = 99 while N = 10 Resulting array: 0: 0 1: 11 2: 22 3: 33 4: 44 5: 55 6: 66 7: 77 8: 88 9: 99 R8VEC_EVEN2_TEST: R8VEC_EVEN2 interpolates a specified number of points pairs of values in a vector. Input data: 0 (4) 1 (3) 5 (5) 2 (0) 0 Resulting vector: * 0 0.2 0.4 0.6 0.8 * 1 2 3 4 * 5 4.5 4 3.5 3 2.5 * 2 * 0 R8VEC_EXPAND_LINEAR_TEST R8VEC_EXPAND_LINEAR linearly interpolates new data between old values. Original vector: 0: 16 1: 4 2: 0 3: 4 4: 16 5: 36 Expansion factor is 3 Fattened vector: 0: 16 1: 13 2: 10 3: 7 4: 4 5: 3 6: 2 7: 1 8: 0 9: 1 10: 2 11: 3 12: 4 13: 7 14: 10 15: 13 16: 16 17: 21 18: 26 19: 31 20: 36 R8VEC_FRAC_TEST R8VEC_FRAC: K-th smallest R8VEC entry; Array to search: 0: 0.218418 1: 0.956318 2: 0.829509 3: 0.561695 4: 0.415307 5: 0.0661187 6: 0.257578 7: 0.109957 8: 0.043829 9: 0.633966 Fractile Value 1 0.043829 6 0.415307 R8VEC_HISTOGRAM_TEST R8VEC_HISTOGRAM histograms a real vector. Uniform data: Histogram of data: 0 0 0 0.05 63 0.05 0.1 37 0.1 0.15 49 0.15 0.2 37 0.2 0.25 46 0.25 0.3 57 0.3 0.35 49 0.35 0.4 52 0.4 0.45 51 0.45 0.5 49 0.5 0.55 50 0.55 0.6 56 0.6 0.65 60 0.65 0.7 52 0.7 0.75 44 0.75 0.8 47 0.8 0.85 54 0.85 0.9 48 0.9 0.95 52 0.95 1 47 1 0 Normal data: Histogram of data: -3 0 -3 -2.7 2 -2.7 -2.4 2 -2.4 -2.1 11 -2.1 -1.8 12 -1.8 -1.5 32 -1.5 -1.2 55 -1.2 -0.9 66 -0.9 -0.6 75 -0.6 -0.3 115 -0.3 0 111 0 0.3 115 0.3 0.6 117 0.6 0.9 103 0.9 1.2 65 1.2 1.5 46 1.5 1.8 29 1.8 2.1 17 2.1 2.4 15 2.4 2.7 7 2.7 3 4 3 1 R8VEC_HOUSE_COLUMN_TEST R8VEC_HOUSE_COLUMN returns the compact form of a Householder matrix that packs a column of a matrix. Matrix A: Col: 0 1 2 3 Row 0: 1.09209 2.07654 0.219145 2.00653 1: 4.78159 0.330594 3.16983 3.77337 2: 4.14755 1.28789 0.308636 3.98643 3: 2.80848 0.549784 2.24769 0.00919186 Working on column K = 1 Householder matrix H: Col: 0 1 2 3 Row 0: -0.155781 -0.682069 -0.591626 -0.400615 1: -0.682069 0.597486 -0.34914 -0.236418 2: -0.591626 -0.34914 0.697156 -0.205068 3: -0.400615 -0.236418 -0.205068 0.86114 Product H*A: Col: 0 1 2 3 Row 0: -7.01042 -1.53117 -3.27924 -5.24844 1: -1.11022e-16 -1.79845 1.1053 -0.508058 2: -7.77156e-16 -0.558841 -1.48213 0.272729 3: -4.44089e-16 -0.700714 1.03509 -2.50551 Working on column K = 2 Householder matrix H: Col: 0 1 2 3 Row 0: 1 0 0 0 1: 0 -0.895014 -0.278112 -0.348717 2: 0 -0.278112 0.959184 -0.0511776 3: 0 -0.348717 -0.0511776 0.93583 Product H*A: Col: 0 1 2 3 Row 0: -7.01042 -1.53117 -3.27924 -5.24844 1: 4.70364e-16 2.00941 -0.938018 1.25258 2: -6.91832e-16 4.85723e-17 -1.78201 0.531121 3: -3.37104e-16 1.11022e-16 0.659083 -2.18152 Working on column K = 3 Householder matrix H: Col: 0 1 2 3 Row 0: 1 0 0 0 1: 0 1 0 0 2: 0 0 -0.937906 0.346889 3: 0 0 0.346889 0.937906 Product H*A: Col: 0 1 2 3 Row 0: -7.01042 -1.53117 -3.27924 -5.24844 1: 4.70364e-16 2.00941 -0.938018 1.25258 2: 5.31936e-16 -7.04386e-18 1.89999 -1.25489 3: -5.5616e-16 1.20978e-16 1.11022e-16 -1.86183 R8VEC_IDENTITY_ROW_NEW_TEST R8VEC_IDENTITY_ROW_NEW returns a row of the identity. -1: 0 0 0 0 0 0: 1 0 0 0 0 1: 0 1 0 0 0 2: 0 0 1 0 0 3: 0 0 0 1 0 4: 0 0 0 0 1 5: 0 0 0 0 0 R8VEC_INDEX_DELETE_ALL_TEST R8VEC_INDEX_DELETE_ALL deletes all copies of a particular value. 4 19 17 11 8 1 5 2 1 13 1 9 8 15 16 0 18 7 2 0 Indexed list of entries: I INDX(I) X(I) X(INDX(I)) 1 18 8 0 2 22 7 0 3 8 4 1 4 13 19 1 5 11 17 1 6 10 11 2 7 21 8 2 8 3 1 4 9 9 5 5 10 2 2 7 11 20 1 7 12 23 13 7 13 1 1 8 14 15 9 8 15 24 8 8 16 7 15 8 17 14 16 9 18 6 0 11 19 12 18 13 20 16 7 15 21 17 2 16 22 5 0 17 23 19 7 18 24 4 8 19 Call R8VEC_INDEX_DELETE_ALL to delete all values of 7: Indexed list of entries: I INDX(I) X(I) X(INDX(I)) 1 17 8 0 2 20 4 0 3 7 19 1 4 12 17 1 5 10 11 1 6 9 8 2 7 19 1 2 8 2 5 4 9 8 2 5 10 1 1 8 11 14 13 8 12 21 1 8 13 6 9 8 14 13 8 9 15 5 15 11 16 11 16 13 17 15 0 15 18 16 18 16 19 4 2 17 20 18 0 18 21 3 8 19 R8VEC_INDEX_DELETE_DUPES_TEST R8VEC_INDEX_DELETE_DUPES deletes duplicates. 4 19 17 11 8 1 5 2 1 13 1 9 8 15 16 0 18 7 2 0 Indexed list of entries: I INDX(I) X(I) X(INDX(I)) 1 18 8 0 2 22 7 0 3 8 4 1 4 13 19 1 5 11 17 1 6 10 11 2 7 21 8 2 8 3 1 4 9 9 5 5 10 2 2 7 11 20 1 7 12 23 13 7 13 1 1 8 14 15 9 8 15 24 8 8 16 7 15 8 17 14 16 9 18 6 0 11 19 12 18 13 20 16 7 15 21 17 2 16 22 5 0 17 23 19 7 18 24 4 8 19 Call R8VEC_INDEX_DELETE_DUPES to delete duplicates: Indexed list of unique entries: I INDX(I) X(I) 1 1 0 2 2 1 3 3 2 4 4 4 5 5 5 6 6 7 7 7 8 8 8 9 9 9 11 10 10 13 11 11 15 12 12 16 13 13 17 14 14 18 15 15 19 R8VEC_INDEX_DELETE_ONE_TEST R8VEC_INDEX_DELETE_ONE deletes one copies of a particular value. 4 19 17 11 8 1 5 2 1 13 1 9 8 15 16 0 18 7 2 0 Indexed list of entries: I INDX(I) X(I) X(INDX(I)) 1 18 8 0 2 22 7 0 3 8 4 1 4 13 19 1 5 11 17 1 6 10 11 2 7 21 8 2 8 3 1 4 9 9 5 5 10 2 2 7 11 20 1 7 12 23 13 7 13 1 1 8 14 15 9 8 15 24 8 8 16 7 15 8 17 14 16 9 18 6 0 11 19 12 18 13 20 16 7 15 21 17 2 16 22 5 0 17 23 19 7 18 24 4 8 19 Call R8VEC_INDEX_DELETE_ONE to delete one value of 8: Indexed list of unique entries: I INDX(I) X(I) 1 18 8 2 22 7 3 8 4 4 13 19 5 11 17 6 10 11 7 21 8 8 3 1 9 9 5 10 2 2 11 20 1 12 23 13 13 1 1 14 15 9 15 7 8 16 14 15 17 6 16 18 12 0 19 16 18 20 17 7 21 5 2 22 19 0 23 4 7 R8VEC_INDEX_INSERT_TEST R8VEC_INDEX_INSERT inserts values into an index sorted array. 4 19 17 11 8 1 5 2 1 13 1 9 8 15 16 0 18 7 2 0 Indexed list of entries: I INDX(I) X(I) X(INDX(I)) 1 18 8 0 2 22 7 0 3 8 4 1 4 13 19 1 5 11 17 1 6 10 11 2 7 21 8 2 8 3 1 4 9 9 5 5 10 2 2 7 11 20 1 7 12 23 13 7 13 1 1 8 14 15 9 8 15 24 8 8 16 7 15 8 17 14 16 9 18 6 0 11 19 12 18 13 20 16 7 15 21 17 2 16 22 5 0 17 23 19 7 18 24 4 8 19 R8VEC_INDEX_INSERT_UNIQUE_TEST R8VEC_INDEX_INSERT_UNIQUE inserts unique values into an index sorted array. 4 19 17 11 8 1 5 2 1 13 1 9 8 15 16 0 18 7 2 0 Indexed list of entries: I INDX(I) X(I) X(INDX(I)) 1 13 4 0 2 6 19 1 3 8 17 2 4 1 11 4 5 7 8 5 6 15 1 7 7 5 5 8 8 10 2 9 9 4 13 11 10 9 9 13 11 11 15 15 12 12 16 16 13 3 0 17 14 14 18 18 15 2 7 19 Results of search for given XVAL: XVAL Less Equal More 0 0 1 2 1 1 2 3 2 2 3 4 3 3 0 4 4 3 4 5 5 4 5 6 6 5 0 6 7 5 6 7 8 6 7 8 9 7 8 9 10 8 0 9 11 8 9 10 12 9 0 10 13 9 10 11 14 10 0 11 15 10 11 12 16 11 12 13 17 12 13 14 18 13 14 15 19 14 15 16 20 15 0 16 R8VEC_INDEX_ORDER_TEST R8VEC_INDEX_ORDER sorts an index sorted array. Generate some random values: 4 19 17 11 8 1 5 2 1 13 1 9 8 15 16 0 18 7 2 0 Indexed list of unique entries: I INDX(I) X(I) X(INDX(I)) 1 13 4 0 2 6 19 1 3 8 17 2 4 1 11 4 5 7 8 5 6 15 1 7 7 5 5 8 8 10 2 9 9 4 13 11 10 9 9 13 11 11 15 15 12 12 16 16 13 3 0 17 14 14 18 18 15 2 7 19 Now call R8VEC_INDEX_ORDER to carry out the sorting: X: 0: 0 1: 1 2: 2 3: 4 4: 5 5: 7 6: 8 7: 9 8: 11 9: 13 10: 15 11: 16 12: 17 13: 18 14: 19 R8VEC_INDEX_SEARCH_TEST R8VEC_INDEX_SEARCH searches for an entry with a given value. Generate some random values: 4 19 17 11 8 1 5 2 1 13 1 9 8 15 16 0 18 7 2 0 Indexed list of entries: I INDX(I) X(I) X(INDX(I)) 1 13 4 0 2 6 19 1 3 8 17 2 4 1 11 4 5 7 8 5 6 15 1 7 7 5 5 8 8 10 2 9 9 4 13 11 10 9 9 13 11 11 15 15 12 12 16 16 13 3 0 17 14 14 18 18 15 2 7 19 Results of search for given XVAL: XVAL Less Equal More 0 0 1 2 1 1 2 3 2 2 3 4 3 3 0 4 4 3 4 5 5 4 5 6 6 5 0 6 7 5 6 7 8 6 7 8 9 7 8 9 10 8 0 9 11 8 9 10 12 9 0 10 13 9 10 11 14 10 0 11 15 10 11 12 16 11 12 13 17 12 13 14 18 13 14 15 19 14 15 16 20 15 0 16 R8VEC_INDEX_SORTED_RANGE_TEST R8VEC_INDEX_SORTED_RANGE seeks the range I_LO:I_HI of entries of sorted indexed R so that R_LO <= R(INDX(I)) <= R_HI for I_LO <= I <= I_HI. Array 0: 0.218418 1: 0.956318 2: 0.829509 3: 0.561695 4: 0.415307 5: 0.0661187 6: 0.257578 7: 0.109957 8: 0.043829 9: 0.633966 10: 0.0617272 11: 0.449539 12: 0.401306 13: 0.754673 14: 0.797287 15: 0.00183837 16: 0.897504 17: 0.350752 18: 0.0945448 19: 0.0136169 I INDX R(INDX(I)) 0 15 0.00183837 1 19 0.0136169 2 8 0.043829 3 10 0.0617272 4 5 0.0661187 5 18 0.0945448 6 7 0.109957 7 0 0.218418 8 6 0.257578 9 17 0.350752 10 12 0.401306 11 4 0.415307 12 11 0.449539 13 3 0.561695 14 9 0.633966 15 13 0.754673 16 14 0.797287 17 2 0.829509 18 16 0.897504 19 1 0.956318 R_LO 0.840847 R_HI 0.859097 Empty range in R. Array 0: 0.123104 1: 0.00751236 2: 0.260303 3: 0.912484 4: 0.113664 5: 0.351629 6: 0.822887 7: 0.267132 8: 0.692066 9: 0.561662 10: 0.861216 11: 0.453794 12: 0.911977 13: 0.597917 14: 0.188955 15: 0.761492 16: 0.396988 17: 0.185314 18: 0.574366 19: 0.367027 I INDX R(INDX(I)) 0 1 0.00751236 1 4 0.113664 2 0 0.123104 3 17 0.185314 4 14 0.188955 5 2 0.260303 6 7 0.267132 7 5 0.351629 8 19 0.367027 9 16 0.396988 10 11 0.453794 11 9 0.561662 12 18 0.574366 13 13 0.597917 14 8 0.692066 15 15 0.761492 16 6 0.822887 17 10 0.861216 18 12 0.911977 19 3 0.912484 R_LO 0.361529 8 19 0.367027 9 16 0.396988 10 11 0.453794 11 9 0.561662 12 18 0.574366 13 13 0.597917 R_HI 0.617205 Array 0: 0.21293 1: 0.714471 2: 0.117707 3: 0.299329 4: 0.825003 5: 0.82466 6: 0.0618618 7: 0.710781 8: 0.0882833 9: 0.777994 10: 0.745303 11: 0.308675 12: 0.899373 13: 0.763537 14: 0.761731 15: 0.40697 16: 0.938749 17: 0.562088 18: 0.01782 19: 0.501103 I INDX R(INDX(I)) 0 18 0.01782 1 6 0.0618618 2 8 0.0882833 3 2 0.117707 4 0 0.21293 5 3 0.299329 6 11 0.308675 7 15 0.40697 8 19 0.501103 9 17 0.562088 10 7 0.710781 11 1 0.714471 12 10 0.745303 13 14 0.761731 14 13 0.763537 15 9 0.777994 16 5 0.82466 17 4 0.825003 18 12 0.899373 19 16 0.938749 R_LO 0.0419093 1 6 0.0618618 2 8 0.0882833 3 2 0.117707 4 0 0.21293 5 3 0.299329 6 11 0.308675 R_HI 0.368851 Array 0: 0.271724 1: 0.858573 2: 0.0290366 3: 0.0174423 4: 0.152384 5: 0.114319 6: 0.353907 7: 0.119308 8: 0.206653 9: 0.212924 10: 0.612948 11: 0.809519 12: 0.58709 13: 0.215492 14: 0.768056 15: 0.723297 16: 0.448019 17: 0.855176 18: 0.945017 19: 0.909057 I INDX R(INDX(I)) 0 3 0.0174423 1 2 0.0290366 2 5 0.114319 3 7 0.119308 4 4 0.152384 5 8 0.206653 6 9 0.212924 7 13 0.215492 8 0 0.271724 9 6 0.353907 10 16 0.448019 11 12 0.58709 12 10 0.612948 13 15 0.723297 14 14 0.768056 15 11 0.809519 16 17 0.855176 17 1 0.858573 18 19 0.909057 19 18 0.945017 R_LO 0.0301946 2 5 0.114319 3 7 0.119308 4 4 0.152384 5 8 0.206653 6 9 0.212924 7 13 0.215492 8 0 0.271724 9 6 0.353907 10 16 0.448019 R_HI 0.519726 Array 0: 0.481067 1: 0.292313 2: 0.90264 3: 0.667842 4: 0.412278 5: 0.156948 6: 0.833282 7: 0.964404 8: 0.74079 9: 0.456099 10: 0.653561 11: 0.406827 12: 0.540539 13: 0.832281 14: 0.145756 15: 0.717128 16: 0.775651 17: 0.362262 18: 0.531111 19: 0.379977 I INDX R(INDX(I)) 0 14 0.145756 1 5 0.156948 2 1 0.292313 3 17 0.362262 4 19 0.379977 5 11 0.406827 6 4 0.412278 7 9 0.456099 8 0 0.481067 9 18 0.531111 10 12 0.540539 11 10 0.653561 12 3 0.667842 13 15 0.717128 14 8 0.74079 15 16 0.775651 16 13 0.832281 17 6 0.833282 18 2 0.90264 19 7 0.964404 R_LO 0.269285 2 1 0.292313 3 17 0.362262 4 19 0.379977 5 11 0.406827 6 4 0.412278 7 9 0.456099 8 0 0.481067 9 18 0.531111 10 12 0.540539 11 10 0.653561 12 3 0.667842 13 15 0.717128 14 8 0.74079 15 16 0.775651 16 13 0.832281 17 6 0.833282 R_HI 0.877418 R8VEC_INDEXED_HEAP_D_TEST R8VEC_INDEXED_HEAP_D creates a descending heap from an indexed vector. The data vector: 0: 101 1: 102 2: 103 3: 104 4: 105 5: 106 6: 107 7: 108 8: 109 9: 110 10: 111 11: 112 12: 113 13: 114 14: 115 15: 116 16: 117 17: 118 18: 119 19: 120 The index vector: 0: 0 1: 10 2: 16 3: 4 4: 6 5: 12 6: 14 7: 2 8: 18 9: 8 A(INDX): 0 101 1 111 2 117 3 105 4 107 5 113 6 115 7 103 8 119 9 109 The data vector (should NOT change): 0: 101 1: 102 2: 103 3: 104 4: 105 5: 106 6: 107 7: 108 8: 109 9: 110 10: 111 11: 112 12: 113 13: 114 14: 115 15: 116 16: 117 17: 118 18: 119 19: 120 The index vector (may change): 0: 18 1: 10 2: 16 3: 4 4: 8 5: 12 6: 14 7: 2 8: 0 9: 6 A(INDX) is now a descending heap: 0 119 1 111 2 117 3 105 4 109 5 113 6 115 7 103 8 101 9 107 R8VEC_INDEXED_HEAP_D_EXTRACT_TEST For an indexed R8VEC, R8VEC_INDEXED_HEAP_D_EXTRACT extracts the maximum value; The data vector: 0: 1 1: 2 2: 3 3: 4 4: 5 5: 6 6: 7 7: 8 8: 9 9: 10 10: 11 11: 12 12: 13 13: 14 14: 15 15: 16 16: 17 17: 18 18: 19 19: 20 The index vector: 0: 8 1: 1 2: 7 3: 13 4: 4 A(INDX): 0 9 1 2 2 8 3 14 4 5 The index vector after heaping: 0: 13 1: 8 2: 7 3: 1 4: 4 A(INDX) after heaping: 0 14 1 9 2 8 3 2 4 5 Inserting value 7 Current maximum is 14 Inserting value 15 Current maximum is 15 Inserting value 1 Current maximum is 15 Inserting value 19 Current maximum is 19 Inserting value 20 Current maximum is 20 The data vector after insertions: 0: 1 1: 2 2: 3 3: 4 4: 5 5: 6 6: 7 7: 8 8: 9 9: 10 10: 11 11: 12 12: 13 13: 14 14: 15 15: 16 16: 17 17: 18 18: 19 19: 20 The index vector after insertions: 0: 19 1: 18 2: 13 3: 8 4: 14 5: 6 6: 7 7: 0 8: 1 9: 4 A(INDX) after insertions: 0 20 1 19 2 14 3 9 4 15 5 7 6 8 7 1 8 2 9 5 Now extract the maximum several times. Extracting maximum element A[19] = 20 Extracting maximum element A[18] = 19 Extracting maximum element A[14] = 15 Extracting maximum element A[13] = 14 Extracting maximum element A[8] = 9 The data vector after extractions: 0: 1 1: 2 2: 3 3: 4 4: 5 5: 6 6: 7 7: 8 8: 9 9: 10 10: 11 11: 12 12: 13 13: 14 14: 15 15: 16 16: 17 17: 18 18: 19 19: 20 The index vector after extractions: 0: 7 1: 4 2: 6 3: 1 4: 0 A(INDX) after extractions: 0 8 1 5 2 7 3 2 4 1 R8VEC_INDEXED_HEAP_D_INSERT_TEST For an indexed R8VEC, R8VEC_INDEXED_HEAP_D_INSERT inserts a value into the heap. The data vector: 0: 1 1: 2 2: 3 3: 4 4: 5 5: 6 6: 7 7: 8 8: 9 9: 10 10: 11 11: 12 12: 13 13: 14 14: 15 15: 16 16: 17 17: 18 18: 19 19: 20 The index vector: 0: 8 1: 1 2: 7 3: 13 4: 4 A(INDX): 0 9 1 2 2 8 3 14 4 5 The index vector after heaping: 0: 13 1: 8 2: 7 3: 1 4: 4 A(INDX) after heaping: 0 14 1 9 2 8 3 2 4 5 Inserting value 7 Current maximum is 14 Inserting value 15 Current maximum is 15 Inserting value 1 Current maximum is 15 Inserting value 19 Current maximum is 19 Inserting value 20 Current maximum is 20 The data vector after insertions: 0: 1 1: 2 2: 3 3: 4 4: 5 5: 6 6: 7 7: 8 8: 9 9: 10 10: 11 11: 12 12: 13 13: 14 14: 15 15: 16 16: 17 17: 18 18: 19 19: 20 The index vector after insertions: 0: 19 1: 18 2: 13 3: 8 4: 14 5: 6 6: 7 7: 0 8: 1 9: 4 A(INDX) after insertions: 0 20 1 19 2 14 3 9 4 15 5 7 6 8 7 1 8 2 9 5 R8VEC_INDEXED_HEAP_D_MAX_TEST For an indexed R8VEC, R8VEC_INDEXED_HEAP_D_MAX reports the maximum value. The data vector: 0: 1 1: 2 2: 3 3: 4 4: 5 5: 6 6: 7 7: 8 8: 9 9: 10 10: 11 11: 12 12: 13 13: 14 14: 15 15: 16 16: 17 17: 18 18: 19 19: 20 The index vector: 0: 8 1: 1 2: 7 3: 13 4: 4 A(INDX): 0 9 1 2 2 8 3 14 4 5 The index vector after heaping: 0: 13 1: 8 2: 7 3: 1 4: 4 A(INDX) after heaping: 0 14 1 9 2 8 3 2 4 5 Inserting value 7 Current maximum is 14 Inserting value 15 Current maximum is 15 Inserting value 1 Current maximum is 15 Inserting value 19 Current maximum is 19 Inserting value 20 Current maximum is 20 The data vector after insertions: 0: 1 1: 2 2: 3 3: 4 4: 5 5: 6 6: 7 7: 8 8: 9 9: 10 10: 11 11: 12 12: 13 13: 14 14: 15 15: 16 16: 17 17: 18 18: 19 19: 20 The index vector after insertions: 0: 19 1: 18 2: 13 3: 8 4: 14 5: 6 6: 7 7: 0 8: 1 9: 4 A(INDX) after insertions: 0 20 1 19 2 14 3 9 4 15 5 7 6 8 7 1 8 2 9 5 TEST012555 R8VEC_INDICATOR0_NEW returns an indicator vector. Indicator0 vector: 0: 0 1: 1 2: 2 3: 3 4: 4 5: 5 6: 6 7: 7 8: 8 9: 9 R8VEC_INDICATOR1_NEW_TEST R8VEC_INDICATOR1_NEW returns an indicator1 vector. Indicator1 vector: 0: 1 1: 2 2: 3 3: 4 4: 5 5: 6 6: 7 7: 8 8: 9 9: 10 R8VEC_IS_BINARY_TEST R8VEC_IS_BINARY is TRUE if an R8VEC only contains 0 or 1 entries. X: 0 0 0 X is binary. X: 1 0 1 X is binary. X: 0 2 1 X is NOT binary. R8VEC_IS_INTEGER_TEST R8VEC_IS_INTEGER is TRUE if an R8VEC only contains integer entries. Example 1: Obviously integer: X: 1 2 3 4 5 6 X is integer. Example 2: Obviously NOT integer: X: 1 2 3 4 5 6.5 X is NOT integer. Example 3: Not obviously not integer: X: 1 2 3 4 5 6 X is NOT integer. Example 4: Not obviously not integer: X: 1 2 3e+08 4 5 6 X is NOT integer. R8VEC_LEGENDRE_TEST R8VEC_LEGENDRE computes N Legendre points in [R1,R2]. N = 5 R1 = -1 R2 = 1 Legendre points: 0: -0.90618 1: -0.538469 2: 0 3: 0.538469 4: 0.90618 N = 7 R1 = 0 R2 = 10 Legendre points: 0: 0.25446 1: 1.29234 2: 2.97077 3: 5 4: 7.02923 5: 8.70766 6: 9.74554 R8VEC_LINSPACE_NEW_TEST For a R8VEC: R8VEC_LINSPACE_NEW: evenly spaced points between A and B; r8vec_linspace ( 5, 10, 20 ) 0: 10 1: 12.5 2: 15 3: 17.5 4: 20 R8VEC_MAX_TEST R8VEC_MAX produces the maximum entry in a real array. The array: 0: 0.218418 1: 0.956318 2: 0.829509 3: 0.561695 4: 0.415307 5: 0.0661187 6: 0.257578 7: 0.109957 8: 0.043829 9: 0.633966 R8VEC_MAX reports the maximum value is 0.956318. R8VEC_MAX_ABS_INDEX_TEST R8VEC_MAX_ABS_INDEX: index of entry of maximum absolute value. Input vector: 0: -5.63163 1: 9.12635 2: 6.59018 3: 1.23391 4: -1.69386 Index of entry of maximum absolute value = 1 R8VEC_MAX_INDEX_TEST For an R8VEC: R8VEC_MAX_INDEX: index of maximum entry; Input vector: 0: -5.63163 1: 9.12635 2: 6.59018 3: 1.23391 4: -1.69386 5: -8.67763 6: -4.84844 7: -7.80086 8: -9.12342 9: 2.67931 Maximum index: 1 R8VEC_MEAN_TEST R8VEC_MEAN computes the mean of an R8VEC; Input vector: 0: -2.81582 1: 4.56318 2: 3.29509 3: 0.616954 4: -0.846929 5: -4.33881 6: -2.42422 7: -3.90043 8: -4.56171 9: 1.33966 Mean: -0.907304 R8VEC_MEAN_GEOMETRIC_TEST R8VEC_MEAN_GEOMETRIC computes the geometric mean of an R8VEC; Input vector: 0: 1.09209 1: 4.78159 2: 4.14755 3: 2.80848 4: 2.07654 5: 0.330594 6: 1.28789 7: 0.549784 8: 0.219145 9: 3.16983 Geometric mean: 1.35287 R8VEC_MEAN_RUNNING_TEST R8VEC_MEAN_RUNNING returns the running means of an R8VEC. Random R8VEC: 0: -1.72373 1: 9.34476 2: 7.44264 3: 3.42543 4: 1.22961 5: -4.00822 6: -1.13633 7: -3.35065 8: -4.34257 9: 4.50949 Running means: 0: 0 1: -1.72373 2: 3.81052 3: 5.02123 4: 4.62228 5: 3.94374 6: 2.61842 7: 2.08202 8: 1.40294 9: 0.76455 10: 1.13904 R8VEC_MEDIAN_TEST For an R8VEC: R8VEC_MEDIAN: median value; Input vector: 0: -5.63163 1: 9.12635 2: 6.59018 3: 1.23391 4: -1.69386 5: -8.67763 6: -4.84844 7: -7.80086 8: -9.12342 9: 2.67931 Median: -4.84844 R8VEC_MIDSPACE_NEW_TEST For a R8VEC: R8VEC_MIDSPACE_NEW: evenly spaced midpoints between A and B r8vec_midspace ( 5, 10, 20 ) 0: 11 1: 13 2: 15 3: 17 4: 19 R8VEC_MIN_TEST R8VEC_MIN produces the minimum entry. The array: 0: 0.218418 1: 0.956318 2: 0.829509 3: 0.561695 4: 0.415307 5: 0.0661187 6: 0.257578 7: 0.109957 8: 0.043829 9: 0.633966 R8VEC_MIN reports the minimum value is 0.043829. R8VEC_MIN_INDEX_TEST For an R8VEC: R8VEC_MIN_INDEX: index of minimum entry; Input vector: 0: -5.63163 1: 9.12635 2: 6.59018 3: 1.23391 4: -1.69386 5: -8.67763 6: -4.84844 7: -7.80086 8: -9.12342 9: 2.67931 Minimum index: 8 R8VEC_MIRROR_NEXT_TEST R8VEC_MIRROR_NEXT generates all sign variations of a real vector. Next vector: 0: 1 1: 2 2: 3 Next vector: 0: -1 1: 2 2: 3 Next vector: 0: 1 1: -2 2: 3 Next vector: 0: -1 1: -2 2: 3 Next vector: 0: 1 1: 2 2: -3 Next vector: 0: -1 1: 2 2: -3 Next vector: 0: 1 1: -2 2: -3 Next vector: 0: -1 1: -2 2: -3 Done. Next vector: 0: 1 1: 0 2: 3 Next vector: 0: -1 1: 0 2: 3 Next vector: 0: 1 1: -0 2: -3 Next vector: 0: -1 1: -0 2: -3 Done. R8VEC_MIRROR_AB_NEXT_TEST R8VEC_MIRROR_AB_NEXT generates all versions of of a real vector X mirrored by A and B.. Case 1: 3x3x3 possibilities: A: -0.5 -0.5 -0.5 X: 0 0 0 B: 0.5 0.5 0.5 1: -1 -1 -1 2: -1 -1 0 3: -1 -1 1 4: -1 0 -1 5: -1 0 0 6: -1 0 1 7: -1 1 -1 8: -1 1 0 9: -1 1 1 10: 0 -1 -1 11: 0 -1 0 12: 0 -1 1 13: 0 0 -1 14: 0 0 0 15: 0 0 1 16: 0 1 -1 17: 0 1 0 18: 0 1 1 19: 1 -1 -1 20: 1 -1 0 21: 1 -1 1 22: 1 0 -1 23: 1 0 0 24: 1 0 1 25: 1 1 -1 26: 1 1 0 27: 1 1 1 Done. Case 2: 3x2x3 possibilities: A: -0.5 -0.5 -0.5 X: 0 0.5 0 B: 0.5 0.5 0.5 1: -1 -1.5 -1 2: -1 -1.5 0 3: -1 -1.5 1 4: -1 0.5 -1 5: -1 0.5 0 6: -1 0.5 1 7: 0 -1.5 -1 8: 0 -1.5 0 9: 0 -1.5 1 10: 0 0.5 -1 11: 0 0.5 0 12: 0 0.5 1 13: 1 -1.5 -1 14: 1 -1.5 0 15: 1 -1.5 1 16: 1 0.5 -1 17: 1 0.5 0 18: 1 0.5 1 Done. Case 3: 1x3x3 possibilities: A: 0 -0.5 -0.5 X: 0 0 0 B: 0 0.5 0.5 1: 0 -1 -1 2: 0 -1 0 3: 0 -1 1 4: 0 0 -1 5: 0 0 0 6: 0 0 1 7: 0 1 -1 8: 0 1 0 9: 0 1 1 Done. R8VEC_NINT_TEST R8VEC_NINT rounds an R8VEC. Vector A: 0: -2.81582 1: 4.56318 2: 3.29509 3: 0.616954 4: -0.846929 Rounded vector A: 0: -3 1: 5 2: 3 3: 1 4: -1 R8VEC_NORM_TEST R8VEC_NORM computes the L2 norm of an R8VEC. Input vector: 0: 0.218418 1: 0.956318 2: 0.829509 3: 0.561695 4: 0.415307 5: 0.0661187 6: 0.257578 7: 0.109957 8: 0.043829 9: 0.633966 L2 norm: 1.62017 R8VEC_NORM_AFFINE_TEST R8VEC_NORM_AFFINE computes the L2 norm of the difference of two R8VECs. R8VEC_NORM_AFFINE(X,Y) = 18.4134 R8VEC_NORM(X-Y) = 18.4134 R8VEC_NORM_L0_TEST R8VEC_NORM_L0 computes the L0 'norm' of an R8VEC. Input vector: 0: -1 1: 2 2: 1 3: 0 4: 0 5: -2 6: -1 7: -2 8: -2 9: 1 L0 norm: 8 R8VEC_NORM_L1_TEST R8VEC_NORM_L1 computes the L1 norm of an R8VEC. Input vector: 0: -5.63163 1: 9.12635 2: 6.59018 3: 1.23391 4: -1.69386 5: -8.67763 6: -4.84844 7: -7.80086 8: -9.12342 9: 2.67931 L1 norm: 57.4056 R8VEC_NORM_L2_TEST R8VEC_NORM_L2 computes the L2 norm of an R8VEC. Input vector: 0: -5.63163 1: 9.12635 2: 6.59018 3: 1.23391 4: -1.69386 5: -8.67763 6: -4.84844 7: -7.80086 8: -9.12342 9: 2.67931 L2 norm: 20.3201 R8VEC_NORM_LI_TEST R8VEC_NORM_LI computes the Loo norm of an R8VEC. Input vector: 0: -5.63163 1: 9.12635 2: 6.59018 3: 1.23391 4: -1.69386 5: -8.67763 6: -4.84844 7: -7.80086 8: -9.12342 9: 2.67931 L-Infinity norm: 9.12635 R8VEC_NORMAL_01_TEST R8VEC_NORMAL_01 computes a vector of normally distributed random numbers. Using initial random number seed = 123456789 Test #1: Call 5 times, 1 value each time. 0 1.67904 1 -0.56606 2 1.21293 3 1.26938 4 -1.66609 Test #2: Restore the random number seed. Call 5 times, 1 value each time. The results should be identical. 0 1.67904 1 -0.56606 2 1.21293 3 1.26938 4 -1.66609 Test #3: Restore the random number seed. Call 1 time for 5 values. The results should be identical. 0 1.67904 1 -0.472769 2 -0.56606 3 -0.231124 4 1.21293 Test #4: Restore the random number seed. Call for 2, 1, and 2 values. The results should be identical. 0 1.67904 1 -0.472769 0 -0.56606 0 1.21293 1 0.535037 Test #5: Number of samples was 1000 Minimum value was -3.02975 Maximum value was 3.32858 Average value was -0.0169841 Variance was 1 Expected average = 0.0 Expected variance = 1.0 R8VEC_NORMAL_AB_NEW_TEST R8VEC_NORMAL_AB_NEW returns an R8VEC of random normal values with mean A and variance B. For this problem: A = 15 B = 0.25 Input SEED = 123456789 Random R8VEC: 0: 15.4198 1: 14.8818 2: 14.8585 3: 14.9422 4: 15.3032 5: 15.1338 6: 15.3173 7: 15.2624 8: 14.5835 9: 14.5337 Input SEED = 1361431000 Random R8VEC: 0: 14.4394 1: 15.184 2: 15.0099 3: 14.6623 4: 15.1683 5: 15.0019 6: 14.9312 7: 15.0937 8: 15.541 9: 15.0464 Input SEED = 29242052 Random R8VEC: 0: 15.0744 1: 14.8841 2: 15.5111 3: 15.0241 4: 15.3497 5: 14.7857 6: 14.6893 7: 15.4186 8: 14.9832 9: 15.1552 R8VEC_NORMALIZE_L1_TEST For an R8VEC: R8VEC_NORMALIZE_L1: make unit sum; Input vector: 0: -5.63163 1: 9.12635 2: 6.59018 3: 1.23391 4: -1.69386 5: -8.67763 6: -4.84844 7: -7.80086 8: -9.12342 9: 2.67931 After calling R8VEC_NORMALIZE_L1: 0: 0.31035 1: -0.502938 2: -0.363174 3: -0.0679986 4: 0.0933457 5: 0.478209 6: 0.26719 7: 0.429892 8: 0.502776 9: -0.147652 R8VEC_ORDER_TYPE_TEST R8VEC_ORDER_TYPE classifies a real vector as -1: no order 0: all equal; 1: ascending; 2: strictly ascending; 3: descending; 4: strictly descending. The following vector has order type -1. 0: 1 1: 3 2: 2 3: 4 The following vector has order type 0. 0: 2 1: 2 2: 2 3: 2 The following vector has order type 1. 0: 1 1: 2 2: 2 3: 4 The following vector has order type 2. 0: 1 1: 2 2: 3 3: 4 The following vector has order type 3. 0: 4 1: 4 2: 3 3: 1 The following vector has order type 4. 0: 9 1: 7 2: 3 3: 0 R8VEC_PERMUTE_TEST R8VEC_PERMUTE permutes an R8VEC in place. Original Array X[]: 0: 1 1: 2 2: 3 3: 4 4: 5 Permutation Vector P[]: 0: 1 1: 3 2: 4 3: 0 4: 2 Permuted array X[P[]]: 0: 2 1: 4 2: 5 3: 1 4: 3 R8VEC_PERMUTE_CYCLIC_TEST R8VEC_PERMUTE_CYCLIC performs a cyclic permutation of K places on an R8VEC. K = 4 Original Array X: 0: 1 1: 2 2: 3 3: 4 4: 5 5: 6 6: 7 7: 8 8: 9 9: 10 Array after cyclic permutation: 0: 5 1: 6 2: 7 3: 8 4: 9 5: 10 6: 1 7: 2 8: 3 9: 4 R8VEC_PERMUTE_UNIFORM_TEST R8VEC_PERMUTE_UNIFORM randomly reorders an R8VEC. A, before rearrangement: 0: 101 1: 102 2: 103 3: 104 4: 105 5: 106 6: 107 7: 108 8: 109 9: 110 A, after random permutation: 0: 103 1: 110 2: 109 3: 107 4: 104 5: 106 6: 108 7: 105 8: 101 9: 102 R8VEC_POLARIZE_TEST R8VEC_POLARIZE decomposes a vector into components parallel and normal to a direction. Original vector: 0: 1 1: 2 2: 3 Direction vector: 0: 3 1: 1 2: -2 Normal component: 0: 1.21429 1: 2.07143 2: 2.85714 Parallel component: 0: -0.214286 1: -0.0714286 2: 0.142857 Dot product of P and A_normal (should be 0) 8.88178e-16 Cosine of angle between P and A_parallel (should be 1 or -1) -1 Sum of components (should equal A): 0: 1 1: 2 2: 3 R8VEC_PRINT_TEST R8VEC_PRINT prints an R8VEC. The R8VEC: 0: 123.456 1: 5e-06 2: -1e+06 3: 3.14159 R8VEC_PRINT_PART R8VEC_PRINT_PART prints part of an R8VEC. Lines 10:20 of R8VEC: 10: 9 11: 10 12: 11 13: 12 14: 13 15: 14 16: 15 17: 16 18: 17 19: 18 20: 19 R8VEC_PRINT_SOME R8VEC_PRINT_SOME prints some of an R8VEC. No more than 10 lines of R8VEC: 0: 0 1: 1 2: 2 3: 3 4: 4 5: 5 6: 6 7: 7 ........ .............. 99: 99 R8VEC_REVERSE_TEST R8VEC_REVERSE reverses an R8VEC. Original array: 0: 1 1: 2 2: 3 3: 4 4: 5 Reversed array: 0: 5 1: 4 2: 3 3: 2 4: 1 R8VEC_ROTATE_TEST R8VEC_ROTATE rotates an R8VEC in place. Rotate entries 2 places to the right. Original array: 0: 1 1: 2 2: 3 3: 4 4: 5 Rotated array: 0: 4 1: 5 2: 1 3: 2 4: 3 R8VEC_RSQUARED_TEST R8VEC_RSQUARED evaluates the R^2 goodness-of-fit statistic. Data and model: 0: 0 0 1: 9.58 9 2: 16.76 16 3: 21.52 21 4: 24.38 24 5: 24.97 25 6: 22.9 24 7: 20.45 21 8: 12.4 16 9: 7.65 9 10: -3.82 0 Computed R^2 is 0.967402 R8VEC_RSQUARED_ADJUSTED_TEST R8VEC_RSQUARED_ADJUSTED evaluates the adjusted R^2 goodness-of-fit statistic. Data and model: 0: 0 0 1: 9.58 9 2: 16.76 16 3: 21.52 21 4: 24.38 24 5: 24.97 25 6: 22.9 24 7: 20.45 21 8: 12.4 16 9: 7.65 9 10: -3.82 0 Computed R^2, adusted for degree = 2 is 0.959253 R8VEC_SCALE_01_TEST R8VEC_SCALE_01 shifts and scales an R8VEC so that it has min 0 and max 1 Vector X: 0: -0.631634 1: 14.1264 2: 11.5902 3: 6.23391 4: 3.30614 5: -3.67763 6: 0.151556 7: -2.80086 8: -4.12342 9: 7.67931 mean(X) = 3.18539 std(X) = 6.16423 max(X) = 14.1264 min(X) = -4.12342 Vector XS: 0: 0.191333 1: 1 2: 0.86103 3: 0.567532 4: 0.407104 5: 0.0244274 6: 0.234248 7: 0.0724697 8: 0 9: 0.646733 mean(XS) = 0.400488 std(XS) = 0.33777 max(XS) = 1 min(XS) = 0 R8VEC_SCALE_AB_TEST R8VEC_SCALE_AB shifts and scales an R8VEC so that it has min A and max B Vector X: 0: -0.631634 1: 14.1264 2: 11.5902 3: 6.23391 4: 3.30614 5: -3.67763 6: 0.151556 7: -2.80086 8: -4.12342 9: 7.67931 mean(X) = 3.18539 std(X) = 6.16423 max(X) = 14.1264 min(X) = -4.12342 Rescaling vector to [-1,1]. Vector XS: 0: -0.617334 1: 1 2: 0.72206 3: 0.135064 4: -0.185791 5: -0.951145 6: -0.531504 7: -0.855061 8: -1 9: 0.293467 mean(XS) = -0.199024 std(XS) = 0.675541 max(XS) = 1 min(XS) = -1 R8VEC_SEARCH_BINARY_A_TEST For ascending order: R8VEC_SEARCH_BINARY_A searches a sorted array; Using initial random number seed = 123456789 Sorted vector A: 0: 0.043829 1: 0.0661187 2: 0.109957 3: 0.218418 4: 0.257578 5: 0.415307 6: 0.561695 7: 0.633966 8: 0.829509 9: 0.956318 Search the array for the value 0.218418 SEARCH RESULT: The value occurs in index 4 r8vec_shift_circular_test(): r8vec_shift_circular() performs a circular shift of K positions on an R8VEC. The original array: 1 2 3 4 5 K: 1 2 3 4 5 -2 3 4 5 1 2 -1 2 3 4 5 1 0 1 2 3 4 5 1 5 1 2 3 4 2 4 5 1 2 3 3 3 4 5 1 2 R8VEC_SIGN3_RUNNING_TEST R8VEC_SIGN3_RUNNING returns the running sign3 of an R8VEC. Random R8VEC: 0: -1.72373 1: 9.34476 2: 7.44264 3: 3.42543 4: 1.22961 5: -4.00822 6: -1.13633 7: -3.35065 8: -4.34257 9: 4.50949 Running sign3: 0: 0 1: -1 2: 1 3: 1 4: 1 5: 1 6: 1 7: 1 8: 1 9: 1 10: 1 r8vec_smooth_test r8vec_smooth smooths an R8VEC. The vector X: 0: 1 1: 2 2: 3 3: 4 4: 5 5: 6 6: 7 7: 8 8: 9 9: 10 Vector X using smoothing S = 2 0: 1 1: 2 2: 3 3: 4 4: 5 5: 6 6: 7 7: 8 8: 9 9: 10 The vector X: 0: 1 1: 4 2: 9 3: 16 4: 25 5: 36 6: 49 7: 64 8: 81 9: 100 Vector X using smoothing S = 1 0: 1 1: 4.66667 2: 9.66667 3: 16.6667 4: 25.6667 5: 36.6667 6: 49.6667 7: 64.6667 8: 81.6667 9: 100 R8VEC_SOFTMAX_TEST R8VEC_SOFTMAX evaluates the softmax function of an R8VEC. X, Softmax: 0: 2.03712 0.578269 1: -4.41831 0.00090902 2: -4.69818 0.00068711 3: -3.69337 0.00187676 4: 0.638803 0.142839 5: -1.39489 0.0186908 6: 0.808142 0.169196 7: 0.148628 0.0874919 8: -7.99826 2.53408e-05 9: -8.59568 1.39432e-05 R8VEC_SORT_BUBBLE_A_TEST R8VEC_SORT_BUBBLE_A sorts a real array. Using random seed 123456789. Unsorted array: 0: 0.218418 1: 0.956318 2: 0.829509 3: 0.561695 4: 0.415307 5: 0.0661187 6: 0.257578 7: 0.109957 8: 0.043829 9: 0.633966 10: 0.0617272 11: 0.449539 12: 0.401306 13: 0.754673 14: 0.797287 15: 0.00183837 16: 0.897504 17: 0.350752 18: 0.0945448 19: 0.0136169 Sorted array: 0: 0.00183837 1: 0.0136169 2: 0.043829 3: 0.0617272 4: 0.0661187 5: 0.0945448 6: 0.109957 7: 0.218418 8: 0.257578 9: 0.350752 10: 0.401306 11: 0.415307 12: 0.449539 13: 0.561695 14: 0.633966 15: 0.754673 16: 0.797287 17: 0.829509 18: 0.897504 19: 0.956318 R8VEC_SORT_HEAP_A_TEST R8VEC_SORT_HEAP_A ascending sorts an R8VEC. Original array: 1: 13.1051 2: 57.3791 3: 49.7706 4: 33.7017 5: 24.9184 6: 3.96712 7: 15.4547 8: 6.59741 9: 2.62974 10: 38.0379 Ascending sorted array: 1: 0.110302 2: 0.817013 3: 2.62974 4: 3.70363 5: 3.96712 6: 5.67269 7: 6.59741 8: 13.1051 9: 15.4547 10: 21.0451 R8VEC_SORT_HEAP_D_TEST R8VEC_SORT_HEAP_D descending sorts an R8VEC. Original array: 1: 13.1051 2: 57.3791 3: 49.7706 4: 33.7017 5: 24.9184 6: 3.96712 7: 15.4547 8: 6.59741 9: 2.62974 10: 38.0379 Descending sorted array: 1: 0.110302 2: 57.3791 3: 33.7017 4: 38.0379 5: 0.817013 6: 45.2804 7: 6.59741 8: 21.0451 9: 24.9184 10: 3.70363 R8VEC_SORT_HEAP_INDEX_A_NEW_TEST R8VEC_SORT_HEAP_INDEX_A_NEW creates an ascending sort index for an R8VEC. Unsorted array: 0: 13.1051 1: 57.3791 2: 49.7706 3: 33.7017 4: 24.9184 5: 3.96712 6: 15.4547 7: 6.59741 8: 2.62974 9: 38.0379 10: 3.70363 11: 26.9723 12: 24.0784 13: 45.2804 14: 47.8372 15: 0.110302 16: 53.8502 17: 21.0451 18: 5.67269 19: 0.817013 After indexed ascending sort: I INDX(I) A(I) 0 15 13.1051 1 19 57.3791 2 8 49.7706 3 10 33.7017 4 5 24.9184 5 18 3.96712 6 7 15.4547 7 0 6.59741 8 6 2.62974 9 17 38.0379 10 12 3.70363 11 4 26.9723 12 11 24.0784 13 3 45.2804 14 9 47.8372 15 13 0.110302 16 14 53.8502 17 2 21.0451 18 16 5.67269 19 1 0.817013 Now use the index array to carry out the permutation implicitly. INDX(I) A(INDX(I)) 15 0.110302 19 0.817013 8 2.62974 10 3.70363 5 3.96712 18 5.67269 7 6.59741 0 13.1051 6 15.4547 17 21.0451 12 24.0784 4 24.9184 11 26.9723 3 33.7017 9 38.0379 13 45.2804 14 47.8372 2 49.7706 16 53.8502 1 57.3791 Call R8VEC_PERMUTE to carry out the permutation explicitly. I, A(I) 0: 0.110302 1: 0.817013 2: 2.62974 3: 3.70363 4: 3.96712 5: 5.67269 6: 6.59741 7: 13.1051 8: 15.4547 9: 21.0451 10: 24.0784 11: 24.9184 12: 26.9723 13: 33.7017 14: 38.0379 15: 45.2804 16: 47.8372 17: 49.7706 18: 53.8502 19: 57.3791 R8VEC_SORT_HEAP_INDEX_D_NEW_TEST R8VEC_SORT_HEAP_INDEX_D_NEW creates a descending sort index for an R8VEC. Unsorted array: 0: 13.1051 1: 57.3791 2: 49.7706 3: 33.7017 4: 24.9184 5: 3.96712 6: 15.4547 7: 6.59741 8: 2.62974 9: 38.0379 10: 3.70363 11: 26.9723 12: 24.0784 13: 45.2804 14: 47.8372 15: 0.110302 16: 53.8502 17: 21.0451 18: 5.67269 19: 0.817013 After indexed descending sort: I INDX(I) A(I) 0 1 13.1051 1 16 57.3791 2 2 49.7706 3 14 33.7017 4 13 24.9184 5 9 3.96712 6 3 15.4547 7 11 6.59741 8 4 2.62974 9 12 38.0379 10 17 3.70363 11 6 26.9723 12 0 24.0784 13 7 45.2804 14 18 47.8372 15 5 0.110302 16 10 53.8502 17 8 21.0451 18 19 5.67269 19 15 0.817013 Now use the index array to carry out the permutation implicitly. INDX(I) A(INDX(I)) 1 57.3791 16 53.8502 2 49.7706 14 47.8372 13 45.2804 9 38.0379 3 33.7017 11 26.9723 4 24.9184 12 24.0784 17 21.0451 6 15.4547 0 13.1051 7 6.59741 18 5.67269 5 3.96712 10 3.70363 8 2.62974 19 0.817013 15 0.110302 Call R8VEC_PERMUTE to carry out the permutation explicitly. I, A(I) 0: 57.3791 1: 53.8502 2: 49.7706 3: 47.8372 4: 45.2804 5: 38.0379 6: 33.7017 7: 26.9723 8: 24.9184 9: 24.0784 10: 21.0451 11: 15.4547 12: 13.1051 13: 6.59741 14: 5.67269 15: 3.96712 16: 3.70363 17: 2.62974 18: 0.817013 19: 0.110302 R8VEC_SORT_HEAP_MASK_A_TEST R8VEC_SORT_HEAP_MASK_A creates an ascending sort index for a masked R8VEC. Unsorted array: 0: 13.1051 1: 57.3791 2: 49.7706 3: 33.7017 4: 24.9184 5: 3.96712 6: 15.4547 7: 6.59741 8: 2.62974 9: 38.0379 10: 3.70363 11: 26.9723 12: 24.0784 13: 45.2804 14: 47.8372 15: 0.110302 16: 53.8502 17: 21.0451 18: 5.67269 19: 0.817013 The mask array: 0: 1 1: 3 2: 6 3: 7 4: 8 5: 11 6: 12 7: 15 8: 17 9: 18 Masked vector printout: The masked unsorted array: 0: 1 13.1051 1: 3 49.7706 2: 6 3.96712 3: 7 15.4547 4: 8 6.59741 5: 11 3.70363 6: 12 26.9723 7: 15 47.8372 8: 17 53.8502 9: 18 21.0451 After masked indexed ascending sort: I, INDX(I), MASK(INDX(I)), A(MASK(INDX(I))) 0 5 11 26.9723 1 2 6 15.4547 2 4 8 2.62974 3 0 1 57.3791 4 3 7 6.59741 5 9 18 5.67269 6 6 12 24.0784 7 7 15 0.110302 8 1 3 33.7017 9 8 17 21.0451 Call I4VEC_PERMUTE to carry out the index permutation explicitly on the MASK vector. The reordered mask array: 0: 11 1: 6 2: 8 3: 1 4: 7 5: 18 6: 12 7: 15 8: 3 9: 17 Masked vector printout: The reordered masked sorted array: 0: 11 3.70363 1: 6 3.96712 2: 8 6.59741 3: 1 13.1051 4: 7 15.4547 5: 18 21.0451 6: 12 26.9723 7: 15 47.8372 8: 3 49.7706 9: 17 53.8502 R8VEC_SORT_INSERT_A_TEST R8VEC_SORT_INSERT_A ascending sorts an R8VEC. Unsorted array: 1: 13.1051 2: 57.3791 3: 49.7706 4: 33.7017 5: 24.9184 6: 3.96712 7: 15.4547 8: 6.59741 9: 2.62974 10: 38.0379 Sorted array: 1: 0.110302 2: 0.817013 3: 2.62974 4: 3.70363 5: 3.96712 6: 5.67269 7: 6.59741 8: 13.1051 9: 15.4547 10: 21.0451 R8VEC_SORT_INSERT_INDEX_A_TEST R8VEC_SORT_INSERT_INDEX_A creates an ascending sort index for an R8VEC. Unsorted array: 1: 13.1051 2: 57.3791 3: 49.7706 4: 33.7017 5: 24.9184 6: 3.96712 7: 15.4547 8: 6.59741 9: 2.62974 10: 38.0379 After indexed ascending sort: I INDX(I), A(I) 0 15 13.1051 1 19 57.3791 2 8 49.7706 3 10 33.7017 4 5 24.9184 5 18 3.96712 6 7 15.4547 7 0 6.59741 8 6 2.62974 9 17 38.0379 10 12 3.70363 11 4 26.9723 12 11 24.0784 13 3 45.2804 14 9 47.8372 15 13 0.110302 16 14 53.8502 17 2 21.0451 18 16 5.67269 19 1 0.817013 Now use the index array to carry out the permutation implicitly. I INDX(I), A(INDX(I)) 0 15 0.110302 1 19 0.817013 2 8 2.62974 3 10 3.70363 4 5 3.96712 5 18 5.67269 6 7 6.59741 7 0 13.1051 8 6 15.4547 9 17 21.0451 10 12 24.0784 11 4 24.9184 12 11 26.9723 13 3 33.7017 14 9 38.0379 15 13 45.2804 16 14 47.8372 17 2 49.7706 18 16 53.8502 19 1 57.3791 Call R8VEC_PERMUTE to carry out the permutation explicitly. Permuted data 1: 0.110302 2: 0.817013 3: 2.62974 4: 3.70363 5: 3.96712 6: 5.67269 7: 6.59741 8: 13.1051 9: 15.4547 10: 21.0451 R8VEC_SORT_QUICK_A_TEST R8VEC_SORT_QUICK_A sorts an R8VEC using quick sort. Unsorted array: 0: 2.18418 1: 9.56318 2: 8.29509 3: 5.61695 4: 4.15307 5: 0.661187 6: 2.57578 7: 1.09957 8: 0.43829 9: 6.33966 10: 0.617272 11: 4.49539 12: 4.01306 13: 7.54673 14: 7.97287 15: 0.0183837 16: 8.97504 17: 3.50752 18: 0.945448 19: 0.136169 Sorted array: 0: 0.0183837 1: 0.136169 2: 0.43829 3: 0.617272 4: 0.661187 5: 0.945448 6: 1.09957 7: 2.18418 8: 2.57578 9: 3.50752 10: 4.01306 11: 4.15307 12: 4.49539 13: 5.61695 14: 6.33966 15: 7.54673 16: 7.97287 17: 8.29509 18: 8.97504 19: 9.56318 R8VEC_SORTED_MERGE_A_TEST For ascending order: R8VEC_SORTED_MERGE_A merges two sorted R8VEC's; Using initial random number seed = 123456789 Sorted vector A: 0: 0.043829 1: 0.0661187 2: 0.109957 3: 0.218418 4: 0.257578 5: 0.415307 6: 0.561695 7: 0.633966 8: 0.829509 9: 0.956318 Sorted vector B: 0: 0.00183837 1: 0.0136169 2: 0.0617272 3: 0.0945448 4: 0.350752 5: 0.401306 6: 0.449539 7: 0.754673 8: 0.797287 9: 0.897504 Merged vector C: 0: 0.00183837 1: 0.0136169 2: 0.043829 3: 0.0617272 4: 0.0661187 5: 0.0945448 6: 0.109957 7: 0.218418 8: 0.257578 9: 0.350752 10: 0.401306 11: 0.415307 12: 0.449539 13: 0.561695 14: 0.633966 15: 0.754673 16: 0.797287 17: 0.829509 18: 0.897504 19: 0.956318 R8VEC_SORTED_NEAREST_TEST R8VEC_SORTED_NEAREST finds the nearest entry in a sorted real array. Sorted array: 0: 0.43829 1: 0.661187 2: 1.09957 3: 2.18418 4: 2.57578 5: 4.15307 6: 5.61695 7: 6.33966 8: 8.29509 9: 9.56318 Test Nearest Value Index Value 0.0617272 1 0.43829 0.449539 1 0.43829 0.401306 1 0.43829 0.754673 2 0.661187 0.797287 2 0.661187 0.00183837 1 0.43829 0.897504 3 1.09957 0.350752 1 0.43829 0.0945448 1 0.43829 0.0136169 1 0.43829 R8VEC_SORTED_RANGE_TEST R8VEC_SORTED_RANGE seeks the range of indices in a sorted vector R so that R_LO <= R(I_LO:I_HI) <= R_HI. Sorted array R: 0: 0.043829 1: 0.0661187 2: 0.109957 3: 0.218418 4: 0.257578 5: 0.415307 6: 0.561695 7: 0.633966 8: 0.829509 9: 0.956318 R_LO 0.0617272 1 0.0661187 2 0.109957 3 0.218418 4 0.257578 5 0.415307 R_HI 0.449539 Sorted array R: 0: 0.00183837 1: 0.0136169 2: 0.0945448 3: 0.350752 4: 0.401306 5: 0.754673 6: 0.797287 7: 0.840847 8: 0.859097 9: 0.897504 R_LO 0.00751236 1 0.0136169 2 0.0945448 R_HI 0.123104 Sorted array R: 0: 0.113664 1: 0.260303 2: 0.267132 3: 0.351629 4: 0.453794 5: 0.561662 6: 0.692066 7: 0.822887 8: 0.861216 9: 0.912484 R_LO 0.597917 6 0.692066 7 0.822887 8 0.861216 R_HI 0.911977 Sorted array R: 0: 0.185314 1: 0.188955 2: 0.21293 3: 0.361529 4: 0.367027 5: 0.396988 6: 0.574366 7: 0.617205 8: 0.714471 9: 0.761492 R_LO 0.117707 0 0.185314 1 0.188955 2 0.21293 R_HI 0.299329 Sorted array R: 0: 0.0618618 1: 0.0882833 2: 0.308675 3: 0.710781 4: 0.745303 5: 0.763537 6: 0.777994 7: 0.82466 8: 0.825003 9: 0.899373 R_LO 0.40697 3 0.710781 4 0.745303 R_HI 0.761731 R8VEC_SORTED_SPLIT_TEST R8VEC_SORTED_SPLIT splits a sorted vector into entries less than and greater than a splitting value. The sorted array: 0: 0 1: 0 2: 0 3: 0 4: 0.5 5: 0.5 6: 0.5 7: 0.5 8: 0.5 9: 1 10: 1.5 11: 1.5 12: 2 13: 2 14: 2 15: 2 16: 3 17: 3 18: 4 19: 4 20: 4 21: 4 22: 4.5 23: 4.5 24: 5 Splitting value is 2.5 Lower index I_LT = 16 Upper index I_GT = 17 R8VEC_SORTED_UNDEX_TEST R8VEC_SORTED_UNDEX produces index vectors which create a sorted list of the unique elements of a sorted R8VEC, and a map from the original vector to the (implicit) vector of sorted unique elements. The vector X: 0: 11 1: 11 2: 11 3: 22 4: 22 5: 33 6: 33 7: 55 8: 55 Number of unique entries in X is 4 UNDX can be used to list the unique elements of X in sorted order. I UNDX X(UNDX) 0 0 11 1 3 22 2 5 33 3 7 55 UNDX can be used to created XU, a copy of X containing only the unique elements, in sorted order. I UNDX XU(I) 0 0 11 1 3 22 2 5 33 3 7 55 XDNU can be used to match each element of X with one of the unique elements I XDNU X(I) XU(XDNU(I)) 0 0 11 11 1 0 11 11 2 0 11 11 3 1 22 22 4 1 22 22 5 2 33 33 6 2 33 33 7 3 55 55 8 3 55 55 R8VEC_SORTED_UNIQUE_TEST R8VEC_SORTED_UNIQUE finds unique entries in a sorted R8VEC; Unsorted array: 1: 4 2: 19 3: 17 4: 11 5: 8 6: 1 7: 5 8: 2 9: 1 10: 13 Unique entries 0: 0 1: 1 2: 2 3: 4 4: 5 5: 7 6: 8 7: 9 8: 11 9: 13 10: 15 11: 16 12: 17 13: 18 14: 19 R8VEC_SORTED_UNIQUE_COUNT_TEST R8VEC_SORTED_UNIQUE_COUNT counts unique entries in a sorted R8VEC; Using a tolerance of 0.25 R8VEC_SORTED_UNIQUE_COUNT counts 30 unique entries in A. R8VEC_SORTED_UNIQUE_HIST_TEST R8VEC_SORTED_UNIQUE_HIST stores the unique entries and their multiplicities. Using random seed 123456789. Unsorted array: 0: 6.5 1: 28.5 2: 24.5 3: 16.5 4: 12.5 5: 1.5 6: 7.5 7: 3.5 8: 1.5 9: 19.5 10: 1.5 11: 13.5 12: 12.5 13: 22.5 14: 23.5 15: 0.5 16: 26.5 17: 10.5 18: 2.5 19: 0.5 20: 25.5 21: 25.5 22: 3.5 23: 0.5 24: 7.5 25: 27.5 26: 3.5 27: 10.5 28: 24.5 29: 8.5 Sorted array: 0: 0.5 1: 0.5 2: 0.5 3: 1.5 4: 1.5 5: 1.5 6: 2.5 7: 3.5 8: 3.5 9: 3.5 10: 6.5 11: 7.5 12: 7.5 13: 8.5 14: 10.5 15: 10.5 16: 12.5 17: 12.5 18: 13.5 19: 16.5 20: 19.5 21: 22.5 22: 23.5 23: 24.5 24: 24.5 25: 25.5 26: 25.5 27: 26.5 28: 27.5 29: 28.5 R8VEC_SORTED_UNIQUE_HIST counts 19 unique entries. Value Multiplicity 0 0.5 3 1 1.5 3 2 2.5 1 3 3.5 3 4 6.5 1 5 7.5 2 6 8.5 1 7 10.5 2 8 12.5 2 9 13.5 1 10 16.5 1 11 19.5 1 12 22.5 1 13 23.5 1 14 24.5 2 15 25.5 2 16 26.5 1 17 27.5 1 18 28.5 1 R8VEC_SPLIT_TEST R8VEC_SPLIT splits a vector into entries less than and greater than a splitting value. Splitting value is 1.25 The split array: 0: 1 1: 0 2: 0.5 3: 0 4: 0.5 5: 0.5 6: 0 7: 0.5 8: 0 9: 0.5 10: 2 11: 2 12: 4 13: 4 14: 3 15: 4.5 16: 2 17: 1.5 18: 2 19: 4.5 20: 4 21: 3 22: 4 23: 1.5 24: 5 Array entries <= SPLIT up to index 10 R8VEC_STANDARDIZE_TEST R8VEC_STANDARDIZE shifts and scales an R8VEC so that it has zero mean and unit standard deviation. Vector X: 0: -0.631634 1: 14.1264 2: 11.5902 3: 6.23391 4: 3.30614 5: -3.67763 6: 0.151556 7: -2.80086 8: -4.12342 9: 7.67931 mean(X) = 3.18539 std(X) = 6.49767 max(X) = 14.1264 min(X) = -4.12342 Vector XS: 0: -0.587445 1: 1.68383 2: 1.29351 3: 0.469171 4: 0.0185836 5: -1.05623 6: -0.466911 7: -0.921293 8: -1.12484 9: 0.691621 mean(XS) = -2.22045e-17 std(XS) = 1 max(XS) = 1.68383 min(XS) = -1.12484 r8vec_std_test(): r8vec_std() returns the standard deviation of an R8VEC. The array: 0: 2 1: 10 2: 8 3: 6 4: 4 5: 1 6: 3 7: 1 8: 0 9: 6 Standard deviation = 3.14484 r8vec_std_sample_test(): r8vec_std_sample() returns the sample standard deviation of an R8VEC. The array: 0: 2 1: 10 2: 8 3: 6 4: 4 5: 1 6: 3 7: 1 8: 0 9: 6 Sample standard deviation = 3.31495 r8vec_std_sample_update_test() r8vec_std_sample_update() updates the sample standard deviation of a vector when one more element is added. N R STD STD_UPDATE 1 0.218418 0 0 2 0.956318 0.521774 0.521774 3 0.829509 0.394548 0.394548 4 0.561695 0.326509 0.326509 5 0.415307 0.300312 0.300312 6 0.0661187 0.344949 0.344949 7 0.257578 0.3288 0.3288 8 0.109957 0.330245 0.330245 9 0.043829 0.334261 0.334261 10 0.633966 0.324883 0.324883 r8vec_std_update_test() r8vec_std_update() updates the standard deviation of a vector when one more element is added. N R STD STD_UPDATE 1 0.218418 0 0 2 0.956318 0.36895 0.36895 3 0.829509 0.322147 0.322147 4 0.561695 0.282765 0.282765 5 0.415307 0.268607 0.268607 6 0.0661187 0.314894 0.314894 7 0.257578 0.304409 0.304409 8 0.109957 0.308916 0.308916 9 0.043829 0.315145 0.315145 10 0.633966 0.308212 0.308212 R8VEC_SUM_TEST R8VEC_SUM computes the sum of an R8VEC; Input vector: 0: -2.81582 1: 4.56318 2: 3.29509 3: 0.616954 4: -0.846929 5: -4.33881 6: -2.42422 7: -3.90043 8: -4.56171 9: 1.33966 Sum: -9.07304 R8VEC_SUM_RUNNING_TEST R8VEC_SUM_RUNNING returns the running sums of an R8VEC. Random R8VEC: 0: -1.72373 1: 9.34476 2: 7.44264 3: 3.42543 4: 1.22961 5: -4.00822 6: -1.13633 7: -3.35065 8: -4.34257 9: 4.50949 Running sums: 0: 0 1: -1.72373 2: 7.62104 3: 15.0637 4: 18.4891 5: 19.7187 6: 15.7105 7: 14.5742 8: 11.2235 9: 6.88095 10: 11.3904 R8VEC_TRANSPOSE_PRINT_TEST R8VEC_TRANSPOSE_PRINT prints an R8VEC "transposed", that is, placing multiple entries on a line. The vector X: 0.218418 0.956318 0.829509 0.561695 0.415307 0.0661187 0.257578 0.109957 0.043829 0.633966 0.0617272 0.449539 R8VEC_UNDEX_TEST R8VEC_UNDEX produces index vectors which create a sorted list of the unique elements of an (unsorted) R8VEC, and a map from the original vector to the (implicit) vector of sorted unique elements. The vector X: 0: 33 1: 55 2: 11 3: 11 4: 55 5: 33 6: 22 7: 22 8: 11 Number of unique entries in X is 4 UNDX can be used to list the unique elements of X in sorted order. I UNDX X(UNDX) 0 2 11 1 6 22 2 5 33 3 4 55 UNDX can be used to created XU, a copy of X containing only the unique elements, in sorted order. I UNDX XU(I) 0 2 11 1 6 22 2 5 33 3 4 55 XDNU can be used to match each element of X with one of the unique elements I XDNU X(I) XU(XDNU(I)) 0 2 33 33 1 3 55 55 2 0 11 11 3 0 11 11 4 3 55 55 5 2 33 33 6 1 22 22 7 1 22 22 8 0 11 11 r8vec_uniform_01_test(): r8vec_uniform_01() returns a random R8VEC with entries in [ 0.0, 1.0 ] Input SEED = 123456789 Random R8VEC: 0: 0.218418 1: 0.956318 2: 0.829509 3: 0.561695 4: 0.415307 5: 0.0661187 6: 0.257578 7: 0.109957 8: 0.043829 9: 0.633966 Input SEED = 1361431000 Random R8VEC: 0: 0.0617272 1: 0.449539 2: 0.401306 3: 0.754673 4: 0.797287 5: 0.00183837 6: 0.897504 7: 0.350752 8: 0.0945448 9: 0.0136169 Input SEED = 29242052 Random R8VEC: 0: 0.859097 1: 0.840847 2: 0.123104 3: 0.00751236 4: 0.260303 5: 0.912484 6: 0.113664 7: 0.351629 8: 0.822887 9: 0.267132 R8VEC_UNIFORM_01_NEW_TEST R8VEC_UNIFORM_01_NEW returns a random R8VEC with entries in [ 0.0, 1.0 ] Input SEED = 123456789 Random R8VEC: 0: 0.218418 1: 0.956318 2: 0.829509 3: 0.561695 4: 0.415307 5: 0.0661187 6: 0.257578 7: 0.109957 8: 0.043829 9: 0.633966 Input SEED = 1361431000 Random R8VEC: 0: 0.0617272 1: 0.449539 2: 0.401306 3: 0.754673 4: 0.797287 5: 0.00183837 6: 0.897504 7: 0.350752 8: 0.0945448 9: 0.0136169 Input SEED = 29242052 Random R8VEC: 0: 0.859097 1: 0.840847 2: 0.123104 3: 0.00751236 4: 0.260303 5: 0.912484 6: 0.113664 7: 0.351629 8: 0.822887 9: 0.267132 R8VEC_UNIFORM_AB_NEW_TEST R8VEC_UNIFORM_AB returns a random R8VEC with entries in a given range [ A, B ] For this problem: A = 10 B = 20 Input SEED = 123456789 Random R8VEC: 0: 12.1842 1: 19.5632 2: 18.2951 3: 15.617 4: 14.1531 5: 10.6612 6: 12.5758 7: 11.0996 8: 10.4383 9: 16.3397 Input SEED = 1361431000 Random R8VEC: 0: 10.6173 1: 14.4954 2: 14.0131 3: 17.5467 4: 17.9729 5: 10.0184 6: 18.975 7: 13.5075 8: 10.9454 9: 10.1362 Input SEED = 29242052 Random R8VEC: 0: 18.591 1: 18.4085 2: 11.231 3: 10.0751 4: 12.603 5: 19.1248 6: 11.1366 7: 13.5163 8: 18.2289 9: 12.6713 R8VEC_UNIFORM_UNIT_NEW_TEST R8VEC_UNIFORM_UNIT returns a random R8VEC on the surface of the unit M sphere. Vector: 0: 0.759464 1: -0.213843 2: -0.25604 3: -0.104542 4: 0.548635 Vector: 0: 0.339299 1: 0.280538 2: -0.445337 3: -0.498567 4: -0.5994 Vector: 0: 0.0258545 1: -0.880217 2: 0.43861 3: 0.00506653 4: -0.179289 Vector: 0: 0.713403 1: 0.0611863 2: 0.0981703 3: -0.152886 4: 0.674018 Vector: 0: 0.527 1: -0.32302 2: -0.46829 3: 0.630868 4: -0.0252735 r8vec_variance_test() r8vec_variance() computes the variance of an R8VEC; Input vector: 0: -2.81582 1: 4.56318 2: 3.29509 3: 0.616954 4: -0.846929 5: -4.33881 6: -2.42422 7: -3.90043 8: -4.56171 9: 1.33966 Variance: 9.49943 R8VEC_VARIANCE_CIRCULAR_TEST R8VEC_VARIANCE_CIRCULAR computes the circular variance of an R8VEC. Uniform Vector in [-PI,+PI]: 0: -1.76923 1: 2.86713 2: 2.07037 3: 0.387644 4: -0.532141 5: -2.72616 6: -1.52318 7: -2.45071 8: -2.86621 9: 0.841731 Circular variance = 0.765084 Normal vector, mean 0, variance 1 0: 1.67904 1: -0.472769 2: -0.56606 3: -0.231124 4: 1.21293 5: 0.535037 6: 1.26938 7: 1.04954 8: -1.66609 9: -1.86523 Circular variance = 0.564186 r8vec_variance_sample_test(): r8vec_variance_sample() computes the sample variance of an R8VEC; Input vector: 0: -2.81582 1: 4.56318 2: 3.29509 3: 0.616954 4: -0.846929 5: -4.33881 6: -2.42422 7: -3.90043 8: -4.56171 9: 1.33966 Sample variance: 10.5549 r8vec_variance_sample_update_test(): r8vec_variance_sample_update() updates the sample variance of a vector when one more element is added. N R VARIANCE VARIANCE_UPDATE 1 0.218418 0 0 2 0.956318 0.272248 0.272248 3 0.829509 0.155668 0.155668 4 0.561695 0.106608 0.106608 5 0.415307 0.0901874 0.0901874 6 0.0661187 0.11899 0.11899 7 0.257578 0.108109 0.108109 8 0.109957 0.109062 0.109062 9 0.043829 0.111731 0.111731 10 0.633966 0.105549 0.105549 r8vec_variance_update_test(): r8vec_variance_update() updates the variance of a vector when one more element is added. N R VARIANCE VARIANCE_UPDATE 1 0.218418 0 0 2 0.956318 0.136124 0.136124 3 0.829509 0.103779 0.103779 4 0.561695 0.0799561 0.0799561 5 0.415307 0.0721499 0.0721499 6 0.0661187 0.0991581 0.0991581 7 0.257578 0.0926651 0.0926651 8 0.109957 0.095429 0.095429 9 0.043829 0.0993161 0.0993161 10 0.633966 0.0949943 0.0949943 R8VEC_ZEROS_NEW_TEST R8VEC_ZEROS returns a zero R8VEC Zeroed vector: 0: 0 1: 0 2: 0 3: 0 4: 0 5: 0 6: 0 7: 0 8: 0 9: 0 R8VEC2_PRINT_TEST R8VEC2_PRINT prints a pair of R8VEC's. Squares and square roots: 0: 1 1 1: 4 1.41421 2: 9 1.73205 3: 16 2 4: 25 2.23607 R8VEC2_PRINT_SOME_TEST R8VEC2_PRINT_SOME prints some of a pair of R8VEC's. No more than 10 lines of two vectors: 0: 1 1 1: 4 1.41421 2: 9 1.73205 3: 16 2 4: 25 2.23607 5: 36 2.44949 6: 49 2.64575 7: 64 2.82843 ...... .............. .............. 99: 10000 10 R8VEC2_SORT_A_TEST For a pair of R8VEC's: R8VEC2_SORT_A ascending sorts; The pair of arrays: 0: 1.43684 5.30864 1: 2.91264 7.24769 2: 1.43684 5.30864 3: 2.12339 8.77337 4: 1.83061 8.98643 5: 2.91264 7.24769 6: 1.51516 9.48752 7: 1.21991 6.75376 8: 1.43684 5.30864 9: 2.26793 5.06808 Arrays after ascending sort: 0: 1.21991 6.75376 1: 1.43684 5.30864 2: 1.43684 5.30864 3: 1.43684 5.30864 4: 1.51516 9.48752 5: 1.83061 8.98643 6: 2.12339 8.77337 7: 2.26793 5.06808 8: 2.91264 7.24769 9: 2.91264 7.24769 R8VEC2_SORT_D_TEST For a pair of R8VEC's: R8VEC2_SORT_D descending sorts; The pair of arrays: 0: 1.43684 5.30864 1: 2.91264 7.24769 2: 1.43684 5.30864 3: 2.12339 8.77337 4: 1.83061 8.98643 5: 2.91264 7.24769 6: 1.51516 9.48752 7: 1.21991 6.75376 8: 1.43684 5.30864 9: 2.26793 5.06808 Arrays after descending sort: 0: 2.91264 7.24769 1: 2.91264 7.24769 2: 2.26793 5.06808 3: 2.12339 8.77337 4: 1.83061 8.98643 5: 1.51516 9.48752 6: 1.43684 5.30864 7: 1.43684 5.30864 8: 1.43684 5.30864 9: 1.21991 6.75376 R8VEC2_SORT_HEAP_INDEX_A_TEST R8VEC2_SORT_HEAP_INDEX_A creates a sort index for an (X,Y) array. The unsorted array: I X(I), Y(I) 0 0.2 1 1 0.85 0.55 2 0.4 0.05 3 0.25 0.1 4 0 0.65 5 0.05 0.45 6 0.4 0.75 7 0.8 0 8 0.9 0.35 9 0.05 0 10 0.9 0.85 11 0.1 0 12 0.25 0.95 13 0.1 0.35 14 0.85 0.25 15 0.7 0.55 16 0.9 0.45 17 0.95 0.6 18 0.15 0.75 19 0.4 0.15 After sorting: I INDX(I), X(I), Y(I) 0 4 0.2 1 1 9 0.85 0.55 2 5 0.4 0.05 3 11 0.25 0.1 4 13 0 0.65 5 18 0.05 0.45 6 0 0.4 0.75 7 3 0.8 0 8 12 0.9 0.35 9 2 0.05 0 10 19 0.9 0.85 11 6 0.1 0 12 15 0.25 0.95 13 7 0.1 0.35 14 14 0.85 0.25 15 1 0.7 0.55 16 8 0.9 0.45 17 16 0.95 0.6 18 10 0.15 0.75 19 17 0.4 0.15 Now use the index array to carry out the permutation implicitly. I INDX(I), X(INDX(I)), Y(INDX(I)) 0 4 0 0.65 1 9 0.05 0 2 5 0.05 0.45 3 11 0.1 0 4 13 0.1 0.35 5 18 0.15 0.75 6 0 0.2 1 7 3 0.25 0.1 8 12 0.25 0.95 9 2 0.4 0.05 10 19 0.4 0.15 11 6 0.4 0.75 12 15 0.7 0.55 13 7 0.8 0 14 14 0.85 0.25 15 1 0.85 0.55 16 8 0.9 0.35 17 16 0.9 0.45 18 10 0.9 0.85 19 17 0.95 0.6 R8VEC_PERMUTE carries out the permutation. I X(I), Y(I) 0 0 0.65 1 0.05 0 2 0.05 0.45 3 0.1 0 4 0.1 0.35 5 0.15 0.75 6 0.2 1 7 0.25 0.1 8 0.25 0.95 9 0.4 0.05 10 0.4 0.15 11 0.4 0.75 12 0.7 0.55 13 0.8 0 14 0.85 0.25 15 0.85 0.55 16 0.9 0.35 17 0.9 0.45 18 0.9 0.85 19 0.95 0.6 R8VEC2_SORTED_UNIQUE_TEST For a pair of R8VEC's: R8VEC2_SORTED_UNIQUE counts unique entries. The pair of arrays: 0: 1.43684 5.30864 1: 2.91264 7.24769 2: 1.43684 5.30864 3: 2.12339 8.77337 4: 1.83061 8.98643 5: 2.91264 7.24769 6: 1.51516 9.48752 7: 1.21991 6.75376 8: 1.43684 5.30864 9: 2.26793 5.06808 Arrays after ascending sort: 0: 1.21991 6.75376 1: 1.43684 5.30864 2: 1.43684 5.30864 3: 1.43684 5.30864 4: 1.51516 9.48752 5: 1.83061 8.98643 6: 2.12339 8.77337 7: 2.26793 5.06808 8: 2.91264 7.24769 9: 2.91264 7.24769 UNIQed array: 0: 1.21991 6.75376 1: 1.43684 5.30864 2: 1.51516 9.48752 3: 1.83061 8.98643 4: 2.12339 8.77337 5: 2.26793 5.06808 6: 2.91264 7.24769 R8VEC2_SORTED_UNIQUE_INDEX_TEST For a pair of R8VEC's: R8VEC2_SORTED_UNIQUE_INDEX indexes unique entries. The pair of arrays: 0: 1.43684 5.30864 1: 2.91264 7.24769 2: 1.43684 5.30864 3: 2.12339 8.77337 4: 1.83061 8.98643 5: 2.91264 7.24769 6: 1.51516 9.48752 7: 1.21991 6.75376 8: 1.43684 5.30864 9: 2.26793 5.06808 The number of unique elements is 10 Index of Unique Elements: 0: 1 1: 2 2: 3 3: 4 4: 5 5: 6 6: 7 7: 8 8: 9 9: 10 After Indexed Nonunique Deletion. 0: 1.43684 5.30864 1: 2.91264 7.24769 2: 1.43684 5.30864 3: 2.12339 8.77337 4: 1.83061 8.98643 5: 2.91264 7.24769 6: 1.51516 9.48752 7: 1.21991 6.75376 8: 1.43684 5.30864 9: 2.26793 5.06808 R8VEC2_SUM_MAX_INDEX_TEST For a pair of R8VEC's: R8VEC2_SUM_MAX_INDEX: index of the sum vector with maximum value. The pair of vectors: 0: 2.18418 0.308636 1: 9.56318 2.24769 2: 8.29509 2.00653 3: 5.61695 3.77337 4: 4.15307 3.98643 5: 0.661187 0.00919186 6: 2.57578 4.48752 7: 1.09957 1.75376 8: 0.43829 0.472724 9: 6.33966 0.0680845 Index of maximum in A+B: 2 r8lib_test() Normal end of execution. 23 June 2024 02:00:44 PM