10-Jan-2019 15:52:07 R8LIB_TEST MATLAB version Test the R8LIB library. C8_SQRT_R8_TEST C8_SQRT_R8 returns the square root of an R8. R1 C2=C8_SQRT_R8(R1) R3=C2*C2 -56.32 ( 0, 7.504) -56.32 91.26 ( 9.553, 0) 91.26 65.9 ( 8.118, 0) 65.9 12.34 ( 3.513, 0) 12.34 -16.94 ( 0, 4.116) -16.94 -86.78 ( 0, 9.315) -86.78 -48.48 ( 0, 6.963) -48.48 -78.01 ( 0, 8.832) -78.01 -91.23 ( 0, 9.552) -91.23 26.79 ( 5.176, 0) 26.79 I4_LOG_10_TEST I4_LOG_10: whole part of log base 10, X, I4_LOG_10 0 0 1 0 2 0 3 0 9 0 10 1 11 1 99 1 101 2 -1 0 -2 0 -3 0 -9 0 I4_MODP_TEST I4_MODP factors a number into a multiple and a remainder. Number Divisor Multiple Remainder 107 50 2 7 107 -50 -2 7 -107 50 -3 43 -107 -50 3 43 Repeat using MOD: 107 50 2 7 107 -50 -3 -43 -107 50 -3 43 -107 -50 2 -7 I4_SIGN_TEST I4_SIGN returns the sign of a number. I4 I4_SIGN(I4) -10 -1 -7 -1 0 1 5 1 9 1 I4_UNIFORM_AB_TEST I4_UNIFORM_AB computes pseudorandom values in an interval [A,B]. The lower endpoint A = -100.000000 The upper endpoint B = 200.000000 The initial seed is 123456789 1 -35 2 187 3 149 4 69 5 25 6 -81 7 -23 8 -67 9 -87 10 90 11 -82 12 35 13 20 14 127 15 139 16 -100 17 170 18 5 19 -72 20 -96 I4INT_TO_R8INT_TEST For data in an interval, I4INT_TO_R8INT converts an I4 to an R8; I4 interval: [1, 11] R8 interval: [100.000000, 200.000000] R I(R) R(I(R)) 113.394379 2 110.000000 209.321285 12 210.000000 192.836200 10 190.000000 158.020408 7 160.000000 138.989921 5 140.000000 93.595436 0 90.000000 118.485113 3 120.000000 99.294383 1 100.000000 90.697770 0 90.000000 167.415543 8 170.000000 KSUB_NEXT4_TEST KSUB_NEXT4 generates K subsets of an N set. N = 5 K = 3 Rank Subset 1 1 2 3 2 1 2 4 3 1 3 4 4 2 3 4 5 1 2 5 6 1 3 5 7 2 3 5 8 1 4 5 9 2 4 5 10 3 4 5 PERM0_CHECK_TEST PERM0_CHECK checks a permutation of 0,...,N-1. Permutation 1: 5 2 3 4 1 PERM0_CHECK - Warning! Permutation is missing the value 0. Permutation 2: 4 1 3 0 2 Permutation 3: 0 2 1 3 2 PERM0_CHECK - Warning! Permutation is missing the value 4. PERM0_UNIFORM_TEST PERM0_UNIFORM randomly selects a permutation of 0,...,N-1. 2 9 8 6 3 5 7 4 0 1 6 1 5 2 8 4 0 9 3 7 0 1 8 2 4 5 7 9 3 6 3 8 4 7 0 9 2 5 6 1 1 7 5 4 0 6 8 2 3 9 PERM1_CHECK_TEST PERM1_CHECK checks a permutation of 1,...,N. Permutation 1: 5 2 3 4 1 Permutation 2: 4 1 3 0 2 PERM1_CHECK - Warning! Permutation is missing the value 5. Permutation 3: 0 2 1 3 2 PERM1_CHECK - Warning! Permutation is missing the value 4. PERM1_UNIFORM_TEST PERM1_UNIFORM randomly selects a permutation of 1,...,N. 3 10 9 7 4 6 8 5 1 2 7 2 6 3 9 5 1 10 4 8 1 2 9 3 5 6 8 10 4 7 4 9 5 8 1 10 3 6 7 2 2 8 6 5 1 7 9 3 4 10 R8_ABS_TEST R8_ABS returns the absolute value of an R8. X R8_ABS(X) -1.252654 1.252654 4.650541 4.650541 3.636074 3.636074 1.493564 1.493564 0.322457 0.322457 -2.471050 2.471050 -0.939378 0.939378 -2.120346 2.120346 -2.649368 2.649368 2.071726 2.071726 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_ADD_TEST R8_ADD adds two R8's. R1 R2 R3 R4 R1+R2 R8_ADD(R1,R2) -281.582 456.318 174.736 174.736 329.509 61.6954 391.205 391.205 -84.6929 -433.881 -518.574 -518.574 -242.422 -390.043 -632.465 -632.465 -456.171 133.966 -322.205 -322.205 R8_AGM_TEST: R8_AGM computes the arithmetic geometric mean. X Y AGM AGM Exact Computed 22.000000 96.000000 52.27464119870424 52.27464119870424 83.000000 56.000000 68.83653005985852 68.83653005985852 42.000000 7.000000 20.65930119673401 20.65930119673401 26.000000 11.000000 17.69685487374365 17.69685487374367 4.000000 63.000000 23.8670497217533 23.8670497217533 6.000000 45.000000 20.71701598280599 20.71701598280599 40.000000 75.000000 56.12784225561668 56.12784225561668 80.000000 0.000000 0 0 90.000000 35.000000 59.26956508122964 59.26956508122989 9.000000 1.000000 3.936235503649555 3.936235503649556 53.000000 53.000000 53 53 1.000000 2.000000 1.456791031046907 1.456791031046907 1.000000 4.000000 2.243028580287603 2.243028580287603 1.000000 8.000000 3.615756177597363 3.615756177597363 R8_AINT_TEST R8_AINT returns the integer value of an R8. X R8_AINT(X) -1.252654 -1.000000 4.650541 4.000000 3.636074 3.000000 1.493564 1.000000 0.322457 0.000000 -2.471050 -2.000000 -0.939378 -0.000000 -2.120346 -2.000000 -2.649368 -2.000000 2.071726 2.000000 R8_ASINH_TEST R8_ASINH computes the inverse hyperbolic sine of a given value. X R8_ASINH(X) SINH(R8_SINH(X)) 1.000000 0.881374 1.000000 1.200000 1.015973 1.200000 1.400000 1.137982 1.400000 1.600000 1.248983 1.600000 1.800000 1.350441 1.800000 2.000000 1.443635 2.000000 2.200000 1.529660 2.200000 2.400000 1.609438 2.400000 2.600000 1.683743 2.600000 2.800000 1.753229 2.800000 3.000000 1.818446 3.000000 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.000000 0.000000 0.000000 0.000000 1.000000 1.000000 0.785398 0.785398 0.000000 1.000000 1.570796 1.570796 -1.000000 1.000000 2.356194 2.356194 -1.000000 0.000000 3.141593 3.141593 -1.000000 -1.000000 -2.356194 3.926991 0.000000 -1.000000 -1.570796 4.712389 1.000000 -1.000000 -0.785398 5.497787 R8_ATANH_TEST R8_ATANH computes the inverse hyperbolic tangent of a given value. X R8_ATANH(X) TANH(R8_ATANH(X)) -0.200000 -0.202733 -0.200000 -0.100000 -0.100335 -0.100000 0.000000 0.000000 0.000000 0.100000 0.100335 0.100000 0.200000 0.202733 0.200000 0.300000 0.309520 0.300000 0.400000 0.423649 0.400000 0.500000 0.549306 0.500000 0.600000 0.693147 0.600000 0.700000 0.867301 0.700000 0.800000 1.098612 0.800000 0.900000 1.472219 0.900000 R8_BIG_TEST R8_BIG returns a "big" R8 value; R8_BIG = 1000000000000000019884624838656.000000 R8_CAS_TEST R8_CAS evaluates the casine of a number. X R8_CAS ( X ) 0.000000 1.000000 0.261799 1.224745 0.523599 1.366025 0.785398 1.414214 1.047198 1.366025 1.308997 1.224745 1.570796 1.000000 1.832596 0.707107 2.094395 0.366025 2.356194 0.000000 2.617994 -0.366025 2.879793 -0.707107 3.141593 -1.000000 R8_CEILING_TEST R8_CEILING rounds a value up. X R8_CEILING(X) -1.200000 -1 -1.000000 -1 -0.800000 0 -0.600000 0 -0.400000 0 -0.200000 0 0.000000 0 0.200000 1 0.400000 1 0.600000 1 0.800000 1 1.000000 1 1.200000 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_CHOP_TEST R8_CHOP truncates a value to N binary digits. Here, we chop values of 3.141593 N X2=R8_CHOP(N,X) abs(X2-X) 1 2.00000000 1.1415927 2 3.00000000 0.14159265 3 3.00000000 0.14159265 4 3.00000000 0.14159265 5 3.12500000 0.016592654 6 3.12500000 0.016592654 7 3.12500000 0.016592654 8 3.14062500 0.00096765359 9 3.14062500 0.00096765359 10 3.14062500 0.00096765359 11 3.14062500 0.00096765359 12 3.14062500 0.00096765359 13 3.14111328 0.00047937234 14 3.14135742 0.00023523171 15 3.14147949 0.0001131614 16 3.14154053 5.2126246e-05 17 3.14157104 2.1608668e-05 18 3.14158630 6.3498789e-06 19 3.14158630 6.3498789e-06 20 3.14159012 2.5351816e-06 21 3.14159203 6.2783296e-07 22 3.14159203 6.2783296e-07 23 3.14159250 1.509958e-07 24 3.14159250 1.509958e-07 25 3.14159262 3.1786509e-08 26 3.14159262 3.1786509e-08 27 3.14159265 1.984187e-09 28 3.14159265 1.984187e-09 29 3.14159265 1.984187e-09 30 3.14159265 1.984187e-09 31 3.14159265 1.2154189e-10 32 3.14159265 1.2154189e-10 R8_COSD_TEST R8_COSD computes the cosine of an angle given in degrees. ANGLE R8_COSD(ANGLE) 0.00 1 15.00 0.965926 30.00 0.866025 45.00 0.707107 60.00 0.5 75.00 0.258819 90.00 6.12323e-17 105.00 -0.258819 120.00 -0.5 135.00 -0.707107 150.00 -0.866025 165.00 -0.965926 180.00 -1 195.00 -0.965926 210.00 -0.866025 225.00 -0.707107 240.00 -0.5 255.00 -0.258819 270.00 -1.83697e-16 285.00 0.258819 300.00 0.5 315.00 0.707107 330.00 0.866025 345.00 0.965926 360.00 1 R8_COT_TEST R8_COT computes the cotangent of an angle. ANGLE R8_COT(ANGLE) 0.00 Inf 0.26 3.73205 0.52 1.73205 0.79 1 1.05 0.57735 1.31 0.267949 1.57 6.12323e-17 1.83 -0.267949 2.09 -0.57735 2.36 -1 2.62 -1.73205 2.88 -3.73205 3.14 -Inf 3.40 3.73205 3.67 1.73205 3.93 1 4.19 0.57735 4.45 0.267949 4.71 1.83697e-16 4.97 -0.267949 5.24 -0.57735 5.50 -1 5.76 -1.73205 6.02 -3.73205 6.28 Inf R8_COTD_TEST R8_COTD computes the cotangent of an angle given in degrees. ANGLE R8_COTD(ANGLE) 0.00 Undefined 15.00 3.73205 30.00 1.73205 45.00 1 60.00 0.57735 75.00 0.267949 90.00 6.12323e-17 105.00 -0.267949 120.00 -0.57735 135.00 -1 150.00 -1.73205 165.00 -3.73205 180.00 Undefined 195.00 3.73205 210.00 1.73205 225.00 1 240.00 0.57735 255.00 0.267949 270.00 1.83697e-16 285.00 -0.267949 300.00 -0.57735 315.00 -1 330.00 -1.73205 345.00 -3.73205 360.00 Undefined R8_CSC_TEST R8_CSC computes the cosecant of an angle. ANGLE R8_CSC(ANGLE) 0.00 Inf 0.26 3.8637 0.52 2 0.79 1.41421 1.05 1.1547 1.31 1.03528 1.57 1 1.83 1.03528 2.09 1.1547 2.36 1.41421 2.62 2 2.88 3.8637 3.14 8.16562e+15 3.40 -3.8637 3.67 -2 3.93 -1.41421 4.19 -1.1547 4.45 -1.03528 4.71 -1 4.97 -1.03528 5.24 -1.1547 5.50 -1.41421 5.76 -2 6.02 -3.8637 6.28 -4.08281e+15 R8_CSCD_TEST R8_CSCD computes the cosecant of an angle given in degrees. ANGLE R8_CSCD(ANGLE) 0.00 Undefined 15.00 3.8637 30.00 2 45.00 1.41421 60.00 1.1547 75.00 1.03528 90.00 1 105.00 1.03528 120.00 1.1547 135.00 1.41421 150.00 2 165.00 3.8637 180.00 Undefined 195.00 -3.8637 210.00 -2 225.00 -1.41421 240.00 -1.1547 255.00 -1.03528 270.00 -1 285.00 -1.03528 300.00 -1.1547 315.00 -1.41421 330.00 -2 345.00 -3.8637 360.00 Undefined R8_CUBE_ROOT_TEST R8_CUBE_ROOT computes the cube root of an R8. X Y Y^3 -5.63163 -1.77915 -5.63163 9.12635 2.08977 9.12635 6.59018 1.87485 6.59018 1.23391 1.07258 1.23391 -1.69386 -1.19204 -1.69386 -8.67763 -2.05495 -8.67763 -4.84844 -1.69252 -4.84844 -7.80086 -1.98327 -7.80086 -9.12342 -2.08955 -9.12342 2.67931 1.38891 2.67931 R8_DAYS_TO_DHMS_TEST R8_DAYS_TO_DHMS converts a decimal day to days/hours/minutes/seconds. R8_DHMS_TO_DAYS converts a days/hours/minutes/seconds date to days. Days D H M S Days 1.0921 1 2 12 36.7043 1.0921 4.7816 4 18 45 29.1931 4.7816 4.1475 4 3 32 27.9891 4.1475 2.8085 2 19 24 12.4313 2.8085 2.0765 2 1 50 12.6592 2.0765 R8_DEGREES_TEST R8_DEGREES converts an angle from radians to degrees; Degrees Radians Degrees -60.000000 -1.047198 -60.000000 -30.000000 -0.523599 -30.000000 0.000000 0.000000 0.000000 30.000000 0.523599 30.000000 60.000000 1.047198 60.000000 90.000000 1.570796 90.000000 120.000000 2.094395 120.000000 150.000000 2.617994 150.000000 180.000000 3.141593 180.000000 210.000000 3.665191 210.000000 240.000000 4.188790 240.000000 270.000000 4.712389 270.000000 300.000000 5.235988 300.000000 330.000000 5.759587 330.000000 360.000000 6.283185 360.000000 390.000000 6.806784 390.000000 420.000000 7.330383 420.000000 R8_DHMS_TO_DAYS_TEST R8_DHMS_TO_DAYS converts a days/hours/minutes/seconds date to days. R8_DAYS_TO_DHMS converts a decimal day to days/hours/minutes/seconds. Days D H M S Days 1.0921 1 2 12 36.7043 1.0921 4.7816 4 18 45 29.1931 4.7816 4.1475 4 3 32 27.9891 4.1475 2.8085 2 19 24 12.4313 2.8085 2.0765 2 1 50 12.6592 2.0765 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.000000 0.062500 0.937500 0.875000 1.000000 0.125000 0.875000 0.875000 1.000000 0.250000 0.750000 0.750000 1.000000 0.500000 0.500000 0.500000 1.000000 0.874000 0.126000 0.125000 1.000000 0.876000 0.124000 0.125000 1.000000 0.900000 0.100000 0.125000 1.000000 0.950000 0.050000 0.000000 1.000000 0.990000 0.010000 0.000000 1.000000 1.000000 0.000000 0.000000 1.000000 1.010000 -0.010000 0.000000 1.000000 1.050000 -0.050000 0.000000 1.000000 1.100000 -0.100000 -0.137500 1.000000 3.000000 -2.000000 -1.875000 1.000000 10.000000 -9.000000 -8.750000 R8_DIGIT_TEST R8_DIGIT extracts decimal digits. Here, we get digits of 3.141593 -1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 -2 -1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 R8_DIVIDE_I4_TEST R8_DIVIDE_I4 computes an integer ratio as a real result. I J R8_DIVIDE_I4 I/J -6 10 -0.6 -0.6 7 1 7 7 -2 -9 0.222222 0.222222 -5 -8 0.625 0.625 -10 3 -3.33333 -3.33333 R8_E_TEST R8_E returns the value of the exponential base. E = 2.7182818284590451 R8_EPSILON_TEST R8_EPSILON produces the R8 roundoff unit. R = R8_EPSILON() = 2.220446e-16 ( 1 + R ) - 1 = 2.220446e-16 ( 1 + (R/2) ) - 1 = 0.000000e+00 R8_EPSILON_COMPUTE_TEST R8_EPSILON_COMPUTE computes the R8 roundoff unit. R = R8_EPSILON_COMPUTE() = 2.220446e-16 ( 1 + R ) - 1 = 2.220446e-16 ( 1 + (R/2) ) - 1 = 0.000000e+00 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.0000 4 120 120 5.2500 4 163.16015625 163.16015625 5.5000 4 216.5625 216.5625 5.7500 4 281.66015625 281.66015625 6.0000 4 360 360 7.5000 0 1 1 7.5000 1 7.5 7.5 7.5000 2 48.75 48.75 7.5000 3 268.125 268.125 7.5000 4 1206.5625 1206.5625 7.5000 5 4222.96875 4222.96875 7.5000 6 10557.421875 10557.421875 7.5000 7 15836.1328125 15836.1328125 7.5000 8 7918.06640625 7918.06640625 7.5000 9 -3959.033203125 -3959.033203125 R8_FLOOR_TEST R8_FLOOR rounds an R8 towards -infinity X R8_FLOOR(X) -1.252654 -2.000000 4.650541 4.000000 3.636074 3.000000 1.493564 1.000000 0.322457 0.000000 -2.471050 -3.000000 -0.939378 -1.000000 -2.120346 -3.000000 -2.649368 -3.000000 2.071726 2.000000 R8_FRACTIONAL_TEST R8_FRACTIONAL returns the fractional part of an R8. X R8_FRACTIONAL(X) -1.252654 0.252654 4.650541 0.650541 3.636074 0.636074 1.493564 0.493564 0.322457 0.322457 -2.471050 0.471050 -0.939378 0.939378 -2.120346 0.120346 -2.649368 0.649368 2.071726 0.071726 R8_GAMMA_TEST: R8_GAMMA evaluates the Gamma function. X GAMMA(X) R8_GAMMA(X) -0.5 -3.544907701811032 -3.544907701811032 -0.01 -100.5871979644108 -100.5871979644108 0.01 99.4325851191506 99.4325851191506 0.1 9.513507698668732 9.513507698668731 0.2 4.590843711998803 4.590843711998803 0.4 2.218159543757688 2.218159543757688 0.5 1.772453850905516 1.772453850905516 0.6 1.489192248812817 1.489192248812817 0.8 1.164229713725303 1.164229713725303 1 1 1 1.1 0.9513507698668732 0.9513507698668732 1.2 0.9181687423997607 0.9181687423997607 1.3 0.8974706963062772 0.8974706963062772 1.4 0.8872638175030753 0.8872638175030754 1.5 0.8862269254527581 0.8862269254527581 1.6 0.8935153492876903 0.8935153492876903 1.7 0.9086387328532904 0.9086387328532904 1.8 0.9313837709802427 0.9313837709802427 1.9 0.9617658319073874 0.9617658319073874 2 1 1 3 2 2 4 6 6 10 362880 362880 20 1.21645100408832e+17 1.216451004088321e+17 30 8.841761993739702e+30 8.841761993739751e+30 R8_GAMMA_LOG_TEST: R8_GAMMA_LOG evaluates the logarithm of the Gamma function. X GAMMA_LOG(X) R8_GAMMA_LOG(X) 0.2 1.524063822430784 1.524063822430784 0.4 0.7966778177017837 0.7966778177017837 0.6 0.3982338580692348 0.3982338580692349 0.8 0.1520596783998375 0.1520596783998376 1 0 0 1.1 -0.04987244125983972 -0.04987244125983976 1.2 -0.08537409000331583 -0.08537409000331585 1.3 -0.1081748095078604 -0.1081748095078605 1.4 -0.1196129141723712 -0.1196129141723713 1.5 -0.1207822376352452 -0.1207822376352453 1.6 -0.1125917656967557 -0.1125917656967558 1.7 -0.09580769740706586 -0.09580769740706586 1.8 -0.07108387291437215 -0.07108387291437215 1.9 -0.03898427592308333 -0.03898427592308337 2 0 0 3 0.6931471805599453 0.6931471805599454 4 1.791759469228055 1.791759469228055 10 12.80182748008147 12.80182748008147 20 39.33988418719949 39.33988418719949 30 71.25703896716801 71.257038967168 R8_HAVERSINE_TEST R8_HAVERSINE computes the haversine of an angle. Degrees Radians Haversine 0.000000 0.000000 0.000000 0.009139 0.523599 0.066987 0.018277 1.047198 0.250000 0.027416 1.570796 0.500000 0.036554 2.094395 0.750000 0.045693 2.617994 0.933013 0.054831 3.141593 1.000000 0.063970 3.665191 0.933013 0.073108 4.188790 0.750000 0.082247 4.712389 0.500000 0.091385 5.235988 0.250000 0.100524 5.759587 0.066987 0.109662 6.283185 0.000000 R8_HUGE_TEST R8_HUGE returns the largest R8 value; R8_HUGE = 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000 R8_HYPOT_TEST R8_HYPOT computes sqrt(A^2+B^2) carefully. A B R8_HYPOT Norm sqrt(A^2+B^2) -5.06197e+307 8.20319e+307 9.63929e+307 9.63929e+307 Inf 5.92356e+307 1.10909e+307 6.0265e+307 6.0265e+307 Inf -1.52252e+307 -7.79985e+307 7.94706e+307 7.94706e+307 Inf -4.35801e+307 -7.01178e+307 8.25574e+307 8.25574e+307 Inf -8.20055e+307 2.40829e+307 8.54687e+307 8.54687e+307 Inf R8_IS_IN_01_TEST R8_IS_IN_01 is TRUE if an R8 is in [0,1] R8 R8_IS_IN_01?: 0.1839 1 1.1432 0 0.9784 1 0.6302 1 0.4399 1 -0.0140 0 0.2349 1 0.0429 1 -0.0430 0 0.7242 1 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) = 1 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)) = 1 R8_IS_INF(log(0)) = 1 R8_IS_INF(sqrt(-1)) = 0 R8_IS_INSIGNIFICANT_TEST R8_IS_INSIGNIFICANT(R,S) is TRUE if S is insignicant compared to R. R S R8_IS_INSIGNIFICANT(R,S) 1 100 0 1 10 0 1 1 0 1 0.1 0 1 0.01 0 1 0.001 0 1 0.0001 0 1 1e-05 0 1 1e-06 0 1 1e-07 0 1 1e-08 0 1 1e-09 0 1 1e-10 0 1 1e-11 0 1 1e-12 0 1 1e-13 0 1 1e-14 0 1 1e-15 0 1 1e-16 1 1 1e-17 1 1 1e-18 1 1 1e-19 1 1 1e-20 1 1 1e-21 1 1 1e-22 1 R8_IS_INTEGER_TEST R8_IS_INTEGER reports whether an R8 stores an integer value. R8_IS_INTEGER(-1.142857) = 0 R8_IS_INTEGER(-1.000000) = 1 R8_IS_INTEGER(-0.857143) = 0 R8_IS_INTEGER(-0.714286) = 0 R8_IS_INTEGER(-0.571429) = 0 R8_IS_INTEGER(-0.428571) = 0 R8_IS_INTEGER(-0.285714) = 0 R8_IS_INTEGER(-0.142857) = 0 R8_IS_INTEGER(0.000000) = 1 R8_IS_INTEGER(0.142857) = 0 R8_IS_INTEGER(0.285714) = 0 R8_IS_INTEGER(0.428571) = 0 R8_IS_INTEGER(0.571429) = 0 R8_IS_INTEGER(0.714286) = 0 R8_IS_INTEGER(0.857143) = 0 R8_IS_INTEGER(1.000000) = 1 R8_IS_INTEGER(1.142857) = 0 R8_IS_INTEGER(1.285714) = 0 R8_IS_INTEGER(1.428571) = 0 R8_IS_INTEGER(1.571429) = 0 R8_IS_INTEGER(1.714286) = 0 R8_IS_INTEGER(1.857143) = 0 R8_IS_INTEGER(2.000000) = 1 R8_IS_INTEGER(2.142857) = 0 R8_IS_NAN_TEST R8_IS_NAN reports whether an R8 is Not-a-Number. 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)) = 0 R8_IS_NAN(exp(1000)) = 0 R8_IS_NAN(log(0)) = 0 R8_IS_NAN(sqrt(-1)) = 0 R8_LOG_2_TEST R8_LOG_2 computes the logarithm base 2. X R8_LOG_2 0.000000 -Inf 1.000000 0.000000 2.000000 1.000000 3.000000 1.584963 9.000000 3.169925 10.000000 3.321928 11.000000 3.459432 99.000000 6.629357 101.000000 6.658211 -1.000000 0.000000 -2.000000 1.000000 -3.000000 1.584963 -9.000000 3.169925 0.500000 -1.000000 0.330000 -1.599462 0.250000 -2.000000 0.200000 -2.321928 0.010000 -6.643856 R8_LOG_10_TEST R8_LOG_10 computes the logarithm base 10. X R8_LOG_10 0.000000 -Inf 1.000000 0.000000 2.000000 0.301030 3.000000 0.477121 9.000000 0.954243 10.000000 1.000000 11.000000 1.041393 99.000000 1.995635 101.000000 2.004321 -1.000000 0.000000 -2.000000 0.301030 -3.000000 0.477121 -9.000000 0.954243 0.500000 -0.301030 0.330000 -0.481486 0.250000 -0.602060 0.200000 -0.698970 0.010000 -2.000000 R8_LOG_B_TEST R8_LOG_B computes the logarithm base B. X B R8_LOG_B 16.000000 2.000000 4.000000 16.000000 3.000000 2.523719 16.000000 4.000000 2.000000 16.000000 5.000000 1.722706 16.000000 6.000000 1.547411 16.000000 7.000000 1.424829 16.000000 8.000000 1.333333 16.000000 16.000000 1.000000 16.000000 32.000000 0.800000 16.000000 256.000000 0.500000 R8_MANT_TEST R8_MANT decomposes a value. Number to be decomposed: -314.159000 R8_MANT: X = -1 * 1.227184 * 2^ 8 R8_MAX_TEST R8_MAX returns the maximum of two R8's. A B C=R8_MAX(A,B) -2.8158 4.5632 4.5632 3.2951 0.6170 3.2951 -0.8469 -4.3388 -0.8469 -2.4242 -3.9004 -2.4242 -4.5617 1.3397 1.3397 -4.3827 -0.5046 -0.5046 -0.9869 2.5467 2.5467 2.9729 -4.9816 2.9729 3.9750 -1.4925 3.9750 -4.0546 -4.8638 -4.0546 R8_MIN_TEST R8_MIN returns the minimum of two R8's. A B C=R8_MIN(A,B) -2.8158 4.5632 -2.8158 3.2951 0.6170 0.6170 -0.8469 -4.3388 -4.3388 -2.4242 -3.9004 -3.9004 -4.5617 1.3397 -4.5617 -4.3827 -0.5046 -4.3827 -0.9869 2.5467 -0.9869 2.9729 -4.9816 -4.9816 3.9750 -1.4925 -1.4925 -4.0546 -4.8638 -4.8638 R8_MOD_TEST R8_MOD returns the remainder after division. X Y MOD(X,Y) R8_MOD(X,Y) -5.631634 9.126352 3.494717 -5.631634 6.590185 1.233909 0.420640 0.420640 -1.693858 -8.677625 -1.693858 -1.693858 -4.848444 -7.800864 -4.848444 -4.848444 -9.123420 2.679314 1.593837 -1.085477 -8.765455 -1.009221 -0.691689 -0.691689 -1.973874 5.093470 3.119595 -1.973874 5.945739 -9.963233 -4.017493 5.945739 7.950081 -2.984953 -1.004779 1.980175 -8.109105 -9.727662 -8.109105 -8.109105 R8_MODP_TEST R8_MODP returns the remainder after division. Unlike the MATLAB MOD, R8_MODP ( X, Y ) is positive. X Y MOD(X,Y) R8_MODP(X,Y) -5.631634 9.126352 3.494717 3.494717 6.590185 1.233909 0.420640 0.420640 -1.693858 -8.677625 -1.693858 6.983767 -4.848444 -7.800864 -4.848444 2.952420 -9.123420 2.679314 1.593837 1.593837 -8.765455 -1.009221 -0.691689 0.317532 -1.973874 5.093470 3.119595 3.119595 5.945739 -9.963233 -4.017493 5.945739 7.950081 -2.984953 -1.004779 1.980175 -8.109105 -9.727662 -8.109105 1.618557 R8_MOP_TEST R8_MOP evaluates (-1.0)^I4 as an R8. I4 R8_MOP(I4) -57 -1.0 92 1.0 66 1.0 12 1.0 -17 -1.0 -87 -1.0 -49 -1.0 -78 1.0 -92 1.0 27 -1.0 R8_NINT_TEST R8_NINT produces the nearest integer. X R8_NINT(X) -5.631634 -6 9.126352 10 6.590185 7 1.233909 2 -1.693858 -2 -8.677625 -9 -4.848444 -5 -7.800864 -8 -9.123420 -10 2.679314 3 R8_NORMAL_01_TEST R8_NORMAL_01 generates normally distributed random values. Using initial random number seed = 123456789 1.679040 -0.566060 1.212934 1.269381 -1.666087 -2.242464 0.039675 0.673068 -0.275127 2.164005 0.297785 2.044536 1.398819 -1.242985 -0.067084 -0.794396 -0.523768 -0.350567 0.131700 0.537380 R8_NORMAL_AB_TEST R8_NORMAL_AB generates normally distributed values with given mean and standard deviation. Using initial random number seed = 123456789 MEAN = 100 STD = 10 116.790403 94.339402 112.129342 112.693806 83.339133 77.575360 100.396749 106.730682 97.248726 121.640048 102.977852 120.445356 113.988185 87.570149 99.329163 92.056040 94.762315 96.494328 101.316998 105.373799 R8_NTH_ROOT_TEST R8_NTH_ROOT computes the nth root of an R8. X -3 -2 -1 0 1 2 3 -3 -0.6934 -0.5774 -0.3333 1 -3 NaN -1.442 -2 -0.7937 -0.7071 -0.5 1 -2 NaN -1.26 -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.7937 0.7071 0.5 1 2 1.414 1.26 3 0.6934 0.5774 0.3333 1 3 1.732 1.442 R8_PI_TEST R8_PI returns the value of PI. R8_PI = 3.1415926535897931 4 * Atan(1) = 3.1415926535897931 PI = 3.1415926535897931 R8_POWER_TEST R8_POWER computes R^P. R P R8_POWER 2.000000 -5 0.031250 2.000000 -4 0.062500 2.000000 -3 0.125000 2.000000 -2 0.250000 2.000000 -1 0.500000 2.000000 0 1.000000 2.000000 1 2.000000 2.000000 2 4.000000 2.000000 3 8.000000 2.000000 4 16.000000 2.000000 5 32.000000 R8_POWER_FAST_TEST R8_POWER_FAST computes R^P, economizing on multiplications. R P R^P Mults 2.000000 -10 0.000977 7 2.000000 -9 0.001953 7 2.000000 -8 0.003906 6 2.000000 -7 0.007812 7 2.000000 -6 0.015625 6 2.000000 -5 0.031250 6 2.000000 -4 0.062500 5 2.000000 -3 0.125000 5 2.000000 -2 0.250000 4 2.000000 -1 0.500000 1 2.000000 0 1.000000 0 2.000000 1 2.000000 0 2.000000 2 4.000000 3 2.000000 3 8.000000 4 2.000000 4 16.000000 4 2.000000 5 32.000000 5 2.000000 6 64.000000 5 2.000000 7 128.000000 6 2.000000 8 256.000000 5 2.000000 9 512.000000 6 2.000000 10 1024.000000 6 2.000000 11 2048.000000 7 2.000000 12 4096.000000 6 2.000000 13 8192.000000 7 2.000000 14 16384.000000 7 2.000000 15 32768.000000 8 2.000000 16 65536.000000 6 2.000000 17 131072.000000 7 2.000000 18 262144.000000 7 2.000000 19 524288.000000 8 2.000000 20 1048576.000000 7 2.000000 21 2097152.000000 8 2.000000 22 4194304.000000 8 2.000000 23 8388608.000000 9 2.000000 24 16777216.000000 7 2.000000 25 33554432.000000 8 2.000000 26 67108864.000000 8 2.000000 27 134217728.000000 9 2.000000 28 268435456.000000 8 2.000000 29 536870912.000000 9 2.000000 30 1073741824.000000 9 2.000000 31 2147483648.000000 10 2.000000 32 4294967296.000000 7 2.000000 33 8589934592.000000 8 2.000000 34 17179869184.000000 8 2.000000 35 34359738368.000000 9 2.000000 36 68719476736.000000 8 2.000000 37 137438953472.000000 9 2.000000 38 274877906944.000000 9 2.000000 39 549755813888.000000 10 2.000000 40 1099511627776.000000 8 R8_PRINT_TEST R8_PRINT prints an R8 with a label. The value of pi is 3.14159 Seven divided by four is 1.75 1234.56 R8_RADIANS_TEST R8_RADIANS converts an angle from degrees to radians; Degrees Radians Degrees -60.000000 -1.047198 -60.000000 -30.000000 -0.523599 -30.000000 0.000000 0.000000 0.000000 30.000000 0.523599 30.000000 60.000000 1.047198 60.000000 90.000000 1.570796 90.000000 120.000000 2.094395 120.000000 150.000000 2.617994 150.000000 180.000000 3.141593 180.000000 210.000000 3.665191 210.000000 240.000000 4.188790 240.000000 270.000000 4.712389 270.000000 300.000000 5.235988 300.000000 330.000000 5.759587 330.000000 360.000000 6.283185 360.000000 390.000000 6.806784 390.000000 420.000000 7.330383 420.000000 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 Rise(X,N). X N Exact Computed 5.0000 4 1680 1680 5.2500 4 1962.59765625 1962.59765625 5.5000 4 2279.0625 2279.0625 5.7500 4 2631.97265625 2631.97265625 6.0000 4 3024 3024 7.5000 0 1 1 7.5000 1 7.5 7.5 7.5000 2 63.75 63.75 7.5000 3 605.625 605.625 7.5000 4 6359.0625 6359.0625 7.5000 5 73129.21875 73129.21875 7.5000 6 914115.234375 914115.234375 7.5000 7 12340555.6640625 12340555.6640625 7.5000 8 178938057.1289063 178938057.1289062 7.5000 9 2773539885.498047 2773539885.498047 R8_ROUND_TEST R8_ROUND rounds an R8 X R8_ROUND(X) -1.252654 -1.000000 4.650541 5.000000 3.636074 4.000000 1.493564 1.000000 0.322457 0.000000 -2.471050 -2.000000 -0.939378 -1.000000 -2.120346 -2.000000 -2.649368 -3.000000 2.071726 2.000000 R8_ROUND2_TEST R8_ROUND2 rounds a number to a specified number of base 2 digits. Test effect on PI: X = 3.141593 NPLACE XROUND 0 0.000000 1 2.000000 2 3.000000 3 3.000000 4 3.000000 5 3.125000 6 3.125000 7 3.125000 8 3.140625 9 3.140625 10 3.140625 11 3.140625 12 3.140625 13 3.141113 14 3.141357 15 3.141479 16 3.141541 17 3.141571 18 3.141586 19 3.141586 20 3.141590 R8_ROUNDB_TEST R8_ROUNDB rounds a number to a specified number of base BASE digits. Here, we will use BASE = 3 Test effect on PI: X = 3.141593 NPLACE XROUND 0 0.000000 1 3.000000 2 3.000000 3 3.000000 4 3.111111 5 3.111111 6 3.135802 7 3.139918 8 3.141289 9 3.141289 10 3.141442 11 3.141543 12 3.141577 13 3.141589 14 3.141592 15 3.141592 16 3.141593 17 3.141593 18 3.141593 19 3.141593 20 3.141593 Try with a negative base: Input quantity is X = 121.000000 to be rounded in base -3 Output value to 1 places is 81.000000 Output value to 2 places is 108.000000 Output value to 3 places is 117.000000 Output value to 4 places is 120.000000 Output value to 5 places is 121.000000 R8_ROUNDX_TEST R8_ROUNDX rounds a number to a specified number of decimal digits. Test effect on PI: X = 3.141593 NPLACE XROUND 0 0.000000 1 3.000000 2 3.100000 3 3.140000 4 3.141000 5 3.141500 6 3.141590 7 3.141592 8 3.141593 9 3.141593 10 3.141593 Test effect on random values: NPLACE X XROUND 0 0.218418 0.000000 2 0.218418 0.210000 4 0.218418 0.218400 6 0.218418 0.218418 8 0.218418 0.218418 10 0.218418 0.218418 0 0.956318 0.000000 2 0.956318 0.950000 4 0.956318 0.956300 6 0.956318 0.956317 8 0.956318 0.956318 10 0.956318 0.956318 0 0.829509 0.000000 2 0.829509 0.820000 4 0.829509 0.829500 6 0.829509 0.829509 8 0.829509 0.829509 10 0.829509 0.829509 0 0.561695 0.000000 2 0.561695 0.560000 4 0.561695 0.561600 6 0.561695 0.561695 8 0.561695 0.561695 10 0.561695 0.561695 0 0.415307 0.000000 2 0.415307 0.410000 4 0.415307 0.415300 6 0.415307 0.415307 8 0.415307 0.415307 10 0.415307 0.415307 R8_SECD_TEST R8_SECD computes the secant of an angle given in degrees. ANGLE R8_SECD(ANGLE) 0.00 1 15.00 1.03528 30.00 1.1547 45.00 1.41421 60.00 2 75.00 3.8637 90.00 Undefined 105.00 -3.8637 120.00 -2 135.00 -1.41421 150.00 -1.1547 165.00 -1.03528 180.00 -1 195.00 -1.03528 210.00 -1.1547 225.00 -1.41421 240.00 -2 255.00 -3.8637 270.00 Undefined 285.00 3.8637 300.00 2 315.00 1.41421 330.00 1.1547 345.00 1.03528 360.00 1 R8_SECH_TEST R8_SECH computes the hyperbolic-secant of an angle. X A=R8_SECH(X) ASECH(A) 1 0.648054 1 1.5 0.425096 1.5 2 0.265802 2 2.5 0.163071 2.5 3 0.0993279 3 3.5 0.0603397 3.5 4 0.036619 4 4.5 0.0222153 4.5 5 0.0134753 5 R8_SIGMOID_TEST R8_SIGMOID evaluates the sigmoid function of R8. X R8_SIGMOID(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.250000 -1.000000 -0.250000 -1.000000 0.000000 1.000000 0.500000 1.000000 9.000000 1.000000 R8_SIGN_CHAR_TEST R8_SIGN3_CHAR returns the three-way sign of an R8 as a character. R8 R8_SIGN_CHAR(R8) -1.2500 "-" -0.2500 "-" 0.0000 "0" 0.5000 "+" 9.0000 "+" R8_SIGN_MATCH_TEST R8_SIGN_MATCH returns TRUE if two R8's have matching sign. R1 R2 R8_SIGN_MATCH(R1,R2) -1.00 -1.00 1 -1.00 0.00 1 -1.00 1.00 0 0.00 -1.00 1 0.00 0.00 1 0.00 1.00 1 1.00 -1.00 0 1.00 0.00 1 1.00 1.00 1 R8_SIGN_MATCH_STRICT_TEST R8_SIGN_MATCH_STRICT returns TRUE if two R8's have strictly matching sign. R1 R2 R8_SIGN_MATCH_STRICT(R1,R2) -1.00 -1.00 1 -1.00 0.00 0 -1.00 1.00 0 0.00 -1.00 0 0.00 0.00 1 0.00 1.00 0 1.00 -1.00 0 1.00 0.00 0 1.00 1.00 1 R8_SIGN_OPPOSITE_TEST R8_SIGN_OPPOSITE returns TRUE if two R8's have opposite sign. R1 R2 R8_SIGN_OPPOSITE(R1,R2) -1.00 -1.00 0 -1.00 0.00 1 -1.00 1.00 1 0.00 -1.00 1 0.00 0.00 1 0.00 1.00 1 1.00 -1.00 1 1.00 0.00 1 1.00 1.00 0 R8_SIGN_OPPOSITE_STRICT_TEST R8_SIGN_OPPOSITE_STRICT returns TRUE if two R8's have srictly opposite sign. R1 R2 R8_SIGN_OPPOSITE_STRICT(R1,R2) -1.00 -1.00 0 -1.00 0.00 0 -1.00 1.00 1 0.00 -1.00 0 0.00 0.00 0 0.00 1.00 0 1.00 -1.00 1 1.00 0.00 0 1.00 1.00 0 R8_SIGN3_TEST R8_SIGN3 returns the three-way sign of an R8. R8 R8_SIGN3(R8) -1.250000 -1.000000 -0.250000 -1.000000 0.000000 0.000000 0.500000 1.000000 9.000000 1.000000 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 1 0.000000 4.56318 4.56318 4.56318 2 0.314159 -0.0925808 -0.0925808 -0.0925808 3 0.628319 -4.65768 -4.65768 -4.65768 4 0.942478 -4.66168 -4.66168 -4.66168 5 1.256637 -0.100663 -0.100663 -0.100663 6 1.570796 4.55893 4.55893 4.55893 7 1.884956 4.75412 4.75412 4.75412 8 2.199115 0.293777 0.293777 0.293777 9 2.513274 -4.45425 -4.45425 -4.45425 10 2.827433 -4.84039 -4.84039 -4.84039 11 3.141593 -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.00 0 15.00 0.258819 30.00 0.5 45.00 0.707107 60.00 0.866025 75.00 0.965926 90.00 1 105.00 0.965926 120.00 0.866025 135.00 0.707107 150.00 0.5 165.00 0.258819 180.00 1.22465e-16 195.00 -0.258819 210.00 -0.5 225.00 -0.707107 240.00 -0.866025 255.00 -0.965926 270.00 -1 285.00 -0.965926 300.00 -0.866025 315.00 -0.707107 330.00 -0.5 345.00 -0.258819 360.00 -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_SQRT_I4_TEST R8_SQRT_I4 returns the square root of an integer. I1 R2=R8_SQRT_I4(I1) R3=R2*R2 1014 31.843367 1014 4778 69.123079 4778 4131 64.272856 4131 2765 52.583267 2765 2018 44.922155 2018 237 15.394804 237 1213 34.82815 1213 460 21.447611 460 123 11.090537 123 3133 55.973208 3133 R8_SQRT_PI_TEST R8_SQRT_PI returns the square root of PI. R8_SQRT_PI = 1.7724538509055161 2 * sqrt ( atan(1) ) = 1.7724538509055159 sqrt ( PI ) = 1.7724538509055159 R8_SWAP_TEST R8_SWAP swaps two reals. Before swapping: X = 1.000000 Y = 3.141590 After swapping: X = 3.141590 Y = 1.000000 R8_SWAP3_TEST R8_SWAP3 swaps three reals. Before 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.00 0 15.00 0.267949 30.00 0.57735 45.00 1 60.00 1.73205 75.00 3.73205 90.00 Undefined 105.00 -3.73205 120.00 -1.73205 135.00 -1 150.00 -0.57735 165.00 -0.267949 180.00 -1.22465e-16 195.00 0.267949 210.00 0.57735 225.00 1 240.00 1.73205 255.00 3.73205 270.00 Undefined 285.00 -3.73205 300.00 -1.73205 315.00 -1 330.00 -0.57735 345.00 -0.267949 360.00 -2.44929e-16 R8_TINY_TEST R8_TINY returns a "tiny" R8 value; R8_TINY = 2.22507e-308 R8_TO_I4_TEST R8_TO_I4 finds an integer IX in [IXMIN,IXMAX] corresponding to X in [XMIN,XMAX]. XMIN = 2.500000, X = 3.500000, XMAX = 5.500000 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.000000, 10.000000] R RD 1.839438 1.947368 11.432128 10.000000 9.783620 10.000000 6.302041 6.210526 4.398992 4.315789 -0.140456 1.000000 2.348511 2.421053 0.429438 1.000000 -0.430223 1.000000 7.241554 7.157895 -0.197546 1.000000 4.844006 4.789474 4.216982 4.315789 8.810755 8.578947 9.364730 9.526316 R8_UNIFORM_01_TEST R8_UNIFORM_01 produces a sequence of random values. Using random seed 123456789 SEED R8_UNIFORM_01(SEED) 469049721 0.218418 2053676357 0.956318 1781357515 0.829509 1206231778 0.561695 891865166 0.415307 141988902 0.066119 553144097 0.257578 236130416 0.109957 94122056 0.043829 1361431000 0.633966 Verify that the sequence can be restarted. Set the seed back to its original value, and see that we generate the same sequence. SEED R8_UNIFORM_01(SEED) 469049721 0.218418 2053676357 0.956318 1781357515 0.829509 1206231778 0.561695 891865166 0.415307 141988902 0.066119 553144097 0.257578 236130416 0.109957 94122056 0.043829 1361431000 0.633966 R8_UNIFORM_AB_TEST R8_UNIFORM_AB returns random values in a given range: [ A, B ] For this problem: A = 10.000000 B = 20.000000 12.184183 19.563176 18.295092 15.616954 14.153071 10.661187 12.575778 11.099568 10.438290 16.339657 R8_UNSWAP3_TEST R8_UNSWAP3 reverses R8_SWAP3. Before R8_SWAP3: 1 3.14159 1952 After R8_SWAP3 #1: 3.14159 1952 1 After R8_SWAP3 #2: 1952 1 3.14159 After R8_UNSWAP3 #1: 3.14159 1952 1 After R8_UNSWAP3 #2: 1 3.14159 1952 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.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.250000 0.000000 0.000000 0.000000 0.000000 1.000000 0.000000 0.500000 0.000000 0.000000 0.000000 1.000000 0.000000 0.000000 0.750000 0.000000 0.000000 0.000000 1.000000 1.000000 0.000000 1.000000 0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 1.250000 0.000000 0.000000 1.000000 0.000000 1.000000 0.000000 1.500000 0.000000 0.000000 1.000000 1.000000 0.000000 0.000000 1.750000 0.000000 0.000000 1.000000 1.000000 1.000000 0.000000 2.000000 0.000000 1.000000 0.000000 0.000000 0.000000 0.000000 2.250000 0.000000 1.000000 0.000000 0.000000 1.000000 0.000000 2.500000 0.000000 1.000000 0.000000 1.000000 0.000000 0.000000 2.750000 0.000000 1.000000 0.000000 1.000000 1.000000 0.000000 3.000000 0.000000 1.000000 1.000000 0.000000 0.000000 0.000000 3.250000 0.000000 1.000000 1.000000 0.000000 1.000000 0.000000 3.500000 0.000000 1.000000 1.000000 1.000000 0.000000 0.000000 3.750000 0.000000 1.000000 1.000000 1.000000 1.000000 0.000000 4.000000 1.000000 0.000000 0.000000 0.000000 0.000000 0.000000 4.250000 1.000000 0.000000 0.000000 0.000000 1.000000 0.000000 4.500000 1.000000 0.000000 0.000000 1.000000 0.000000 0.000000 4.750000 1.000000 0.000000 0.000000 1.000000 1.000000 0.000000 5.000000 1.000000 0.000000 1.000000 0.000000 0.000000 0.000000 5.250000 1.000000 0.000000 1.000000 0.000000 1.000000 0.000000 5.500000 1.000000 0.000000 1.000000 1.000000 0.000000 0.000000 5.750000 1.000000 0.000000 1.000000 1.000000 1.000000 0.000000 6.000000 1.000000 1.000000 0.000000 0.000000 0.000000 0.000000 6.250000 1.000000 1.000000 0.000000 0.000000 1.000000 0.000000 6.500000 1.000000 1.000000 0.000000 1.000000 0.000000 0.000000 6.750000 1.000000 1.000000 0.000000 1.000000 1.000000 0.000000 7.000000 1.000000 1.000000 1.000000 0.000000 0.000000 0.000000 7.250000 1.000000 1.000000 1.000000 0.000000 1.000000 0.000000 7.500000 1.000000 1.000000 1.000000 1.000000 0.000000 0.000000 7.750000 1.000000 1.000000 1.000000 1.000000 1.000000 0.000000 8.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 R8_WRAP_TEST R8_WRAP "wraps" an R8 to lie within an interval: Wrapping interval is 3.000000, 6.500000 R R8_WRAP ( R ) 1.05786 4.55786 11.3884 4.38845 9.61313 6.11313 5.86374 5.86374 3.8143 3.8143 -1.07434 5.92566 1.60609 5.10609 -0.460605 3.0394 -1.38639 5.61361 6.87552 3.37552 -1.13582 5.86418 4.29355 4.29355 3.61829 3.61829 8.56543 5.06543 9.16202 5.66202 -1.97426 5.02574 10.5651 3.56506 2.91053 6.41053 -0.676373 6.32363 -1.80936 5.19064 R82_PRINT_TEST R82_PRINT prints a pair of R8's with a label. The square roots of 9: : ( 3, -3 ) R82COL_PRINT_PART_TEST R82COL_PRINT_PART prints part of an R82COL. Output with MAX_PRINT = 2 1 11 12 2 21 22 ...more entries... Output with MAX_PRINT = 5 1 11 12 2 21 22 3 31 32 .... .............. .............. 10 101 102 Output with MAX_PRINT = 25 1 11 12 2 21 22 3 31 32 4 41 42 5 51 52 6 61 62 7 71 72 8 81 82 9 91 92 10 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 1: 1 3 2: 2 2 3: 1 0 4: 1 0 Order type = -1 1: 0 2 2: 0 1 3: 1 2 4: 2 0 Order type = -1 1: 3 1 2: 0 0 3: 3 3 4: 0 0 Order type = -1 1: 1 3 2: 0 1 3: 2 1 4: 2 2 Order type = -1 1: 3 1 2: 3 2 3: 1 2 4: 1 1 Order type = 3 1: 2 1 2: 2 1 3: 1 2 4: 0 1 Order type = -1 1: 2 2 2: 0 2 3: 0 2 4: 2 1 Order type = -1 1: 3 2 2: 2 1 3: 3 2 4: 0 2 Order type = -1 1: 0 1 2: 1 3 3: 0 0 4: 0 0 Order type = -1 1: 1 0 2: 1 1 3: 2 2 4: 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 = Before rearrangement: 1: 2.18418 9.56318 2: 8.29509 5.61695 3: 4.15307 0.661187 4: 2.57578 1.09957 5: 0.43829 6.33966 6: 0.617272 4.49539 7: 4.01306 7.54673 8: 7.97287 0.0183837 9: 8.97504 3.50752 10: 0.945448 0.136169 11: 8.59097 8.40847 12: 1.23104 0.0751236 Rearranged array Left index = 4 Key index = 5 Right index = 6 Left half: 1: 1.23104 0.0751236 2: 0.945448 0.136169 3: 0.617272 4.49539 4: 0.43829 6.33966 Key: 1: 2.18418 9.56318 Right half: 1: 4.01306 7.54673 2: 7.97287 0.0183837 3: 8.97504 3.50752 4: 2.57578 1.09957 5: 8.59097 8.40847 6: 4.15307 0.661187 7: 8.29509 5.61695 R82ROW_PRINT_PART_TEST R82ROW_PRINT_PART prints part of an R82ROW. Output with MAX_PRINT = 2 1 11 21 2 12 22 ...more entries... Output with MAX_PRINT = 5 1 11 21 2 12 22 3 13 23 .... .............. .............. 10 20 30 Output with MAX_PRINT = 25 1 11 21 2 12 22 3 13 23 4 14 24 5 15 25 6 16 26 7 17 27 8 18 28 9 19 29 10 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: 1: 2.18418 9.56318 2: 8.29509 3.50752 3: 0.43829 0.661187 4: 1.23104 1.09957 5: 0.43829 6.33966 6: 0.617272 9.56318 7: 8.59097 8.40847 8: 7.97287 0.0183837 9: 8.97504 3.50752 10: 0.945448 0.136169 11: 8.59097 8.40847 12: 1.23104 0.0751236 I Index A(Index) 1 3 0.43829 0.661187 2 5 0.43829 6.33966 3 6 0.617272 9.56318 4 10 0.945448 0.136169 5 12 1.23104 0.0751236 6 4 1.23104 1.09957 7 1 2.18418 9.56318 8 8 7.97287 0.0183837 9 2 8.29509 3.50752 10 7 8.59097 8.40847 11 11 8.59097 8.40847 12 9 8.97504 3.50752 After rearrangement by R82ROW_PERMUTE: 1: 0.43829 0.661187 2: 0.43829 6.33966 3: 0.617272 9.56318 4: 0.945448 0.136169 5: 1.23104 0.0751236 6: 1.23104 1.09957 7: 2.18418 9.56318 8: 7.97287 0.0183837 9: 8.29509 3.50752 10: 8.59097 8.40847 11: 8.59097 8.40847 12: 8.97504 3.50752 R82ROW_SORT_QUICK_A_TEST R82ROW_SORT_QUICK_A sorts an R82ROW using quick sort. Using initial random number seed = 123456789 Before rearrangement: 1: 2.18418 9.56318 2: 8.29509 3.50752 3: 0.43829 0.661187 4: 1.23104 1.09957 5: 0.43829 6.33966 6: 0.617272 9.56318 7: 8.59097 8.40847 8: 7.97287 0.0183837 9: 8.97504 3.50752 10: 0.945448 0.136169 11: 8.59097 8.40847 12: 1.23104 0.0751236 Sorted array: 1: 0.43829 0.661187 2: 0.43829 6.33966 3: 0.617272 9.56318 4: 0.945448 0.136169 5: 1.23104 0.0751236 6: 1.23104 1.09957 7: 2.18418 9.56318 8: 7.97287 0.0183837 9: 8.29509 3.50752 10: 8.59097 8.40847 11: 8.59097 8.40847 12: 8.97504 3.50752 R82ROW_UNIFORM_AB_TEST R82ROW_UNIFORM_AB computes a random R82ROW. Initial seed is 123456789 Uniform R82ROW: 1: 12.1842 14.1531 2: 19.5632 10.6612 3: 18.2951 12.5758 4: 15.617 11.0996 R82VEC_ORDER_TYPE_TEST R82VEC_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 1: 1 3 2: 2 2 3: 1 0 4: 1 0 Order type = -1 1: 0 2 2: 0 1 3: 1 2 4: 2 0 Order type = -1 1: 3 1 2: 0 0 3: 3 3 4: 0 0 Order type = -1 1: 1 3 2: 0 1 3: 2 1 4: 2 2 Order type = -1 1: 3 1 2: 3 2 3: 1 2 4: 1 1 Order type = 3 1: 2 1 2: 2 1 3: 1 2 4: 0 1 Order type = -1 1: 2 2 2: 0 2 3: 0 2 4: 2 1 Order type = -1 1: 3 2 2: 2 1 3: 3 2 4: 0 2 Order type = -1 1: 0 1 2: 1 3 3: 0 0 4: 0 0 Order type = -1 1: 1 0 2: 1 1 3: 2 2 4: 2 1 R82VEC_PART_QUICK_A_TEST R82VEC_PART_QUICK_A reorders an R82VEC as part of a quick sort. Using initial random number seed = Before rearrangement: 1: 2.18418 9.56318 2: 8.29509 5.61695 3: 4.15307 0.661187 4: 2.57578 1.09957 5: 0.43829 6.33966 6: 0.617272 4.49539 7: 4.01306 7.54673 8: 7.97287 0.0183837 9: 8.97504 3.50752 10: 0.945448 0.136169 11: 8.59097 8.40847 12: 1.23104 0.0751236 Rearranged array Left index = 4 Key index = 5 Right index = 6 Left half: 1: 1.23104 0.0751236 2: 0.945448 0.136169 3: 0.617272 4.49539 4: 0.43829 6.33966 Key: 1: 2.18418 9.56318 Right half: 1: 4.01306 7.54673 2: 7.97287 0.0183837 3: 8.97504 3.50752 4: 2.57578 1.09957 5: 8.59097 8.40847 6: 4.15307 0.661187 7: 8.29509 5.61695 R82VEC_PERMUTE_TEST R82VEC_PERMUTE permutes an R82VEC. Original array XY[]: 1: 1 11 2: 2 22 3: 3 33 4: 4 44 5: 5 55 Permutation vector P[]: 1: 2 2: 4 3: 5 4: 1 5: 3 Permuted array X[P[]]: 1: 2 22 2: 4 44 3: 5 55 4: 1 11 5: 3 33 R82VEC_PRINT_TEST R82VEC_PRINT prints an R82VEC. The R82VEC: 1: 2.18418 4.15307 2: 9.56318 0.661187 3: 8.29509 2.57578 4: 5.61695 1.09957 R82VEC_PRINT_PART_TEST R82VEC_PRINT_PART prints part of an R82VEC. The R82VEC: 1 2.18418 5.40539 2 9.56318 8.32281 3 8.29509 1.45756 4 5.61695 7.17128 5 4.15307 7.75651 6 0.661187 3.62262 7 2.57578 5.31111 8 1.09957 3.79977 .... .............. .............. 100 4.06827 2.78111 R82VEC_SORT_HEAP_INDEX_A_TEST R82VEC_SORT_HEAP_INDEX_A index sorts an R82VEC using heapsort. Using initial random number seed = 123456789 Before rearrangement: 1: 2.18418 9.56318 2: 8.29509 3.50752 3: 0.43829 0.661187 4: 1.23104 1.09957 5: 0.43829 6.33966 6: 0.617272 9.56318 7: 8.59097 8.40847 8: 7.97287 0.0183837 9: 8.97504 3.50752 10: 0.945448 0.136169 11: 8.59097 8.40847 12: 1.23104 0.0751236 I Index A(Index) 1 3 0.43829 0.661187 2 5 0.43829 6.33966 3 6 0.617272 9.56318 4 10 0.945448 0.136169 5 12 1.23104 0.0751236 6 4 1.23104 1.09957 7 1 2.18418 9.56318 8 8 7.97287 0.0183837 9 2 8.29509 3.50752 10 7 8.59097 8.40847 11 11 8.59097 8.40847 12 9 8.97504 3.50752 After rearrangement by R82VEC_PERMUTE: 1: 0.43829 0.661187 2: 0.43829 6.33966 3: 0.617272 9.56318 4: 0.945448 0.136169 5: 1.23104 0.0751236 6: 1.23104 1.09957 7: 2.18418 9.56318 8: 7.97287 0.0183837 9: 8.29509 3.50752 10: 8.59097 8.40847 11: 8.59097 8.40847 12: 8.97504 3.50752 R82VEC_SORT_QUICK_A_TEST R82VEC_SORT_QUICK_A sorts an R82VEC using quick sort. Using initial random number seed = 123456789 Before rearrangement: 1: 2.18418 9.56318 2: 8.29509 3.50752 3: 0.43829 0.661187 4: 1.23104 1.09957 5: 0.43829 6.33966 6: 0.617272 9.56318 7: 8.59097 8.40847 8: 7.97287 0.0183837 9: 8.97504 3.50752 10: 0.945448 0.136169 11: 8.59097 8.40847 12: 1.23104 0.0751236 Sorted array: 1: 0.43829 0.661187 2: 0.43829 6.33966 3: 0.617272 9.56318 4: 0.945448 0.136169 5: 1.23104 0.0751236 6: 1.23104 1.09957 7: 2.18418 9.56318 8: 7.97287 0.0183837 9: 8.29509 3.50752 10: 8.59097 8.40847 11: 8.59097 8.40847 12: 8.97504 3.50752 R82VEC_UNIFORM_01_TEST R82VEC_UNIFORM_01 computes a random R82VEC. Initial seed is 123456789 Uniform R82VEC: 1: 0.218418 0.956318 2: 0.829509 0.561695 3: 0.415307 0.0661187 4: 0.257578 0.109957 R82VEC_UNIFORM_AB_TEST R82VEC_UNIFORM_AB computes a random R82VEC in [A,B]. Initial seed is 123456789 Uniform R82VEC: 1: 12.1842 14.1531 2: 19.5632 10.6612 3: 18.2951 12.5758 4: 15.617 11.0996 R83COL_PRINT_PART_TEST R83COL_PRINT_PART prints part of an R83COL. Output with MAX_PRINT = 2 1 11 12 13 2 21 22 23 ...more entries... Output with MAX_PRINT = 5 1 11 12 13 2 21 22 23 3 31 32 33 .... .............. .............. .............. 10 101 102 103 Output with MAX_PRINT = 25 1 11 12 13 2 21 22 23 3 31 32 33 4 41 42 43 5 51 52 53 6 61 62 63 7 71 72 73 8 81 82 83 9 91 92 93 10 101 102 103 R83ROW_PRINT_PART_TEST R83ROW_PRINT_PART prints part of an R83ROW. Output with MAX_PRINT = 2 1 11 21 31 2 12 22 32 ...more entries... Output with MAX_PRINT = 5 1 11 21 31 2 12 22 32 3 13 23 33 .... .............. .............. .............. 10 20 30 40 Output with MAX_PRINT = 25 1 11 21 31 2 12 22 32 3 13 23 33 4 14 24 34 5 15 25 35 6 16 26 36 7 17 27 37 8 18 28 38 9 19 29 39 10 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_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 R8INT_TO_I4INT_TEST R8INT_TO_I4INT converts an R8 to an I4. I4 interval: [1, 11] R8 interval: [100.000000, 200.000000] R I(R) R(I(R)) 113.394379 2 110.000000 209.321285 12 210.000000 192.836200 10 190.000000 158.020408 7 160.000000 138.989921 5 140.000000 93.595436 0 90.000000 118.485113 3 120.000000 99.294383 1 100.000000 90.697770 0 90.000000 167.415543 8 170.000000 R8MAT_ADD_TEST R8MAT_ADD computes C = alpha * A + beta * B for R8MAT's. A: Col: 1 2 3 4 Row 1 : 11 12 13 14 2 : 21 22 23 24 3 : 31 32 33 34 4 : 41 42 43 44 B: Col: 1 2 3 4 Row 1 : 11 21 31 41 2 : 12 22 32 42 3 : 13 23 33 43 4 : 14 24 34 44 ALPHA = 3, BETA = 0.5 C = alpha * A + beta * B: Col: 1 2 3 4 Row 1 : 38.5 46.5 54.5 62.5 2 : 69 77 85 93 3 : 99.5 107.5 115.5 123.5 4 : 130 138 146 154 R8MAT_AMAX_TEST R8MAT_AMAX computes the maximum absolute value; Random array: Col: 1 2 3 Row 1 : -5.63163 -8.67763 -8.76546 2 : 9.12635 -4.84844 -1.00922 3 : 6.59018 -7.80086 -1.97387 4 : 1.23391 -9.12342 5.09347 5 : -1.69386 2.67931 5.94574 Maximum value = 9.126352 R8MAT_BORDER_ADD_TEST R8MAT_BORDER_ADD adds a zero border to a matrix. Matrix A: Col: 1 2 3 Row 1 : 1 2 3 2 : 0 2 1 3 : 0 4 3 4 : 5 6 7 Matrix A + border: Col: 1 2 3 4 5 Row 1 : 0 0 0 0 0 2 : 0 1 2 3 0 3 : 0 0 2 1 0 4 : 0 0 4 3 0 5 : 0 5 6 7 0 6 : 0 0 0 0 0 R8MAT_BORDER_CUT_TEST R8MAT_BORDER_CUT cuts the border from a matrix. Matrix A: Col: 1 2 3 4 Row 1 : 11 12 13 14 2 : 21 22 23 24 3 : 31 32 33 34 4 : 41 42 43 44 5 : 51 52 53 54 Matrix A - border: Col: 1 2 Row 1 : 22 23 2 : 32 33 3 : 42 43 R8MAT_CHOLESKY_FACTOR_TEST R8MAT_CHOLESKY_FACTOR determines the lower triangular Cholesky factorization of a positive definite symmetric matrix, Matrix to be factored: Col: 1 2 3 4 5 Row 1 : 2 -1 0 0 0 2 : -1 2 -1 0 0 3 : 0 -1 2 -1 0 4 : 0 0 -1 2 -1 5 : 0 0 0 -1 2 Cholesky factor L: Col: 1 2 3 4 5 Row 1 : 1.41421 0 0 0 0 2 : -0.707107 1.22474 0 0 0 3 : 0 -0.816497 1.1547 0 0 4 : 0 0 -0.866025 1.11803 0 5 : 0 0 0 -0.894427 1.09545 Product L * L': Col: 1 2 3 4 5 Row 1 : 2 -1 0 0 0 2 : -1 2 -1 0 0 3 : 0 -1 2 -1 0 4 : 0 0 -1 2 -1 5 : 0 0 0 -1 2 R8MAT_CHOLESKY_FACTOR_UPPER_TEST R8MAT_CHOLESKY_FACTOR_UPPER determines the upper triangular Cholesky factorization of a positive definite symmetric matrix, Matrix to be factored: Col: 1 2 3 4 5 Row 1 : 2 -1 0 0 0 2 : -1 2 -1 0 0 3 : 0 -1 2 -1 0 4 : 0 0 -1 2 -1 5 : 0 0 0 -1 2 Cholesky factor R: Col: 1 2 3 4 5 Row 1 : 1.41421 -0.707107 0 0 0 2 : 0 1.22474 -0.816497 0 0 3 : 0 0 1.1547 -0.866025 0 4 : 0 0 0 1.11803 -0.894427 5 : 0 0 0 0 1.09545 Product R'*R: Col: 1 2 3 4 5 Row 1 : 2 -1 0 0 0 2 : -1 2 -1 0 0 3 : 0 -1 2 -1 0 4 : 0 0 -1 2 -1 5 : 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: 1 2 3 4 5 Row 1 : 2 -1 0 0 0 2 : -1 2 -1 0 0 3 : 0 -1 2 -1 0 4 : 0 0 -1 2 -1 5 : 0 0 0 -1 2 Inverse matrix: Col: 1 2 3 4 5 Row 1 : 0.833333 0.666667 0.5 0.333333 0.166667 2 : 0.666667 1.33333 1 0.666667 0.333333 3 : 0.5 1 1.5 1 0.5 4 : 0.333333 0.666667 1 1.33333 0.666667 5 : 0.166667 0.333333 0.5 0.666667 0.833333 Product inv(A) * A: Col: 1 2 3 4 5 Row 1 : 1 2.22045e-16 0 -1.11022e-16 0 2 :-6.66134e-16 1 2.22045e-16 -1.66533e-16 -1.11022e-16 3 :-6.66134e-16 1.11022e-15 1 -2.22045e-16 0 4 :-4.44089e-16 6.66134e-16 0 1 0 5 :-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: 1 2 3 4 5 Row 1 : 2 -1 0 0 0 2 : -1 2 -1 0 0 3 : 0 -1 2 -1 0 4 : 0 0 -1 2 -1 5 : 0 0 0 -1 2 Cholesky factor L: Col: 1 2 3 4 5 Row 1 : 1.41421 0 0 0 0 2 : -0.707107 1.22474 0 0 0 3 : 0 -0.816497 1.1547 0 0 4 : 0 0 -0.866025 1.11803 0 5 : 0 0 0 -0.894427 1.09545 Product L * L': Col: 1 2 3 4 5 Row 1 : 2 -1 0 0 0 2 : -1 2 -1 0 0 3 : 0 -1 2 -1 0 4 : 0 0 -1 2 -1 5 : 0 0 0 -1 2 Right hand side: 1: 0 2: 0 3: 0 4: 0 5: 6 Computed solution: 1: 1 2: 2 3: 3 4: 4 5: 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: 1 2 3 4 5 Row 1 : 2 -1 0 0 0 2 : -1 2 -1 0 0 3 : 0 -1 2 -1 0 4 : 0 0 -1 2 -1 5 : 0 0 0 -1 2 Cholesky factor R: Col: 1 2 3 4 5 Row 1 : 1.41421 -0.707107 0 0 0 2 : 0 1.22474 -0.816497 0 0 3 : 0 0 1.1547 -0.866025 0 4 : 0 0 0 1.11803 -0.894427 5 : 0 0 0 0 1.09545 Product R' * R: Col: 1 2 3 4 5 Row 1 : 2 -1 0 0 0 2 : -1 2 -1 0 0 3 : 0 -1 2 -1 0 4 : 0 0 -1 2 -1 5 : 0 0 0 -1 2 Right hand side: 1: 0 2: 0 3: 0 4: 0 5: 6 Computed solution: 1: 1 2: 2 3: 3 4: 4 5: 5 R8MAT_COVARIANCE_TEST R8MAT_COVARIANCE computes the covariance. Array of M vectors of length N: Col: 1 2 3 4 5 Row 1 : 2.18418 4.15307 0.43829 4.01306 8.97504 2 : 9.56318 0.661187 6.33966 7.54673 3.50752 3 : 8.29509 2.57578 0.617272 7.97287 0.945448 4 : 5.61695 1.09957 4.49539 0.0183837 0.136169 MxM covariance matrix: Col: 1 2 3 4 Row 1 : 10.1866 -5.2474 -2.77356 -6.20683 2 : -5.2474 12.1962 8.92771 5.19352 3 : -2.77356 8.92771 14.25 1.52143 4 : -6.20683 5.19352 1.52143 6.78683 R8MAT_DET_2D_TEST R8MAT_DET_2D: determinant of a 2 by 2 matrix; Matrix: Col: 1 2 Row 1 : 1 1 2 : 1 10 R8MAT_DET_2D computes determinant: 9.000000 Exact determinant is 9.000000 R8MAT_DET_3D_TEST R8MAT_DET_3D: determinant of a 3 by 3 matrix; Matrix: Col: 1 2 3 Row 1 : 1 1 1 2 : 1 10 100 3 : 1 4 16 R8MAT_DET_3D computes determinant: -162.000000 Exact determinant is -162.000000 R8MAT_DET_4D_TEST R8MAT_DET_4D determinant of a 4 by 4 matrix; Matrix: Col: 1 2 3 4 Row 1 : 1 1 1 1 2 : 1 10 100 1000 3 : 1 4 16 64 4 : 1 2 4 8 R8MAT_DET_4D computes determinant: -2592.000000 Exact determinant is -2592.000000 R8MAT_DET_5D_TEST R8MAT_DET_5D: determinant of 5 by 5 matrix. Matrix: Col: 1 2 3 4 5 Row 1 : 1 1 1 1 1 2 : 1 10 100 1000 10000 3 : 1 4 16 64 256 4 : 1 2 4 8 16 5 : 1 3 9 27 81 R8MAT_DET_5D computes determinant: -36288.000000 Exact determinant is -36288.000000 R8MAT_DIAG_ADD_SCALAR_TEST R8MAT_DIAG_ADD_SCALAR adds a scalar to each diagonal entry of an R8MAT. Initial matrix A: Col: 1 2 3 4 5 Row 1 : 11 12 13 14 15 2 : 21 22 23 24 25 3 : 31 32 33 34 35 4 : 41 42 43 44 45 5 : 51 52 53 54 55 Using scalar S = 7 A + s*I: Col: 1 2 3 4 5 Row 1 : 18 12 13 14 15 2 : 21 29 23 24 25 3 : 31 32 40 34 35 4 : 41 42 43 51 45 5 : 51 52 53 54 62 R8MAT_DIAG_ADD_VECTOR_TEST R8MAT_DIAG_ADD_VECTOR adds a vector to the diagonal of an R8MAT. Initial matrix A: Col: 1 2 3 4 5 Row 1 : 11 12 13 14 15 2 : 21 22 23 24 25 3 : 31 32 33 34 35 4 : 41 42 43 44 45 5 : 51 52 53 54 55 Vector to add to diagonal: 1: 0.218418 2: 0.956318 3: 0.829509 4: 0.561695 5: 0.415307 A + V: Col: 1 2 3 4 5 Row 1 : 11.2184 12 13 14 15 2 : 21 22.9563 23 24 25 3 : 31 32 33.8295 34 35 4 : 41 42 43 44.5617 45 5 : 51 52 53 54 55.4153 R8MAT_DIAG_GET_VECTOR_TEST R8MAT_DIAG_GET_VECTOR gets a vector of the diagonal entries of an R8MAT. Initial matrix A: Col: 1 2 3 4 5 Row 1 : 11 12 13 14 15 2 : 21 22 23 24 25 3 : 31 32 33 34 35 4 : 41 42 43 44 45 5 : 51 52 53 54 55 Diagonal vector: 1: 11 2: 22 3: 33 4: 44 5: 55 R8MAT_DIAG_SET_SCALAR_TEST R8MAT_DIAG_SET_SCALAR sets the diagonal etnries of an R8MAT to a given scalar. Initial matrix A: Col: 1 2 3 4 5 Row 1 : 11 12 13 14 15 2 : 21 22 23 24 25 3 : 31 32 33 34 35 4 : 41 42 43 44 45 5 : 51 52 53 54 55 Scalar value for diagonal is 123.45 A with new diagonal: Col: 1 2 3 4 5 Row 1 : 123.45 12 13 14 15 2 : 21 123.45 23 24 25 3 : 31 32 123.45 34 35 4 : 41 42 43 123.45 45 5 : 51 52 53 54 123.45 R8MAT_DIAG_SET_VECTOR_TEST R8MAT_DIAG_SET_VECTOR sets the diagonal etnries of an R8MAT to a given vector. Initial matrix A: Col: 1 2 3 4 5 Row 1 : 11 12 13 14 15 2 : 21 22 23 24 25 3 : 31 32 33 34 35 4 : 41 42 43 44 45 5 : 51 52 53 54 55 Vector to add to diagonal: 1: 0.218418 2: 0.956318 3: 0.829509 4: 0.561695 5: 0.415307 A with new diagonal: Col: 1 2 3 4 5 Row 1 : 0.218418 12 13 14 15 2 : 21 0.956318 23 24 25 3 : 31 32 0.829509 34 35 4 : 41 42 43 0.561695 45 5 : 51 52 53 54 0.415307 R8MAT_DIAGONAL_TEST R8MAT_DIAGONAL returns a matrix with given diagonal. Desired diagonal entriesss: 1: 11 2: 22 3: 33 4: 44 Matrix with given diagonal: Col: 1 2 3 4 Row 1 : 11 0 0 0 2 : 0 22 0 0 3 : 0 0 33 0 4 : 0 0 0 44 R8MAT_EXPAND_LINEAR_TEST R8MAT_EXPAND_LINEAR linearly interpolates new data between old values in a matrix. Original matrix: Col: 1 2 3 Row 1 : 1 1 1 2 : 2 4 8 3 : 3 9 27 4 : 4 16 64 MFAT = 2 NFAT = 1 Fattened matrix: Col: 1 2 3 4 5 Row 1 : 1 1 1 1 1 2 : 1.33333 1.66667 2 2.66667 3.33333 3 : 1.66667 2.33333 3 4.33333 5.66667 4 : 2 3 4 6 8 5 : 2.33333 4 5.66667 10 14.3333 6 : 2.66667 5 7.33333 14 20.6667 7 : 3 6 9 18 27 8 : 3.33333 7.33333 11.3333 25.3333 39.3333 9 : 3.66667 8.66667 13.6667 32.6667 51.6667 10 : 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: 1 2 Row 1 : 11 12 2 : 21 22 3 : 31 32 Expanded array A2: Col: 1 2 3 4 5 Row 1 : 11 11.25 11.5 11.75 12 2 : 13.2222 13.4722 13.7222 13.9722 14.2222 3 : 15.4444 15.6944 15.9444 16.1944 16.4444 4 : 17.6667 17.9167 18.1667 18.4167 18.6667 5 : 19.8889 20.1389 20.3889 20.6389 20.8889 6 : 22.1111 22.3611 22.6111 22.8611 23.1111 7 : 24.3333 24.5833 24.8333 25.0833 25.3333 8 : 26.5556 26.8056 27.0556 27.3056 27.5556 9 : 28.7778 29.0278 29.2778 29.5278 29.7778 10 : 31 31.25 31.5 31.75 32 R8MAT_FLIP_COLS_TEST R8MAT_FLIP_COLS "flips" the columns of a matrix; Matrix A: Col: 1 2 3 Row 1 : 11 12 13 2 : 21 22 23 3 : 31 32 33 4 : 41 42 43 5 : 51 52 53 Matrix after column flipping: Col: 1 2 3 Row 1 : 13 12 11 2 : 23 22 21 3 : 33 32 31 4 : 43 42 41 5 : 53 52 51 R8MAT_FLIP_ROWS_TEST R8MAT_FLIP_ROWS "flips" the rows of a matrix; Matrix A: Col: 1 2 3 Row 1 : 11 12 13 2 : 21 22 23 3 : 31 32 33 4 : 41 42 43 5 : 51 52 53 Matrix after row flipping: Col: 1 2 3 Row 1 : 51 52 53 2 : 41 42 43 3 : 31 32 33 4 : 21 22 23 5 : 11 12 13 R8MAT_FS_TEST For a matrix in general storage, R8MAT_FS factors and solves a linear system. Matrix order N = 10 Solution: 1: 1 2: 2 3: 3 4: 4 5: 5 6: 6 7: 7 8: 8 9: 9 10: 10 R8MAT_FSS_TEST For a matrix in general storage, R8MAT_FSS factors and solves multiple linear systems. Matrix order N = 10 Solution: Col: 1 2 3 Row 1 : 1 1 1 2 : 1 2 2 3 : 1 3 3 4 : 1 4 1 5 : 1 5 2 6 : 1 6 3 7 : 1 7 1 8 : 1 8 2 9 : 1 9 3 10 : 1 10 1 R8MAT_GIVENS_POST_TEST R8MAT_GIVENS_POST computes a Givens postmultiplier rotation matrix. Matrix A: Col: 1 2 3 Row 1 : 1 1 1 2 : 1 2 4 3 : 1 3 9 I = 3, J = 2 G Col: 1 2 3 Row 1 : 1 0 0 2 : 0 0.948683 0.316228 3 : 0 -0.316228 0.948683 A * G Col: 1 2 3 Row 1 : 1 0.632456 1.26491 2 : 1 0.632456 4.42719 3 : 1 -4.44089e-16 9.48683 R8MAT_GIVENS_PRE_TEST R8MAT_GIVENS_PRE computes a Givens premultiplier rotation matrix. Matrix A: Col: 1 2 3 Row 1 : 1 1 1 2 : 1 2 4 3 : 1 3 9 I = 3, J = 2 G Col: 1 2 3 Row 1 : 1 0 0 2 : 0 0.5547 0.83205 3 : 0 -0.83205 0.5547 G*A Col: 1 2 3 Row 1 : 1 1 1 2 : 1.38675 3.60555 9.70725 3 : -0.27735 2.22045e-16 1.6641 R8MAT_HESS_TEST R8MAT_HESS estimates the Hessian matrix of a scalar function. Estimated Hessian: Col: 1 2 3 Row 1 : 2 1 0 2 : 1 2.381e-06 9.88032 3 : 0 9.88032 -30.8503 Exact Hessian: Col: 1 2 3 Row 1 : 2 1 0 2 : 1 0 9.88032 3 : 0 9.88032 -30.8503 R8MAT_HOUSE_AXH_TEST R8MAT_HOUSE_AXH multiplies a matrix A times a compact Householder matrix. Matrix A: Col: 1 2 3 4 5 Row 1 : -2.81582 -4.33881 -4.38273 -4.98162 3.59097 2 : 4.56318 -2.42422 -0.50461 3.97504 3.40847 3 : 3.29509 -3.90043 -0.986937 -1.49248 -3.76896 4 : 0.616954 -4.56171 2.54673 -4.05455 -4.92488 5 : -0.846929 1.33966 2.97287 -4.86383 -2.39697 Compact vector V so H*A packs column 3: 1: 0 2: 0 3: -0.788819 4: 0.399863 5: 0.466771 Householder matrix H: Col: 1 2 3 4 5 Row 1 : 1 -0 -0 -0 -0 2 : -0 1 -0 -0 -0 3 : -0 -0 -0.244469 0.630839 0.736395 4 : -0 -0 0.630839 0.680219 -0.373289 5 : -0 -0 0.736395 -0.373289 0.56425 Indirect product A*H: Col: 1 2 3 4 5 Row 1 : -2.81582 -4.33881 0.573215 -7.49385 0.65837 2 : 4.56318 -2.42422 5.14095 1.11322 0.0678026 3 : 3.29509 -3.90043 -3.47568 -0.230898 -2.29629 4 : 0.616954 -4.56171 -6.80702 0.686997 0.610057 5 : -0.846929 1.33966 -5.56019 -0.538306 2.65233 Direct product A*H: Col: 1 2 3 4 5 Row 1 : -2.81582 -4.33881 0.573215 -7.49385 0.65837 2 : 4.56318 -2.42422 5.14095 1.11322 0.0678026 3 : 3.29509 -3.90043 -3.47568 -0.230898 -2.29629 4 : 0.616954 -4.56171 -6.80702 0.686997 0.610057 5 : -0.846929 1.33966 -5.56019 -0.538306 2.65233 H*A should have packed column 3: Col: 1 2 3 4 5 Row 1 : -2.81582 -4.33881 -4.38273 -4.98162 3.59097 2 : 4.56318 -2.42422 -0.50461 3.97504 3.40847 3 : -1.04002 -0.937652 4.03706 -5.7746 -3.95052 4 : 2.81449 -6.06358 -3.12044e-16 -1.88388 -4.83284 5 : 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: 1: 0 2: 0 3: 1 4: 2 5: 3 Householder matrix H: Col: 1 2 3 4 5 Row 1 : 1 -0 -0 -0 -0 2 : -0 1 -0 -0 -0 3 : -0 -0 0.857143 -0.285714 -0.428571 4 : -0 -0 -0.285714 0.428571 -0.857143 5 : -0 -0 -0.428571 -0.857143 -0.285714 R8MAT_HOUSE_POST_TEST R8MAT_HOUSE_POST computes a Householder postmultiplier; Matrix A: Col: 1 2 3 4 5 Row 1 : 1.09209 0.330594 0.308636 0.00919186 4.29548 2 : 4.78159 1.28789 2.24769 4.48752 4.20424 3 : 4.14755 0.549784 2.00653 1.75376 0.61552 4 : 2.80848 0.219145 3.77337 0.472724 0.0375618 5 : 2.07654 3.16983 3.98643 0.0680845 1.30151 I = 2, J = 3 Householder matrix H: Col: 1 2 3 4 5 Row 1 : 1 -0 -0 -0 -0 2 : -0 1 -0 -0 -0 3 : -0 -0 -0.343307 -0.685413 -0.642145 4 : -0 -0 -0.685413 0.650273 -0.32765 5 : -0 -0 -0.642145 -0.32765 0.693034 Product A*H: Col: 1 2 3 4 5 Row 1 : 1.09209 0.330594 -2.87058 -1.61298 2.77572 2 : 4.78159 1.28789 -6.54718 3.18938e-16 0 3 : 4.14755 0.549784 -2.28616 -0.436552 -1.43653 4 : 2.80848 0.219145 -1.64356 -2.29122 -2.5519 5 : 2.07654 3.16983 -2.251 -3.11452 -1.68018 R8MAT_HOUSE_PRE_TEST R8MAT_HOUSE_PRE computes a Householder premultiplier; Matrix A: Col: 1 2 3 4 5 Row 1 : 1.09209 0.330594 0.308636 0.00919186 4.29548 2 : 4.78159 1.28789 2.24769 4.48752 4.20424 3 : 4.14755 0.549784 2.00653 1.75376 0.61552 4 : 2.80848 0.219145 3.77337 0.472724 0.0375618 5 : 2.07654 3.16983 3.98643 0.0680845 1.30151 I = 2, J = 3 Householder matrix H: Col: 1 2 3 4 5 Row 1 : 1 -0 -0 -0 -0 2 : -0 -0.358962 -0.320448 -0.602615 -0.636643 3 : -0 -0.320448 0.924437 -0.142099 -0.150122 4 : -0 -0.602615 -0.142099 0.732777 -0.282312 5 : -0 -0.636643 -0.150122 -0.282312 0.701747 Product H*A: Col: 1 2 3 4 5 Row 1 : 1.09209 0.330594 0.308636 0.00919186 4.29548 2 : -6.05992 -2.78859 -6.26165 -2.50105 -2.55764 3 : 1.59108 -0.411463 4.44267e-16 0.105833 -0.978953 4 : -1.99906 -1.58852 9.53827e-18 -2.62628 -2.96091 5 : -3.00247 1.26009 4.44089e-16 -3.2059 -1.86627 R8MAT_INDICATOR_TEST R8MAT_INDICATOR returns an indicator matrix. Indicator matrix: Col: 1 2 3 4 Row 1 : 11 12 13 14 2 : 21 22 23 24 3 : 31 32 33 34 4 : 41 42 43 44 5 : 51 52 53 54 R8MAT_INVERSE_2D_TEST R8MAT_INVERSE_2D inverts a 2 by 2 matrix. Matrix A to invert: Col: 1 2 Row 1 : 1 2 2 : 3 4 Inverse matrix B: Col: 1 2 Row 1 : -2 1 2 : 1.5 -0.5 Product C = A * B: Col: 1 2 Row 1 : 1 0 2 : 0 1 R8MAT_INVERSE_3D_TEST R8MAT_INVERSE_3D inverts a 3 by 3 matrix. Matrix A to be inverted: Col: 1 2 3 Row 1 : 1 2 3 2 : 4 5 6 3 : 7 8 0 Inverse matrix B: Col: 1 2 3 Row 1 : -1.77778 0.888889 -0.111111 2 : 1.55556 -0.777778 0.222222 3 : -0.111111 0.222222 -0.111111 Product C = A * B: Col: 1 2 3 Row 1 : 1 -1.11022e-16 0 2 : 5.55112e-16 1 1.11022e-16 3 : 1.77636e-15 -8.88178e-16 1 R8MAT_INVERSE_4D_TEST R8MAT_INVERSE_4D inverts a 4 x 4 matrix. Matrix A to be inverted: Col: 1 2 3 4 Row 1 : 4 3 2 1 2 : 3 3 2 1 3 : 0 2 2 1 4 : 0 0 1 1 Determinant is 1.000000 Inverse B: Col: 1 2 3 4 Row 1 : 1 -1 0 -0 2 : -3 4 -1 0 3 : 6 -8 3 -1 4 : -6 8 -3 2 Product C = A * B: Col: 1 2 3 4 Row 1 : 1 0 0 0 2 : 0 1 0 0 3 : 0 0 1 0 4 : 0 0 0 1 R8MAT_IS_BINARY_TEST R8MAT_IS_BINARY is TRUE if an R8MAT only contains 0 or 1 entries. Matrix: Col: 1 2 3 Row 1 : 0 1 0 2 : 1 0 1 X is binary Matrix: Col: 1 2 3 Row 1 : 1 1 1 2 : 1 1 1 X is binary Matrix: Col: 1 2 3 Row 1 : 0 1 0 2 : 1 2 1 X is NOT binary. R8MAT_JAC_TEST R8MAT_JAC estimates the M by N jacobian matrix of a nonlinear function. Estimated jacobian: Col: 1 2 3 4 Row 1 : -0.83233 -0.41616 0 0 2 : 0.70711 0 1 0 3 : 1 2 3 4 Exact jacobian: Col: 1 2 3 4 Row 1 : -0.832294 -0.416147 0 0 2 : 0.707107 0 1 0 3 : 1 2 3 4 R8MAT_KRONECKER_TEST R8MAT_KRONECKER computes the Kronecker product of two matrices. Factor matrix A: Col: 1 2 3 Row 1 : 1 2 3 2 : 4 5 6 Factor matrix B: Col: 1 2 Row 1 : 7 8 2 : 9 10 3 : 11 12 Kronecker product C = kron(A,B) Col: 1 2 3 4 5 Row 1 : 7 8 14 16 21 2 : 9 10 18 20 27 3 : 11 12 22 24 33 4 : 28 32 35 40 42 5 : 36 40 45 50 54 6 : 44 48 55 60 66 Col: 6 Row 1 : 24 2 : 30 3 : 36 4 : 48 5 : 60 6 : 72 R8MAT_L_INVERSE_TEST R8MAT_L_INVERSE inverts a lower triangular matrix. Matrix A to be inverted: Col: 1 2 3 4 Row 1 : 1 0 0 0 2 : 2 3 0 0 3 : 4 5 6 0 4 : 7 8 9 10 Inverse matrix B: Col: 1 2 3 4 Row 1 : 1 0 0 0 2 : -0.666667 0.333333 0 0 3 : -0.111111 -0.277778 0.166667 0 4 : -0.0666667 -0.0166667 -0.15 0.1 Product C = A * B: Col: 1 2 3 4 Row 1 : 1 0 0 0 2 : 0 1 0 0 3 : 0 0 1 0 4 : 0 0 0 1 R8MAT_L_PRINT_TEST R8MAT_L_PRINT prints a lower triangular matrix 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 11 21 3 11 21 31 4 11 21 31 41 5 11 21 31 41 51 6 11 21 31 41 51 61 7 11 21 31 41 51 61 71 A 7 by 3 matrix. Col 1 2 3 Row 1 11 2 11 21 3 11 21 31 4 11 21 31 5 11 21 31 6 11 21 31 7 11 21 31 A 4 by 7 matrix. Col 1 2 3 4 Row 1 11 2 11 21 3 11 21 31 4 11 21 31 41 R8MAT_L_SOLVE_TEST R8MAT_L_SOLVE solves a lower triangular system. Input matrix A: Col: 1 2 3 4 Row 1 : 1 0 0 0 2 : 2 3 0 0 3 : 4 5 6 0 4 : 7 8 9 10 Right hand side b: 1: 1 2: 8 3: 32 4: 90 Computed solution x: 1: 1 2: 2 3: 3 4: 4 Norm of A*x-b = 0 R8MAT_L1_INVERSE_TEST R8MAT_L1_INVERSE inverts a unit lower triangular matrix. Matrix A to be inverted: Col: 1 2 3 4 5 Row 1 : 1 0 0 0 0 2 : 2 1 0 0 0 3 : 0 0 1 0 0 4 : 5 0 3 1 0 5 : 0 0 0 0 1 6 : 75 0 0 6 4 Col: 6 Row 1 : 0 2 : 0 3 : 0 4 : 0 5 : 0 6 : 1 Inverse matrix B: Col: 1 2 3 4 5 Row 1 : 1 0 0 0 0 2 : -2 1 0 0 0 3 : -0 -0 1 0 0 4 : -5 -0 -3 1 0 5 : -0 -0 -0 -0 1 6 : -45 -0 18 -6 -4 Col: 6 Row 1 : 0 2 : 0 3 : 0 4 : 0 5 : 0 6 : 1 Product C = A * B: Col: 1 2 3 4 5 Row 1 : 1 0 0 0 0 2 : 0 1 0 0 0 3 : 0 0 1 0 0 4 : 0 0 0 1 0 5 : 0 0 0 0 1 6 : 0 0 0 0 0 Col: 6 Row 1 : 0 2 : 0 3 : 0 4 : 0 5 : 0 6 : 1 R8MAT_LT_SOLVE_TEST R8MAT_LT_SOLVE solves a transposed lower triangular system. Input matrix A: Col: 1 2 3 4 Row 1 : 1 0 0 0 2 : 2 3 0 0 3 : 4 5 6 0 4 : 7 8 9 10 Right hand side b: 1: 45 2: 53 3: 54 4: 40 Computed solution x: 1: 1 2: 2 3: 3 4: 4 Norm of A'*x-b = 0 R8MAT_LU_TEST R8MAT_LU computes the LU factors of a matrix. Matrix to be factored: Col: 1 2 3 4 5 Row 1 : 1 1 1 1 1 2 : 1 10 100 1000 10000 3 : 1 4 16 64 256 4 : 1 2 4 8 16 5 : 1 3 9 27 81 P factor: Col: 1 2 3 4 5 Row 1 : 1 0 0 0 0 2 : 0 1 0 0 0 3 : 0 0 1 0 0 4 : 0 0 0 1 0 5 : 0 0 0 0 1 L factor: Col: 1 2 3 4 5 Row 1 : 1 0 0 0 0 2 : 1 1 0 0 0 3 : 1 0.333333 1 0 0 4 : 1 0.111111 0.444444 1 0 5 : 1 0.222222 0.777778 0.875 1 U factor: Col: 1 2 3 4 5 Row 1 : 1 1 1 1 1 2 : 0 9 99 999 9999 3 : 0 0 -18 -270 -3078 4 : 0 0 0 16 272 5 : 0 0 0 0 14 P*L*U: Col: 1 2 3 4 5 Row 1 : 1 1 1 1 1 2 : 1 10 100 1000 10000 3 : 1 4 16 64 256 4 : 1 2 4 8 16 5 : 1 3 9 27 81 R8MAT_MAX_TEST For a real matrix, R8MAT_MAX computes the maximum value; Random array: Col: 1 2 3 Row 1 : 2.18418 0.661187 0.617272 2 : 9.56318 2.57578 4.49539 3 : 8.29509 1.09957 4.01306 4 : 5.61695 0.43829 7.54673 5 : 4.15307 6.33966 7.97287 Maximum value = 9.563176 R8MAT_MAX_INDEX_TEST For an R8MAT, R8MAT_MAX_INDEX locates the maximum entry; Random array: Col: 1 2 3 Row 1 : 2.18418 0.661187 0.617272 2 : 9.56318 2.57578 4.49539 3 : 8.29509 1.09957 4.01306 4 : 5.61695 0.43829 7.54673 5 : 4.15307 6.33966 7.97287 Maximum I,J indices = (2,1) R8MAT_MIN_TEST For a real matrix, R8MAT_MIN computes the minimum value; Random array: Col: 1 2 3 Row 1 : 2.18418 0.661187 0.617272 2 : 9.56318 2.57578 4.49539 3 : 8.29509 1.09957 4.01306 4 : 5.61695 0.43829 7.54673 5 : 4.15307 6.33966 7.97287 Minimum value = 0.438290 R8MAT_MIN_INDEX_TEST For an R8MAT, R8MAT_MIN_INDEX locates the minimum entry; Random array: Col: 1 2 3 Row 1 : 2.18418 0.661187 0.617272 2 : 9.56318 2.57578 4.49539 3 : 8.29509 1.09957 4.01306 4 : 5.61695 0.43829 7.54673 5 : 4.15307 6.33966 7.97287 Minimum I,J indices = (4,2) R8MAT_MAXCOL_MINROW_TEST R8MAT_MAXCOL_MINROW computes the maximum over columns of the mininum over rows; Random array: Col: 1 2 3 Row 1 : 2.18418 0.661187 0.617272 2 : 9.56318 2.57578 4.49539 3 : 8.29509 1.09957 4.01306 4 : 5.61695 0.43829 7.54673 5 : 4.15307 6.33966 7.97287 MAXCOL_MINROW = 4.153071 R8MAT_MAXROW_MINCOL_TEST R8MAT_MAXROW_MINCOL computes the maximum over rows of the mininum over columns; Random array: Col: 1 2 3 Row 1 : 2.18418 0.661187 0.617272 2 : 9.56318 2.57578 4.49539 3 : 8.29509 1.09957 4.01306 4 : 5.61695 0.43829 7.54673 5 : 4.15307 6.33966 7.97287 MAXROW_MINCOL = 2.184183 R8MAT_MEAN_TEST R8MAT_MEAN computes the mean of all values in an R8MAT. Random array: Col: 1 2 3 Row 1 : 2.18418 0.661187 0.617272 2 : 9.56318 2.57578 4.49539 3 : 8.29509 1.09957 4.01306 4 : 5.61695 0.43829 7.54673 5 : 4.15307 6.33966 7.97287 Mean value = 4.371486 R8MAT_MINCOL_MAXROW_TEST R8MAT_MINCOL_MAXROW computes the minimum over columns of the maxinum over rows; Random array: Col: 1 2 3 Row 1 : 2.18418 0.661187 0.617272 2 : 9.56318 2.57578 4.49539 3 : 8.29509 1.09957 4.01306 4 : 5.61695 0.43829 7.54673 5 : 4.15307 6.33966 7.97287 MINCOL_MAXROW = 4.153071 R8MAT_MINROW_MAXCOL_TEST R8MAT_MINROW_MAXCOL computes the minimum over rows of the maxinum over columns; Random array: Col: 1 2 3 Row 1 : 2.18418 0.661187 0.617272 2 : 9.56318 2.57578 4.49539 3 : 8.29509 1.09957 4.01306 4 : 5.61695 0.43829 7.54673 5 : 4.15307 6.33966 7.97287 MINROW_MAXCOL = 6.339657 R8MAT_MM_TEST R8MAT_MM computes a matrix-matrix product C = A * B. A: Col: 1 2 3 Row 1 : 1 0 0 2 : 1 1 0 3 : 1 2 1 4 : 1 3 3 B: Col: 1 2 3 4 Row 1 : 1 1 1 1 2 : 0 1 2 3 3 : 0 0 1 3 C = A*B: Col: 1 2 3 4 Row 1 : 1 1 1 1 2 : 1 2 3 4 3 : 1 3 6 10 4 : 1 4 10 19 R8MAT_MMT_TEST R8MAT_MMT computes a matrix-transpose(matrix) product C = A * B'. A: Col: 1 2 3 Row 1 : 1 0 0 2 : 1 1 0 3 : 1 2 1 4 : 1 3 3 B: Col: 1 2 3 Row 1 : 1 0 0 2 : 1 1 0 3 : 1 2 1 4 : 1 3 3 C = A*B': Col: 1 2 3 4 Row 1 : 1 1 1 1 2 : 1 2 3 4 3 : 1 3 6 10 4 : 1 4 10 19 R8MAT_MTM_TEST R8MAT_MTM computes a transpose(matrix)-matrix product C = A' * B. A: Col: 1 2 3 Row 1 : 1 0 0 2 : 1 1 0 3 : 1 2 1 4 : 1 3 3 B: Col: 1 2 3 Row 1 : 1 0 0 2 : 1 1 0 3 : 1 2 1 4 : 1 3 3 C = A'*B: Col: 1 2 3 Row 1 : 4 6 4 2 : 6 14 11 3 : 4 11 10 R8MAT_MTV_TEST R8MAT_MTV computes a matrix-vector product b = A' * x; A: Col: 1 2 3 4 Row 1 : 1 2 3 4 2 : 1 1 1 1 x: 1: 1 2: 2 b = A'*x: 1: 3 2: 4 3: 5 4: 6 R8MAT_MV_TEST R8MAT_MV computes a matrix-vector product b = A * x; A: Col: 1 2 Row 1 : 1 1 2 : 2 1 3 : 3 1 4 : 4 1 X: 1: 1 2: 2 B = A*X: 1: 3 2: 4 3: 5 4: 6 R8MAT_NINT_TEST R8MAT_NINT rounds an R8MAT. Matrix A: Col: 1 2 3 4 Row 1 : -2.81582 -4.33881 -4.38273 -4.98162 2 : 4.56318 -2.42422 -0.50461 3.97504 3 : 3.29509 -3.90043 -0.986937 -1.49248 4 : 0.616954 -4.56171 2.54673 -4.05455 5 : -0.846929 1.33966 2.97287 -4.86383 Rounded matrix A: Col: 1 2 3 4 Row 1 : -3 -4 -4 -5 2 : 5 -2 -1 4 3 : 3 -4 -1 -1 4 : 1 -5 3 -4 5 : -1 1 3 -5 R8MAT_NONZEROS_TEST R8MAT_NONZEROS counts nonzeros in an R8MAT. Matrix A: Col: 1 2 3 4 Row 1 : 0 0 0 0 2 : 0 1 0 1 3 : 0 0 0 0 4 : 0 1 0 1 5 : 0 0 0 0 Expected nonzeros = 4 Computed nonzeros = 4 R8MAT_NORM_EIS_TEST R8MAT_NORM_EIS computes the EISPACK norm of an R8MAT; A: Col: 1 2 3 4 Row 1 : 1 2 3 4 2 : 5 6 7 8 3 : 9 10 11 12 4 : 13 14 15 16 5 : 17 18 19 20 EISPACK norm of A = 210 R8MAT_NORM_FRO_TEST R8MAT_NORM_FRO computes a Frobenius norm of an R8MAT; A: Col: 1 2 3 4 Row 1 : 1 2 3 4 2 : 5 6 7 8 3 : 9 10 11 12 4 : 13 14 15 16 5 : 17 18 19 20 Expected norm = 53.5724 Computed norm = 53.5724 R8MAT_NORM_FRO_AFFINE_TEST R8MAT_NORM_FRO_AFFINE computes the Frobenius norm of the difference of two R8MAT's; Expected norm = 2.1594 Computed norm = 2.1594 R8MAT_NORM_L1_TEST R8MAT_NORM_L1 computes the L1 norm of an R8MAT; A: Col: 1 2 3 4 Row 1 : -3 -4 -4 -5 2 : 5 -2 -1 4 3 : 3 -4 -1 -1 4 : 1 -5 3 -4 5 : -1 1 3 -5 Computed L1 norm = 19 R8MAT_NORM_L2_TEST R8MAT_NORM_L2 computes the L2 norm of an R8MAT; A: Col: 1 2 3 4 Row 1 : -3 -4 -4 -5 2 : 5 -2 -1 4 3 : 3 -4 -1 -1 4 : 1 -5 3 -4 5 : -1 1 3 -5 Computed L2 norm = 10.5487 R8MAT_NORM_LI_TEST R8MAT_NORM_L1 computes the Loo norm of an R8MAT; A: Col: 1 2 3 4 Row 1 : -3 -4 -4 -5 2 : 5 -2 -1 4 3 : 3 -4 -1 -1 4 : 1 -5 3 -4 5 : -1 1 3 -5 Computed Loo norm = 16 R8MAT_NORM_RMS_TEST R8MAT_NORM_RMS computes the RMS norm of an R8MAT; A: Col: 1 2 3 4 Row 1 : 1 2 3 4 2 : 5 6 7 8 3 : 9 10 11 12 4 : 13 14 15 16 5 : 17 18 19 20 RMS norm of A = 11.9791 R8MAT_NORMAL_01_TEST R8MAT_NORMAL_01 computes a matrix of Normal 01 values. The matrix: Col: 1 2 3 4 Row 1 : 1.67904 0.535037 -2.24246 0.00777484 2 : -0.472769 1.26938 0.735809 -0.275127 3 : -0.56606 1.04954 0.0396749 0.37494 4 : -0.231124 -1.66609 -1.35074 2.164 5 : 1.21293 -1.86523 0.673068 0.1856 R8MAT_NULLSPACE_TEST R8MAT_NULLSPACE computes the nullspace of a matrix. Input A: Col: 1 2 3 4 5 Row 1 : 1 3 0 2 6 2 : -2 -6 0 -2 -8 3 : 3 9 0 0 6 4 : -1 -3 0 1 0 Col: 6 7 Row 1 : 3 1 2 : 3 1 3 : 6 2 4 : 9 3 Nullspace size is 4 Nullspace vectors: Col: 1 2 3 4 Row 1 : -3 0 -2 0 2 : 1 0 0 0 3 : 0 1 0 0 4 : 0 0 -2 0 5 : 0 0 1 0 6 : 0 0 0 -0.333333 7 : 0 0 0 1 Product A * Nullspace vectors: Col: 1 2 3 4 Row 1 : 0 0 0 0 2 : 0 0 0 0 3 : 0 0 0 0 4 : 0 0 0 0 R8MAT_NULLSPACE_SIZE_TEST R8MAT_NULLSPACE_SIZE computes the size of the nullspace of a matrix. Input A: Col: 1 2 3 4 5 Row 1 : 1 3 0 2 6 2 : -2 -6 0 -2 -8 3 : 3 9 0 0 6 4 : -1 -3 0 1 0 Col: 6 7 Row 1 : 3 1 2 : 3 1 3 : 6 2 4 : 9 3 Nullspace size is 4 R8MAT_ORTH_UNIFORM_TEST R8MAT_ORTH_UNIFORM computes a random orthogonal matrix. Random orthogonal matrix A Col: 1 2 3 4 5 Row 1 : -0.559743 -0.371903 -0.0337166 0.68224 0.285986 2 : 0.188708 -0.906112 0.0432361 -0.368531 0.0752686 3 : -0.404357 -0.0795868 -0.732356 -0.200174 -0.503733 4 : -0.423174 0.184571 -0.114406 -0.542494 0.692437 5 : 0.555425 0.0157436 -0.668999 0.253702 0.423476 AT*A Col: 1 2 3 4 5 Row 1 : 1 5.19305e-18 -1.24927e-17 4.93036e-17 0 2 : 5.19305e-18 1 5.23726e-18 2.23036e-17 -1.04083e-17 3 :-1.24927e-17 5.23726e-18 1 2.66583e-18 -5.55112e-17 4 : 4.93036e-17 2.23036e-17 2.66583e-18 1 -1.11022e-16 5 : 0 -1.04083e-17 -5.55112e-17 -1.11022e-16 1 R8MAT_PLOT_TEST R8MAT_PLOT prints a symbolic picture of a matrix. Typically, "-" for negative, " " for zero, and "+" for positive entries or "X" for nonzero and, " " 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_TEST R8MAT_POWER computes the P-th power of a matrix; Matrix A: Col: 1 2 3 Row 1 : 1 2 3 2 : 0 2 1 3 : 0 4 3 Matrix A^0 Col: 1 2 3 Row 1 : 1 0 0 2 : 0 1 0 3 : 0 0 1 Matrix A^1 Col: 1 2 3 Row 1 : 1 2 3 2 : 0 2 1 3 : 0 4 3 Matrix A^2 Col: 1 2 3 Row 1 : 1 18 14 2 : 0 8 5 3 : 0 20 13 Matrix A^3 Col: 1 2 3 Row 1 : 1 94 63 2 : 0 36 23 3 : 0 92 59 R8MAT_POWER_METHOD R8MAT_POWER_METHOD applies the power method to a matrix. Estimated eigenvalue = 3.731980 Estimated eigenvector V: 1: 0.292877 2: -0.499987 3: 0.573126 4: -0.499987 5: 0.292877 Value of A*V: 1: 1.08574 2: -1.86598 3: 2.14622 4: -1.86598 5: 1.08574 R8MAT_PRINT_TEST R8MAT_PRINT prints an R8MAT. The R8MAT: Col: 1 2 3 4 Row 1 : 11 12 13 14 2 : 21 22 23 24 3 : 31 32 33 34 4 : 41 42 43 44 5 : 51 52 53 54 6 : 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: 1 2 Row 2 : 21 22 3 : 31 32 4 : 41 42 R8MAT_PRODUCT_ELEMENTWISE_TEST R8MAT_PRODUCT_ELEMENTWISE computes the elementwise product of two R8MATs. A: Col: 1 2 3 Row 1 : 1 2 3 2 : 4 5 6 B: Col: 1 2 3 Row 1 : 1 3 5 2 : 2 4 6 Elementwise product = 86 R8MAT_REF_TEST R8MAT_REF computes the row echelon form of a matrix. Input A: Col: 1 2 3 4 5 Row 1 : 1 3 0 2 6 2 : -2 -6 0 -2 -8 3 : 3 9 0 0 6 4 : -1 -3 0 1 0 Col: 6 7 Row 1 : 3 1 2 : 3 1 3 : 6 2 4 : 9 3 The pseudo-determinant = 48 REF form: Col: 1 2 3 4 5 Row 1 : 1 3 0 2 6 2 : 0 0 0 1 2 3 : 0 0 0 0 0 4 : 0 0 0 0 0 Col: 6 7 Row 1 : 3 1 2 : 4.5 1.5 3 : 1 0.333333 4 : 0 0 R8MAT_RREF_TEST R8MAT_RREF computes the reduced row echelon form of a matrix. Input A: Col: 1 2 3 4 5 Row 1 : 1 3 0 2 6 2 : -2 -6 0 -2 -8 3 : 3 9 0 0 6 4 : -1 -3 0 1 0 Col: 6 7 Row 1 : 3 1 2 : 3 1 3 : 6 2 4 : 9 3 The pseudo-determinant = 48 RREF form: Col: 1 2 3 4 5 Row 1 : 1 3 0 0 2 2 : 0 0 0 1 2 3 : 0 0 0 0 0 4 : 0 0 0 0 0 Col: 6 7 Row 1 : 0 0 2 : 0 0 3 : 1 0.333333 4 : 0 0 R8MAT_RREF_SOLVE_BINARY_TEST: R8MAT_RREF_SOLVE_BINARY seeks binary solutions of a Row-Reduced Echelon Form linear system A*x=b. The RREF matrix A: Col: 1 2 3 4 5 Row 1 : 1 0 0 0 0 2 : 0 1 0 0 0 3 : 0 0 1 0 0 4 : 0 0 0 1 0 5 : 0 0 0 0 1 6 : 0 0 0 0 0 7 : 0 0 0 0 0 8 : 0 0 0 0 0 9 : 0 0 0 0 0 Col: 6 7 8 9 10 Row 1 : 0 1 0 -1 0 2 : 0 0 0 1 0 3 : 0 1 0 -1 0 4 : 0 0 0 1 1 5 : 0 0 0 0 1 6 : 1 -1 0 1 0 7 : 0 0 1 0 -1 8 : 0 0 0 0 0 9 : 0 0 0 0 0 The RREF right hand side b: 1: 0 2: 1 3: 0 4: 1 5: 1 6: 1 7: 0 8: 0 9: 0 Binary solution vectors x: Col: 1 2 3 4 Row 1 : 0 0 1 0 2 : 1 1 0 0 3 : 0 0 1 0 4 : 1 0 0 0 5 : 1 0 1 1 6 : 1 1 0 1 7 : 0 0 0 1 8 : 0 1 0 0 9 : 0 0 1 1 10 : 0 1 0 0 R8MAT_RREF_SOLVE_BINARY_NZ_TEST: R8MAT_RREF_SOLVE_BINARY_NZ seeks binary solutions of a Row-Reduced Echelon Form linear system A*x=b which have exactly NZ nonzeros. The RREF matrix A: Col: 1 2 3 4 5 Row 1 : 1 0 0 0 0 2 : 0 1 0 0 0 3 : 0 0 1 0 0 4 : 0 0 0 1 0 5 : 0 0 0 0 1 6 : 0 0 0 0 0 7 : 0 0 0 0 0 8 : 0 0 0 0 0 9 : 0 0 0 0 0 Col: 6 7 8 9 10 Row 1 : 0 1 0 -1 0 2 : 0 0 0 1 0 3 : 0 1 0 -1 0 4 : 0 0 0 1 1 5 : 0 0 0 0 1 6 : 1 -1 0 1 0 7 : 0 0 1 0 -1 8 : 0 0 0 0 0 9 : 0 0 0 0 0 The RREF right hand side b: 1: 0 2: 1 3: 0 4: 1 5: 1 6: 1 7: 0 8: 0 9: 0 Only consider binary solutions with exactly 4 nonzeros. VERBOSE: System has 3 degrees of freedom. VERBOSE: Augmented Row-Reduced Echelon Form system matrix A and right hand side B: Columns associated with a free variable are headed with a "*" : : : : : : * : * * 1 0 0 0 0 0 1 0-1 0 0 0 1 0 0 0 0 0 0 1 0 1 0 0 1 0 0 0 1 0-1 0 0 0 0 0 1 0 0 0 0 1 1 1 0 0 0 0 1 0 0 0 0 1 1 0 0 0 0 0 1-1 0 1 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0-1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 VERBOSE: Tried 8 right hands sides, found 4 solutions. Binary solution vectors x: Col: 1 2 3 4 Row 1 : 0 1 0 0 2 : 1 0 1 0 3 : 0 1 0 0 4 : 1 0 0 0 5 : 1 1 0 1 6 : 1 0 1 1 7 : 0 0 0 1 8 : 0 0 1 0 9 : 0 1 0 1 10 : 0 0 1 0 R8MAT_SCALE_01_TEST R8MAT_SCALE_01 shifts and scales the columns of an R8MAT so they each have min 0 and max 1 Array X: Col: 1 2 3 Row 1 : -0.631634 -3.67763 -3.76546 2 : 14.1264 0.151556 3.99078 3 : 11.5902 -2.80086 3.02613 4 : 6.23391 -4.12342 10.0935 5 : 3.30614 7.67931 10.9457 mean(X): 6.92499 -0.554208 4.85813 std(X): 6.00624 4.89468 5.97793 max(X): 14.1264 7.67931 10.9457 min(X): -0.631634 -4.12342 -3.76546 Array XS: Col: 1 2 3 Row 1 : 0 0.0377705 0 2 : 1 0.362202 0.527234 3 : 0.82815 0.112055 0.461661 4 : 0.465209 0 0.942067 5 : 0.266823 1 1 mean(XS): 0.512036 0.302406 0.586192 std(XS): 0.406983 0.414707 0.406352 max(XS): 1 1 1 min(XS): 0 0 0 R8MAT_SCALE_AB_TEST R8MAT_SCALE_AB shifts and scales the columns of an R8MAT so they each have min A and max B Array X: Col: 1 2 3 Row 1 : -0.631634 -3.67763 -3.76546 2 : 14.1264 0.151556 3.99078 3 : 11.5902 -2.80086 3.02613 4 : 6.23391 -4.12342 10.0935 5 : 3.30614 7.67931 10.9457 mean(X): 6.92499 -0.554208 4.85813 std(X): 6.00624 4.89468 5.97793 max(X): 14.1264 7.67931 10.9457 min(X): -0.631634 -4.12342 -3.76546 Rescale to interval [-1,1] Array XS: Col: 1 2 3 Row 1 : -1 -0.924459 -1 2 : 1 -0.275596 0.054467 3 : 0.656299 -0.77589 -0.0766785 4 : -0.0695827 -1 0.884133 5 : -0.466353 1 1 mean(XS): 0.0240726 -0.395189 0.172384 std(XS): 0.813965 0.829414 0.812705 max(XS): 1 1 1 min(XS): -1 -1 -1 R8MAT_SOLVE_TEST R8MAT_SOLVE solves linear systems. The linear system: Col: 1 2 3 4 5 Row 1 : 1 2 3 14 7 2 : 4 5 6 32 16 3 : 7 8 0 23 7 The computed solutions Col: 1 2 Row 1 : 1 1 2 : 2 0 3 : 3 2 R8MAT_SOLVE_2D_TEST R8MAT_SOLVE_2D solves 2D linear systems. Solution / Computed: 0.415307 0.415307 0.066119 0.066119 Solution / Computed: 0.061727 0.061727 0.449539 0.449539 Solution / Computed: 0.897504 0.897504 0.350752 0.350752 Solution / Computed: 0.123104 0.123104 0.007512 0.007512 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.061727 0.061727 0.449539 0.449539 Solution / Computed: 0.840847 0.840847 0.123104 0.123104 0.007512 0.007512 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.406970 0.406970 R8MAT_SOLVE2_TEST R8MAT_SOLVE2 is a linear solver. Right hand side: 1: 5 2: 11 The system is nonsingular. Computed solution: 1: 1 2: 2 Right hand side: 1: 4 2: 2 3: 2 R8MAT_SOLVE2 - Warning: Consistent singularity, equation = 3 The system is singular, but consistent. Computed solution: 1: 2 2: 0 3: 0 Right hand side: 1: 5 2: 11 3: 16 4: 15 The system is nonsingular. Computed solution: 1: -2 2: -6 3: 10 4: 7 Right hand side: 1: 13 2: 17 3: 20 R8MAT_SOLVE2 - Error: Inconsistent singularity, equation = 2 The system is singular and inconsistent. Computed solution: 1: 6.42857 2: 0 3: 0.142857 R8MAT_STANDARDIZE_TEST R8MAT_STANDARDIZE shifts and scales an R8MAT so that each column has zero mean and unit standard deviation. Vector X: Col: 1 2 3 Row 1 : -0.631634 -3.76546 12.1819 2 : 14.1264 3.99078 11.8169 3 : 11.5902 3.02613 -2.53792 4 : 6.23391 10.0935 -4.84975 5 : 3.30614 10.9457 0.20606 6 : -3.67763 -4.96323 13.2497 7 : 0.151556 12.9501 -2.72672 8 : -2.80086 2.01505 2.03257 9 : -4.12342 -3.1091 11.4577 10 : 7.67931 -4.72766 0.342645 mean(X) = 3.18539 2.64558 4.11732 std(X) = 6.49767 6.82621 7.20369 max(X) = 14.1264 12.9501 13.2497 min(X) = -4.12342 -4.96323 -4.84975 Vector XS: Col: 1 2 3 Row 1 : -0.490236 -0.387562 -0.571557 2 : -0.490236 -0.387562 -0.571557 3 : -0.490236 -0.387562 -0.571557 4 : -0.490236 -0.387562 -0.571557 5 : -0.490236 -0.387562 -0.571557 6 : -0.490236 -0.387562 -0.571557 7 : -0.490236 -0.387562 -0.571557 8 : -0.490236 -0.387562 -0.571557 9 : -0.490236 -0.387562 -0.571557 10 : -0.490236 -0.387562 -0.571557 mean(X) = -0.490236 -0.387562 -0.571557 std(X) = 1.17028e-16 5.85139e-17 0 max(X) = -0.490236 -0.387562 -0.571557 min(X) = -0.490236 -0.387562 -0.571557 R8MAT_SUM_TEST R8MAT_SUM sums all values in an R8MAT. Random array: Col: 1 2 3 Row 1 : 2.18418 0.661187 0.617272 2 : 9.56318 2.57578 4.49539 3 : 8.29509 1.09957 4.01306 4 : 5.61695 0.43829 7.54673 5 : 4.15307 6.33966 7.97287 Sum of matrix entries = 65.572286 R8MAT_SYMM_JACOBI_TEST For a symmetric R8MAT: R8MAT_SYMM_JACOBI diagonalizes; Matrix to diagonalize: Col: 1 2 3 4 5 Row 1 : 2.86409 -0.334105 -0.906958 -0.379152 1.04295 2 : -0.334105 2.25488 0.0784356 0.631118 -0.225108 3 : -0.906958 0.0784356 3.21422 -0.91655 -0.026989 4 : -0.379152 0.631118 -0.91655 3.86102 0.916005 5 : 1.04295 -0.225108 -0.026989 0.916005 2.80579 Computed Eigenvalues: 1.000000 2.000000 4.000000 5.000000 3.000000 R8LIB_TEST080 R8MAT_TO_R8PLU determines the compressed PLU factors of an R8MAT. Using initial random number seed = 123456789 Matrix order N = 5 The matrix A: Col: 1 2 3 4 5 Row 1 : 0.218418 0.0661187 0.0617272 0.00183837 0.859097 2 : 0.956318 0.257578 0.449539 0.897504 0.840847 3 : 0.829509 0.109957 0.401306 0.350752 0.123104 4 : 0.561695 0.043829 0.754673 0.0945448 0.00751236 5 : 0.415307 0.633966 0.797287 0.0136169 0.260303 The pivot vector P: 1: 2 2: 5 3: 4 4: 4 5: 5 The compressed LU factors: Col: 1 2 3 4 5 Row 1 : 0.956318 0.257578 0.449539 0.897504 0.840847 2 : -0.228395 0.522106 0.602062 -0.376149 -0.104858 3 : -0.867399 0.217324 0.614552 -0.510026 -0.507943 4 : -0.587352 0.20582 -0.231419 -0.391459 -0.511487 5 : -0.434277 -0.0139612 0.0803036 -0.610161 0.939815 The recovered matrix A2: Col: 1 2 3 4 5 Row 1 : 0.218418 0.0661187 0.0617272 0.00183837 0.859097 2 : 0.956318 0.257578 0.449539 0.897504 0.840847 3 : 0.829509 0.109957 0.401306 0.350752 0.123104 4 : 0.561695 0.043829 0.754673 0.0945448 0.00751236 5 : 0.415307 0.633966 0.797287 0.0136169 0.260303 R8MAT_TRACE_TEST R8MAT_TRACE computes the trace of a matrix Matrix: Col: 1 2 3 4 Row 1 : 4 3 2 1 2 : 3 3 2 1 3 : 0 2 2 1 4 : 0 0 1 1 Trace is 10.000000 R8MAT_TRANSPOSE_PRINT_TEST R8MAT_TRANSPOSE_PRINT prints a R8MAT, transposed. Matrix row order M = 7 Matrix column order N = 12 The transposed matrix A: Row: 1 2 3 4 5 Col 1: 101 201 301 401 501 2: 102 202 302 402 502 3: 103 203 303 403 503 4: 104 204 304 404 504 5: 105 205 305 405 505 6: 106 206 306 406 506 7: 107 207 307 407 507 8: 108 208 308 408 508 9: 109 209 309 409 509 10: 110 210 310 410 510 11: 111 211 311 411 511 12: 112 212 312 412 512 Row: 6 7 Col 1: 601 701 2: 602 702 3: 603 703 4: 604 704 5: 605 705 6: 606 706 7: 607 707 8: 608 708 9: 609 709 10: 610 710 11: 611 711 12: 612 712 R8MAT_TRANSPOSE_PRINT_SOME_TEST R8MAT_TRANSPOSE_PRINT_SOME prints some of an R8MAT, transposed. Matrix row order M = 5 Matrix column order N = 4 The matrix A: Col: 1 2 3 4 Row 1 : 11 12 13 14 2 : 21 22 23 24 3 : 31 32 33 34 4 : 41 42 43 44 5 : 51 52 53 54 The transposed matrix A, rows 1:3, cols 2:3: Row: 1 2 3 Col 2: 12 22 32 3: 13 23 33 R8MAT_U_INVERSE_TEST R8MAT_U_INVERSE inverts an upper triangular matrix. Input matrix A Col: 1 2 3 4 Row 1 : 1 2 4 7 2 : 0 3 5 8 3 : 0 0 6 9 4 : 0 0 0 10 Inverse matrix B: Col: 1 2 3 4 Row 1 : 1 -0.666667 -0.111111 -0.0666667 2 : 0 0.333333 -0.277778 -0.0166667 3 : 0 0 0.166667 -0.15 4 : 0 0 0 0.1 Product C = A * B: Col: 1 2 3 4 Row 1 : 1 0 0 -2.77556e-17 2 : 0 1 0 0 3 : 0 0 1 1.11022e-16 4 : 0 0 0 1 R8MAT_U_SOLVE_TEST R8MAT_U_SOLVE solves an upper triangular system. Input matrix A: Col: 1 2 3 4 Row 1 : 1 2 4 7 2 : 0 3 5 8 3 : 0 0 6 9 4 : 0 0 0 10 Right hand side b: 1: 45 2: 53 3: 54 4: 40 Computed solution x: 1: 1 2: 2 3: 3 4: 4 Norm of A*x-b = 0 R8MAT_U1_INVERSE_TEST R8MAT_U1_INVERSE inverts a unit upper triangular matrix. Input matrix A Col: 1 2 3 4 5 Row 1 : 1 2 0 5 0 2 : 0 1 0 0 0 3 : 0 0 1 3 0 4 : 0 0 0 1 0 5 : 0 0 0 0 1 6 : 0 0 0 0 0 Col: 6 Row 1 : 75 2 : 0 3 : 0 4 : 6 5 : 4 6 : 1 Inverse matrix B: Col: 1 2 3 4 5 Row 1 : 1 -2 -0 -5 -0 2 : 0 1 -0 -0 -0 3 : 0 0 1 -3 -0 4 : 0 0 0 1 -0 5 : 0 0 0 0 1 6 : 0 0 0 0 0 Col: 6 Row 1 : -45 2 : -0 3 : 18 4 : -6 5 : -4 6 : 1 Product C = A * B: Col: 1 2 3 4 5 Row 1 : 1 0 0 0 0 2 : 0 1 0 0 0 3 : 0 0 1 0 0 4 : 0 0 0 1 0 5 : 0 0 0 0 1 6 : 0 0 0 0 0 Col: 6 Row 1 : 0 2 : 0 3 : 0 4 : 0 5 : 0 6 : 1 R8MAT_UNIFORM_01_TEST R8MAT_UNIFORM_01 computes a random R8MAT. Initial seed is 123456789 Uniform R8MAT: Col: 1 2 3 4 Row 1 : 0.218418 0.0661187 0.0617272 0.00183837 2 : 0.956318 0.257578 0.449539 0.897504 3 : 0.829509 0.109957 0.401306 0.350752 4 : 0.561695 0.043829 0.754673 0.0945448 5 : 0.415307 0.633966 0.797287 0.0136169 R8MAT_UNIFORM_AB_TEST R8MAT_UNIFORM_AB sets an R8MAT to random values in [A,B]. Using initial random number seed = 123456789 The random matrix: Col: 1 2 3 4 Row 1 : 3.74735 2.52895 2.49382 2.01471 2 : 9.65054 4.06062 5.59631 9.18003 3 : 8.63607 2.87965 5.21045 4.80602 4 : 6.49356 2.35063 8.03739 2.75636 5 : 5.32246 7.07173 8.3783 2.10894 R8MAT_UNIFORM_ABVEC_TEST R8MAT_UNIFORM_ABVEC sets an R8MAT to random values in [A,B] where A and B are vectors of row limits. Using initial random number seed = 123456789 Lower and upper row limits: 1: 2 10 2: 0 1 3: -1 0 4: 100 110 5: 0.1 0.2 The random matrix: Col: 1 2 3 4 Row 1 : 3.74735 2.52895 2.49382 2.01471 2 : 0.956318 0.257578 0.449539 0.897504 3 : -0.170491 -0.890043 -0.598694 -0.649248 4 : 105.617 100.438 107.547 100.945 5 : 0.141531 0.163397 0.179729 0.101362 R8MAT_UT_SOLVE_TEST R8MAT_UT_SOLVE solves a transposed upper triangular system. Input matrix A: Col: 1 2 3 4 Row 1 : 1 2 4 7 2 : 0 3 5 8 3 : 0 0 6 9 4 : 0 0 0 10 Right hand side b: 1: 1 2: 8 3: 32 4: 90 Computed solution x: 1: 1 2: 2 3: 3 4: 4 Norm of A'*x-b = 0 R8MAT_VAND2_TEST R8MAT_VAND2 returns a row Vandermonde matrix. The factor vector X: 1: 1 2: 2 3: 3 4: 4 5: 5 The row Vandermonde matrix: Col: 1 2 3 4 Row 1 : 1 1 1 1 2 : 1 2 4 8 3 : 1 3 9 27 4 : 1 4 16 64 5 : 1 5 25 125 R8PLU_DET_TEST R8PLU_DET determines the determinant of a matrix from its compressed PLU factors. Using initial random number seed = 123456789 Matrix order N = 5 The matrix A: Col: 1 2 3 4 5 Row 1 : 0.218418 0.0661187 0.0617272 0.00183837 0.859097 2 : 0.956318 0.257578 0.449539 0.897504 0.840847 3 : 0.829509 0.109957 0.401306 0.350752 0.123104 4 : 0.561695 0.043829 0.754673 0.0945448 0.00751236 5 : 0.415307 0.633966 0.797287 0.0136169 0.260303 The determinant = 0.112888 R8PLU_INVERSE_TEST R8PLU_INVERSE determines the inverse of a matrix from its compressed PLU factors. Using initial random number seed = 123456789 Matrix order N = 5 The matrix A: Col: 1 2 3 4 5 Row 1 : 0.218418 0.0661187 0.0617272 0.00183837 0.859097 2 : 0.956318 0.257578 0.449539 0.897504 0.840847 3 : 0.829509 0.109957 0.401306 0.350752 0.123104 4 : 0.561695 0.043829 0.754673 0.0945448 0.00751236 5 : 0.415307 0.633966 0.797287 0.0136169 0.260303 The inverse matrix B: Col: 1 2 3 4 5 Row 1 : 0.625209 -1.0222 2.84978 -0.868794 -0.0840984 2 : -0.471548 -0.149728 0.892032 -2.1207 1.67928 3 : -0.274368 0.546937 -1.95265 2.05705 0.00285593 4 : -1.39029 1.75848 -1.70625 0.283212 -0.293107 5 : 1.06404 0.228349 -0.649235 0.235691 -0.107439 The product matrix C = A * B: Col: 1 2 3 4 5 Row 1 : 1 1.12775e-16 -6.41709e-17 8.54696e-18 -1.38778e-17 2 :-2.01947e-16 1 1.26792e-16 -1.83596e-16 -2.77556e-17 3 :-3.14644e-16 3.52598e-16 1 -2.05646e-16 0 4 :-3.29056e-16 3.32634e-16 -1.83411e-16 1 -1.01915e-17 5 :-1.11022e-16 6.245e-17 -1.66533e-16 -1.94289e-16 1 R8PLU_MUL_TEST R8PLU_MUL computes the product A*x=b using the compressed PLU factors of A. Using initial random number seed = 123456789 Matrix order N = 5 The matrix A: Col: 1 2 3 4 5 Row 1 : 0.218418 0.0661187 0.0617272 0.00183837 0.859097 2 : 0.956318 0.257578 0.449539 0.897504 0.840847 3 : 0.829509 0.109957 0.401306 0.350752 0.123104 4 : 0.561695 0.043829 0.754673 0.0945448 0.00751236 5 : 0.415307 0.633966 0.797287 0.0136169 0.260303 The right hand side B (computed from A): 1: 4.83868 2: 10.6143 3: 4.27187 4: 3.32911 5: 5.43108 The right hand side B (computed from PLU): 1: 4.83868 2: 10.6143 3: 4.27187 4: 3.32911 5: 5.43108 R8PLU_SOL_TEST R8PLU_SOL solves a linear system A*x=b using the compressed PLU factors of A. Using initial random number seed = 123456789 Matrix order N = 5 The matrix A: Col: 1 2 3 4 5 Row 1 : 0.218418 0.0661187 0.0617272 0.00183837 0.859097 2 : 0.956318 0.257578 0.449539 0.897504 0.840847 3 : 0.829509 0.109957 0.401306 0.350752 0.123104 4 : 0.561695 0.043829 0.754673 0.0945448 0.00751236 5 : 0.415307 0.633966 0.797287 0.0136169 0.260303 The right hand side B: 1: 4.83868 2: 10.6143 3: 4.27187 4: 3.32911 5: 5.43108 The computed solution X: 1: 1 2: 2 3: 3 4: 4 5: 5 R8PLU_TO_R8MAT_TEST R8PLU_TO_R8MAT determines the original matrix from the compressed PLU factors. Using initial random number seed = 123456789 Matrix order N = 5 The matrix A: Col: 1 2 3 4 5 Row 1 : 0.218418 0.0661187 0.0617272 0.00183837 0.859097 2 : 0.956318 0.257578 0.449539 0.897504 0.840847 3 : 0.829509 0.109957 0.401306 0.350752 0.123104 4 : 0.561695 0.043829 0.754673 0.0945448 0.00751236 5 : 0.415307 0.633966 0.797287 0.0136169 0.260303 The pivot vector P: 1: 2 2: 5 3: 4 4: 4 5: 5 The compressed LU factors: Col: 1 2 3 4 5 Row 1 : 0.956318 0.257578 0.449539 0.897504 0.840847 2 : -0.228395 0.522106 0.602062 -0.376149 -0.104858 3 : -0.867399 0.217324 0.614552 -0.510026 -0.507943 4 : -0.587352 0.20582 -0.231419 -0.391459 -0.511487 5 : -0.434277 -0.0139612 0.0803036 -0.610161 0.939815 The recovered matrix A2: Col: 1 2 3 4 5 Row 1 : 0.218418 0.0661187 0.0617272 0.00183837 0.859097 2 : 0.956318 0.257578 0.449539 0.897504 0.840847 3 : 0.829509 0.109957 0.401306 0.350752 0.123104 4 : 0.561695 0.043829 0.754673 0.0945448 0.00751236 5 : 0.415307 0.633966 0.797287 0.0136169 0.260303 R8R8_PRINT_TEST R8R8_PRINT prints a pair of R8's with a label. Center : ( 1.23, 7.45 ) ( 1.23, 7.45 ) Focus : ( 1.23457, 7.45679e+06 ) R8R8VEC_INDEX_INSERT_UNIQUE_TEST R8R8VEC_INDEX_INSERT_UNIQUE inserts unique values into an index sorted array. Generate 30 random values: Index XVAL YVAL 1 2.000000 3.000000 2 3.000000 2.000000 3 2.000000 1.000000 3 2.000000 1.000000 4 1.000000 2.000000 4 1.000000 2.000000 1 2.000000 3.000000 5 3.000000 1.000000 6 4.000000 2.000000 7 1.000000 1.000000 8 4.000000 3.000000 7 1.000000 1.000000 1 2.000000 3.000000 4 1.000000 2.000000 2 3.000000 2.000000 2 3.000000 2.000000 6 4.000000 2.000000 6 4.000000 2.000000 1 2.000000 3.000000 3 2.000000 1.000000 2 3.000000 2.000000 2 3.000000 2.000000 9 2.000000 2.000000 4 1.000000 2.000000 10 3.000000 3.000000 4 1.000000 2.000000 11 1.000000 3.000000 2 3.000000 2.000000 8 4.000000 3.000000 2 3.000000 2.000000 Vector of unique X Y values: I X(I) Y(I) 1 2.000000 3.000000 2 3.000000 2.000000 3 2.000000 1.000000 4 1.000000 2.000000 5 3.000000 1.000000 6 4.000000 2.000000 7 1.000000 1.000000 8 4.000000 3.000000 9 2.000000 2.000000 10 3.000000 3.000000 11 1.000000 3.000000 X, Y sorted by index I INDX(I) X(INDX(I)) Y(INDX(I)) 1 7.000000 1.000000 1 2 4.000000 1.000000 2 3 11.000000 1.000000 3 4 3.000000 2.000000 1 5 9.000000 2.000000 2 6 1.000000 2.000000 3 7 5.000000 3.000000 1 8 2.000000 3.000000 2 9 10.000000 3.000000 3 10 6.000000 4.000000 2 11 8.000000 4.000000 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 1 2.000000 3.000000 3.000000 2 3.000000 2.000000 1.000000 3 2.000000 1.000000 1.000000 4 3.000000 1.000000 2.000000 1 2.000000 3.000000 3.000000 5 1.000000 3.000000 2.000000 6 1.000000 1.000000 4.000000 7 4.000000 1.000000 1.000000 8 2.000000 3.000000 1.000000 9 2.000000 3.000000 2.000000 10 3.000000 2.000000 4.000000 1 2.000000 3.000000 3.000000 9 2.000000 3.000000 2.000000 11 2.000000 2.000000 2.000000 12 3.000000 2.000000 2.000000 4 3.000000 1.000000 2.000000 13 3.000000 3.000000 1.000000 14 3.000000 1.000000 3.000000 10 3.000000 2.000000 4.000000 15 3.000000 3.000000 2.000000 16 4.000000 2.000000 1.000000 4 3.000000 1.000000 2.000000 8 2.000000 3.000000 1.000000 17 1.000000 1.000000 1.000000 18 2.000000 1.000000 2.000000 19 2.000000 2.000000 3.000000 14 3.000000 1.000000 3.000000 10 3.000000 2.000000 4.000000 20 4.000000 3.000000 3.000000 21 1.000000 2.000000 2.000000 Vector of unique X Y Z values: I X(I) Y(I) Z(I) 1 2.000000 3.000000 3.000000 2 3.000000 2.000000 1.000000 3 2.000000 1.000000 1.000000 4 3.000000 1.000000 2.000000 5 1.000000 3.000000 2.000000 6 1.000000 1.000000 4.000000 7 4.000000 1.000000 1.000000 8 2.000000 3.000000 1.000000 9 2.000000 3.000000 2.000000 10 3.000000 2.000000 4.000000 11 2.000000 2.000000 2.000000 12 3.000000 2.000000 2.000000 13 3.000000 3.000000 1.000000 14 3.000000 1.000000 3.000000 15 3.000000 3.000000 2.000000 16 4.000000 2.000000 1.000000 17 1.000000 1.000000 1.000000 18 2.000000 1.000000 2.000000 19 2.000000 2.000000 3.000000 20 4.000000 3.000000 3.000000 21 1.000000 2.000000 2.000000 X Y Z sorted by index: I INDX(I) X(I) X(INDX(I)) 1 17.000000 1.000000 1.000000 1 2 6.000000 1.000000 1.000000 4 3 21.000000 1.000000 2.000000 2 4 5.000000 1.000000 3.000000 2 5 3.000000 2.000000 1.000000 1 6 18.000000 2.000000 1.000000 2 7 11.000000 2.000000 2.000000 2 8 19.000000 2.000000 2.000000 3 9 8.000000 2.000000 3.000000 1 10 9.000000 2.000000 3.000000 2 11 1.000000 2.000000 3.000000 3 12 4.000000 3.000000 1.000000 2 13 14.000000 3.000000 1.000000 3 14 2.000000 3.000000 2.000000 1 15 12.000000 3.000000 2.000000 2 16 10.000000 3.000000 2.000000 4 17 13.000000 3.000000 3.000000 1 18 15.000000 3.000000 3.000000 2 19 7.000000 4.000000 1.000000 1 20 16.000000 4.000000 2.000000 1 21 20.000000 4.000000 3.000000 3 m = 3 n = 4 R8ROWS_TO_R8MAT_TEST R8ROWS_TO_R8MAT allows an R8MAT to be initialized by data stored ROW-WISE in a vector. The data vector: 1: 11 2: 12 3: 13 4: 14 5: 21 6: 22 7: 23 8: 24 9: 31 10: 32 11: 33 12: 34 The data copied into an array: Col: 1 2 3 4 Row 1 : 11 12 13 14 2 : 21 22 23 24 3 : 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 6 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 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: 1: -5.63163 2: 9.12635 3: 6.59018 4: 1.23391 5: -1.69386 6: -8.67763 7: -4.84844 8: -7.80086 9: -9.12342 10: 2.67931 Maximum absolute: 9.126352 R8VEC_AMAX_INDEX_TEST R8VEC_AMAX_INDEX: index of maximum magnitude entry; Input vector: 1: -5.63163 2: 9.12635 3: 6.59018 4: 1.23391 5: -1.69386 6: -8.67763 7: -4.84844 8: -7.80086 9: -9.12342 10: 2.67931 Maximum absolute occurs at a[2] R8VEC_AMIN_TEST For an R8VEC: R8VEC_AMIN: minimum magnitude entry. Input vector: 1: -5.63163 2: 9.12635 3: 6.59018 4: 1.23391 5: -1.69386 6: -8.67763 7: -4.84844 8: -7.80086 9: -9.12342 10: 2.67931 Minimum absolute: 1.233909 R8VEC_AMIN_INDEX_TEST R8VEC_AMIN_INDEX: index of minimum magnitude entry; Input vector: 1: -5.63163 2: 9.12635 3: 6.59018 4: 1.23391 5: -1.69386 6: -8.67763 7: -4.84844 8: -7.80086 9: -9.12342 10: 2.67931 Minimum absolute occurs at a[4] R8VEC_ANY_NORMAL_TEST R8VEC_ANY_NORMAL computes a vector V2 that is normal to a given vector V1. Test ||V1|| ||V2|| V1.V2 1 1.62017 1 0 2 1.58424 1 0 3 1.80159 1 0 4 1.93359 1 0 5 1.73095 1 0 R8VEC_ASUM_TEST R8VEC_ASUM computes the absolute sum of an R8VEC. Input vector: 1: -2.81582 2: 4.56318 3: 3.29509 4: 0.616954 5: -0.846929 6: -4.33881 7: -2.42422 8: -3.90043 9: -4.56171 10: 1.33966 Absolute sum = 28.7028 R8VEC_BIN_TEST R8VEC_BIN sorts an R8VEC into bins. Some of the R8VEC: 1 11.7131 2 24.2574 3 22.1017 4 17.5488 5 15.0602 6 9.12402 7 12.3788 8 9.86927 ...... .............. 100 14.9161 Bin Population Limits 1 17 -Inf < x < 10 2 5 10 < x < 11 3 7 11 < x < 12 4 5 12 < x < 13 5 4 13 < x < 14 6 8 14 < x < 15 7 6 15 < x < 16 8 3 16 < x < 17 9 5 17 < x < 18 10 4 18 < x < 19 11 3 19 < x < 20 12 33 20 < x < +Inf R8VEC_BINARY_NEXT_TEST R8VEC_BINARY_NEXT generates the next binary vector. 000 001 010 011 100 101 110 111 R8VEC_BLEND_TEST: R8VEC_BLEND blends two vectors. V1 and V2: 1: 1 0 2: 2 5 3: 3 10 T1 = 0.25, T2 = 0.75 1: 1 0.25 0 2: 2 4.25 5 3: 3 8.25 10 T1 = 0.5, T2 = 0.5 1: 1 0.5 0 2: 2 3.5 5 3: 3 6.5 10 T1 = 0.75, T2 = 0.25 1: 1 0.75 0 2: 2 2.75 5 3: 3 4.75 10 R8VEC_BRACKET_TEST R8VEC_BRACKET finds a pair of entries in a sorted real array which bracket a value. Sorted array: 1: 1 2: 2 3: 3 4: 4 5: 5 6: 5 7: 7 8: 8 9: 9 10: 10 LEFT RIGHT X(LEFT) XVAL X(RIGHT) 1 2 1.000000 -10.000000 2.000000 1 2 1.000000 1.000000 2.000000 4 5 4.000000 4.500000 5.000000 6 7 5.000000 5.000000 7.000000 9 10 9.000000 10.000000 10.000000 9 10 9.000000 12.000000 10.000000 R8VEC_BRACKET2_TEST R8VEC_BRACKET2 finds a pair of entries in a sorted R8VEC which bracket a value. Sorted array: 1: 1 2: 2 3: 3 4: 4 5: 5 6: 5 7: 7 8: 8 9: 9 10: 10 Search for XVAL = Start = 5 Left = 1 Right = 2 X(LEFT) = 1.000000 X(RIGHT) = 2.000000 Search for XVAL = Start = 1 Left = 1 Right = 1 X(LEFT) = 1.000000 X(RIGHT) = 1.000000 Search for XVAL = Start = 1 Left = 4 Right = 5 X(LEFT) = 4.000000 X(RIGHT) = 5.000000 Search for XVAL = Start = 4 Left = 5 Right = 5 X(LEFT) = 5.000000 X(RIGHT) = 5.000000 Search for XVAL = Start = 5 Left = 9 Right = 10 X(LEFT) = 9.000000 X(RIGHT) = 10.000000 Search for XVAL = Start = 9 Left = 10 Right = -1 X(LEFT) = 10.000000 R8VEC_BRACKET3_TEST R8VEC_BRACKET3 finds a pair of entries in a sorted real array which bracket a value. Sorted array: 1: 1 2: 2 3: 3 4: 4 5: 5 6: 5 7: 7 8: 8 9: 9 10: 10 Search for XVAL = -10.000000 Starting guess for interval is = 5 Nearest interval: X[1]= 1.000000 X[2]= 2.000000 Search for XVAL = 1.000000 Starting guess for interval is = 1 Nearest interval: X[1]= 1.000000 X[2]= 2.000000 Search for XVAL = 4.500000 Starting guess for interval is = 1 Nearest interval: X[4]= 4.000000 X[5]= 5.000000 Search for XVAL = 5.000000 Starting guess for interval is = 4 Nearest interval: X[4]= 4.000000 X[5]= 5.000000 Search for XVAL = 10.000000 Starting guess for interval is = 4 Nearest interval: X[9]= 9.000000 X[10]= 10.000000 Search for XVAL = 12.000000 Starting guess for interval is = 9 Nearest interval: X[9]= 9.000000 X[10]= 10.000000 R8VEC_BRACKET4_TEST R8VEC_BRACKET4 finds a pair of entries in a sorted real array which bracket a value. Sorted array: 1: 0.75 2: 1.75 3: 2.75 4: 3.75 5: 4.75 6: 4.75 7: 6.75 8: 7.75 9: 8.75 10: 9.75 11: 10.75 Values to be bracketed: 1: -10.1 2: 1.2 3: 4.5 4: 5.2 5: 10.4 6: 12.5 Item Value Left Right 1 -10.10 1 2 2 1.20 1 2 3 4.50 4 5 4 5.20 6 7 5 10.40 10 11 6 12.50 10 11 R8VEC_BRACKET5_TEST R8VEC_BRACKET5 finds a pair of entries in a sorted R8VEC which bracket a value. Sorted array: 1: 1 2: 2 3: 3 4: 4 5: 5 6: 5 7: 7 8: 8 9: 9 10: 10 LEFT RIGHT X(LEFT) XVAL X(RIGHT) -1 1 2 1.0000 1.0000 2.0000 4 5 4.0000 4.5000 5.0000 6 7 5.0000 5.0000 7.0000 9 10 9.0000 10.0000 10.0000 -1 R8VEC_BRACKET6_TEST R8VEC_BRACKET6 finds a pair of entries in a sorted real array which bracket a value. Sorted array: 1: 0.75 2: 1.75 3: 2.75 4: 3.75 5: 4.75 6: 4.75 7: 6.75 8: 7.75 9: 8.75 10: 9.75 11: 10.75 Values to be bracketed: 1: -10.1 2: 1.2 3: 4.5 4: 5.2 5: 10.4 6: 12.5 Item Value Left Right 1 -10.10 -1 0 2 1.20 1 2 3 4.50 4 5 4 5.20 6 7 5 10.40 10 11 6 12.50 -1 0 R8VEC_CHEBY_EXTREME_TEST R8VEC_CHEBY_EXTREME computes Chebyshev Extreme points in [R1,R2]. N = 5, R1 = -1.000000, R2 = 1.000000 Chebyshev points: 1: -1 2: -0.707107 3: 0 4: 0.707107 5: 1 N = 7, R1 = 0.000000, R2 = 10.000000 Chebyshev points: 1: 0 2: 0.669873 3: 2.5 4: 5 5: 7.5 6: 9.33013 7: 10 R8VEC_CHEBY_ZERO_TEST R8VEC_CHEBY_ZERO computes Chebyshev Zero points in [R1,R2]. N = 5, R1 = -1.000000, R2 = 1.000000 Chebyshev points: 1: -0.951057 2: -0.587785 3: 0 4: 0.587785 5: 0.951057 N = 7, R1 = 0.000000, R2 = 10.000000 Chebyshev points: 1: 0.12536 2: 1.09084 3: 2.83058 4: 5 5: 7.16942 6: 8.90916 7: 9.87464 R8VEC_CHEBY1SPACE_TEST R8VEC_CHEBY1SPACE: Chebyshev Type 1 spaced points in [A,B]; r8vec_cheby1space ( 5, 10, 20 ) 1: 10 2: 11.4645 3: 15 4: 18.5355 5: 20 R8VEC_CHEBY2SPACE_TEST R8VEC_CHEBY2SPACE: Chebyshev Type 2 spaced points in [A,B]; r8vec_cheby2space ( 5, 10, 20 ) 1: 10.6699 2: 12.5 3: 15 4: 17.5 5: 19.3301 R8VEC_COMPARE_TEST: R8VEC_COMPARE compares the order of two R8VEC's. V1 and V2: 1: 1 0 2: 2 5 3: 3 10 V1 > V2 V1 and V2: 1: 1 1 2: 2 2 3: 3 3 V1 = V2 V1 and V2: 1: 1 1 2: 2 3 3: 3 0 V1 < V2 R8VEC_CONCATENATE_TEST R8VEC_CONCATENATE concatenates two R8VECs Array 1: 1: 91.1 2: 31.2 3: 71.3 4: 51.4 5: 31.5 Array 2: 1: 42.6 2: 22.7 3: 12.8 Array 3 = Array 1 + Array 2: 1: 91.1 2: 31.2 3: 71.3 4: 51.4 5: 31.5 6: 42.6 7: 22.7 8: 12.8 R8VEC_CONVOLUTION_TEST R8VEC_CONVOLUTION computes the convolution of two vectors. The factor X: 1: 1 2: 2 3: 3 4: 4 The factor Y: 1: -1 2: 5 3: 3 The convolution z = x star y: 1: -1 2: 3 3: 10 4: 17 5: 29 6: 12 Correct answer: 1: -1 2: 3 3: 10 4: 17 5: 29 6: 12 R8VEC_CONVOLUTION_CIRC_TEST R8VEC_CONVOLUTION_CIRC computes the circular convolution of two vectors. The factor X: 1: 1 2: 2 3: 3 4: 4 The factor Y: 1: 1 2: 2 3: 4 4: 8 The circular convolution z = xCCy: 1: 37 2: 44 3: 43 4: 26 Correct answer: 1: 37 2: 44 3: 43 4: 26 R8VEC_COPY_TEST R8VEC_COPY copies an R8VEC. Original array A: 1: 1 2: 2 3: 3 4: 4 5: 5 Copied array B: 1: 1 2: 2 3: 3 4: 4 5: 5 R8VEC_CORRELATION_TEST: R8VEC_CORRELATION computes the correlation of two R8VEC's. Vector V1: 1: 1 2: 0 Vector V2: 1: 2.18418 2: 0 Correlation = 1 Vector V2: 1: 8.28195 2: 4.78159 Correlation = 0.866025 Vector V2: 1: 4.14755 2: 7.18376 Correlation = 0.5 Vector V2: 1: 3.43939e-16 2: 5.61695 Correlation = 6.12323e-17 Vector V2: 1: -2.07654 2: 3.59666 Correlation = -0.5 Vector V2: 1: -0.572605 2: 0.330594 Correlation = -0.866025 Vector V2: 1: -2.57578 2: 3.15442e-16 Correlation = -1 Vector V2: 1: -0.952254 2: -0.549784 Correlation = -0.866025 Vector V2: 1: -0.219145 2: -0.37957 Correlation = -0.5 Vector V2: 1: -1.16458e-15 2: -6.33966 Correlation = -1.83697e-16 Vector V2: 1: 0.308636 2: -0.534573 Correlation = 0.5 Vector V2: 1: 3.89312 2: -2.24769 Correlation = 0.866025 Vector V2: 1: 4.01306 2: -9.82917e-16 Correlation = 1 R8VEC_CROSS_PRODUCT_2D_TEST: R8VEC_CROSS_PRODUCT_2D computes the cross product of two R8VEC's. Vector V1: 1: 1 2: 0.5 Vector V2: 1: 2.18418 2: 0 V1xV2 = -1.09209 Vector V2: 1: 8.28195 2: 4.78159 V1xV2 = 0.640611 Vector V2: 1: 4.14755 2: 7.18376 V1xV2 = 5.10999 Vector V2: 1: 3.43939e-16 2: 5.61695 V1xV2 = 5.61695 Vector V2: 1: -2.07654 2: 3.59666 V1xV2 = 4.63493 Vector V2: 1: -0.572605 2: 0.330594 V1xV2 = 0.616896 Vector V2: 1: -2.57578 2: 3.15442e-16 V1xV2 = 1.28789 Vector V2: 1: -0.952254 2: -0.549784 V1xV2 = -0.0736571 Vector V2: 1: -0.219145 2: -0.37957 V1xV2 = -0.269998 Vector V2: 1: -1.16458e-15 2: -6.33966 V1xV2 = -6.33966 Vector V2: 1: 0.308636 2: -0.534573 V1xV2 = -0.688892 Vector V2: 1: 3.89312 2: -2.24769 V1xV2 = -4.19426 Vector V2: 1: 4.01306 2: -9.82917e-16 V1xV2 = -2.00653 R8VEC_CROSS_PRODUCT_3D_TEST: R8VEC_CROSS_PRODUCT_3D computes the cross product of two R8VEC's. Vector V1: 1: 1 2: 0.5 3: 0 Vector V2: 1: 2.18418 2: 9.56318 3: 8.29509 V3 = V1 x V2: 1: 4.14755 2: -8.29509 3: 8.47108 Vector V2: 1: 5.61695 2: 4.15307 3: 0.661187 V3 = V1 x V2: 1: 0.330594 2: -0.661187 3: 1.34459 Vector V2: 1: 2.57578 2: 1.09957 3: 0.43829 V3 = V1 x V2: 1: 0.219145 2: -0.43829 3: -0.188321 Vector V2: 1: 6.33966 2: 0.617272 3: 4.49539 V3 = V1 x V2: 1: 2.24769 2: -4.49539 3: -2.55256 Vector V2: 1: 4.01306 2: 7.54673 3: 7.97287 V3 = V1 x V2: 1: 3.98643 2: -7.97287 3: 5.5402 R8VEC_DIF_TEST R8VEC_DIF estimates derivatives. Estimate the derivative of order N = 4 Using H = 0.010000 at argument X = 1.000000 The difference coefficients: 1: 6.25e+06 2: -2.5e+07 3: 3.75e+07 4: -2.5e+07 5: 6.25e+06 Estimate is FDIF = 2.718463 R8VEC_DIFF_NORM_TEST R8VEC_DIFF_NORM: L2 norm of the difference of two R8VEC's. Vector V1: 1: -5.63163 2: 9.12635 3: 6.59018 4: 1.23391 5: -1.69386 Vector V2: 1: -8.67763 2: -4.84844 3: -7.80086 4: -9.12342 5: 2.67931 L2 norm of V1-V2: 23.1964 R8VEC_DIFF_NORM_L1_TEST R8VEC_DIFF_NORM_L1: L1 norm of the difference of two R8VEC's. Vector V1: 1: -5.63163 2: 9.12635 3: 6.59018 4: 1.23391 5: -1.69386 Vector V2: 1: -8.67763 2: -4.84844 3: -7.80086 4: -9.12342 5: 2.67931 L1 norm of V1-V2: 46.1423 R8VEC_DIFF_NORM_L2_TEST R8VEC_DIFF_NORM_L2: L2 norm of the difference of two R8VEC's. Vector V1: 1: -5.63163 2: 9.12635 3: 6.59018 4: 1.23391 5: -1.69386 Vector V2: 1: -8.67763 2: -4.84844 3: -7.80086 4: -9.12342 5: 2.67931 L2 norm of V1-V2: 23.1964 R8VEC_DIFF_NORM_LI_TEST R8VEC_DIFF_NORM_LI: L-infinity norm of the difference of two R8VEC's. Vector V1: 1: -5.63163 2: 9.12635 3: 6.59018 4: 1.23391 5: -1.69386 Vector V2: 1: -8.67763 2: -4.84844 3: -7.80086 4: -9.12342 5: 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) 1 1.000000 50.000000 800.000000 2 2.000000 50.000000 800.000000 3 3.000000 50.000000 800.000000 4 4.000000 50.000000 800.000000 5 1.000000 60.000000 800.000000 6 2.000000 60.000000 800.000000 7 3.000000 60.000000 800.000000 8 4.000000 60.000000 800.000000 9 1.000000 70.000000 800.000000 10 2.000000 70.000000 800.000000 11 3.000000 70.000000 800.000000 12 4.000000 70.000000 800.000000 13 1.000000 50.000000 900.000000 14 2.000000 50.000000 900.000000 15 3.000000 50.000000 900.000000 16 4.000000 50.000000 900.000000 17 1.000000 60.000000 900.000000 18 2.000000 60.000000 900.000000 19 3.000000 60.000000 900.000000 20 4.000000 60.000000 900.000000 21 1.000000 70.000000 900.000000 22 2.000000 70.000000 900.000000 23 3.000000 70.000000 900.000000 24 4.000000 70.000000 900.000000 R8VEC_DIRECT_PRODUCT2_TEST R8VEC_DIRECT_PRODUCT2 forms the entries of a direct product of a given number of R8VEC factors. J W(J) 1 40000.000000 2 80000.000000 3 120000.000000 4 160000.000000 5 48000.000000 6 96000.000000 7 144000.000000 8 192000.000000 9 56000.000000 10 112000.000000 11 168000.000000 12 224000.000000 13 45000.000000 14 90000.000000 15 135000.000000 16 180000.000000 17 54000.000000 18 108000.000000 19 162000.000000 20 216000.000000 21 63000.000000 22 126000.000000 23 189000.000000 24 252000.000000 R8VEC_DOT_PRODUCT_TEST: R8VEC_DOT_PRODUCT computes the dot product of two R8VEC's. V1 and V2: 1: 0.218418 0.0617272 2: 0.956318 0.449539 3: 0.829509 0.401306 4: 0.561695 0.754673 5: 0.415307 0.797287 6: 0.0661187 0.00183837 7: 0.257578 0.897504 8: 0.109957 0.350752 9: 0.043829 0.0945448 10: 0.633966 0.0136169 V1 dot V2 = 1.81393 R8VEC_EQ_TEST: R8VEC_EQ determines if R8VEC V1 is equal to V2. V1 and V2: 1: 1 0 2: 2 5 3: 3 10 V1 EQ V2? = 0 V1 and V2: 1: 1 1 2: 2 2 3: 3 3 V1 EQ V2? = 1 V1 and V2: 1: 1 1 2: 2 3 3: 3 0 V1 EQ V2? = 0 R8VEC_EVEN_TEST R8VEC_EVEN computes N evenly spaced values between XLO and XHI. XLO = 0.000000 XHI = 99.000000 while N = 10 Resulting array: 1: 0 2: 11 3: 22 4: 33 5: 44 6: 55 7: 66 8: 77 9: 88 10: 99 R8VEC_EVEN2_TEST: R8VEC_EVEN2 interpolates a specified number of points pairs of values in a vector. Input data: 0.000000 4 1.000000 3 5.000000 5 2.000000 0 0.000000 Resulting vector: * 0.000000 0.200000 0.400000 0.600000 0.800000 * 1.000000 2.000000 3.000000 4.000000 * 5.000000 4.500000 4.000000 3.500000 3.000000 2.500000 * 2.000000 * 0.000000 R8VEC_EVEN3_TEST R8VEC_EVEN3 tries to evenly interpolate new data between old values. Original vector: 1: 0 2: 5.1 3: 7 4: 10 New vector: 1: 0 2: 1.02 3: 2.04 4: 3.06 5: 4.08 6: 5.1 7: 5.73333 8: 6.36667 9: 7 10: 8 11: 9 12: 10 R8VEC_EXPAND_LINEAR_TEST R8VEC_EXPAND_LINEAR linearly interpolates new data between old values. Original vector: 1: 16 2: 4 3: 0 4: 4 5: 16 6: 36 Expansion factor is 3 Fattened vector: 1: 16 2: 13 3: 10 4: 7 5: 4 6: 3 7: 2 8: 1 9: 0 10: 1 11: 2 12: 3 13: 4 14: 7 15: 10 16: 13 17: 16 18: 21 19: 26 20: 31 21: 36 R8VEC_FILL R8VEC_FILL sets all entries of an R8VEC to a given value. Using FILL = 123.45 Random R8VEC: 1: 123.45 2: 123.45 3: 123.45 4: 123.45 5: 123.45 R8VEC_FRAC_TEST R8VEC_FRAC: K-th smallest DVEC entry; Array to search: 1: 0.218418 2: 0.956318 3: 0.829509 4: 0.561695 5: 0.415307 6: 0.0661187 7: 0.257578 8: 0.109957 9: 0.043829 10: 0.633966 Fractile Value 1 0.043829 6 0.415307 R8VEC_GT_TEST: R8VEC_GT determines if R8VEC V1 is greater than V2. V1 and V2: 1: 1 0 2: 2 5 3: 3 10 V1 GT V2? = 1 V1 and V2: 1: 1 1 2: 2 2 3: 3 3 V1 GT V2? = 0 V1 and V2: 1: 1 1 2: 2 3 3: 3 0 V1 GT V2? = 0 R8VEC_HEAP_A_TEST R8VEC_HEAP_A puts an R8VEC into ascending heap form. Unsorted array: 1: 4.36837 2: 19.1264 3: 16.5902 4: 11.2339 5: 8.30614 6: 1.32237 7: 5.15156 8: 2.19914 9: 0.87658 10: 12.6793 Ascending heap form: 1: 0.87658 2: 2.19914 3: 1.32237 4: 4.36837 5: 8.30614 6: 16.5902 7: 5.15156 8: 19.1264 9: 11.2339 10: 12.6793 R8VEC_HEAP_D_TEST R8VEC_HEAP_D puts an R8VEC into descending heap form. Unsorted array: 1: 4.36837 2: 19.1264 3: 16.5902 4: 11.2339 5: 8.30614 6: 1.32237 7: 5.15156 8: 2.19914 9: 0.87658 10: 12.6793 Descending heap form: 1: 19.1264 2: 12.6793 3: 16.5902 4: 11.2339 5: 8.30614 6: 1.32237 7: 5.15156 8: 2.19914 9: 0.87658 10: 4.36837 R8VEC_HISTOGRAM_TEST R8VEC_HISTOGRAM histograms an integer vector. Uniform data: Histogram of data: 0.000000 0 0.000000 0.050000 63 0.050000 0.100000 37 0.100000 0.150000 49 0.150000 0.200000 37 0.200000 0.250000 46 0.250000 0.300000 57 0.300000 0.350000 49 0.350000 0.400000 52 0.400000 0.450000 51 0.450000 0.500000 49 0.500000 0.550000 50 0.550000 0.600000 56 0.600000 0.650000 60 0.650000 0.700000 52 0.700000 0.750000 44 0.750000 0.800000 47 0.800000 0.850000 54 0.850000 0.900000 48 0.900000 0.950000 52 0.950000 1.000000 47 1.000000 0 Normal data: Histogram of data: -3.000000 0 -3.000000 -2.700000 2 -2.700000 -2.400000 2 -2.400000 -2.100000 11 -2.100000 -1.800000 12 -1.800000 -1.500000 32 -1.500000 -1.200000 55 -1.200000 -0.900000 66 -0.900000 -0.600000 75 -0.600000 -0.300000 115 -0.300000 0.000000 111 0.000000 0.300000 115 0.300000 0.600000 117 0.600000 0.900000 103 0.900000 1.200000 65 1.200000 1.500000 46 1.500000 1.800000 29 1.800000 2.100000 17 2.100000 2.400000 15 2.400000 2.700000 7 2.700000 3.000000 4 3.000000 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: 1 2 3 4 Row 1 : 1.09209 2.07654 0.219145 2.00653 2 : 4.78159 0.330594 3.16983 3.77337 3 : 4.14755 1.28789 0.308636 3.98643 4 : 2.80848 0.549784 2.24769 0.00919186 Working on column K = 1 Householder matrix H: Col: 1 2 3 4 Row 1 : -0.155781 -0.682069 -0.591626 -0.400615 2 : -0.682069 0.597486 -0.34914 -0.236418 3 : -0.591626 -0.34914 0.697156 -0.205068 4 : -0.400615 -0.236418 -0.205068 0.86114 Product H*A: Col: 1 2 3 4 Row 1 : -7.01042 -1.53117 -3.27924 -5.24844 2 : 0 -1.79845 1.1053 -0.508058 3 :-8.88178e-16 -0.558841 -1.48213 0.272729 4 :-4.44089e-16 -0.700714 1.03509 -2.50551 Working on column K = 2 Householder matrix H: Col: 1 2 3 4 Row 1 : 1 -0 -0 -0 2 : -0 -0.895014 -0.278112 -0.348717 3 : -0 -0.278112 0.959184 -0.0511776 4 : -0 -0.348717 -0.0511776 0.93583 Product H*A: Col: 1 2 3 4 Row 1 : -7.01042 -1.53117 -3.27924 -5.24844 2 : 4.01874e-16 2.00941 -0.938018 1.25258 3 :-8.29199e-16 1.11022e-16 -1.78201 0.531121 4 :-3.70137e-16 1.11022e-16 0.659083 -2.18152 Working on column K = 3 Householder matrix H: Col: 1 2 3 4 Row 1 : 1 -0 -0 -0 2 : -0 1 -0 -0 3 : -0 -0 -0.937906 0.346889 4 : -0 -0 0.346889 0.937906 Product H*A: Col: 1 2 3 4 Row 1 : -7.01042 -1.53117 -3.27924 -5.24844 2 : 4.01874e-16 2.00941 -0.938018 1.25258 3 : 6.49315e-16 -6.56162e-17 1.89999 -1.25489 4 :-6.34794e-16 1.42641e-16 0 -1.86183 R8VEC_IDENTITY_ROW_TEST R8VEC_IDENTITY_ROW returns a row of the identity matrix. 0: 0 0 0 0 0 1: 1 0 0 0 0 2: 0 1 0 0 0 3: 0 0 1 0 0 4: 0 0 0 1 0 5: 0 0 0 0 1 6: 0 0 0 0 0 R8VEC_INDEX_DELETE_ALL_TEST R8VEC_INDEX_DELETE_ALL deletes all copies of a particular value. 4.000000 19.000000 17.000000 11.000000 8.000000 1.000000 5.000000 2.000000 1.000000 13.000000 1.000000 9.000000 8.000000 15.000000 16.000000 0.000000 18.000000 7.000000 2.000000 0.000000 Indexed list of entries: I INDX(I) X(I) X(INDX(I)) 1 18 8.000000 0.000000 2 22 7.000000 0.000000 3 8 4.000000 1.000000 4 13 19.000000 1.000000 5 11 17.000000 1.000000 6 10 11.000000 2.000000 7 21 8.000000 2.000000 8 3 1.000000 4.000000 9 9 5.000000 5.000000 10 2 2.000000 7.000000 11 20 1.000000 7.000000 12 23 13.000000 7.000000 13 1 1.000000 8.000000 14 15 9.000000 8.000000 15 24 8.000000 8.000000 16 7 15.000000 8.000000 17 14 16.000000 9.000000 18 6 0.000000 11.000000 19 12 18.000000 13.000000 20 16 7.000000 15.000000 21 17 2.000000 16.000000 22 5 0.000000 17.000000 23 19 7.000000 18.000000 24 4 8.000000 19.000000 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.000000 0.000000 2 20 4.000000 0.000000 3 7 19.000000 1.000000 4 12 17.000000 1.000000 5 10 11.000000 1.000000 6 9 8.000000 2.000000 7 19 1.000000 2.000000 8 2 5.000000 4.000000 9 8 2.000000 5.000000 10 1 1.000000 8.000000 11 14 13.000000 8.000000 12 21 1.000000 8.000000 13 6 9.000000 8.000000 14 13 8.000000 9.000000 15 5 15.000000 11.000000 16 11 16.000000 13.000000 17 15 0.000000 15.000000 18 16 18.000000 16.000000 19 4 2.000000 17.000000 20 18 0.000000 18.000000 21 3 8.000000 19.000000 R8VEC_INDEX_DELETE_DUPES_TEST R8VEC_INDEX_DELETE_DUPES deletes duplicates. 4.000000 19.000000 17.000000 11.000000 8.000000 1.000000 5.000000 2.000000 1.000000 13.000000 1.000000 9.000000 8.000000 15.000000 16.000000 0.000000 18.000000 7.000000 2.000000 0.000000 Indexed list of entries: I INDX(I) X(I) X(INDX(I)) 1 18 8.000000 0.000000 2 22 7.000000 0.000000 3 8 4.000000 1.000000 4 13 19.000000 1.000000 5 11 17.000000 1.000000 6 10 11.000000 2.000000 7 21 8.000000 2.000000 8 3 1.000000 4.000000 9 9 5.000000 5.000000 10 2 2.000000 7.000000 11 20 1.000000 7.000000 12 23 13.000000 7.000000 13 1 1.000000 8.000000 14 15 9.000000 8.000000 15 24 8.000000 8.000000 16 7 15.000000 8.000000 17 14 16.000000 9.000000 18 6 0.000000 11.000000 19 12 18.000000 13.000000 20 16 7.000000 15.000000 21 17 2.000000 16.000000 22 5 0.000000 17.000000 23 19 7.000000 18.000000 24 4 8.000000 19.000000 Call R8VEC_INDEX_DELETE_DUPES to delete duplicates: Indexed list of unique entries: I INDX(I) X(I) 1 1 0.000000 2 2 1.000000 3 3 2.000000 4 4 4.000000 5 5 5.000000 6 6 7.000000 7 7 8.000000 8 8 9.000000 9 9 11.000000 10 10 13.000000 11 11 15.000000 12 12 16.000000 13 13 17.000000 14 14 18.000000 15 15 19.000000 R8VEC_INDEX_DELETE_ONE_TEST R8VEC_INDEX_DELETE_ONE deletes one copy of a particular value. 4.000000 19.000000 17.000000 11.000000 8.000000 1.000000 5.000000 2.000000 1.000000 13.000000 1.000000 9.000000 8.000000 15.000000 16.000000 0.000000 18.000000 7.000000 2.000000 0.000000 Indexed list of entries: I INDX(I) X(I) X(INDX(I)) 1 18 8.000000 0.000000 2 22 7.000000 0.000000 3 8 4.000000 1.000000 4 13 19.000000 1.000000 5 11 17.000000 1.000000 6 10 11.000000 2.000000 7 21 8.000000 2.000000 8 3 1.000000 4.000000 9 9 5.000000 5.000000 10 2 2.000000 7.000000 11 20 1.000000 7.000000 12 23 13.000000 7.000000 13 1 1.000000 8.000000 14 15 9.000000 8.000000 15 24 8.000000 8.000000 16 7 15.000000 8.000000 17 14 16.000000 9.000000 18 6 0.000000 11.000000 19 12 18.000000 13.000000 20 16 7.000000 15.000000 21 17 2.000000 16.000000 22 5 0.000000 17.000000 23 19 7.000000 18.000000 24 4 8.000000 19.000000 Call R8VEC_INDEX_DELETE_ONE to delete one value of 8: Indexed list of entries: I INDX(I) X(I) X(INDX(I)) 1 18 8.000000 0.000000 2 22 7.000000 0.000000 3 8 4.000000 1.000000 4 13 19.000000 1.000000 5 11 17.000000 1.000000 6 10 11.000000 2.000000 7 21 8.000000 2.000000 8 3 1.000000 4.000000 9 9 5.000000 5.000000 10 2 2.000000 7.000000 11 20 1.000000 7.000000 12 23 13.000000 7.000000 13 1 1.000000 8.000000 14 15 9.000000 8.000000 15 7 8.000000 8.000000 16 14 15.000000 9.000000 17 6 16.000000 11.000000 18 12 0.000000 13.000000 19 16 18.000000 15.000000 20 17 7.000000 16.000000 21 5 2.000000 17.000000 22 19 0.000000 18.000000 23 4 7.000000 19.000000 R8VEC_INDEX_INSERT_TEST R8VEC_INDEX_INSERT inserts values into an index sorted array. 4.000000 19.000000 17.000000 11.000000 8.000000 1.000000 5.000000 2.000000 1.000000 13.000000 1.000000 9.000000 8.000000 15.000000 16.000000 0.000000 18.000000 7.000000 2.000000 0.000000 Indexed list of entries: I INDX(I) X(I) X(INDX(I)) 1 18 8.000000 0.000000 2 22 7.000000 0.000000 3 8 4.000000 1.000000 4 13 19.000000 1.000000 5 11 17.000000 1.000000 6 10 11.000000 2.000000 7 21 8.000000 2.000000 8 3 1.000000 4.000000 9 9 5.000000 5.000000 10 2 2.000000 7.000000 11 20 1.000000 7.000000 12 23 13.000000 7.000000 13 1 1.000000 8.000000 14 15 9.000000 8.000000 15 24 8.000000 8.000000 16 7 15.000000 8.000000 17 14 16.000000 9.000000 18 6 0.000000 11.000000 19 12 18.000000 13.000000 20 16 7.000000 15.000000 21 17 2.000000 16.000000 22 5 0.000000 17.000000 23 19 7.000000 18.000000 24 4 8.000000 19.000000 R8VEC_INDEX_INSERT_UNIQUE_TEST R8VEC_INDEX_INSERT_UNIQUE inserts unique values into an index sorted array. Generate some random values: 4.000000 19.000000 17.000000 11.000000 8.000000 1.000000 5.000000 2.000000 1.000000 13.000000 1.000000 9.000000 8.000000 15.000000 16.000000 0.000000 18.000000 7.000000 2.000000 0.000000 Indexed list of unique entries: I INDX(I) X(I) X(INDX(I)) 1 13 4.000000 0.000000 2 6 19.000000 1.000000 3 8 17.000000 2.000000 4 1 11.000000 4.000000 5 7 8.000000 5.000000 6 15 1.000000 7.000000 7 5 5.000000 8.000000 8 10 2.000000 9.000000 9 4 13.000000 11.000000 10 9 9.000000 13.000000 11 11 15.000000 15.000000 12 12 16.000000 16.000000 13 3 0.000000 17.000000 14 14 18.000000 18.000000 15 2 7.000000 19.000000 R8VEC_INDEX_ORDER_TEST R8VEC_INDEX_ORDER sorts an index sorted array. Generate some random values: 4.000000 19.000000 17.000000 11.000000 8.000000 1.000000 5.000000 2.000000 1.000000 13.000000 1.000000 9.000000 8.000000 15.000000 16.000000 0.000000 18.000000 7.000000 2.000000 0.000000 Indexed list of unique entries: I INDX(I) X(I) X(INDX(I)) 1 13 4.000000 0.000000 2 6 19.000000 1.000000 3 8 17.000000 2.000000 4 1 11.000000 4.000000 5 7 8.000000 5.000000 6 15 1.000000 7.000000 7 5 5.000000 8.000000 8 10 2.000000 9.000000 9 4 13.000000 11.000000 10 9 9.000000 13.000000 11 11 15.000000 15.000000 12 12 16.000000 16.000000 13 3 0.000000 17.000000 14 14 18.000000 18.000000 15 2 7.000000 19.000000 Now call DVEC_INDEX_ORDER to carry out the sorting: X: 1: 0 2: 1 3: 2 4: 4 5: 5 6: 7 7: 8 8: 9 9: 11 10: 13 11: 15 12: 16 13: 17 14: 18 15: 19 R8LIB_TEST125 R8VEC_INDEX_SEARCH searches for an entry with a given value. Generate some random values: 4.000000 19.000000 17.000000 11.000000 8.000000 1.000000 5.000000 2.000000 1.000000 13.000000 1.000000 9.000000 8.000000 15.000000 16.000000 0.000000 18.000000 7.000000 2.000000 0.000000 Indexed list of entries: I INDX(I) X(I) X(INDX(I)) 1 13 4.000000 0.000000 2 6 19.000000 1.000000 3 8 17.000000 2.000000 4 1 11.000000 4.000000 5 7 8.000000 5.000000 6 15 1.000000 7.000000 7 5 5.000000 8.000000 8 10 2.000000 9.000000 9 4 13.000000 11.000000 10 9 9.000000 13.000000 11 11 15.000000 15.000000 12 12 16.000000 16.000000 13 3 0.000000 17.000000 14 14 18.000000 18.000000 15 2 7.000000 19.000000 Results of search for given XVAL: XVAL Less Equal More 0.000000 0 1 2 1.000000 1 2 3 2.000000 2 3 4 3.000000 3 0 4 4.000000 3 4 5 5.000000 4 5 6 6.000000 5 0 6 7.000000 5 6 7 8.000000 6 7 8 9.000000 7 8 9 10.000000 8 0 9 11.000000 8 9 10 12.000000 9 0 10 13.000000 9 10 11 14.000000 10 0 11 15.000000 10 11 12 16.000000 11 12 13 17.000000 12 13 14 18.000000 13 14 15 19.000000 14 15 16 20.000000 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 1: 0.218418 2: 0.956318 3: 0.829509 4: 0.561695 5: 0.415307 6: 0.0661187 7: 0.257578 8: 0.109957 9: 0.043829 10: 0.633966 11: 0.0617272 12: 0.449539 13: 0.401306 14: 0.754673 15: 0.797287 16: 0.00183837 17: 0.897504 18: 0.350752 19: 0.0945448 20: 0.0136169 I INDX R(INDX(I)) 1 16 0.001838 2 20 0.013617 3 9 0.043829 4 11 0.061727 5 6 0.066119 6 19 0.094545 7 8 0.109957 8 1 0.218418 9 7 0.257578 10 18 0.350752 11 13 0.401306 12 5 0.415307 13 12 0.449539 14 4 0.561695 15 10 0.633966 16 14 0.754673 17 15 0.797287 18 3 0.829509 19 17 0.897504 20 2 0.956318 R_LO 0.840847 R_HI 0.859097 Empty range in R. Array 1: 0.123104 2: 0.00751236 3: 0.260303 4: 0.912484 5: 0.113664 6: 0.351629 7: 0.822887 8: 0.267132 9: 0.692066 10: 0.561662 11: 0.861216 12: 0.453794 13: 0.911977 14: 0.597917 15: 0.188955 16: 0.761492 17: 0.396988 18: 0.185314 19: 0.574366 20: 0.367027 I INDX R(INDX(I)) 1 2 0.007512 2 5 0.113664 3 1 0.123104 4 18 0.185314 5 15 0.188955 6 3 0.260303 7 8 0.267132 8 6 0.351629 9 20 0.367027 10 17 0.396988 11 12 0.453794 12 10 0.561662 13 19 0.574366 14 14 0.597917 15 9 0.692066 16 16 0.761492 17 7 0.822887 18 11 0.861216 19 13 0.911977 20 4 0.912484 R_LO 0.361529 9 20 0.367027 10 17 0.396988 11 12 0.453794 12 10 0.561662 13 19 0.574366 14 14 0.597917 R_HI 0.617205 Array 1: 0.21293 2: 0.714471 3: 0.117707 4: 0.299329 5: 0.825003 6: 0.82466 7: 0.0618618 8: 0.710781 9: 0.0882833 10: 0.777994 11: 0.745303 12: 0.308675 13: 0.899373 14: 0.763537 15: 0.761731 16: 0.40697 17: 0.938749 18: 0.562088 19: 0.01782 20: 0.501103 I INDX R(INDX(I)) 1 19 0.017820 2 7 0.061862 3 9 0.088283 4 3 0.117707 5 1 0.212930 6 4 0.299329 7 12 0.308675 8 16 0.406970 9 20 0.501103 10 18 0.562088 11 8 0.710781 12 2 0.714471 13 11 0.745303 14 15 0.761731 15 14 0.763537 16 10 0.777994 17 6 0.824660 18 5 0.825003 19 13 0.899373 20 17 0.938749 R_LO 0.041909 2 7 0.061862 3 9 0.088283 4 3 0.117707 5 1 0.212930 6 4 0.299329 7 12 0.308675 R_HI 0.368851 Array 1: 0.271724 2: 0.858573 3: 0.0290366 4: 0.0174423 5: 0.152384 6: 0.114319 7: 0.353907 8: 0.119308 9: 0.206653 10: 0.212924 11: 0.612948 12: 0.809519 13: 0.58709 14: 0.215492 15: 0.768056 16: 0.723297 17: 0.448019 18: 0.855176 19: 0.945017 20: 0.909057 I INDX R(INDX(I)) 1 4 0.017442 2 3 0.029037 3 6 0.114319 4 8 0.119308 5 5 0.152384 6 9 0.206653 7 10 0.212924 8 14 0.215492 9 1 0.271724 10 7 0.353907 11 17 0.448019 12 13 0.587090 13 11 0.612948 14 16 0.723297 15 15 0.768056 16 12 0.809519 17 18 0.855176 18 2 0.858573 19 20 0.909057 20 19 0.945017 R_LO 0.030195 3 6 0.114319 4 8 0.119308 5 5 0.152384 6 9 0.206653 7 10 0.212924 8 14 0.215492 9 1 0.271724 10 7 0.353907 11 17 0.448019 R_HI 0.519726 Array 1: 0.481067 2: 0.292313 3: 0.90264 4: 0.667842 5: 0.412278 6: 0.156948 7: 0.833282 8: 0.964404 9: 0.74079 10: 0.456099 11: 0.653561 12: 0.406827 13: 0.540539 14: 0.832281 15: 0.145756 16: 0.717128 17: 0.775651 18: 0.362262 19: 0.531111 20: 0.379977 I INDX R(INDX(I)) 1 15 0.145756 2 6 0.156948 3 2 0.292313 4 18 0.362262 5 20 0.379977 6 12 0.406827 7 5 0.412278 8 10 0.456099 9 1 0.481067 10 19 0.531111 11 13 0.540539 12 11 0.653561 13 4 0.667842 14 16 0.717128 15 9 0.740790 16 17 0.775651 17 14 0.832281 18 7 0.833282 19 3 0.902640 20 8 0.964404 R_LO 0.269285 3 2 0.292313 4 18 0.362262 5 20 0.379977 6 12 0.406827 7 5 0.412278 8 10 0.456099 9 1 0.481067 10 19 0.531111 11 13 0.540539 12 11 0.653561 13 4 0.667842 14 16 0.717128 15 9 0.740790 16 17 0.775651 17 14 0.832281 18 7 0.833282 R_HI 0.877418 R8VEC_INDEXED_HEAP_D_TEST R8VEC_INDEXED_HEAP_D creates a descending heap from an indexed R8VEC. The data vector: 1: 101 2: 102 3: 103 4: 104 5: 105 6: 106 7: 107 8: 108 9: 109 10: 110 11: 111 12: 112 13: 113 14: 114 15: 115 16: 116 17: 117 18: 118 19: 119 20: 120 The index vector: 1: 1 2: 11 3: 17 4: 5 5: 7 6: 13 7: 15 8: 3 9: 19 10: 9 A(INDX): 1 101 2 111 3 117 4 105 5 107 6 113 7 115 8 103 9 119 10 109 The data vector (should NOT change): 1: 101 2: 102 3: 103 4: 104 5: 105 6: 106 7: 107 8: 108 9: 109 10: 110 11: 111 12: 112 13: 113 14: 114 15: 115 16: 116 17: 117 18: 118 19: 119 20: 120 The index vector (may change): 1: 19 2: 11 3: 17 4: 5 5: 9 6: 13 7: 15 8: 3 9: 1 10: 7 A(INDX) is now a heap: 1 119 2 111 3 117 4 105 5 109 6 113 7 115 8 103 9 101 10 107 R8VEC_INDEXED_HEAP_D_EXTRACT_TEST For an indexed R8VEC, R8VEC_INDEXED_HEAP_D_EXTRACT extracts the maximum value; The data vector: 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: 20 The index vector: 1: 9 2: 2 3: 8 4: 14 5: 5 A(INDX): 1 9.000000 2 2.000000 3 8.000000 4 14.000000 5 5.000000 The index vector after heaping: 1: 14 2: 9 3: 8 4: 2 5: 5 A(INDX) after heaping: 1 14.000000 2 9.000000 3 8.000000 4 2.000000 5 5.000000 Now extract the maximum several times. Extracting maximum element A(14) = 14.000000 Extracting maximum element A(9) = 9.000000 Extracting maximum element A(8) = 8.000000 Extracting maximum element A(5) = 5.000000 Extracting maximum element A(2) = 2.000000 The data vector after extractions: 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: 20 The index vector after extractions: A(INDX) after extractions: R8VEC_INDEXED_HEAP_D_INSERT_TEST For an indexed R8VEC, R8VEC_INDEXED_HEAP_D_INSERT inserts a value into the heap. The data vector: 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: 20 The index vector: 1: 9 2: 2 3: 8 4: 14 5: 5 A(INDX): 1 9.000000 2 2.000000 3 8.000000 4 14.000000 5 5.000000 The index vector after heaping: 1: 14 2: 9 3: 8 4: 2 5: 5 A(INDX) after heaping: 1 14.000000 2 9.000000 3 8.000000 4 2.000000 5 5.000000 Inserting value 7.000000 Inserting value 15.000000 Inserting value 1.000000 Inserting value 19.000000 Inserting value 20.000000 The data vector after insertions: 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: 20 The index vector after insertions: 1: 20 2: 19 3: 14 4: 9 5: 15 6: 7 7: 8 8: 1 9: 2 10: 5 A(INDX) after insertions: 1 20.000000 2 19.000000 3 14.000000 4 9.000000 5 15.000000 6 7.000000 7 8.000000 8 1.000000 9 2.000000 10 5.000000 R8VEC_INDEXED_HEAP_D_MAX_TEST For an indexed R8VEC, R8VEC_INDEXED_HEAP_D_MAX reports the maximum value. The data vector: 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: 20 The index vector: 1: 9 2: 2 3: 8 4: 14 5: 5 A(INDX): 1 9.000000 2 2.000000 3 8.000000 4 14.000000 5 5.000000 The index vector after heaping: 1: 14 2: 9 3: 8 4: 2 5: 5 A(INDX) after heaping: 1 14.000000 2 9.000000 3 8.000000 4 2.000000 5 5.000000 Inserting value 7.000000 Current maximum is 14.000000 Inserting value 15.000000 Current maximum is 15.000000 Inserting value 1.000000 Current maximum is 15.000000 Inserting value 19.000000 Current maximum is 19.000000 Inserting value 20.000000 Current maximum is 20.000000 The data vector after insertions: 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: 20 The index vector after insertions: 1: 20 2: 19 3: 14 4: 9 5: 15 6: 7 7: 8 8: 1 9: 2 10: 5 A(INDX) after insertions: 1 20.000000 2 19.000000 3 14.000000 4 9.000000 5 15.000000 6 7.000000 7 8.000000 8 1.000000 9 2.000000 10 5.000000 R8VEC_INDICATOR0_TEST R8VEC_INDICATOR0 returns an indicator vector. The indicator0 vector: 1: 0 2: 1 3: 2 4: 3 5: 4 6: 5 7: 6 8: 7 9: 8 10: 9 R8VEC_INDICATOR1_TEST R8VEC_INDICATOR1 returns a 1-based indicator vector. The indicator1 vector: 1: 1 2: 2 3: 3 4: 4 5: 5 6: 6 7: 7 8: 8 9: 9 10: 10 R8VEC_INSERT_TEST R8VEC_INSERT inserts a value into an R8VEC. a = 0 1 2 3 4 5 6 7 8 9 The initial vector: 1: 0 2: 1 3: 2 4: 3 5: 4 6: 5 7: 6 8: 7 9: 8 10: 9 After insertion of 5.5 at position 7: 1: 0 2: 1 3: 2 4: 3 5: 4 6: 5 7: 5.5 8: 6 9: 7 10: 8 11: 9 R8VEC_IS_ASCENDING_TEST R8VEC_IS_ASCENDING is TRUE if an R8VEC is ascending. Vector #1 -2.81582 4.56318 3.29509 r8vec_is_ascending() = 0 Vector #2 0.616954 -0.846929 -4.33881 r8vec_is_ascending() = 0 Vector #3 -2.42422 -3.90043 -4.56171 r8vec_is_ascending() = 0 Vector #4 1.33966 -4.38273 -0.50461 r8vec_is_ascending() = 0 Vector #5 -0.986937 2.54673 2.97287 r8vec_is_ascending() = 1 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_DISTINCT_TEST R8VEC_IS_DISTINCT is TRUE if an R8VEC only contains distinct entries. X: 0 1 3 X is distinct X: 1.5 1.6 1.5 X is NOT distinct. X: -1 1 10 X is distinct R8VEC_IS_INTEGER_TEST R8VEC_IS_INTEGER is TRUE if every entry of an R8VEC is an integer. Example 1: Obviously integer: a = 1 2 3 4 5 6 A is an integer vector. Example 2: Obviously NOT integer: a = 1.0000 2.0000 3.0000 4.0000 5.0000 6.5000 A is NOT an integer vector. Example 3: Not Integer, Not obvious: a = 1.0000 2.0000 3.0000 4.0000 5.0000 6.0000 A is NOT an integer vector. Example 4: Not Integer, Not obvious: a = Columns 1 through 4: 1.00000 2.00000 300000000.20000 4.00000 Columns 5 and 6: 5.00000 6.00000 A is NOT an integer vector. R8VEC_LEGENDRE_TEST R8VEC_LEGENDRE computes N Legendre points in [R1,R2]. N = 5, R1 = -1, R2 = 1 Legendre points: 1: -0.90618 2: -0.538469 3: 0 4: 0.538469 5: 0.90618 N = 7, R1 = 0, R2 = 10 Legendre points: 1: 0.25446 2: 1.29234 3: 2.97077 4: 5 5: 7.02923 6: 8.70766 7: 9.74554 R8VEC_LINSPACE_TEST For a R8VEC: R8VEC_LINSPACE: evenly spaced points between A and B; r8vec_linspace ( 5, 10, 20 ) 1: 10 2: 12.5 3: 15 4: 17.5 5: 20 R8VEC_LINSPACE2_TEST R8VEC_LINSPACE2: evenly spaced points between A and B; r8vec_linspace2 ( 5, 10, 20 ) 1: 11.6667 2: 13.3333 3: 15 4: 16.6667 5: 18.3333 R8VEC_LT_TEST: R8VEC_LT determines if R8VEC V1 is less than V2. V1 and V2: 1: 1 0 2: 2 5 3: 3 10 V1 LT V2? = 0 V1 and V2: 1: 1 1 2: 2 2 3: 3 3 V1 LT V2? = 0 V1 and V2: 1: 1 1 2: 2 3 3: 3 0 V1 LT V2? = 1 R8VEC_MAX_TEST For an R8VEC: R8VEC_MAX: maximum entry; Input vector: 1: -5.63163 2: 9.12635 3: 6.59018 4: 1.23391 5: -1.69386 6: -8.67763 7: -4.84844 8: -7.80086 9: -9.12342 10: 2.67931 Maximum: 9.126352 R8VEC_MAX_ABS_INDEX_TEST R8VEC_MAX_ABS_INDEX: index of entry of maximum absolute value; Input vector: 1: -5.63163 2: 9.12635 3: 6.59018 4: 1.23391 5: -1.69386 6: -8.67763 7: -4.84844 8: -7.80086 9: -9.12342 10: 2.67931 Index of entry of maximum absolute value: 2 R8VEC_MAX_INDEX_TEST R8VEC_MAX_INDEX: index of maximum entry; Input vector: 1: -5.63163 2: 9.12635 3: 6.59018 4: 1.23391 5: -1.69386 6: -8.67763 7: -4.84844 8: -7.80086 9: -9.12342 10: 2.67931 Maximum index: 2 R8VEC_MEAN_TEST R8VEC_MEAN computes the mean value of an R8VEC. Input vector: 1: -2.81582 2: 4.56318 3: 3.29509 4: 0.616954 5: -0.846929 6: -4.33881 7: -2.42422 8: -3.90043 9: -4.56171 10: 1.33966 Value = -0.907304 R8VEC_MEAN_GEOMETRIC_TEST R8VEC_MEAN_GEOMETRIC computes the geometric mean of an R8VEC. Input vector: 1: 1.09209 2: 4.78159 3: 4.14755 4: 2.80848 5: 2.07654 6: 0.330594 7: 1.28789 8: 0.549784 9: 0.219145 10: 3.16983 Geometric mean = 1.35287 R8VEC_MEAN_RUNNING_TEST R8VEC_MEAN_RUNNING returns the running means of an R8VEC. Random R8VEC: 1: -1.72373 2: 9.34476 3: 7.44264 4: 3.42543 5: 1.22961 6: -4.00822 7: -1.13633 8: -3.35065 9: -4.34257 10: 4.50949 Running means: 1: 0 2: -1.72373 3: 3.81052 4: 5.02123 5: 4.62228 6: 3.94374 7: 2.61842 8: 2.08202 9: 1.40294 10: 0.76455 11: 1.13904 R8VEC_MEAN_UPDATE_TEST R8VEC_MEAN_UPDATE updates the mean of a vector when one more element is added. N R MEAN MEAN_UPDATE 1 0.218418 0.218418 0.218418 2 0.956318 0.587368 0.587368 3 0.829509 0.668082 0.668082 4 0.561695 0.641485 0.641485 5 0.415307 0.59625 0.59625 6 0.0661187 0.507894 0.507894 7 0.257578 0.472135 0.472135 8 0.109957 0.426863 0.426863 9 0.043829 0.384303 0.384303 10 0.633966 0.40927 0.40927 R8VEC_MEDIAN_TEST For an R8VEC R8VEC_MEDIAN: median value; Input vector: 1: -5.63163 2: 9.12635 3: 6.59018 4: 1.23391 5: -1.69386 6: -8.67763 7: -4.84844 8: -7.80086 9: -9.12342 10: 2.67931 Median: -1.693858 R8VEC_MIDSPACE_TEST For a R8VEC: R8VEC_MIDSPACE: evenly spaced midpoints between A and B r8vec_midspace ( 5, 10, 20 ) 1: 11 2: 13 3: 15 4: 17 5: 19 R8VEC_MIN_TEST For an R8VEC: R8VEC_MIN: minimum entry. Input vector: 1: -5.63163 2: 9.12635 3: 6.59018 4: 1.23391 5: -1.69386 6: -8.67763 7: -4.84844 8: -7.80086 9: -9.12342 10: 2.67931 Minimum: -9.123420 R8VEC_MIN_INDEX_TEST R8VEC_MIN_INDEX: index of minimum entry; Input vector: 1: -5.63163 2: 9.12635 3: 6.59018 4: 1.23391 5: -1.69386 6: -8.67763 7: -4.84844 8: -7.80086 9: -9.12342 10: 2.67931 Maximum index: 2 Minimum index: 9 R8VEC_MIN_POS_TEST R8VEC_MIN_POS returns the minimum positive entry in an R8VEC. Input vector: 1: -5.63163 2: 9.12635 3: 6.59018 4: 1.23391 5: -1.69386 6: -8.67763 7: -4.84844 8: -7.80086 9: -9.12342 10: 2.67931 Minimum positive entry: 1.233909 R8VEC_MIRROR_NEXT_TEST R8VEC_MIRROR_NEXT generates all sign variations of a real vector. Next vector: 1: 1 2: 2 3: 3 Next vector: 1: -1 2: 2 3: 3 Next vector: 1: 1 2: -2 3: 3 Next vector: 1: -1 2: -2 3: 3 Next vector: 1: 1 2: 2 3: -3 Next vector: 1: -1 2: 2 3: -3 Next vector: 1: 1 2: -2 3: -3 Next vector: 1: -1 2: -2 3: -3 Done. Next vector: 1: 1 2: 0 3: 3 Next vector: 1: -1 2: 0 3: 3 Next vector: 1: 1 2: -0 3: -3 Next vector: 1: -1 2: -0 3: -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: 1: -2.81582 2: 4.56318 3: 3.29509 4: 0.616954 5: -0.846929 Rounded vector A: 1: -3 2: 5 3: 3 4: 1 5: -1 R8VEC_NORM_TEST R8VEC_NORM computes the L2 norm of an R8VEC. Input vector: 1: -5.63163 2: 9.12635 3: 6.59018 4: 1.23391 5: -1.69386 6: -8.67763 7: -4.84844 8: -7.80086 9: -9.12342 10: 2.67931 L2 norm = 20.320074 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: 1: -1 2: 2 3: 1 4: 0 5: -0 6: -2 7: -1 8: -2 9: -2 10: 1 L0 norm: 8.000000 R8VEC_NORM_L1_TEST For an R8VEC: R8VEC_NORM_L1: L1 norm. Input vector: 1: -5.63163 2: 9.12635 3: 6.59018 4: 1.23391 5: -1.69386 6: -8.67763 7: -4.84844 8: -7.80086 9: -9.12342 10: 2.67931 L1 norm: 57.405605 R8VEC_NORM_L2_TEST R8VEC_NORM_L2 computes the L2 norm of an R8VEC. Input vector: 1: -5.63163 2: 9.12635 3: 6.59018 4: 1.23391 5: -1.69386 6: -8.67763 7: -4.84844 8: -7.80086 9: -9.12342 10: 2.67931 L2 norm = 20.320074 R8VEC_NORM_LI_TEST For an R8VEC: R8VEC_NORM_LI: L-infinity norm. Input vector: 1: -5.63163 2: 9.12635 3: 6.59018 4: 1.23391 5: -1.69386 6: -8.67763 7: -4.84844 8: -7.80086 9: -9.12342 10: 2.67931 L-Infinity norm: 9.126352 R8VEC_NORM_LP_TEST R8VEC_NORM_LP computes the LP norm of an R8VEC. Input vector V: 1: -5.63163 2: 9.12635 3: 6.59018 4: 1.23391 5: -1.69386 6: -8.67763 7: -4.84844 8: -7.80086 9: -9.12342 10: 2.67931 P LP-norm(V) 0.2500 50146 0.5000 527.694 1.0000 57.4056 1.5000 28.4061 2.0000 20.3201 2.5000 16.7632 3.0000 14.8162 5.0000 11.7665 10.0000 10.1366 20.0000 9.53537 R8VEC_NORM_RMS_TEST R8VEC_NORM_RMS computes the RMS norm of an R8VEC. Input vector: 1: -5.63163 2: 9.12635 3: 6.59018 4: 1.23391 5: -1.69386 6: -8.67763 7: -4.84844 8: -7.80086 9: -9.12342 10: 2.67931 RMS norm = 6.425772 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. 1 1.679040 2 -0.566060 3 1.212934 4 1.269381 5 -1.666087 Test #2: Restore the random number seed. Call 5 times, 1 value each time. The results should be identical. 1 1.679040 2 -0.566060 3 1.212934 4 1.269381 5 -1.666087 Test #3: Restore the random number seed. Call 1 time for 5 values. The results should be identical. 1 1.679040 2 -0.472769 3 -0.566060 4 -0.231124 5 1.212934 Test #4: Restore the random number seed. Call for 2, 1, and 2 values. The results should be identical. 1 1.679040 2 -0.472769 1 -0.566060 1 1.212934 2 0.535037 Test #5: Number of samples was 1000 Minimum value was -3.029754 Maximum value was 3.328581 Average value was -0.016984 Variance was 1.001002 Expected average 0.000000 Expected variance 1.000000 R8VEC_NORMAL_AB_TEST R8VEC_NORMAL_AB computes a scaled pseudonormal vector. MU = 15 SIGMA = 0.25 SEED = 1.23457e+08 The vector: 1: 15.4198 2: 14.8818 3: 14.8585 4: 14.9422 5: 15.3032 6: 15.1338 7: 15.3173 8: 15.2624 9: 14.5835 10: 14.5337 R8VEC_NORMALIZE_TEST R8VEC_NORMALIZE normalizes an R8VEC in L2 norm. Input vector: 1: -5.63163 2: 9.12635 3: 6.59018 4: 1.23391 5: -1.69386 6: -8.67763 7: -4.84844 8: -7.80086 9: -9.12342 10: 2.67931 After calling R8VEC_NORMALIZE: 1: -0.277146 2: 0.44913 3: 0.324319 4: 0.0607236 5: -0.0833589 6: -0.427047 7: -0.238604 8: -0.383899 9: -0.448986 10: 0.131856 R8VEC_NORMALIZE_L1_TEST For an R8VEC: R8VEC_NORMALIZE_L1: make unit sum; Input vector: 1: -5.63163 2: 9.12635 3: 6.59018 4: 1.23391 5: -1.69386 6: -8.67763 7: -4.84844 8: -7.80086 9: -9.12342 10: 2.67931 After calling R8VEC_NORMALIZE_L1: 1: -0.0981025 2: 0.15898 3: 0.1148 4: 0.0214946 5: -0.0295068 6: -0.151163 7: -0.0844594 8: -0.13589 9: -0.158929 10: 0.0466734 R8VEC_NORMSQ_TEST R8VEC_NORMSQ computes the squared L2 norm of an R8VEC. Input vector: 1: -5.63163 2: 9.12635 3: 6.59018 4: 1.23391 5: -1.69386 6: -8.67763 7: -4.84844 8: -7.80086 9: -9.12342 10: 2.67931 Square of L2 norm = 412.905407 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 1: 1 2: 3 3: 2 4: 4 The following vector has order type 0 1: 2 2: 2 3: 2 4: 2 The following vector has order type 1 1: 1 2: 2 3: 2 4: 4 The following vector has order type 2 1: 1 2: 2 3: 3 4: 4 The following vector has order type 3 1: 4 2: 4 3: 3 4: 1 The following vector has order type 4 1: 9 2: 7 3: 3 4: 0 R8VEC_PART_QUICK_A_TEST R8VEC_PART_QUICK_A reorders an R8VEC as part of a quick sort. Using initial random number seed = Before rearrangement: 1: 2.18418 2: 9.56318 3: 8.29509 4: 5.61695 5: 4.15307 6: 0.661187 7: 2.57578 8: 1.09957 9: 0.43829 10: 6.33966 11: 0.617272 12: 4.49539 Rearranged array Left index = 4 Key index = 5 Right index = 6 Left half: 1: 0.617272 2: 0.43829 3: 1.09957 4: 0.661187 Key: 1: 2.18418 Right half: 1: 2.57578 2: 4.15307 3: 5.61695 4: 6.33966 5: 8.29509 6: 4.49539 7: 9.56318 R8VEC_PERMUTE_TEST R8VEC_PERMUTE permutes an R8VEC. Original array X[]: 1: 1 2: 2 3: 3 4: 4 5: 5 Permutation vector P[]: 1: 2 2: 4 3: 5 4: 1 5: 3 Permuted array X[P[]]: 1: 2 2: 4 3: 5 4: 1 5: 3 R8VEC_PERMUTE_CYCLIC_TEST R8VEC_PERMUTE_CYCLIC carries out a cyclic permutation of K positions on an R8VEC. K = 4 Original array X[]: 1: 1 2: 2 3: 3 4: 4 5: 5 6: 6 7: 7 8: 8 9: 9 10: 10 Array after cyclic permutation: 1: 5 2: 6 3: 7 4: 8 5: 9 6: 10 7: 1 8: 2 9: 3 10: 4 R8VEC_PERMUTE_UNIFORM_TEST R8VEC_PERMUTE_UNIFORM randomly reorders an R8VEC. A, before rearrangement: 1: 101 2: 102 3: 103 4: 104 5: 105 6: 106 7: 107 8: 108 9: 109 10: 110 11: 111 12: 112 A, after rearrangement: 1: 103 2: 112 3: 111 4: 109 5: 108 6: 106 7: 105 8: 107 9: 104 10: 101 11: 110 12: 102 R8VEC_POLARIZE_TEST R8VEC_POLARIZE decomposes a vector into components parallel and normal to a direction. Original vector: 1: 1 2: 2 3: 3 Direction vector: 1: 3 2: 1 3: -2 Normal component: 1: 1.21429 2: 2.07143 3: 2.85714 Parallel component: 1: -0.214286 2: -0.0714286 3: 0.142857 Dot product of P and A_normal (should be 0) 0.000000 Cosine of angle between P and A_parallel (should be 1 or -1) -1.000000 Sum of components (should equal A): 1: 1 2: 2 3: 3 R8VEC_PRINT_TEST R8VEC_PRINT prints an R8VEC. The R8VEC: 1: 123.456 2: 5e-06 3: -1e+06 4: 3.14159 R8VEC_PRINT_16_TEST R8VEC_PRINT_16 prints an R8VEC to 16 places. The R8VEC: 1: 3.141592653589793 2: 1.414213562373095 3: 0.1428571428571428 R8VEC_PRINT_MASK_TEST R8VEC_PRINT_MASK prints masked elements of an R8VEC. The full vector: 1: 12.1842 2: 19.5632 3: 18.2951 4: 15.617 5: 14.1531 6: 10.6612 7: 12.5758 8: 11.0996 9: 10.4383 10: 16.3397 Masked vector printout: R > 15.0: 1: 2 19.5632 2: 3 18.2951 3: 4 15.617 4: 10 16.3397 Masked vector printout: R near 12: 1: 1 12.1842 2: 6 10.6612 3: 7 12.5758 4: 8 11.0996 5: 9 10.4383 Masked vector printout: Odd index R: 1: 1 12.1842 2: 3 18.2951 3: 5 14.1531 4: 7 12.5758 5: 9 10.4383 R8VEC_PRINT_PART_TEST R8VEC_PRINT_PART prints part of an R8VEC. Lines 10:20 of the vector: 10: 10 11: 11 12: 12 13: 13 14: 14 15: 15 16: 16 17: 17 18: 18 19: 19 20: 20 R8VEC_PRINT_SOME_TEST R8VEC_PRINT_SOME prints "some" of an R8VEC. Printing at most 8 lines: 1 1 2 2 3 3 4 4 5 5 6 6 ...... .............. 100 100 R8VEC_PRODUCT_TEST R8VEC_PRODUCT computes the product of an R8VEC. Input vector: 1: -2.81582 2: 4.56318 3: 3.29509 4: 0.616954 5: -0.846929 6: -4.33881 7: -2.42422 8: -3.90043 9: -4.56171 10: 1.33966 Product = 5546.47 R8VEC_ROTATE_TEST R8VEC_ROTATE rotates an R8VEC in place. Rotate entries 2 places to the right. Original array: 1: 1 2: 2 3: 3 4: 4 5: 5 Rotated array: 1: 4 2: 5 3: 1 4: 2 5: 3 R8VEC_REVERSE_TEST R8VEC_REVERSE reverses an R8VEC. Original array: 1: 1 2: 2 3: 3 4: 4 5: 5 Reversed array: 1: 5 2: 4 3: 3 4: 2 5: 1 R8VEC_SCALAR_TRIPLE_PRODUCT_TEST: R8VEC_SCALAR_TRIPLE_PRODUCT computes the scalar triple product of three R8VEC's. S = V1 dot ( V2 x V3 ). V1, V2 and V3: 1: -1 -2 0 2: 3 3 4 3: 3 1 0 Computed = -20, Exact = -20 R8VEC_SCALE_TEST R8VEC_SCALE scales a vector by a factor. The vector: 1: 1 2: 2 3: 3 4: 4 5: 5 6: 6 7: 7 8: 8 9: 9 10: 10 Using a scale of S = 10 Scaled vector: 1: 10 2: 20 3: 30 4: 40 5: 50 6: 60 7: 70 8: 80 9: 90 10: 100 R8VEC_SCALE_01_TEST R8VEC_SCALE_01 shifts and scales an R8VEC so that it has min 0 and max 1 Vector X: 1: -0.631634 2: 14.1264 3: 11.5902 4: 6.23391 5: 3.30614 6: -3.67763 7: 0.151556 8: -2.80086 9: -4.12342 10: 7.67931 mean(X) = 3.18539 std(X) = 6.49767 max(X) = 14.1264 min(X) = -4.12342 Vector XS: 1: 0.191333 2: 1 3: 0.86103 4: 0.567532 5: 0.407104 6: 0.0244274 7: 0.234248 8: 0.0724697 9: 0 10: 0.646733 mean(XS) = 0.400488 std(XS) = 0.356041 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: 1: -0.631634 2: 14.1264 3: 11.5902 4: 6.23391 5: 3.30614 6: -3.67763 7: 0.151556 8: -2.80086 9: -4.12342 10: 7.67931 mean(X) = 3.18539 std(X) = 6.49767 max(X) = 14.1264 min(X) = -4.12342 Rescale to [-1,1] Vector XS: 1: -0.617334 2: 1 3: 0.72206 4: 0.135064 5: -0.185791 6: -0.951145 7: -0.531504 8: -0.855061 9: -1 10: 0.293467 mean(XS) = -0.199024 std(XS) = 0.712082 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: 1: 0.043829 2: 0.0661187 3: 0.109957 4: 0.218418 5: 0.257578 6: 0.415307 7: 0.561695 8: 0.633966 9: 0.829509 10: 0.956318 Search the array for the value 0.218418 SEARCH RESULT: The value occurs in index 4 R8VEC_SHIFT_TEST R8VEC_SHIFT shifts a vector by K positions. The vector: 1: 1 2: 2 3: 3 4: 4 5: 5 6: 6 7: 7 8: 8 9: 9 10: 10 Using a shift of K = 3 Shifted vector: 1: 0 2: 0 3: 0 4: 1 5: 2 6: 3 7: 4 8: 5 9: 6 10: 7 R8VEC_SHIFT_CIRCULAR_TEST R8VEC_SHIFT_CIRCULAR circularly shifts a vector by K positions. The vector: 1: 1 2: 2 3: 3 4: 4 5: 5 6: 6 7: 7 8: 8 9: 9 10: 10 Using a circular shift of K = 3 Shifted vector: 1: 8 2: 9 3: 10 4: 1 5: 2 6: 3 7: 4 8: 5 9: 6 10: 7 R8VEC_SIGN3_RUNNING_TEST R8VEC_SIGN3_RUNNING returns the running sign3 of an R8VEC. Random R8VEC: 1: -1.72373 2: 9.34476 3: 7.44264 4: 3.42543 5: 1.22961 6: -4.00822 7: -1.13633 8: -3.35065 9: -4.34257 10: 4.50949 Running sign3: 1: 0 2: -1 3: 1 4: 1 5: 1 6: 1 7: 1 8: 1 9: 1 10: 1 11: 1 R8VEC_SOFTMAX_TEST R8VEC_SOFTMAX evaluates the softmax function of an R8VEC. X, Softmax(X): 1: 2.03712 0.578269 2: -4.41831 0.00090902 3: -4.69818 0.00068711 4: -3.69337 0.00187676 5: 0.638803 0.142839 6: -1.39489 0.0186908 7: 0.808142 0.169196 8: 0.148628 0.0874919 9: -7.99826 2.53408e-05 10: -8.59568 1.39432e-05 R8VEC_SORT_BUBBLE_A_TEST R8VEC_SORT_BUBBLE_A ascending sorts a real vector. 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_BUBBLE_D_TEST R8VEC_SORT_BUBBLE_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: 57.3791 2: 53.8502 3: 49.7706 4: 47.8372 5: 45.2804 6: 38.0379 7: 33.7017 8: 26.9723 9: 24.9184 10: 24.0784 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: 57.3791 2: 53.8502 3: 49.7706 4: 47.8372 5: 45.2804 6: 38.0379 7: 33.7017 8: 26.9723 9: 24.9184 10: 24.0784 R8VEC_SORT_HEAP_INDEX_A_TEST R8VEC_SORT_HEAP_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) 1 16 13.105098 2 20 57.379055 3 9 49.770554 4 11 33.701727 5 6 24.918425 6 19 3.967124 7 8 15.454668 8 1 6.597408 9 7 2.629740 10 18 38.037943 11 13 3.703634 12 5 26.972338 13 12 24.078377 14 4 45.280409 15 10 47.837217 16 14 0.110302 17 15 53.850244 18 3 21.045140 19 17 5.672685 20 2 0.817013 Now use the index array to carry out the permutation implicitly. INDX(I), A(INDX(I)) 16 0.110302 20 0.817013 9 2.629740 11 3.703634 6 3.967124 19 5.672685 8 6.597408 1 13.105098 7 15.454668 18 21.045140 13 24.078377 5 24.918425 12 26.972338 4 33.701727 10 38.037943 14 45.280409 15 47.837217 3 49.770554 17 53.850244 2 57.379055 Call R8VEC_PERMUTE to carry out the permutation explicitly. I, A(I) 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 11: 24.0784 12: 24.9184 13: 26.9723 14: 33.7017 15: 38.0379 16: 45.2804 17: 47.8372 18: 49.7706 19: 53.8502 20: 57.3791 R8VEC_SORT_HEAP_INDEX_D_TEST R8VEC_SORT_HEAP_INDEX_D creates a descending 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 descending sort: I, INDX(I), A(I) 1 2 13.105098 2 17 57.379055 3 3 49.770554 4 15 33.701727 5 14 24.918425 6 10 3.967124 7 4 15.454668 8 12 6.597408 9 5 2.629740 10 13 38.037943 11 18 3.703634 12 7 26.972338 13 1 24.078377 14 8 45.280409 15 19 47.837217 16 6 0.110302 17 11 53.850244 18 9 21.045140 19 20 5.672685 20 16 0.817013 Now use the index array to carry out the permutation implicitly. INDX(I), A(INDX(I)) 2 57.379055 17 53.850244 3 49.770554 15 47.837217 14 45.280409 10 38.037943 4 33.701727 12 26.972338 5 24.918425 13 24.078377 18 21.045140 7 15.454668 1 13.105098 8 6.597408 19 5.672685 6 3.967124 11 3.703634 9 2.629740 20 0.817013 16 0.110302 Call R8VEC_PERMUTE to carry out the permutation explicitly. I, A(I) 1: 57.3791 2: 53.8502 3: 49.7706 4: 47.8372 5: 45.2804 6: 38.0379 7: 33.7017 8: 26.9723 9: 24.9184 10: 24.0784 11: 21.0451 12: 15.4547 13: 13.1051 14: 6.59741 15: 5.67269 16: 3.96712 17: 3.70363 18: 2.62974 19: 0.817013 20: 0.110302 R8VEC_SORT_HEAP_MASK_A_TEST R8VEC_SORT_HEAP_MASK_A creates an ascending sort index for a masked DVEC. 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 11: 3.70363 12: 26.9723 13: 24.0784 14: 45.2804 15: 47.8372 16: 0.110302 17: 53.8502 18: 21.0451 19: 5.67269 20: 0.817013 The mask array: 1: 2 2: 4 3: 7 4: 8 5: 9 6: 12 7: 13 8: 16 9: 18 10: 19 Masked vector printout: The masked unsorted array: 1: 2 57.3791 2: 4 33.7017 3: 7 15.4547 4: 8 6.59741 5: 9 2.62974 6: 12 26.9723 7: 13 24.0784 8: 16 0.110302 9: 18 21.0451 10: 19 5.67269 After masked indexed ascending sort: I, INDX(I), MASK(INDX(I)), A(MASK(INDX(I))) 1 8 $6d 16.000000 0.110302 2 5 $6d 9.000000 2.62974 3 10 $6d 19.000000 5.67269 4 4 $6d 8.000000 6.59741 5 3 $6d 7.000000 15.4547 6 9 $6d 18.000000 21.0451 7 7 $6d 13.000000 24.0784 8 6 $6d 12.000000 26.9723 9 2 $6d 4.000000 33.7017 10 1 $6d 2.000000 57.3791 Call I4VEC_PERMUTE to carry out the index permutation explicitly on the MASK vector. The reordered mask array: 1: 16 2: 9 3: 19 4: 8 5: 7 6: 18 7: 13 8: 12 9: 4 10: 2 Masked vector printout: The reordered masked sorted array: 1: 16 0.110302 2: 9 2.62974 3: 19 5.67269 4: 8 6.59741 5: 7 15.4547 6: 18 21.0451 7: 13 24.0784 8: 12 26.9723 9: 4 33.7017 10: 2 57.3791 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) 1 16 13.105098 2 20 57.379055 3 9 49.770554 4 11 33.701727 5 6 24.918425 6 19 3.967124 7 8 15.454668 8 1 6.597408 9 7 2.629740 10 18 38.037943 11 13 3.703634 12 5 26.972338 13 12 24.078377 14 4 45.280409 15 10 47.837217 16 14 0.110302 17 15 53.850244 18 3 21.045140 19 17 5.672685 20 2 0.817013 Now use the index array to carry out the permutation implicitly. I, INDX(I), A(INDX(I)) 1 16 0.110302 2 20 0.817013 3 9 2.629740 4 11 3.703634 5 6 3.967124 6 19 5.672685 7 8 6.597408 8 1 13.105098 9 7 15.454668 10 18 21.045140 11 13 24.078377 12 5 24.918425 13 12 26.972338 14 4 33.701727 15 10 38.037943 16 14 45.280409 17 15 47.837217 18 3 49.770554 19 17 53.850244 20 2 57.379055 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_INSERT_INDEX_D_TEST R8VEC_SORT_INSERT_INDEX_D creates a descending 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 11: 3.70363 12: 26.9723 13: 24.0784 14: 45.2804 15: 47.8372 16: 0.110302 17: 53.8502 18: 21.0451 19: 5.67269 20: 0.817013 After indexed descending sort: I, INDX(I), A(I) 1 2 13.105098 2 17 57.379055 3 3 49.770554 4 15 33.701727 5 14 24.918425 6 10 3.967124 7 4 15.454668 8 12 6.597408 9 5 2.629740 10 13 38.037943 11 18 3.703634 12 7 26.972338 13 1 24.078377 14 8 45.280409 15 19 47.837217 16 6 0.110302 17 11 53.850244 18 9 21.045140 19 20 5.672685 20 16 0.817013 Now use the index array to carry out the permutation implicitly. I, INDX(I), A(INDX(I)) 1 2 57.379055 2 17 53.850244 3 3 49.770554 4 15 47.837217 5 14 45.280409 6 10 38.037943 7 4 33.701727 8 12 26.972338 9 5 24.918425 10 13 24.078377 11 18 21.045140 12 7 15.454668 13 1 13.105098 14 8 6.597408 15 19 5.672685 16 6 3.967124 17 11 3.703634 18 9 2.629740 19 20 0.817013 20 16 0.110302 Call R8VEC_PERMUTE to carry out the permutation explicitly. Permuted data 1: 57.3791 2: 53.8502 3: 49.7706 4: 47.8372 5: 45.2804 6: 38.0379 7: 33.7017 8: 26.9723 9: 24.9184 10: 24.0784 11: 21.0451 12: 15.4547 13: 13.1051 14: 6.59741 15: 5.67269 16: 3.96712 17: 3.70363 18: 2.62974 19: 0.817013 20: 0.110302 R8VEC_SORT_QUICK_A_TEST R8VEC_SORT_QUICK_A sorts an R8VEC using quick sort. Unsorted array: 1: 2.18418 2: 9.56318 3: 8.29509 4: 5.61695 5: 4.15307 6: 0.661187 7: 2.57578 8: 1.09957 9: 0.43829 10: 6.33966 11: 0.617272 12: 4.49539 13: 4.01306 14: 7.54673 15: 7.97287 16: 0.0183837 17: 8.97504 18: 3.50752 19: 0.945448 20: 0.136169 Sorted array: 1: 0.0183837 2: 0.136169 3: 0.43829 4: 0.617272 5: 0.661187 6: 0.945448 7: 1.09957 8: 2.18418 9: 2.57578 10: 3.50752 11: 4.01306 12: 4.15307 13: 4.49539 14: 5.61695 15: 6.33966 16: 7.54673 17: 7.97287 18: 8.29509 19: 8.97504 20: 9.56318 R8VEC_SORT_SHELL_A_TEST R8VEC_SORT_SHELL_A ascending sorts a real vector using Shell's sort. 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 11: 3.70363 12: 26.9723 13: 24.0784 14: 45.2804 15: 47.8372 16: 0.110302 17: 53.8502 18: 21.0451 19: 5.67269 20: 0.817013 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 11: 24.0784 12: 24.9184 13: 26.9723 14: 33.7017 15: 38.0379 16: 45.2804 17: 47.8372 18: 49.7706 19: 53.8502 20: 57.3791 R8VEC_SORTED_MERGE_A_TEST For ascending order: R8VEC_SORTED_MERGE_A merges two sorted DVEC's; Using initial random number seed = 123456789 Sorted vector A: 1: 0.043829 2: 0.0661187 3: 0.109957 4: 0.218418 5: 0.257578 6: 0.415307 7: 0.561695 8: 0.633966 9: 0.829509 10: 0.956318 Sorted vector B: 1: 0.00183837 2: 0.0136169 3: 0.0617272 4: 0.0945448 5: 0.350752 6: 0.401306 7: 0.449539 8: 0.754673 9: 0.797287 10: 0.897504 Merged vector C: 1: 0.00183837 2: 0.0136169 3: 0.043829 4: 0.0617272 5: 0.0661187 6: 0.0945448 7: 0.109957 8: 0.218418 9: 0.257578 10: 0.350752 11: 0.401306 12: 0.415307 13: 0.449539 14: 0.561695 15: 0.633966 16: 0.754673 17: 0.797287 18: 0.829509 19: 0.897504 20: 0.956318 R8VEC_SORTED_NEAREST_TEST R8VEC_SORTED_NEAREST finds the nearest entry in a sorted real array. Sorted array: 1: 0.43829 2: 0.661187 3: 1.09957 4: 2.18418 5: 2.57578 6: 4.15307 7: 5.61695 8: 6.33966 9: 8.29509 10: 9.56318 Test Nearest Value Index Value 0.617272 2 0.661187 4.495390 6 4.153071 4.013063 6 4.153071 7.546735 9 8.295092 7.972870 9 8.295092 0.018384 1 0.438290 8.975041 10 9.563176 3.507523 6 4.153071 0.945448 3 1.099568 0.136169 1 0.438290 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: 1: 0.043829 2: 0.0661187 3: 0.109957 4: 0.218418 5: 0.257578 6: 0.415307 7: 0.561695 8: 0.633966 9: 0.829509 10: 0.956318 R_LO 0.061727 2 0.066119 3 0.109957 4 0.218418 5 0.257578 6 0.415307 R_HI 0.449539 Sorted array R: 1: 0.00183837 2: 0.0136169 3: 0.0945448 4: 0.350752 5: 0.401306 6: 0.754673 7: 0.797287 8: 0.840847 9: 0.859097 10: 0.897504 R_LO 0.007512 2 0.013617 3 0.094545 R_HI 0.123104 Sorted array R: 1: 0.113664 2: 0.260303 3: 0.267132 4: 0.351629 5: 0.453794 6: 0.561662 7: 0.692066 8: 0.822887 9: 0.861216 10: 0.912484 R_LO 0.597917 7 0.692066 8 0.822887 9 0.861216 R_HI 0.911977 Sorted array R: 1: 0.185314 2: 0.188955 3: 0.21293 4: 0.361529 5: 0.367027 6: 0.396988 7: 0.574366 8: 0.617205 9: 0.714471 10: 0.761492 R_LO 0.117707 1 0.185314 2 0.188955 3 0.212930 R_HI 0.299329 Sorted array R: 1: 0.0618618 2: 0.0882833 3: 0.308675 4: 0.710781 5: 0.745303 6: 0.763537 7: 0.777994 8: 0.82466 9: 0.825003 10: 0.899373 R_LO 0.406970 4 0.710781 5 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: 1: 0 2: 0 3: 0 4: 0 5: 0.5 6: 0.5 7: 0.5 8: 0.5 9: 0.5 10: 1 11: 1.5 12: 1.5 13: 2 14: 2 15: 2 16: 2 17: 3 18: 3 19: 4 20: 4 21: 4 22: 4 23: 4.5 24: 4.5 25: 5 Splitting value is 2.500000 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: 1: 11 2: 11 3: 11 4: 22 5: 22 6: 33 7: 33 8: 55 9: 55 Tolerance for equality is 2.220446e-16 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) 1 1 11.000000 2 4 22.000000 3 6 33.000000 4 8 55.000000 UNDX can be used to created XU, a copy of X containing only the unique elements, in sorted order. I UNDX XU(I) 1 1 11.000000 2 4 22.000000 3 6 33.000000 4 8 55.000000 XDNU can be used to match each element of X with one of the unique elements I XDNU X(I) XU(XDNU(I)) 1 1 11.000000 11.000000 2 1 11.000000 11.000000 3 1 11.000000 11.000000 4 2 22.000000 22.000000 5 2 22.000000 22.000000 6 3 33.000000 33.000000 7 3 33.000000 33.000000 8 4 55.000000 55.000000 9 4 55.000000 55.000000 R8VEC_SORTED_UNIQUE_TEST R8VEC_SORTED_UNIQUE finds the unique entries in a sorted R8VEC; Unsorted array: 1: 6 2: 28 3: 24 4: 16 5: 12 6: 1 7: 7 8: 3 9: 1 10: 19 Unique entries 1: 0 2: 1 3: 2 4: 3 5: 6 6: 7 7: 8 8: 10 9: 12 10: 13 11: 16 12: 19 13: 22 14: 23 15: 24 16: 25 17: 26 18: 27 19: 28 R8VEC_SORTED_UNIQUE_COUNT_TEST R8VEC_SORTED_UNIQUE_COUNT counts the unique entries of a sorted R8VEC; Using a tolerance of 0.250000 R8VEC_SORTED_UNIQUE_COUNT counts 29 unique entries in A. R8VEC_SORTED_UNIQUE_HIST_TEST R8VEC_SORTED_UNIQUE_HIST makes a historgram of the unique entries in a real vector. Using random number seed 123456789 Unsorted array: 1: 7.5 2: 29.5 3: 25.5 4: 17.5 5: 12.5 6: 2.5 7: 8.5 8: 3.5 9: 1.5 10: 19.5 11: 2.5 12: 13.5 13: 12.5 14: 23.5 15: 24.5 16: 0.5 17: 27.5 18: 11.5 19: 3.5 20: 0.5 21: 26.5 22: 25.5 23: 4.5 24: 0.5 25: 8.5 26: 27.5 27: 3.5 28: 11.5 29: 25.5 30: 8.5 Ascending sorted array: 1: 0.5 2: 0.5 3: 0.5 4: 1.5 5: 2.5 6: 2.5 7: 3.5 8: 3.5 9: 3.5 10: 4.5 11: 7.5 12: 8.5 13: 8.5 14: 8.5 15: 11.5 16: 11.5 17: 12.5 18: 12.5 19: 13.5 20: 17.5 21: 19.5 22: 23.5 23: 24.5 24: 25.5 25: 25.5 26: 25.5 27: 26.5 28: 27.5 29: 27.5 30: 29.5 R8VEC_SORTED_UNIQUE_HIST counts 18 unique entries. Value Multiplicity 1 0.500000 3 2 1.500000 1 3 2.500000 2 4 3.500000 3 5 4.500000 1 6 7.500000 1 7 8.500000 3 8 11.500000 2 9 12.500000 2 10 13.500000 1 11 17.500000 1 12 19.500000 1 13 23.500000 1 14 24.500000 1 15 25.500000 3 16 26.500000 1 17 27.500000 2 18 29.500000 1 R8VEC_SPLIT_TEST R8VEC_SPLIT splits a vector into entries less than and greater than a splitting value. The array: 1: 1 2: 5 3: 4 4: 3 5: 2 6: 0.5 7: 1.5 8: 0.5 9: 0 10: 3 11: 0.5 12: 2 13: 2 14: 4 15: 4 16: 0 17: 4.5 18: 2 19: 0.5 20: 0 21: 4.5 22: 4 23: 0.5 24: 0 25: 1.5 Splitting value is 1.250000 The split array: 1: 1 2: 0 3: 0.5 4: 0 5: 0.5 6: 0.5 7: 0 8: 0.5 9: 0 10: 0.5 11: 2 12: 2 13: 4 14: 4 15: 3 16: 4.5 17: 2 18: 1.5 19: 2 20: 4.5 21: 4 22: 3 23: 4 24: 1.5 25: 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: 1: -0.631634 2: 14.1264 3: 11.5902 4: 6.23391 5: 3.30614 6: -3.67763 7: 0.151556 8: -2.80086 9: -4.12342 10: 7.67931 mean(X) = 3.18539 std(X) = 6.49767 max(X) = 14.1264 min(X) = -4.12342 Vector XS: 1: -0.587445 2: 1.68383 3: 1.29351 4: 0.469171 5: 0.0185836 6: -1.05623 7: -0.466911 8: -0.921293 9: -1.12484 10: 0.691621 mean(XS) = -2.22045e-17 std(XS) = 1 max(XS) = 1.68383 min(XS) = -1.12484 R8VEC_STD_TEST R8VEC_STD computes the standard deviation of an R8VEC. Input vector: 1: -2.81582 2: 4.56318 3: 3.29509 4: 0.616954 5: -0.846929 6: -4.33881 7: -2.42422 8: -3.90043 9: -4.56171 10: 1.33966 STD: 3.248835 R8VEC_STD_SAMPLE_TEST R8VEC_STD_SAMPLE computes the sample standard deviation of an R8VEC. Input vector: 1: -2.81582 2: 4.56318 3: 3.29509 4: 0.616954 5: -0.846929 6: -4.33881 7: -2.42422 8: -3.90043 9: -4.56171 10: 1.33966 Sample STD: 3.248835 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 std_n = 0.36895 2 0.956318 0.521774 0.36895 std_n = 0.32215 3 0.829509 0.394548 0.322147 std_n = 0.28277 4 0.561695 0.326509 0.282765 std_n = 0.26861 5 0.415307 0.300312 0.268607 std_n = 0.31489 6 0.0661187 0.344949 0.314894 std_n = 0.30441 7 0.257578 0.3288 0.304409 std_n = 0.30892 8 0.109957 0.330245 0.308916 std_n = 0.31514 9 0.043829 0.334261 0.315145 std_n = 0.30821 10 0.633966 0.324883 0.308212 R8VEC_STEP_TEST R8VEC_STEP evaluates a step function; Step function jump is at X=17.25 Table of step function values: 1: 10 0 2: 10.5 0 3: 11 0 4: 11.5 0 5: 12 0 6: 12.5 0 7: 13 0 8: 13.5 0 9: 14 0 10: 14.5 0 11: 15 0 12: 15.5 0 13: 16 0 14: 16.5 0 15: 17 0 16: 17.5 1 17: 18 1 18: 18.5 1 19: 19 1 20: 19.5 1 21: 20 1 R8VEC_STUTTER_TEST R8VEC_STUTTER makes a "stuttering" copy of an R8VEC; Original vector X: 1: 1 2: 5 3: -2 Stuttering vector: 1: 1 2: 1 3: 1 4: 1 5: 5 6: 5 7: 5 8: 5 9: -2 10: -2 11: -2 12: -2 R8VEC_SUM_TEST R8VEC_SUM computes the sum of an R8VEC. Input vector: 1: -2.81582 2: 4.56318 3: 3.29509 4: 0.616954 5: -0.846929 6: -4.33881 7: -2.42422 8: -3.90043 9: -4.56171 10: 1.33966 Sum = -9.07304 R8VEC_SUM_RUNNING_TEST R8VEC_SUM_RUNNING returns the running sums of an R8VEC. Random R8VEC: 1: -1.72373 2: 9.34476 3: 7.44264 4: 3.42543 5: 1.22961 6: -4.00822 7: -1.13633 8: -3.35065 9: -4.34257 10: 4.50949 Running sums: 1: 0 2: -1.72373 3: 7.62104 4: 15.0637 5: 18.4891 6: 19.7187 7: 15.7105 8: 14.5742 9: 11.2235 10: 6.88095 11: 11.3904 R8VEC_SWAP_TEST: R8VEC_SWAP swaps two R8VEC's. V1 and V2: 1: 1 0 2: 2 5 3: 3 10 V1 and V2 after swap: 1: 0 1 2: 5 2 3: 10 3 R8VEC_TRANSPOSE_PRINT_TEST R8VEC_TRANSPOSE_PRINT prints an R8VEC "tranposed", that is, placing multiple entries on a line. The vector X: 1 2.2 -3.3 4.45 5.678 600 0.0078 8.123 9.45 10.03 11.1 12.99 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: 1: 33 2: 55 3: 11 4: 11 5: 55 6: 33 7: 22 8: 22 9: 11 Tolerance for equality is 2.220446e-16 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) 1 3 11.000000 2 7 22.000000 3 6 33.000000 4 5 55.000000 UNDX can be used to created XU, a copy of X containing only the unique elements, in sorted order. I UNDX XU(I) 1 3 11.000000 2 7 22.000000 3 6 33.000000 4 5 55.000000 XDNU can be used to match each element of X with one of the unique elements I XDNU X(I) XU(XDNU(I)) 1 3 33.000000 33.000000 2 4 55.000000 55.000000 3 1 11.000000 11.000000 4 1 11.000000 11.000000 5 4 55.000000 55.000000 6 3 33.000000 33.000000 7 2 22.000000 22.000000 8 2 22.000000 22.000000 9 1 11.000000 11.000000 R8VEC_UNIFORM_01 R8VEC_UNIFORM_01 returns a random R8VEC with entries in [ 0.0, 1.0 ] Input SEED = 123456789 Random R8VEC: 1: 0.218418 2: 0.956318 3: 0.829509 4: 0.561695 5: 0.415307 6: 0.0661187 7: 0.257578 8: 0.109957 9: 0.043829 10: 0.633966 Input SEED = 1361431000 Random R8VEC: 1: 0.0617272 2: 0.449539 3: 0.401306 4: 0.754673 5: 0.797287 6: 0.00183837 7: 0.897504 8: 0.350752 9: 0.0945448 10: 0.0136169 Input SEED = 29242052 Random R8VEC: 1: 0.859097 2: 0.840847 3: 0.123104 4: 0.00751236 5: 0.260303 6: 0.912484 7: 0.113664 8: 0.351629 9: 0.822887 10: 0.267132 R8VEC_UNIFORM_AB_TEST R8VEC_UNIFORM_AB returns a random R8VEC with entries in a given range [ A, B ] For this problem: A = 10.000000 B = 20.000000 Input SEED = 123456789 Random R8VEC: 1: 12.1842 2: 19.5632 3: 18.2951 4: 15.617 5: 14.1531 6: 10.6612 7: 12.5758 8: 11.0996 9: 10.4383 10: 16.3397 Input SEED = 1361431000 Random R8VEC: 1: 10.6173 2: 14.4954 3: 14.0131 4: 17.5467 5: 17.9729 6: 10.0184 7: 18.975 8: 13.5075 9: 10.9454 10: 10.1362 Input SEED = 29242052 Random R8VEC: 1: 18.591 2: 18.4085 3: 11.231 4: 10.0751 5: 12.603 6: 19.1248 7: 11.1366 8: 13.5163 9: 18.2289 10: 12.6713 R8VEC_UNIFORM_ABVEC_TEST R8VEC_UNIFORM_ABVEC returns a random R8VEC, with a range specified for each dimension. A[I] <= X[I] <= B[I]. I A(I) <= R(I) <= B(I) 1: 1 1.218 2 2: 10 19.56 20 3: 100 100.8 101 4: -5 -2.192 0 R8VEC_UNIFORM_UNIT_TEST R8VEC_UNIFORM_UNIT returns a random R8VEC on the surface of the unit M sphere. Vector: 1: 0.759464 2: -0.213843 3: -0.25604 4: -0.104542 5: 0.548635 Vector: 1: 0.339299 2: 0.280538 3: -0.445337 4: -0.498567 5: -0.5994 Vector: 1: 0.0258545 2: -0.880217 3: 0.43861 4: 0.00506653 5: -0.179289 Vector: 1: 0.713403 2: 0.0611863 3: 0.0981703 4: -0.152886 5: 0.674018 Vector: 1: 0.527 2: -0.32302 3: -0.46829 4: 0.630868 5: -0.0252735 R8VEC_UNIQUE_COUNT_TEST R8VEC_UNIQUE_COUNT counts the unique elements in an R8VEC, witha tolerance. Vector X: 1: 1 2: 2 3: 3 4: 2 5: 1.1 6: 2.01 7: 3.00001 8: 99 9: 2.1 10: 99.1 Using a tolerance of 0, number of unique entries is 9 Using a tolerance of 0.0001, number of unique entries is 8 Using a tolerance of 0.2, number of unique entries is 4 R8VEC_UNIQUE_INDEX_TEST R8VEC_UNIQUE_INDEX indexes the unique elements in an R8VEC, with a tolerance. Vector A: 1: 1 2: 2 3: 3 4: 2 5: 1.1 6: 2.01 7: 3.00001 8: 99 9: 2.1 10: 99.1 Using tolerance of 0.0: 1: 1 1 2: 2 2 3: 3 3 4: 2 2 5: 1.1 4 6: 2.01 5 7: 3.00001 6 8: 99 7 9: 2.1 8 10: 99.1 9 Using a tolerance of 0.0001: 1: 1 1 2: 2 2 3: 3 3 4: 2 2 5: 1.1 4 6: 2.01 5 7: 3.00001 3 8: 99 6 9: 2.1 7 10: 99.1 8 Using a tolerance of 0.2: 1: 1 1 2: 2 2 3: 3 3 4: 2 2 5: 1.1 1 6: 2.01 2 7: 3.00001 3 8: 99 4 9: 2.1 2 10: 99.1 4 R8VEC_VARIANCE_TEST R8VEC_VARIANCE computes the variance of an R8VEC. Input vector: 1: -2.81582 2: 4.56318 3: 3.29509 4: 0.616954 5: -0.846929 6: -4.33881 7: -2.42422 8: -3.90043 9: -4.56171 10: 1.33966 VARIANCE: 10.554927 R8VEC_VARIANCE_CIRCULAR_TEST R8VEC_VARIANCE_CIRCULAR computes the circular variance of an R8VEC. Uniform Vector in [-PI,+PI]: 1: -1.76923 2: 2.86713 3: 2.07037 4: 0.387644 5: -0.532141 6: -2.72616 7: -1.52318 8: -2.45071 9: -2.86621 10: 0.841731 Circular variance: 0.765084 Normal vector, mean 0, variance 1 1: 1.67904 2: -0.472769 3: -0.56606 4: -0.231124 5: 1.21293 6: 0.535037 7: 1.26938 8: 1.04954 9: -1.66609 10: -1.86523 Circular variance: 0.564186 R8VEC_VARIANCE_SAMPLE_TEST R8VEC_VARIANCE_SAMPLE computes the sample variance of an R8VEC. Input vector: 1: -2.81582 2: 4.56318 3: 3.29509 4: 0.616954 5: -0.846929 6: -4.33881 7: -2.42422 8: -3.90043 9: -4.56171 10: 1.33966 Sample variance: 10.554927 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.272248 0.136124 3 0.829509 0.155668 0.103779 4 0.561695 0.106608 0.0799561 5 0.415307 0.0901874 0.0721499 6 0.0661187 0.11899 0.0991581 7 0.257578 0.108109 0.0926651 8 0.109957 0.109062 0.095429 9 0.043829 0.111731 0.0993161 10 0.633966 0.105549 0.0949943 R8VEC_VECTOR_TRIPLE_PRODUCT_TEST: R8VEC_VECTOR_TRIPLE_PRODUCT computes the vector triple product of three R8VEC's. V4 = V1 x ( V2 x V3 ). V1, V2 and V3: 1: 2 1 3 2: -1 4 -2 3: 3 -5 1 V4 and Vexact 1: 62 62 2: 10 10 3: -38 -38 R8VEC_WRITE_TEST R8VEC_WRITE writes an R8VEC file. R8VEC data: 1: 0.218418 2: 0.956318 3: 0.829509 4: 0.561695 5: 0.415307 6: 0.0661187 7: 0.257578 8: 0.109957 9: 0.043829 10: 0.633966 Wrote the file "r8vec_10.txt". R8VEC2_PRINT_TEST R8VEC2_PRINT prints a pair of R8VEC's. Square and square root: 1: 1 1 2: 4 1.41421 3: 9 1.73205 4: 16 2 R8VEC2_PRINT_SOME_TEST R8VEC2_PRINT_SOME prints some of a pair of R8VEC's. No more than 10 lines of two vectors: 1: 1 1 2: 4 1.41421 3: 9 1.73205 4: 16 2 5: 25 2.23607 6: 36 2.44949 7: 49 2.64575 8: 64 2.82843 ...... .............. .............. 100: 10000 10 R8VEC2_SORT_A_TEST For a pair of R8VEC's: R8VEC2_SORT_A ascending sorts; The pair of arrays: 1: 1.43684 5.30864 2: 2.91264 7.24769 3: 1.43684 5.30864 4: 2.12339 8.77337 5: 1.83061 8.98643 6: 2.91264 7.24769 7: 1.51516 9.48752 8: 1.21991 6.75376 9: 1.43684 5.30864 10: 2.26793 5.06808 Arrays after ascending sort: 1: 1.21991 6.75376 2: 1.43684 5.30864 3: 1.43684 5.30864 4: 1.43684 5.30864 5: 1.51516 9.48752 6: 1.83061 8.98643 7: 2.12339 8.77337 8: 2.26793 5.06808 9: 2.91264 7.24769 10: 2.91264 7.24769 R8VEC2_SORT_D_TEST For a pair of R8VEC's: R8VEC2_SORT_D descending sorts; The pair of arrays: 1: 1.43684 5.30864 2: 2.91264 7.24769 3: 1.43684 5.30864 4: 2.12339 8.77337 5: 1.83061 8.98643 6: 2.91264 7.24769 7: 1.51516 9.48752 8: 1.21991 6.75376 9: 1.43684 5.30864 10: 2.26793 5.06808 Arrays after descending sort: 1: 2.91264 7.24769 2: 2.91264 7.24769 3: 2.26793 5.06808 4: 2.12339 8.77337 5: 1.83061 8.98643 6: 1.51516 9.48752 7: 1.43684 5.30864 8: 1.43684 5.30864 9: 1.43684 5.30864 10: 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) 1 0.200000 0.900000 2 1.000000 0.850000 3 0.850000 0.100000 4 0.550000 0.000000 5 0.400000 0.250000 6 0.050000 0.950000 7 0.250000 0.100000 8 0.100000 0.350000 9 0.000000 0.850000 10 0.650000 0.250000 11 0.050000 0.700000 12 0.450000 0.550000 13 0.400000 0.900000 14 0.750000 0.450000 15 0.800000 0.950000 16 0.000000 0.600000 17 0.900000 0.150000 18 0.350000 0.750000 19 0.050000 0.400000 20 0.000000 0.150000 After sorting: I, INDX(I), X(I), Y(I) 1 20 0.200000 0.900000 2 16 1.000000 0.850000 3 9 0.850000 0.100000 4 19 0.550000 0.000000 5 11 0.400000 0.250000 6 6 0.050000 0.950000 7 8 0.250000 0.100000 8 1 0.100000 0.350000 9 7 0.000000 0.850000 10 18 0.650000 0.250000 11 5 0.050000 0.700000 12 13 0.450000 0.550000 13 12 0.400000 0.900000 14 4 0.750000 0.450000 15 10 0.800000 0.950000 16 14 0.000000 0.600000 17 15 0.900000 0.150000 18 3 0.350000 0.750000 19 17 0.050000 0.400000 20 2 0.000000 0.150000 Now use the index array to carry out the permutation implicitly. I, INDX(I), X(INDX(I)), Y(INDX(I)) 1 20 0.000000 0.150000 2 16 0.000000 0.600000 3 9 0.000000 0.850000 4 19 0.050000 0.400000 5 11 0.050000 0.700000 6 6 0.050000 0.950000 7 8 0.100000 0.350000 8 1 0.200000 0.900000 9 7 0.250000 0.100000 10 18 0.350000 0.750000 11 5 0.400000 0.250000 12 13 0.400000 0.900000 13 12 0.450000 0.550000 14 4 0.550000 0.000000 15 10 0.650000 0.250000 16 14 0.750000 0.450000 17 15 0.800000 0.950000 18 3 0.850000 0.100000 19 17 0.900000 0.150000 20 2 1.000000 0.850000 R8VEC_PERMUTE carries out the permutation. I, X(I), Y(I) 1 0.000000 0.150000 2 0.000000 0.600000 3 0.000000 0.850000 4 0.050000 0.400000 5 0.050000 0.700000 6 0.050000 0.950000 7 0.100000 0.350000 8 0.200000 0.900000 9 0.250000 0.100000 10 0.350000 0.750000 11 0.400000 0.250000 12 0.400000 0.900000 13 0.450000 0.550000 14 0.550000 0.000000 15 0.650000 0.250000 16 0.750000 0.450000 17 0.800000 0.950000 18 0.850000 0.100000 19 0.900000 0.150000 20 1.000000 0.850000 R8VEC2_SORTED_UNIQUE_TEST For a pair of R8VEC's: R8VEC2_SORTED_UNIQUE counts unique entries. The pair of arrays: 1: 1.43684 5.30864 2: 2.91264 7.24769 3: 1.43684 5.30864 4: 2.12339 8.77337 5: 1.83061 8.98643 6: 2.91264 7.24769 7: 1.51516 9.48752 8: 1.21991 6.75376 9: 1.43684 5.30864 10: 2.26793 5.06808 Arrays after ascending sort: 1: 1.21991 6.75376 2: 1.43684 5.30864 3: 1.43684 5.30864 4: 1.43684 5.30864 5: 1.51516 9.48752 6: 1.83061 8.98643 7: 2.12339 8.77337 8: 2.26793 5.06808 9: 2.91264 7.24769 10: 2.91264 7.24769 UNIQed array: 1: 1.21991 6.75376 2: 1.43684 5.30864 3: 1.51516 9.48752 4: 1.83061 8.98643 5: 2.12339 8.77337 6: 2.26793 5.06808 7: 2.91264 7.24769 R8VEC2_SORTED_UNIQUE_INDEX_TEST For a pair of R8VEC's: R8VEC2_SORTED_UNIQUE_INDEX indexes unique entries. Sorted arrays: 1: 1.21991 6.75376 2: 1.43684 5.30864 3: 1.43684 5.30864 4: 1.43684 5.30864 5: 1.51516 9.48752 6: 1.83061 8.98643 7: 2.12339 8.77337 8: 2.26793 5.06808 9: 2.91264 7.24769 10: 2.91264 7.24769 The number of unique elements is 7 Index of Unique Elements: 1: 1 2: 2 3: 5 4: 6 5: 7 6: 8 7: 9 After Indexed Nonunique Deletion. 1: 1.21991 6.75376 2: 1.43684 5.30864 3: 1.51516 9.48752 4: 1.83061 8.98643 5: 2.12339 8.77337 6: 2.26793 5.06808 7: 2.91264 7.24769 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: 1: 2.18418 0.308636 2: 9.56318 2.24769 3: 8.29509 2.00653 4: 5.61695 3.77337 5: 4.15307 3.98643 6: 0.661187 0.00919186 7: 2.57578 4.48752 8: 1.09957 1.75376 9: 0.43829 0.472724 10: 6.33966 0.0680845 Index of maximum in A+B: 2 R8VEC3_PRINT_TEST R8VEC3_PRINT prints three R8VEC's. n, n^2, sqrt(n): 1: 1 1 1 2: 2 4 1.41421 3: 3 9 1.73205 4: 4 16 2 5: 5 25 2.23607 SORT_HEAP_EXTERNAL_TEST SORT_HEAP_EXTERNAL sorts objects externally. Unsorted array: 1: 5 2: 20 3: 17 4: 12 5: 9 6: 2 7: 6 8: 3 9: 1 10: 13 11: 2 12: 9 13: 9 14: 16 15: 16 16: 1 17: 18 18: 8 19: 2 20: 1 Sorted array: 1: 1 2: 1 3: 1 4: 2 5: 2 6: 2 7: 3 8: 5 9: 6 10: 8 11: 9 12: 9 13: 9 14: 12 15: 13 16: 16 17: 16 18: 17 19: 18 20: 20 R8LIB_TEST Normal end of execution. 10-Jan-2019 15:52:09