20 February 2026 12:53:54 AM r8lib_test(): C version Test r8lib(). I4INT_TO_R8INT_TEST For data in an interval, I4INT_TO_R8INT converts an integer to a real; Integer interval: [1, 11] Real interval: [100, 200] R I(R) R(I(R)) 107.544 2 110 183.364 9 180 138.643 5 140 112.505 2 110 101.043 1 100 89.6084 0 90 144.718 5 140 131.895 4 130 143.452 5 140 172.736 8 170 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 value 0 Permutation 2: 4 1 3 0 2 Permutation 3: 0 2 1 3 2 PERM0_CHECK - Warning! Permutation is missing 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 0 5 1 8 3 2 9 4 7 6 8 0 2 3 5 9 6 1 4 7 6 0 8 1 9 7 3 4 2 5 5 4 6 0 3 8 2 7 9 1 PERM1_CHECK_TEST PERM1_CHECK checks a permutation of 1, ..., N. Permutation 1: 5 2 3 4 1 Permutation 2: 4 1 3 0 2 PERM1_CHECK(): Fatal error! Permutation is missing value 5 Permutation 3: 0 2 1 3 2 PERM1_CHECK(): Fatal error! Permutation is missing value 4 PERM1_UNIFORM_TEST PERM1_UNIFORM randomly selects a permutation of 1,...,N. 3 10 9 7 4 6 8 5 1 2 1 6 2 9 4 3 10 5 8 7 9 1 3 4 6 10 7 2 5 8 7 1 9 2 10 8 4 5 3 6 6 5 7 1 4 9 3 8 10 2 R8_ABS_TEST R8_ABS returns the absolute value of an R8. X R8_ABS(X) 4.205594 4.205594 4.944436 4.944436 1.375402 1.375402 -0.269439 0.269439 0.274249 0.274249 0.375891 0.375891 3.470230 3.470230 4.779593 4.779593 4.606310 4.606310 -1.001938 1.001938 R8_ACOS_TEST R8_ACOS computes the arc-cosine of an angle. C R8_ACOS(C) ACOS(C) -1.16667 3.14159 -1 3.14159 3.14159 -0.833333 2.55591 2.55591 -0.666667 2.30052 2.30052 -0.5 2.0944 2.0944 -0.333333 1.91063 1.91063 -0.166667 1.73824 1.73824 0 1.5708 1.5708 0.166667 1.40335 1.40335 0.333333 1.23096 1.23096 0.5 1.0472 1.0472 0.666667 0.841069 0.841069 0.833333 0.585686 0.585686 1 0 0 1.16667 0 R8_ACOSH_TEST R8_ACOSH computes the arc-hyperbolic-cosine of an angle. X A=R8_ACOSH(X) COSH(A) 1 0 1 1.5 0.962424 1.5 2 1.31696 2 2.5 1.5668 2.5 3 1.76275 3 3.5 1.92485 3.5 4 2.06344 4 4.5 2.18464 4.5 5 2.29243 5 R8_ASINH_TEST R8_ASINH computes the inverse hyperbolic sine of a given value. X R8_ASINH(X) SINH(R8_ASINH(X)) 1.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.2 -0.202733 -0.2 -0.1 -0.100335 -0.1 0 0 0 0.1 0.100335 0.1 0.2 0.202733 0.2 0.3 0.30952 0.3 0.4 0.423649 0.4 0.5 0.549306 0.5 0.6 0.693147 0.6 0.7 0.867301 0.7 0.8 1.09861 0.8 0.9 1.47222 0.9 R8_BIG_TEST R8_BIG returns a 'big' R8 value; R8_BIG = 1.79769e+308 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.000000 -1.000000 -1.000000 -0.800000 0.000000 -0.600000 0.000000 -0.400000 0.000000 -0.200000 0.000000 0.000000 0.000000 0.200000 1.000000 0.400000 1.000000 0.600000 1.000000 0.800000 1.000000 1.000000 1.000000 1.200000 2.000000 R8_CHOOSE_TEST R8_CHOOSE evaluates C(N,K). N K CNK 0 0 1 1 0 1 1 1 1 2 0 1 2 1 2 2 2 1 3 0 1 3 1 3 3 2 3 3 3 1 4 0 1 4 1 4 4 2 6 4 3 4 4 4 1 5 0 1 5 1 5 5 2 10 5 3 10 5 4 5 5 5 1 R8_COSD_TEST R8_COSD computes the cosine of an angle given in degrees. ANGLE R8_COSD(ANGLE) 0.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_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_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 -9.41054 -2.11124 -9.41054 7.56627 1.96318 7.56627 -6.80869 -1.89534 -6.80869 -1.00209 -1.0007 -1.00209 5.39196 1.75354 5.39196 -4.13432 -1.60497 -4.13432 -7.13431 -1.92509 -7.13431 -4.75726 -1.68184 -4.75726 5.15967 1.72799 5.15967 -1.62245 -1.17505 -1.62245 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.1415926535897931 -2 -1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 0 0 0 3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 1 1 5 9 R8_E_TEST R8_E returns the value of E. Compare E to (1+1/n)^n R8_E = 2.71828 N Estimate Error 1 2 0.718282 2 2.25 0.468282 4 2.44141 0.276876 8 2.56578 0.152497 16 2.63793 0.0803533 32 2.67699 0.0412917 64 2.69734 0.0209369 128 2.70774 0.0105428 256 2.71299 0.0052902 512 2.71563 0.00264983 1024 2.71696 0.0013261 2048 2.71762 0.000663346 4096 2.71795 0.000331747 8192 2.71812 0.000165892 16384 2.7182 8.29507e-05 32768 2.71824 4.14765e-05 65536 2.71826 2.07386e-05 131072 2.71827 1.03693e-05 262144 2.71828 5.18469e-06 524288 2.71828 2.59235e-06 1048576 2.71828 1.29618e-06 R8_EPSILON_TEST R8_EPSILON produces the R8 roundoff unit. R = R8_EPSILON() = 2.2204460492503131e-16 ( 1 + R ) - 1 = 2.2204460492503131e-16 ( 1 + (R/2) ) - 1 = 0.0000000000000000e+00 R8_EPSILON_COMPUTE_TEST R8_EPSILON_COMPUTE computes the R8 roundoff unit. R = R8_EPSILON_COMPUTE() = 2.2204460492503131e-16 ( 1 + R ) - 1 = 2.2204460492503131e-16 ( 1 + (R/2) ) - 1 = 0.0000000000000000e+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 1.79769e+308 100 1.79769e+308 R8_FACTORIAL_TEST R8_FACTORIAL evaluates the factorial. 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. 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.000000 4 120 120 5.250000 4 163.16015625 163.16015625 5.500000 4 216.5625 216.5625 5.750000 4 281.66015625 281.66015625 6.000000 4 360 360 7.500000 0 1 1 7.500000 1 7.5 7.5 7.500000 2 48.75 48.75 7.500000 3 268.125 268.125 7.500000 4 1206.5625 1206.5625 7.500000 5 4222.96875 4222.96875 7.500000 6 10557.421875 10557.421875 7.500000 7 15836.1328125 15836.1328125 7.500000 8 7918.06640625 7918.06640625 7.500000 9 -3959.033203125 -3959.033203125 R8_FRACTIONAL_TEST R8_FRACTIONAL returns the fractional part of an R8. X R8_FRACTIONAL(X) 3.239396 0.239396 -2.296757 0.296757 1.285519 0.285519 3.379765 0.379765 -2.371717 0.371717 3.826973 0.826973 3.507878 0.507878 -1.911038 0.911038 0.536279 0.536279 4.942562 0.942562 R8_HUGE_TEST R8_HUGE returns a large R8 value; R8_HUGE = 1.797693e+308 R8_IS_INF_TEST R8_IS_INF reports whether an R8 is infinite. R8_IS_INF(1.0) = 0 R8_IS_INF(1.0/0.0) = 0 R8_IS_INF(0.0/0.0) = 0 R8_IS_INF(0^0) = 0 R8_IS_INF(acos(-2)) = 0 R8_IS_INF(exp(1000)) = 0 R8_IS_INF(log(0)) = 0 R8_IS_INF(sqrt(-1)) = 0 R8_IS_NAN_TEST R8_IS_NAN reports whether an R8 is a NaN. R8_IS_NAN(1.0) = 0 R8_IS_NAN(1.0/0.0) = 0 R8_IS_NAN(0.0/0.0) = 0 R8_IS_NAN(0^0) = 0 R8_IS_NAN(acos(-2)) = 1 R8_IS_NAN(exp(1000)) = 0 R8_IS_NAN(log(0)) = 0 R8_IS_NAN(sqrt(-1)) = 1 R8_LOG_2_TEST R8_LOG_2: computes the logarithm base 2. X R8_LOG_2 0.000000 -1.79769e+308 1.000000 0 2.000000 1 3.000000 1.58496 9.000000 3.16993 10.000000 3.32193 11.000000 3.45943 99.000000 6.62936 101.000000 6.65821 -1.000000 0 -2.000000 1 -3.000000 1.58496 -9.000000 3.16993 0.500000 -1 0.330000 -1.59946 0.250000 -2 0.200000 -2.32193 0.010000 -6.64386 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: X = -314.159000 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) 4.6486 -4.0109 4.6486 -3.6977 -3.3428 -3.3428 3.4208 2.6292 3.4208 -4.8790 0.6533 0.6533 1.4081 -1.9027 1.4081 4.0878 1.0416 4.0878 3.8618 0.4008 3.8618 2.5714 -0.8737 2.5714 -3.6703 -3.4218 -3.4218 -2.8585 3.9162 3.9162 R8_MIN_TEST R8_MIN returns the minimum of two R8's. A B C=R8_MIN(A,B) 1.0885 1.9005 1.0885 1.2669 0.8963 0.8963 0.5091 3.7963 0.5091 4.1087 3.9220 3.9220 -2.5732 -0.9611 -2.5732 -0.7221 0.1753 -0.7221 4.2635 1.0654 1.0654 -0.3229 -3.9827 -3.9827 0.9950 -1.3875 -1.3875 -2.7590 -1.3720 -2.7590 R8_MOD_TEST R8_MOD returns the remainder after division. R8_MOD ( X, Y ) has the same sign as X. X Y FMOD(X,Y) R8_MOD(X,Y) 5.778962 -4.772488 1.006474 1.006474 7.399537 -0.409569 0.027302 0.027302 -2.229812 2.331882 -2.229812 -2.229812 -0.823783 1.478974 -0.823783 -0.823783 0.824888 1.208662 0.824888 0.824888 -5.303432 2.018662 -1.266108 -1.266108 8.149855 -4.404835 3.745020 3.745020 2.520974 -5.587741 2.520974 2.520974 7.671756 1.539244 1.514781 1.514781 4.761006 8.941176 4.761006 4.761006 R8_MODP_TEST R8_MODP returns the remainder after division. R8_MODP ( X, Y ) is positive if Y is. X FMOD(x,1.0) R8_MODP(x,1.0) 13.115950 0.115950 0.115950 11.095362 0.095362 0.095362 11.146601 0.146601 0.146601 10.323320 0.323320 0.323320 7.035255 0.035255 0.035255 4.468916 0.468916 0.468916 3.109892 0.109892 0.109892 5.524856 0.524856 0.524856 14.545994 0.545994 0.545994 10.763353 0.763353 0.763353 14.136915 0.136915 0.136915 11.890425 0.890425 0.890425 3.358369 0.358369 0.358369 2.260823 0.260823 0.260823 11.861373 0.861373 0.861373 12.027566 0.027566 0.027566 6.758394 0.758394 0.758394 1.530476 0.530476 0.530476 11.472785 0.472785 0.472785 12.228951 0.228951 0.228951 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) 3.394506 3 -6.708958 -7 -1.473846 -1 8.553793 9 8.491050 8 -3.149372 -3 9.775657 10 9.043217 9 1.463455 1 -9.586343 -10 R8_NORMAL_01_TEST R8_NORMAL_01 generates normally distributed random values. -1.854122 0.283257 -1.614936 -0.035083 0.644295 0.870486 0.906746 -2.352457 -1.447523 0.910031 -0.425252 -0.192440 0.581795 0.447878 -0.345446 0.252836 -0.399738 0.730667 -1.740205 0.733572 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 R8_POWER_TEST R8_POWER computes R^P R P R^P 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.000976562 7 2.000000 -9 0.00195312 7 2.000000 -8 0.00390625 6 2.000000 -7 0.0078125 7 2.000000 -6 0.015625 6 2.000000 -5 0.03125 6 2.000000 -4 0.0625 5 2.000000 -3 0.125 5 2.000000 -2 0.25 4 2.000000 -1 0.5 1 2.000000 0 1 0 2.000000 1 2 0 2.000000 2 4 3 2.000000 3 8 4 2.000000 4 16 4 2.000000 5 32 5 2.000000 6 64 5 2.000000 7 128 6 2.000000 8 256 5 2.000000 9 512 6 2.000000 10 1024 6 2.000000 11 2048 7 2.000000 12 4096 6 2.000000 13 8192 7 2.000000 14 16384 7 2.000000 15 32768 8 2.000000 16 65536 6 2.000000 17 131072 7 2.000000 18 262144 7 2.000000 19 524288 8 2.000000 20 1.04858e+06 7 2.000000 21 2.09715e+06 8 2.000000 22 4.1943e+06 8 2.000000 23 8.38861e+06 9 2.000000 24 1.67772e+07 7 2.000000 25 3.35544e+07 8 2.000000 26 6.71089e+07 8 2.000000 27 1.34218e+08 9 2.000000 28 2.68435e+08 8 2.000000 29 5.36871e+08 9 2.000000 30 1.07374e+09 9 2.000000 31 2.14748e+09 10 2.000000 32 4.29497e+09 7 2.000000 33 8.58993e+09 8 2.000000 34 1.71799e+10 8 2.000000 35 3.43597e+10 9 2.000000 36 6.87195e+10 8 2.000000 37 1.37439e+11 9 2.000000 38 2.74878e+11 9 2.000000 39 5.49756e+11 10 2.000000 40 1.09951e+12 8 R8_RELU_TEST R8_RELU evaluates the ReLU function of an R8. This is max(x,0). X R8_RELU(X) -500 0 -50 0 -5 0 -4 0 -3 0 -2 0 -1 0 -0.5 0 -0.05 0 -0.005 0 -0.0005 0 0 0 0.0005 0.0005 0.005 0.005 0.05 0.05 0.5 0.5 1 1 2 2 3 3 4 4 5 5 50 50 500 500 5000 5000 50000 50000 R8_RISE_TEST R8_RISE evaluates the rising factorial Fall(X,N). X N Exact Computed 5.000000 4 1680 1680 5.250000 4 1962.59765625 1962.59765625 5.500000 4 2279.0625 2279.0625 5.750000 4 2631.97265625 2631.97265625 6.000000 4 3024 3024 7.500000 0 1 1 7.500000 1 7.5 7.5 7.500000 2 63.75 63.75 7.500000 3 605.625 605.625 7.500000 4 6359.0625 6359.0625 7.500000 5 73129.21875 73129.21875 7.500000 6 914115.234375 914115.234375 7.500000 7 12340555.6640625 12340555.6640625 7.500000 8 178938057.1289063 178938057.1289062 7.500000 9 2773539885.498047 2773539885.498047 R8_ROUND2_TEST R8_ROUND2 rounds a number to a specified number of base 2 digits. Test effect on PI: X = 3.1415926535897931 NPLACE XROUND 0 0.0000000000000000 1 2.0000000000000000 2 3.0000000000000000 3 3.0000000000000000 4 3.0000000000000000 5 3.1250000000000000 6 3.1250000000000000 7 3.1250000000000000 8 3.1406250000000000 9 3.1406250000000000 10 3.1406250000000000 11 3.1406250000000000 12 3.1406250000000000 13 3.1411132812500000 14 3.1413574218750000 15 3.1414794921875000 16 3.1415405273437500 17 3.1415710449218750 18 3.1415863037109375 19 3.1415863037109375 20 3.1415901184082031 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.1415926535897931 NPLACE XROUND 0 0.0000000000000000 1 3.0000000000000000 2 3.0000000000000000 3 3.0000000000000000 4 3.1111111111111107 5 3.1111111111111107 6 3.1358024691358022 7 3.1399176954732515 8 3.1412894375857339 9 3.1412894375857339 10 3.1414418533760098 11 3.1415434639028601 12 3.1415773340784772 13 3.1415886241370159 14 3.1415923874898626 15 3.1415923874898626 16 3.1415925965650207 17 3.1415925965650207 18 3.1415926430261667 19 3.1415926507696912 20 3.1415926533508660 Try with a negative base: Input quantity is X = 121.0000000000000000 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.000000000000 1 3.000000000000 2 3.100000000000 3 3.140000000000 4 3.141000000000 5 3.141500000000 6 3.141590000000 7 3.141592000000 8 3.141592600000 9 3.141592650000 10 3.141592653000 Test effect on random values: NPLACE X XROUND 0 0.209694 0.000000 2 0.209694 0.200000 4 0.209694 0.209600 6 0.209694 0.209694 8 0.209694 0.209694 10 0.209694 0.209694 0 0.272079 0.000000 2 0.272079 0.270000 4 0.272079 0.272000 6 0.272079 0.272078 8 0.272079 0.272079 10 0.272079 0.272079 0 0.683482 0.000000 2 0.683482 0.680000 4 0.683482 0.683400 6 0.683482 0.683481 8 0.683482 0.683482 10 0.683482 0.683482 0 0.601000 0.000000 2 0.601000 0.600000 4 0.601000 0.601000 6 0.601000 0.601000 8 0.601000 0.601000 10 0.601000 0.601000 0 0.612100 0.000000 2 0.612100 0.610000 4 0.612100 0.612000 6 0.612100 0.612099 8 0.612100 0.612100 10 0.612100 0.612100 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_sigmoid_test r8_sigmoid evaluates the sigmoid function of R8. X R8_SIGMOID(L,B,M,X) -4 0.5 -2 0.5 -1 0.5 -0.5 0.5 -0.25 0.5 0 0.5 0.25 0.5 0.5 0.5 1 0.5 2 0.5 4 0.5 R8_SIGN_TEST R8_SIGN returns the sign of a number. X R8_SIGN(X) -1.2500 -1 -0.2500 -1 0.0000 1 0.5000 1 9.0000 1 R8_SIGN3_TEST R8_SIGN3 returns the three way sign of a number. X R8_SIGN3(X) -1.2500 -1 -0.2500 -1 0.0000 0 0.5000 1 9.0000 1 R8_SINCOS_SUM_TEST R8_SINCOS_SUM simplifies a linear sine and cosine sum 4.70241 * sin ( 2.23664 * x ) + -3.15075 * cos ( 2.23664 * x ) = 5.66038 * sin ( 2.23664 * x + -0.590325 ) = 5.66038 * cos ( 2.23664 * x + -2.16112 ) I X form 1 form 2 form 3 0 0.0000 -3.15075 -3.15075 -3.15075 1 0.3142 0.634532 0.634532 0.634532 2 0.6283 4.1192 4.1192 4.1192 3 0.9425 5.65239 5.65239 5.65239 4 1.2566 4.50776 4.50776 4.50776 5 1.5708 1.22757 1.22757 1.22757 6 1.8850 -2.63418 -2.63418 -2.63418 7 2.1991 -5.24799 -5.24799 -5.24799 8 2.5133 -5.37555 -5.37555 -5.37555 9 2.8274 -2.95644 -2.95644 -2.95644 10 3.1416 0.863283 0.863283 0.863283 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_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. X Y Z Start: 1 3.14159 1952 Swap 1 3.14159 1952 1 Swap 2 1952 1 3.14159 Swap 3 1 3.14159 1952 R8_TAND_TEST R8_TAND computes the tangent of an angle given in degrees. ANGLE R8_TAND(ANGLE) 0.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_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.328957 1.473684 7.205396 7.157895 3.455979 3.368421 -0.872252 1.000000 10.970106 10.000000 1.894684 1.947368 7.071894 7.157895 10.554506 10.000000 11.863670 10.000000 11.799624 10.000000 11.170114 10.000000 9.093602 9.052632 4.777167 4.789474 5.671569 5.736842 4.386767 4.315789 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_uniform_01_test(): r8_uniform_01() samples a uniform random distribution in [0,1]. distributed random numbers. First few values: 0 0.227409 1 0.323651 2 0.042316 3 0.736506 4 0.334621 5 0.240616 6 0.757450 7 0.206198 8 0.776410 9 0.627111 Number of samples was 1000 Minimum value was 0.000776 Maximum value was 0.999659 Average value was 0.490559 Variance was 0.084929 R8_UNIFORM_AB_TEST R8_UNIFORM_AB produces a random real in a given range. Using range 10.000000 <= A <= 25.000000. I A 0 11.293854 1 21.333401 2 13.883744 3 16.038917 4 15.727047 5 13.992690 6 22.055977 7 16.278472 8 13.877809 9 22.696831 R8_WALSH_1D_TEST R8_WALSH_1D evaluates 1D Walsh functions: X W(+2) W(+1) W(0) W(-1) W(-2) W(-3) 0 0 0 0 0 0 0 0.25 0 0 0 0 1 0 0.5 0 0 0 1 0 0 0.75 0 0 0 1 1 0 1 0 0 1 0 0 0 1.25 0 0 1 0 1 0 1.5 0 0 1 1 0 0 1.75 0 0 1 1 1 0 2 0 1 0 0 0 0 2.25 0 1 0 0 1 0 2.5 0 1 0 1 0 0 2.75 0 1 0 1 1 0 3 0 1 1 0 0 0 3.25 0 1 1 0 1 0 3.5 0 1 1 1 0 0 3.75 0 1 1 1 1 0 4 1 0 0 0 0 0 4.25 1 0 0 0 1 0 4.5 1 0 0 1 0 0 4.75 1 0 0 1 1 0 5 1 0 1 0 0 0 5.25 1 0 1 0 1 0 5.5 1 0 1 1 0 0 5.75 1 0 1 1 1 0 6 1 1 0 0 0 0 6.25 1 1 0 0 1 0 6.5 1 1 0 1 0 0 6.75 1 1 0 1 1 0 7 1 1 1 0 0 0 7.25 1 1 1 0 1 0 7.5 1 1 1 1 0 0 7.75 1 1 1 1 1 0 8 0 0 0 0 0 0 R8_WRAP_TEST R8_WRAP "wraps" an R8 to lie within an interval: Wrapping interval is 3, 6.5 R R8_WRAP ( R ) 4.93245 4.93245 11.656 4.65598 4.23912 4.23912 9.92875 6.42875 11.2637 4.26371 10.4512 3.45119 6.75581 3.25581 11.8367 4.83669 8.09896 4.59896 9.67026 6.17026 9.95625 6.45625 2.74074 6.24074 10.3021 3.30215 6.68116 3.18116 7.91417 4.41417 1.12247 4.62247 6.0753 6.0753 6.96675 3.46675 4.08727 4.08727 3.21995 3.21995 R82COL_PRINT_PART_TEST R82COL_PRINT_PART prints part of an R82COL. Output with MAX_PRINT = 2 0: 11 12 1: 21 22 ...more entries... Output with MAX_PRINT = 5 0: 11 12 1: 21 22 2: 31 32 ........ .............. .............. 9: 101 102 Output with MAX_PRINT = 25 0: 11 12 1: 21 22 2: 31 32 3: 41 42 4: 51 52 5: 61 62 6: 71 72 7: 81 82 8: 91 92 9: 101 102 R82ROW_ORDER_TYPE_TEST R82ROW_ORDER_TYPE classifies an R8VEC as -1: no order 0: all equal; 1: ascending; 2: strictly ascending; 3: descending; 4: strictly descending. Order type = -1 0: 2 2 1: 1 3 2: 1 1 3: 3 0 Order type = -1 0: 0 0 1: 1 0 2: 2 1 3: 1 1 Order type = 1 0: 0 2 1: 0 3 2: 1 2 3: 2 0 Order type = 3 0: 1 2 1: 1 2 2: 0 1 3: 0 1 Order type = -1 0: 2 2 1: 1 2 2: 2 1 3: 2 2 Order type = -1 0: 0 2 1: 0 1 2: 2 3 3: 2 1 Order type = -1 0: 1 2 1: 2 1 2: 1 2 3: 2 1 Order type = -1 0: 2 3 1: 3 2 2: 0 1 3: 1 1 Order type = -1 0: 1 1 1: 1 2 2: 2 2 3: 1 0 Order type = -1 0: 1 0 1: 3 3 2: 2 1 3: 2 0 R82ROW_PART_QUICK_A_TEST R82ROW_PART_QUICK_A reorders an R82ROW as part of a quick sort. Before rearrangment: 0: 0.998627 1.9838 1: 1.62664 1.16261 2: 0.109555 0.913501 3: 0.913257 1.75497 4: 0.726101 0.0787756 5: 1.39106 0.840011 6: 1.46238 0.286887 7: 1.82318 0.747962 8: 1.9063 0.257013 9: 1.59567 1.17413 10: 1.01409 1.05302 11: 0.926723 0.607841 Rearranged array Left index = 4 Key index = 5 Right index = 6 Left half: 0: 0.926723 0.607841 1: 0.109555 0.913501 2: 0.913257 1.75497 3: 0.726101 0.0787756 Key: 0: 0.998627 1.9838 Right half: 0: 1.46238 0.286887 1: 1.82318 0.747962 2: 1.9063 0.257013 3: 1.59567 1.17413 4: 1.01409 1.05302 5: 1.39106 0.840011 6: 1.62664 1.16261 R82ROW_PRINT_PART_TEST R82ROW_PRINT_PART prints part of an R82ROW. Output with MAX_PRINT = 2 0: 11 21 1: 12 22 ...more entries... Output with MAX_PRINT = 5 0: 11 21 1: 12 22 2: 13 23 ........ .............. .............. 9: 20 30 Output with MAX_PRINT = 25 0: 11 21 1: 12 22 2: 13 23 3: 14 24 4: 15 25 5: 16 26 6: 17 27 7: 18 28 8: 19 29 9: 20 30 R82ROW_SORT_HEAP_INDEX_A_TEST R82ROW_SORT_HEAP_INDEX_A index sorts an R82ROW using heapsort. Before rearrangement: 0: 4.70671 2.43556 1: 6.56236 0.484001 2: 7.96383 3.66944 3: 4.81201 6.21118 4: 7.96383 4.08917 5: 4.8741 2.43556 6: 8.65924 6.88895 7: 8.78522 0.9128 8: 3.69053 0.484001 9: 9.94188 3.05475 10: 8.65924 6.88895 11: 4.81201 6.44798 I Index A(Index) 0 8 3.690534 0.484001 1 0 4.706710 2.435556 2 3 4.812009 6.211183 3 11 4.812009 6.447975 4 5 4.874104 2.435556 5 1 6.562363 0.484001 6 2 7.963827 3.669443 7 4 7.963827 4.089170 8 6 8.659241 6.888950 9 10 8.659241 6.888950 10 7 8.785218 0.912800 11 9 9.941877 3.054753 After rearrangement by R82ROW_PERMUTE: 0: 3.69053 0.484001 1: 4.70671 2.43556 2: 4.81201 6.21118 3: 4.81201 6.44798 4: 4.8741 2.43556 5: 6.56236 0.484001 6: 7.96383 3.66944 7: 7.96383 4.08917 8: 8.65924 6.88895 9: 8.65924 6.88895 10: 8.78522 0.9128 11: 9.94188 3.05475 R82ROW_SORT_QUICK_A_TEST R82ROW_SORT_QUICK_A sorts an R82ROW as part of a quick sort. Before sorting: 0: 2.77343 1.10708 1: 4.58669 1.29414 2: 2.54313 6.21138 3: 1.91717 3.8429 4: 2.54313 1.08391 5: 2.95605 1.02517 6: 4.61577 8.23415 7: 6.52447 2.77815 8: 1.78582 4.56914 9: 8.17782 4.92187 10: 4.61577 8.23415 11: 1.91717 8.9385 Sorted array: 0: 1.78582 4.56914 1: 1.91717 3.8429 2: 1.91717 8.9385 3: 2.54313 1.08391 4: 2.54313 6.21138 5: 2.77343 1.10708 6: 2.95605 1.02517 7: 4.58669 1.29414 8: 4.61577 8.23415 9: 4.61577 8.23415 10: 6.52447 2.77815 11: 8.17782 4.92187 R83COL_PRINT_PART_TEST R83COL_PRINT_PART prints part of an R83COL. Output with MAX_PRINT = 2 0: 11 12 12 1: 21 22 22 ...more entries... Output with MAX_PRINT = 5 0: 11 12 12 1: 21 22 22 2: 31 32 32 ........ .............. .............. .............. 9: 101 102 102 Output with MAX_PRINT = 25 0: 11 12 13 1: 21 22 23 2: 31 32 33 3: 41 42 43 4: 51 52 53 5: 61 62 63 6: 71 72 73 7: 81 82 83 8: 91 92 93 9: 101 102 103 R83ROW_PRINT_PART_TEST R83ROW_PRINT_PART prints part of an R83ROW. Output with MAX_PRINT = 2 0: 11 21 31 1: 12 22 32 ...more entries... Output with MAX_PRINT = 5 0: 11 21 31 1: 12 22 32 2: 13 23 33 ........ .............. .............. .............. 9: 20 30 40 Output with MAX_PRINT = 25 0: 11 21 31 1: 12 22 32 2: 13 23 33 3: 14 24 34 4: 15 25 35 5: 16 26 36 6: 17 27 37 7: 18 28 38 8: 19 29 39 9: 20 30 40 R8BLOCK_EXPAND_LINEAR_TEST R8BLOCK_EXPAND_LINEAR linearly interpolates new data between old values in a 3D block. Original block: K = 1 1 2 3 1: 1 1 1 2: 2 4 8 3: 3 9 27 4: 4 16 64 K = 2 1 2 3 1: 2 2 2 2: 4 8 16 3: 6 18 54 4: 8 32 128 LFAT = 1 MFAT = 2 NFAT = 1 Fattened block: K = 1 1 2 3 4 5 1: 1 1 1 1 1 2: 1.5 1.83333 2.16667 2.5 3.16667 3: 2 2.66667 3.33333 4 5.33333 4: 2.5 3.83333 5.16667 6.5 10.1667 5: 3 5 7 9 15 6: 3.5 6.5 9.5 12.5 23.5 7: 4 8 12 16 32 6 7 1: 1 1 2: 3.83333 4.5 3: 6.66667 8 4: 13.8333 17.5 5: 21 27 6: 34.5 45.5 7: 48 64 K = 2 1 2 3 4 5 1: 1.5 1.5 1.5 1.5 1.5 2: 2.25 2.75 3.25 3.75 4.75 3: 3 4 5 6 8 4: 3.75 5.75 7.75 9.75 15.25 5: 4.5 7.5 10.5 13.5 22.5 6: 5.25 9.75 14.25 18.75 35.25 7: 6 12 18 24 48 6 7 1: 1.5 1.5 2: 5.75 6.75 3: 10 12 4: 20.75 26.25 5: 31.5 40.5 6: 51.75 68.25 7: 72 96 K = 3 1 2 3 4 5 1: 2 2 2 2 2 2: 3 3.66667 4.33333 5 6.33333 3: 4 5.33333 6.66667 8 10.6667 4: 5 7.66667 10.3333 13 20.3333 5: 6 10 14 18 30 6: 7 13 19 25 47 7: 8 16 24 32 64 6 7 1: 2 2 2: 7.66667 9 3: 13.3333 16 4: 27.6667 35 5: 42 54 6: 69 91 7: 96 128 R8BLOCK_NEW_TEST: R8BLOCK_NEW dynamically creates a 3D array. Array entries can be addressed using the notation "a[i][j][k]". Allocating memory for array A of size 2 by 3 by 2. Assigning values to A. Dynamically allocated matrix A: 0 1 10 11 20 21 100 101 110 111 120 121 R8BLOCK_PRINT_TEST R8BLOCK_PRINT prints an R8BLOCK. The 3D array: K = 1 1 2 3 1: 1 1 1 2: 2 4 8 3: 3 9 27 4: 4 16 64 K = 2 1 2 3 1: 2 2 2 2: 4 8 16 3: 6 18 54 4: 8 32 128 R8CMAT_TO_R8MAT_NEW_TEST R8CMAT_TO_R8MAT_NEW converts an R8CMAT to an R8MAT. Data is of order (5,4). The R8MAT A: Col: 0 1 2 3 Row 0: 11 12 13 14 1: 21 22 23 24 2: 31 32 33 34 3: 41 42 43 44 4: 51 52 53 54 The R8CMAT B: Col: 0 1 2 3 Row 0: 11 12 13 14 1: 21 22 23 24 2: 31 32 33 34 3: 41 42 43 44 4: 51 52 53 54 The R8MAT C: Col: 0 1 2 3 Row 0: 11 12 13 14 1: 21 22 23 24 2: 31 32 33 34 3: 41 42 43 44 4: 51 52 53 54 R8R8VEC_INDEX_INSERT_UNIQUE_TEST R8R8VEC_INDEX_INSERT_UNIQUE inserts unique values into an index sorted array. Generate 30 random values: XVAL YVAL Index 1 3.000000 1.000000 2 3.000000 2.000000 3 2.000000 1.000000 4 4.000000 1.000000 5 1.000000 3.000000 2 3.000000 2.000000 4 4.000000 1.000000 2 3.000000 2.000000 6 4.000000 3.000000 2 3.000000 2.000000 1 3.000000 1.000000 7 2.000000 2.000000 8 4.000000 2.000000 2 3.000000 2.000000 9 3.000000 3.000000 2 3.000000 2.000000 10 1.000000 2.000000 7 2.000000 2.000000 7 2.000000 2.000000 7 2.000000 2.000000 10 1.000000 2.000000 2 3.000000 2.000000 9 3.000000 3.000000 3 2.000000 1.000000 10 1.000000 2.000000 9 3.000000 3.000000 7 2.000000 2.000000 1 3.000000 1.000000 7 2.000000 2.000000 2 3.000000 2.000000 Vector of unique X Y values: I X(I) Y(I) 1 3.000000 1.000000 2 3.000000 2.000000 3 2.000000 1.000000 4 4.000000 1.000000 5 1.000000 3.000000 6 4.000000 3.000000 7 2.000000 2.000000 8 4.000000 2.000000 9 3.000000 3.000000 10 1.000000 2.000000 X, Y sorted by index I INDX(I) X(INDX(I)) Y(INDX(I)) 1 10 1.000000 2.000000 2 5 1.000000 3.000000 3 3 2.000000 1.000000 4 7 2.000000 2.000000 5 1 3.000000 1.000000 6 2 3.000000 2.000000 7 9 3.000000 3.000000 8 4 4.000000 1.000000 9 8 4.000000 2.000000 10 6 4.000000 3.000000 R8R8R8VEC_INDEX_INSERT_UNIQUE_TEST R8R8R8VEC_INDEX_INSERT_UNIQUE inserts unique values into an index sorted array. Number of random values to generate = 30 XVAL YVAL ZVAL Index 2 2 1 1 2 3 3 2 4 2 4 3 1 2 3 4 1 2 2 5 2 2 2 6 4 3 2 7 3 3 2 8 3 2 3 9 2 3 2 10 4 2 3 11 2 2 1 1 2 2 2 6 4 1 3 12 1 3 3 13 2 1 2 14 3 3 4 15 1 3 2 16 1 3 2 16 4 2 2 17 4 2 1 18 2 3 3 2 4 3 3 19 3 1 3 20 4 2 4 3 2 2 4 21 2 3 2 10 1 2 2 5 2 2 2 6 2 1 1 22 Vector of unique X Y Z values: I X(I) Y(I) Z(I) 1 2 2 1 2 2 3 3 3 4 2 4 4 1 2 3 5 1 2 2 6 2 2 2 7 4 3 2 8 3 3 2 9 3 2 3 10 2 3 2 11 4 2 3 12 4 1 3 13 1 3 3 14 2 1 2 15 3 3 4 16 1 3 2 17 4 2 2 18 4 2 1 19 4 3 3 20 3 1 3 21 2 2 4 22 2 1 1 X Y Z sorted by index: I INDX(I) X(I) X(INDX(I)) 1 5 1 2 2 2 4 1 2 3 3 16 1 3 2 4 13 1 3 3 5 22 2 1 1 6 14 2 1 2 7 1 2 2 1 8 6 2 2 2 9 21 2 2 4 10 10 2 3 2 11 2 2 3 3 12 20 3 1 3 13 9 3 2 3 14 8 3 3 2 15 15 3 3 4 16 12 4 1 3 17 18 4 2 1 18 17 4 2 2 19 11 4 2 3 20 3 4 2 4 21 7 4 3 2 22 19 4 3 3 R8INT_TO_I4INT_TEST For data in an interval, R8INT_TO_I4INT converts a real to an integer. Integer interval: [1, 11] Real interval: [100, 200] R I(R) R(I(R)) 114.189 2 110 108.172 2 110 151.191 6 150 91.8932 0 90 99.0053 1 100 204.324 11 200 172.737 8 170 114.402 2 110 151.612 6 150 137.694 5 140 R8MAT_CHOLESKY_FACTOR_TEST R8MAT_CHOLESKY_FACTORS determines the lower triangular Cholesky factorization of a positive definite symmetric matrix, Matrix to be factored: Col: 0 1 2 3 4 Row 0: 2 -1 0 0 0 1: -1 2 -1 0 0 2: 0 -1 2 -1 0 3: 0 0 -1 2 -1 4: 0 0 0 -1 2 Cholesky factor L: Col: 0 1 2 3 4 Row 0: 1.41421 0 0 0 0 1: -0.707107 1.22474 0 0 0 2: 0 -0.816497 1.1547 0 0 3: 0 0 -0.866025 1.11803 0 4: 0 0 0 -0.894427 1.09545 Product L * L': Col: 0 1 2 3 4 Row 0: 2 -1 0 0 0 1: -1 2 -1 0 0 2: 0 -1 2 -1 0 3: 0 0 -1 2 -1 4: 0 0 0 -1 2 R8MAT_CHOLESKY_INVERSE_TEST For a positive definite symmetric matrix, R8MAT_CHOLESKY_INVERSE computes the inverse. Matrix to be inverted: Col: 0 1 2 3 4 Row 0: 2 -1 0 0 0 1: -1 2 -1 0 0 2: 0 -1 2 -1 0 3: 0 0 -1 2 -1 4: 0 0 0 -1 2 Inverse matrix: Col: 0 1 2 3 4 Row 0: 0.833333 0.666667 0.5 0.333333 0.166667 1: 0.666667 1.33333 1 0.666667 0.333333 2: 0.5 1 1.5 1 0.5 3: 0.333333 0.666667 1 1.33333 0.666667 4: 0.166667 0.333333 0.5 0.666667 0.833333 Product inv(A) * A: Col: 0 1 2 3 4 Row 0: 1 2.22045e-16 0 -1.11022e-16 0 1: -6.66134e-16 1 2.22045e-16 -1.66533e-16 -1.11022e-16 2: -6.66134e-16 1.11022e-15 1 -2.22045e-16 0 3: -4.44089e-16 6.66134e-16 0 1 0 4: -1.66533e-16 2.22045e-16 0 -2.22045e-16 1 R8MAT_CHOLESKY_SOLVE_TEST For a positive definite symmetric matrix, R8MAT_CHOLESKY_SOLVE solves a linear system using the lower Cholesky factorization. Matrix to be factored: Col: 0 1 2 3 4 Row 0: 2 -1 0 0 0 1: -1 2 -1 0 0 2: 0 -1 2 -1 0 3: 0 0 -1 2 -1 4: 0 0 0 -1 2 Cholesky factor L: Col: 0 1 2 3 4 Row 0: 1.41421 0 0 0 0 1: -0.707107 1.22474 0 0 0 2: 0 -0.816497 1.1547 0 0 3: 0 0 -0.866025 1.11803 0 4: 0 0 0 -0.894427 1.09545 Product L * L': Col: 0 1 2 3 4 Row 0: 2 -1 0 0 0 1: -1 2 -1 0 0 2: 0 -1 2 -1 0 3: 0 0 -1 2 -1 4: 0 0 0 -1 2 Right hand side: 0: 0 1: 0 2: 0 3: 0 4: 6 Computed solution: 0: 1 1: 2 2: 3 3: 4 4: 5 R8MAT_CHOLESKY_SOLVE_UPPER_TEST For a positive definite symmetric matrix, R8MAT_CHOLESKY_SOLVE_UPPER solves a linear system using the upper Cholesky factorization. Matrix to be factored: Col: 0 1 2 3 4 Row 0: 2 -1 0 0 0 1: -1 2 -1 0 0 2: 0 -1 2 -1 0 3: 0 0 -1 2 -1 4: 0 0 0 -1 2 Cholesky factor R: Col: 0 1 2 3 4 Row 0: 1.41421 -0.707107 0 0 0 1: 0 1.22474 -0.816497 0 0 2: 0 0 1.1547 -0.866025 0 3: 0 0 0 1.11803 -0.894427 4: 0 0 0 0 1.09545 Product R' * R: Col: 0 1 2 3 4 Row 0: 2 -1 0 0 0 1: -1 2 -1 0 0 2: 0 -1 2 -1 0 3: 0 0 -1 2 -1 4: 0 0 0 -1 2 Right hand side: 0: 0 1: 0 2: 0 3: 0 4: 6 Computed solution: 0: 1 1: 2 2: 3 3: 4 4: 5 R8MAT_DET_2D_TEST R8MAT_DET_2D: determinant of a 2 by 2 matrix; Matrix: Col: 0 1 Row 0: 1 1 1: 1 10 R8MAT_DET_2D computes determinant: 9 Exact determinant is 9 R8MAT_DET_3D_TEST R8MAT_DET_3D: determinant of a 3 by 3 matrix; Matrix: Col: 0 1 2 Row 0: 1 1 1 1: 1 10 100 2: 1 4 16 R8MAT_DET_3D computes determinant: -162 Exact determinant is -162 R8MAT_DET_4D R8MAT_DET_4D determinant of a 4 by 4 matrix; Matrix: Col: 0 1 2 3 Row 0: 1 1 1 1 1: 1 10 100 1000 2: 1 4 16 64 3: 1 2 4 8 R8MAT_DET_4D computes determinant:-2592 Exact determinant is -2592 R8MAT_DET_5D_TEST R8MAT_DET_5D determinant of a 5 by 5 matrix; Matrix: Col: 0 1 2 3 4 Row 0: 1 1 1 1 1 1: 1 10 100 1000 10000 2: 1 4 16 64 256 3: 1 2 4 8 16 4: 1 3 9 27 81 R8MAT_DET_5D computes determinant:-36288 Exact determinant is -36288 R8MAT_EXPAND_LINEAR_TEST R8MAT_EXPAND_LINEAR linearly interpolates new data between old values in a matrix. Original matrix: Col: 0 1 2 Row 0: 1 1 1 1: 2 4 8 2: 3 9 27 3: 4 16 64 MFAT = 2 NFAT = 1 Fattened matrix: Col: 0 1 2 3 4 Row 0: 1 1 1 1 1 1: 1.33333 1.66667 2 2.66667 3.33333 2: 1.66667 2.33333 3 4.33333 5.66667 3: 2 3 4 6 8 4: 2.33333 4 5.66667 10 14.3333 5: 2.66667 5 7.33333 14 20.6667 6: 3 6 9 18 27 7: 3.33333 7.33333 11.3333 25.3333 39.3333 8: 3.66667 8.66667 13.6667 32.6667 51.6667 9: 4 10 16 40 64 R8MAT_EXPAND_LINEAR2_TEST R8MAT_EXPAND_LINEAR2 fills in a large array by interpolating data from a small array. Original matrix has dimensions: M = 3, N = 2 Expanded matrix has dimensions: M2 = 10, N2 = 5 The little matrix A: Col: 0 1 Row 0: 11 12 1: 21 22 2: 31 32 Expanded array A2: Col: 0 1 2 3 4 Row 0: 11 11.25 11.5 11.75 12 1: 13.2222 13.4722 13.7222 13.9722 14.2222 2: 15.4444 15.6944 15.9444 16.1944 16.4444 3: 17.6667 17.9167 18.1667 18.4167 18.6667 4: 19.8889 20.1389 20.3889 20.6389 20.8889 5: 22.1111 22.3611 22.6111 22.8611 23.1111 6: 24.3333 24.5833 24.8333 25.0833 25.3333 7: 26.5556 26.8056 27.0556 27.3056 27.5556 8: 28.7778 29.0278 29.2778 29.5278 29.7778 9: 31 31.25 31.5 31.75 32 R8MAT_FS_NEW_TEST For a matrix in general storage, R8MAT_FS_NEW factors and solves a linear system. Matrix order N = 10 Solution: 0: 1 1: 2 2: 3 3: 4 4: 5 5: 6 6: 7 7: 8 8: 9 9: 10 R8MAT_FSS_NEW_TEST For a matrix in general storage, R8MAT_FSS_NEW factors and solves multiple linear systems. Matrix order N = 10 Number of systems NB = 3 Solutions: Col: 0 1 2 Row 0: 1 1 1 1: 1 2 2 2: 1 3 3 3: 1 4 1 4: 1 5 2 5: 1 6 3 6: 1 7 1 7: 1 8 2 8: 1 9 3 9: 1 10 1 R8MAT_GIVENS_POST_TEST R8MAT_GIVENS_POST computes a Givens postmultiplier rotation matrix. Matrix A: Col: 0 1 2 Row 0: 1 1 1 1: 1 2 4 2: 1 3 9 I = 3 J = 2 G Col: 0 1 2 Row 0: 1 0 0 1: 0 0.948683 0.316228 2: 0 -0.316228 0.948683 A*G Col: 0 1 2 Row 0: 1 0.632456 1.26491 1: 1 0.632456 4.42719 2: 1 -4.44089e-16 9.48683 R8MAT_GIVENS_PRE_TEST R8MAT_GIVENS_PRE computes a Givens premultiplier rotation matrix. Matrix A: Col: 0 1 2 Row 0: 1 1 1 1: 1 2 4 2: 1 3 9 I = 3 J = 2 G Col: 0 1 2 Row 0: 1 0 0 1: 0 0.5547 0.83205 2: 0 -0.83205 0.5547 G*A Col: 0 1 2 Row 0: 1 1 1 1: 1.38675 3.60555 9.70725 2: -0.27735 0 1.6641 R8MAT_HESS_TEST R8MAT_HESS estimates the Hessian matrix of a scalar function. Estimated Hessian: Col: 0 1 2 Row 0: 2 1 0 1: 1 2.381e-06 9.88032 2: 0 9.88032 -30.8503 Exact Hessian: Col: 0 1 2 Row 0: 2 1 0 1: 1 0 9.88032 2: 0 9.88032 -30.8503 R8MAT_HOUSE_AXH_TEST R8MAT_HOUSE_AXH multiplies a matrix A times a compact Householder matrix. Matrix A: Col: 0 1 2 3 4 Row 0: -2.15784 1.2836 -4.35359 -1.30572 0.649618 1: -2.26358 3.01045 4.24677 -2.08081 -3.36062 2: 2.39762 -2.48074 -4.36069 3.00431 3.67625 3: -2.25212 4.93529 -0.169023 -3.61252 -4.24061 4: -3.33288 0.0556345 0.810416 0.563964 -4.9103 Compact vector V so H*A packs column 3: 0: 0 1: 0 2: -0.995603 3: -0.0191243 4: 0.0916955 Householder matrix H: Col: 0 1 2 3 4 Row 0: 1 0 0 0 0 1: 0 1 0 0 0 2: 0 0 -0.982452 -0.0380805 0.182585 3: 0 0 -0.0380805 0.999269 0.00350723 4: 0 0 0.182585 0.00350723 0.983184 Indirect product A*H: Col: 0 1 2 3 4 Row 0: -2.15784 1.2836 4.44553 -1.1367 -0.160785 1: -2.26358 3.01045 -4.70661 -2.2528 -2.53601 2: 2.39762 -2.48074 4.84099 3.18107 2.82877 3: -2.25212 4.93529 -0.470646 -3.61832 -4.21283 4: -3.33288 0.0556345 -1.71422 0.515469 -4.67778 Direct product A*H: Col: 0 1 2 3 4 Row 0: -2.15784 1.2836 4.44553 -1.1367 -0.160785 1: -2.26358 3.01045 -4.70661 -2.2528 -2.53601 2: 2.39762 -2.48074 4.84099 3.18107 2.82877 3: -2.25212 4.93529 -0.470646 -3.61832 -4.21283 4: -3.33288 0.0556345 -1.71422 0.515469 -4.67778 Product H*A has packed column 3: Col: 0 1 2 3 4 Row 0: -2.15784 1.2836 -4.35359 -1.30572 0.649618 1: -2.26358 3.01045 4.24677 -2.08081 -3.36062 2: -2.87832 2.25943 4.43858 -2.71106 -4.3468 3: -2.35347 5.02635 -4.33681e-17 -3.72231 -4.39472 4: -2.84696 -0.380937 0 1.09035 -4.17138 R8MAT_HOUSE_FORM_TEST R8MAT_HOUSE_FORM forms a Householder matrix from its compact form. Compact vector form V: 0: 0 1: 0 2: 1 3: 2 4: 3 Householder matrix H: Col: 0 1 2 3 4 Row 0: 1 0 0 0 0 1: 0 1 0 0 0 2: 0 0 0.857143 -0.285714 -0.428571 3: 0 0 -0.285714 0.428571 -0.857143 4: 0 0 -0.428571 -0.857143 -0.285714 R8MAT_HOUSE_POST_TEST R8MAT_HOUSE_POST computes a Householder postmultiplier; Matrix A: Col: 0 1 2 3 4 Row 0: 0.23369 4.67373 4.79342 1.50231 2.41108 1: 4.07331 0.569628 1.02586 3.4116 1.06963 2: 4.18741 0.315823 4.19335 3.74959 0.854511 3: 1.47095 2.26472 0.0631821 2.14378 1.49075 4: 3.8055 1.08125 1.83494 1.30797 3.57393 I = 2 J = 3 Householder matrix H: Col: 0 1 2 3 4 Row 0: 1 0 0 0 0 1: 0 1 0 0 0 2: 0 0 -0.736994 -0.659002 -0.150183 3: 0 0 -0.659002 0.74998 -0.0569783 4: 0 0 -0.150183 -0.0569783 0.987015 Product A*H: Col: 0 1 2 3 4 Row 0: 0.23369 4.67373 -4.88485 -2.16955 1.57428 1: 4.07331 0.569628 -3.16495 1.82164 0.707286 2: 4.18741 0.315823 -5.6898 -2.35922e-16 -1.11022e-16 3: 1.47095 2.26472 -1.68321 1.48122 1.33976 4: 3.8055 1.08125 -2.75103 -0.431917 3.17742 R8MAT_HOUSE_PRE_TEST R8MAT_HOUSE_PRE computes a Householder premultiplier; Matrix A: Col: 0 1 2 3 4 Row 0: 2.72643 4.64142 1.60453 2.08489 3.79299 1: 1.54813 4.76903 2.61072 3.8756 1.52861 2: 2.5299 4.23391 3.67137 1.35112 2.36679 3: 4.80941 1.19066 1.06033 3.40275 2.14314 4: 4.26656 1.58449 1.40888 2.82102 4.83795 I = 2 J = 3 Householder matrix H: Col: 0 1 2 3 4 Row 0: 1 0 0 0 0 1: 0 -0.642528 -0.224 -0.564135 -0.467691 2: 0 -0.224 0.969452 -0.0769339 -0.0637814 3: 0 -0.564135 -0.0769339 0.806245 -0.160631 4: 0 -0.467691 -0.0637814 -0.160631 0.86683 Product H*A: Col: 0 1 2 3 4 Row 0: 2.72643 4.64142 1.60453 2.08489 3.79299 1: -6.27 -5.42537 -3.75694 -6.03181 -4.98402 2: 1.4637 2.84365 2.80297 3.33067e-16 1.47863 3: 2.12423 -2.31065 -1.12667 1.22125e-15 -0.0936553 4: 2.04043 -1.31825 -0.404237 4.44089e-16 2.98355 R8MAT_INDICATOR_NEW_TEST R8MAT_INDICATOR_NEW returns an indicator matrix; Indicator matrix: Col: 0 1 2 3 Row 0: 11 12 13 14 1: 21 22 23 24 2: 31 32 33 34 3: 41 42 43 44 4: 51 52 53 54 R8MAT_INVERSE_2D_TEST R8MAT_INVERSE_2D inverts a 2 by 2 matrix. Matrix A: Col: 0 1 Row 0: 1 2 1: 3 4 Inverse matrix A: Col: 0 1 Row 0: -2 1 1: 1.5 -0.5 Product C = A * B: Col: 0 1 Row 0: 1 0 1: 0 1 R8MAT_INVERSE_3D_TEST R8MAT_INVERSE_3D inverts a 3 by 3 matrix. Matrix A: Col: 0 1 2 Row 0: 3 2 1 1: 2 2 1 2: 0 1 1 Inverse matrix B: Col: 0 1 2 Row 0: 1 -1 0 1: -2 3 -1 2: 2 -3 2 C = A * B: Col: 0 1 2 Row 0: 1 0 0 1: 0 1 0 2: 0 0 1 R8MAT_INVERSE_4D_TEST R8MAT_INVERSE_4D inverts a 4 x 4 matrix. Matrix A: Col: 0 1 2 3 Row 0: 4 3 2 1 1: 3 3 2 1 2: 0 2 2 1 3: 0 0 1 1 Inverse matrix B: Col: 0 1 2 3 Row 0: 1 -1 0 -0 1: -3 4 -1 0 2: 6 -8 3 -1 3: -6 8 -3 2 C = A * B: Col: 0 1 2 3 Row 0: 1 0 0 0 1: 0 1 0 0 2: 0 0 1 0 3: 0 0 0 1 R8MAT_IS_INTEGER_TEST R8MAT_IS_INTEGER is TRUE if every entry of an R8MAT is an integer Example 1: Obviously integer Col: 0 1 2 Row 0: 1 2 3 1: 4 5 6 A is an integer matrix. Example 2: Obviously NOT integer Col: 0 1 2 Row 0: 1 2 3 1: 4 5 6.5 A is NOT an integer matrix. Example 3: Not obviously not integer Col: 0 1 2 Row 0: 1 2 3 1: 4 5 6 A is NOT an integer matrix. Example 4: Not obviously not integer Col: 0 1 2 Row 0: 1 2 3 1: 4 5 3e+08 A is NOT an integer matrix. R8MAT_JAC_TEST R8MAT_JAC estimates the M by N jacobian matrix of a nonlinear function. Estimated jacobian: Col: 0 1 2 3 Row 0: -0.83233 -0.41616 0 0 1: 0.70711 0 1 0 2: 1 2 3 4 Exact jacobian: Col: 0 1 2 3 Row 0: -0.832294 -0.416147 0 0 1: 0.707107 0 1 0 2: 1 2 3 4 R8MAT_KRONECKER_TEST R8MAT_KRONECKER computes the Kronecker product of two matrices. Factor matrix A: Col: 0 1 2 Row 0: 1 2 3 1: 4 5 6 Factor matrix B: Col: 0 1 Row 0: 7 8 1: 9 10 2: 11 12 Kronecker product C = kron(A,B) Col: 0 1 2 3 4 Row 0: 7 8 14 16 21 1: 9 10 18 20 27 2: 11 12 22 24 33 3: 28 32 35 40 42 4: 36 40 45 50 54 5: 44 48 55 60 66 Col: 5 Row 0: 24 1: 30 2: 36 3: 48 4: 60 5: 72 R8MAT_L_INVERSE_TEST R8MAT_L_INVERSE inverts a lower triangular matrix. Matrix A to be inverted: Col: 0 1 2 3 Row 0: 1 0 0 0 1: 2 3 0 0 2: 4 5 6 0 3: 7 8 9 10 Inverse matrix B: Col: 0 1 2 3 Row 0: 1 0 0 0 1: -0.666667 0.333333 0 0 2: -0.111111 -0.277778 0.166667 0 3: -0.0666667 -0.0166667 -0.15 0.1 Product C = A * B: Col: 0 1 2 3 Row 0: 1 0 0 0 1: 0 1 0 0 2: 0 0 1 0 3: 0 0 0 1 R8MAT_L_PRINT_TEST R8MAT_L_PRINT prints a lower triangular 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 21 22 3 31 32 33 4 41 42 43 44 5 51 52 53 54 55 6 61 62 63 64 65 66 7 71 72 73 74 75 76 77 A 7 by 3 matrix. Col 1 2 3 Row 1 11 2 21 22 3 31 32 33 4 41 42 43 5 51 52 53 6 61 62 63 7 71 72 73 A 4 by 7 matrix. Col 1 2 3 4 Row 1 11 2 21 22 3 31 32 33 4 41 42 43 44 R8MAT_L_SOLVE_TEST R8MAT_L_SOLVE solves a lower triangular system. Input matrix A: Col: 0 1 2 3 Row 0: 1 0 0 0 1: 2 3 0 0 2: 4 5 6 0 3: 7 8 9 10 Right hand side b: 0: 1 1: 8 2: 32 3: 90 Solution x: 0: 1 1: 2 2: 3 3: 4 Norm of residual = 0 R8MAT_L1_INVERSE_TEST R8MAT_L1_INVERSE inverts a unit lower triangular matrix. Matrix A to be inverted: Col: 0 1 2 3 4 Row 0: 1 0 0 0 0 1: 2 1 0 0 0 2: 0 0 1 0 0 3: 5 0 3 1 0 4: 0 0 0 0 1 5: 75 0 0 6 4 Col: 5 Row 0: 0 1: 0 2: 0 3: 0 4: 0 5: 1 Inverse matrix B: Col: 0 1 2 3 4 Row 0: 1 0 0 0 0 1: -2 1 0 0 0 2: 0 0 1 0 0 3: -5 0 -3 1 0 4: 0 0 0 0 1 5: -45 0 18 -6 -4 Col: 5 Row 0: 0 1: 0 2: 0 3: 0 4: 0 5: 1 Product C = A * B: Col: 0 1 2 3 4 Row 0: 1 0 0 0 0 1: 0 1 0 0 0 2: 0 0 1 0 0 3: 0 0 0 1 0 4: 0 0 0 0 1 5: 0 0 0 0 0 Col: 5 Row 0: 0 1: 0 2: 0 3: 0 4: 0 5: 1 R8MAT_LT_SOLVE_TEST R8MAT_LT_SOLVE solves a transposed lower triangular system. Input matrix A: Col: 0 1 2 3 Row 0: 1 0 0 0 1: 2 3 0 0 2: 4 5 6 0 3: 7 8 9 10 Right hand side b: 0: 45 1: 53 2: 54 3: 40 Solution x: 0: 1 1: 2 2: 3 3: 4 Norm of residual (A'x-b) = 0 R8MAT_LU_TEST R8MAT_LU computes the LU factors of a matrix. Matrix to be factored: Col: 0 1 2 3 4 Row 0: 1 1 1 1 1 1: 1 10 100 1000 10000 2: 1 4 16 64 256 3: 1 2 4 8 16 4: 1 3 9 27 81 P factor: Col: 0 1 2 3 4 Row 0: 1 0 0 0 0 1: 0 1 0 0 0 2: 0 0 1 0 0 3: 0 0 0 1 0 4: 0 0 0 0 1 L factor: Col: 0 1 2 3 4 Row 0: 1 0 0 0 0 1: 1 1 0 0 0 2: 1 0.333333 1 0 0 3: 1 0.111111 0.444444 1 0 4: 1 0.222222 0.777778 0.875 1 U factor: Col: 0 1 2 3 4 Row 0: 1 1 1 1 1 1: 0 9 99 999 9999 2: 0 0 -18 -270 -3078 3: 0 0 0 16 272 4: 0 0 0 0 14 P*L*U: Col: 0 1 2 3 4 Row 0: 1 1 1 1 1 1: 1 10 100 1000 10000 2: 1 4 16 64 256 3: 1 2 4 8 16 4: 1 3 9 27 81 R8MAT_MAX_TEST For a real matrix, R8MAT_MAX computes the maximum value; Random array: Col: 0 1 2 Row 0: 0.939058 9.41887 3.09813 1: 7.14932 2.2862 9.51222 2: 1.48208 8.50868 9.17715 3: 7.77918 9.40094 7.70256 4: 0.470716 9.6475 7.98812 Maximum value = 9.6475 R8MAT_MAX_INDEX R8MAT_MAX_INDEX locates the maximum entry of an R8MAT; Random array: Col: 0 1 2 Row 0: 5.15882 5.51603 5.27523 1: 0.353932 7.0592 1.11131 2: 2.91736 0.169842 6.45938 3: 1.5928 9.71424 2.23912 4: 9.98251 5.36123 6.07212 Maximum I,J indices 5 1 R8MAT_MAXCOL_MINROW_TEST R8MAT_MAXCOL_MINROW computes the maximum over columns of the mininum over rows; Random array: Col: 0 1 2 Row 0: 4.52723 2.53515 2.26216 1: 7.68335 4.25366 0.0485807 2: 0.183983 0.348557 0.592575 3: 5.93517 8.77861 0.716321 4: 8.78575 5.70912 3.27338 MAXCOL_MINROW = 3.27338 R8MAT_MAXROW_MINCOL_TEST R8MAT_MAXROW_MINCOL computes the maximum over rows of the mininum over columns; Random array: Col: 0 1 2 Row 0: 5.03843 2.37545 8.5877 1: 6.91556 8.41834 4.50161 2: 5.96248 7.99496 8.48755 3: 3.54065 7.6338 5.33417 4: 3.83523 8.86887 4.74933 MAXROW_MINCOL = 4.50161 R8MAT_MIN_TEST For a real matrix, R8MAT_MIN computes the minimum value; Random array: Col: 0 1 2 Row 0: 6.54464 9.27423 8.72683 1: 3.56401 4.39196 7.03662 2: 0.188202 3.60322 3.0965 3: 4.55128 9.62926 9.32604 4: 4.92204 6.25175 6.02705 Minimum value = 0.188202 R8MAT_MIN_INDEX_TEST R8MAT_MIN_INDEX locates the minimum entry of an R8MAT; Random array: Col: 0 1 2 Row 0: 4.52984 8.04782 5.92223 1: 6.07753 5.95545 7.62549 2: 2.7584 9.39088 8.96344 3: 1.77783 6.60931 8.5948 4: 8.13055 7.27246 1.04382 Minimum I,J indices 5 3 R8MAT_MINCOL_MAXROW_TEST R8MAT_MINCOL_MAXROW computes the minimum over columns of the maxinum over rows; Random array: Col: 0 1 2 Row 0: 0.83414 5.6935 1.99583 1: 2.13035 9.05345 9.07053 2: 3.35211 6.02374 3.01517 3: 3.98095 7.32303 0.76662 4: 0.05621 6.25696 3.81974 MINCOL_MAXROW = 5.6935 R8MAT_MINROW_MAXCOL_TEST R8MAT_MINROW_MAXCOL computes the minimum over rows of the maxinum over columns; Random array: Col: 0 1 2 Row 0: 6.29063 5.3007 7.34041 1: 8.65216 8.73684 9.83023 2: 6.06505 2.11439 9.36824 3: 0.11478 9.49734 1.9554 4: 6.70514 1.84664 8.59826 MINROW_MAXCOL = 8.65216 R8MAT_MM_TEST R8MAT_MM multiplies two (rectangular) matrices and returns the result as an argument. Matrix A: Col: 0 1 2 Row 0: 1 2 3 1: 4 5 6 Matrix B: Col: 0 1 2 3 Row 0: 1 4 0 -1 1: 2 5 0 2 2: 3 6 1 -1 Product C = A * B: Col: 0 1 2 3 Row 0: 14 32 3 0 1: 32 77 6 0 R8MAT_MM_NEW_TEST R8MAT_MM_NEW multiplies two (rectangular) matrices and returns the result as the function value. Matrix A: Col: 0 1 2 Row 0: 1 2 3 1: 4 5 6 Matrix B: Col: 0 1 2 3 Row 0: 1 4 0 -1 1: 2 5 0 2 2: 3 6 1 -1 Product C = A * B: Col: 0 1 2 3 Row 0: 14 32 3 0 1: 32 77 6 0 R8MAT_MV_TEST R8MAT_MV multiplies a (rectangular) matrix times a vector, and returns the result as an argument. Matrix A: Col: 0 1 2 Row 0: 1 2 3 1: 4 5 6 Vector B: 0: 1 1: 2 2: 3 Product C = A * B: 0: 14 1: 32 R8MAT_MV_NEW_TEST R8MAT_MV_NEW multiplies a (rectangular) matrix times a vector, and returns the result as the function value. Matrix A: Col: 0 1 2 Row 0: 1 2 3 1: 4 5 6 Vector B: 0: 1 1: 2 2: 3 Product C = A * B: 0: 14 1: 32 R8MAT_MTV_NEW_TEST R8MAT_MTV_NEW multiplies a transposed matrix times a vector, and returns the result as the function value. Matrix A: Col: 0 1 2 Row 0: 1 2 3 1: 4 5 6 Vector B: 0: 1 1: 2 Product C = A' * B: 0: 9 1: 12 2: 15 R8MAT_MTV_TEST R8MAT_MTV multiplies a transposed matrix times a vector, and returns the result as an argument. Matrix A: Col: 0 1 2 Row 0: 1 2 3 1: 4 5 6 Vector B: 0: 1 1: 2 Product C = A' * B: 0: 9 1: 12 2: 15 R8MAT_NINT_TEST R8MAT_NINT rounds an R8MAT. Matrix A: Col: 0 1 2 3 Row 0: 4.76646 3.68318 3.96489 4.47122 1: 2.11659 4.84344 1.44779 -4.52858 2: -1.30511 -4.94191 -4.2587 0.422993 3: -4.64816 2.0703 -2.71856 -2.46937 4: -2.25024 3.90046 4.79588 0.772176 Rounded matrix A: Col: 0 1 2 3 Row 0: 5 4 4 4 1: 2 5 1 -5 2: -1 -5 -4 0 3: -5 2 -3 -2 4: -2 4 5 1 R8MAT_NONZEROS_TEST R8MAT_NONZEROS counts nonzeros in an R8MAT. Matrix A: Col: 0 1 2 3 Row 0: 1 0 1 0 1: 0 0 0 0 2: 1 0 1 0 3: 0 0 0 0 4: 1 0 1 0 Expected nonzeros = 6 Computed nonzeros = 6 R8MAT_NORM_FRO_TEST R8MAT_NORM_FRO computes the Frobenius norm of a matrix. Matrix A: Col: 0 1 2 3 Row 0: 1 2 3 4 1: 5 6 7 8 2: 9 10 11 12 3: 13 14 15 16 4: 17 18 19 20 Expected Frobenius norm = 53.5724 Computed Frobenius norm = 53.5724 R8MAT_NORM_FRO_AFFINE_TEST R8MAT_NORM_FRO_AFFINE computes the Frobenius norm of the difference of two R8MAT's. Expected Frobenius norm = 1.50015 Computed Frobenius norm = 1.50015 R8MAT_NORM_L1_TEST R8MAT_NORM_L1 computes the L1 norm of a matrix. Matrix A: Col: 0 1 2 3 Row 0: -1 4 -2 1 1: 0 -2 3 1 2: -4 -1 2 4 3: 2 -1 -3 1 4: -2 -1 0 2 L1 norm = 10 R8MAT_NULLSPACE_TEST R8MAT_NULLSPACE computes the nullspace of a matrix. Input A: Col: 0 1 2 3 4 Row 0: 1 3 0 2 6 1: -2 -6 0 -2 -8 2: 3 9 0 0 6 3: -1 -3 0 1 0 Col: 5 6 Row 0: 3 1 1: 3 1 2: 6 2 3: 9 3 Nullspace size is 4 Nullspace vectors: Col: 0 1 2 3 Row 0: -3 0 -2 0 1: 1 0 0 0 2: 0 1 0 0 3: 0 0 -2 0 4: 0 0 1 0 5: 0 0 0 -0.333333 6: 0 0 0 1 Product A * Nullspace vectors: Col: 0 1 2 3 Row 0: 0 0 0 0 1: 0 0 0 0 2: 0 0 0 0 3: 0 0 0 0 R8MAT_NULLSPACE_SIZE_TEST R8MAT_NULLSPACE_SIZE computes the size of the nullspace of a matrix. Input A: Col: 0 1 2 3 4 Row 0: 1 3 0 2 6 1: -2 -6 0 -2 -8 2: 3 9 0 0 6 3: -1 -3 0 1 0 Col: 5 6 Row 0: 3 1 1: 3 1 2: 6 2 3: 9 3 Nullspace size is 4 R8MAT_ORTH_UNIFORM_NEW_TEST R8MAT_ORTH_UNIFORM_NEW computes a random orthogonal matrix. Random orthogonal matrix A Col: 0 1 2 3 4 Row 0: -0.162362 -0.715671 -0.350251 0.466761 0.347724 1: -0.397793 0.582731 0.144466 0.530096 0.447563 2: -0.0319088 -0.261718 0.60048 -0.426061 0.623202 3: -0.780412 0.0258426 -0.372363 -0.501461 -0.0131497 4: 0.453143 0.281203 -0.597682 -0.261039 0.538722 AT*A Col: 0 1 2 3 4 Row 0: 1 2.22045e-16 5.55112e-17 -1.11022e-16 -5.55112e-17 1: 2.22045e-16 1 1.11022e-16 -1.52656e-16 -1.11022e-16 2: 5.55112e-17 1.11022e-16 1 -1.11022e-16 0 3: -1.11022e-16 -1.52656e-16 -1.11022e-16 1 -2.77556e-17 4: -5.55112e-17 -1.11022e-16 0 -2.77556e-17 1 R8MAT_PLOT_TEST R8MAT_PLOT prints a symbolic picture of a matrix. Typically, - for negative, 0 for zero, and + for positive entries or X for nonzero and 0 for zero. A plot of the matrix: 1234567890123456789012345678901234567890123456789012345678901234567890 1 -+00000000000000000000000000000000000000000000000000000000000000000000 2 +-+0000000000000000000000000000000000000000000000000000000000000000000 3 0+-+000000000000000000000000000000000000000000000000000000000000000000 4 00+-+00000000000000000000000000000000000000000000000000000000000000000 5 000+-+0000000000000000000000000000000000000000000000000000000000000000 6 0000+-+000000000000000000000000000000000000000000000000000000000000000 7 00000+-+00000000000000000000000000000000000000000000000000000000000000 8 000000+-+0000000000000000000000000000000000000000000000000000000000000 9 0000000+-+000000000000000000000000000000000000000000000000000000000000 10 00000000+-+00000000000000000000000000000000000000000000000000000000000 123456789012345678901234567890 1 00000000000000000000000000000+ 2 000000000000000000000000000000 3 000000000000000000000000000000 4 000000000000000000000000000000 5 000000000000000000000000000000 6 000000000000000000000000000000 7 000000000000000000000000000000 8 000000000000000000000000000000 9 000000000000000000000000000000 10 000000000000000000000000000000 R8MAT_POWER_METHOD_TEST R8MAT_POWER_METHOD applies the power method to a matrix. Estimated eigenvalue = 3.73198 Estimated eigenvector V: 0: 0.292877 1: -0.499987 2: 0.573126 3: -0.499987 4: 0.292877 Value of A*V: 0: 1.08574 1: -1.86598 2: 2.14622 3: -1.86598 4: 1.08574 R8MAT_PRINT_TEST R8MAT_PRINT prints an R8MAT. The matrix: Col: 0 1 2 3 Row 0: 11 12 13 14 1: 21 22 23 24 2: 31 32 33 34 3: 41 42 43 44 4: 51 52 53 54 5: 61 62 63 64 R8MAT_PRINT_SOME_TEST R8MAT_PRINT_SOME prints some of an R8MAT. Rows 2:4, Cols 1:2: Col: 0 1 Row 1: 21 22 2: 31 32 3: 41 42 R8MAT_PRODUCT_ELEMENTWISE_TEST R8MAT_PRODUCT_ELEMENTWISE computes the elementwise product of two R8MATs. A: Col: 0 1 2 Row 0: 1 2 3 1: 4 5 6 B: Col: 0 1 2 Row 0: 1 3 5 1: 2 4 6 Elementwise product = 86 R8MAT_REF_TEST R8MAT_REF computes the row echelon form of a matrix. Input A: Col: 0 1 2 3 4 Row 0: 1 3 0 2 6 1: -2 -6 0 -2 -8 2: 3 9 0 0 6 3: -1 -3 0 1 0 Col: 5 6 Row 0: 3 1 1: 3 1 2: 6 2 3: 9 3 Pseudo-determinant = 48 REF form: Col: 0 1 2 3 4 Row 0: 1 3 0 2 6 1: 0 0 0 1 2 2: 0 0 0 0 0 3: 0 0 0 0 0 Col: 5 6 Row 0: 3 1 1: 4.5 1.5 2: 1 0.333333 3: 0 0 R8MAT_RREF_TEST R8MAT_RREF computes the reduced row echelon form of a matrix. Input A: Col: 0 1 2 3 4 Row 0: 1 3 0 2 6 1: -2 -6 0 -2 -8 2: 3 9 0 0 6 3: -1 -3 0 1 0 Col: 5 6 Row 0: 3 1 1: 3 1 2: 6 2 3: 9 3 Pseudo-determinant = 48 REF form: Col: 0 1 2 3 4 Row 0: 1 3 0 0 2 1: 0 0 0 1 2 2: 0 0 0 0 0 3: 0 0 0 0 0 Col: 5 6 Row 0: 0 0 1: 0 0 2: 1 0.333333 3: 0 0 R8MAT_SCALE_01_TEST R8MAT_SCALE_01 shifts and scales an R8MAT so that every column has min 0 and max 1. Matrix X: Col: 0 1 2 Row 0: 13.2177 9.16709 -0.874006 1: -3.1257 13.7264 5.68424 2: 3.59335 -1.96987 9.3962 3: 0.552034 -1.2871 10.218 4: 2.16702 6.35125 -4.98114 5: 12.7834 11.1662 13.7562 6: -1.64468 8.75423 4.82865 7: -1.19089 14.2365 5.18961 8: 5.41618 -1.11811 11.6454 9: 10.0892 13.0666 10.2009 mean(X): 4.18576 7.20932 6.50641 sigma(X): 6.01711 6.45124 5.8348 xmax(X): 13.2177 14.2365 13.7562 xmin(X): -3.1257 -1.96987 -4.98114 Matrix XS: Col: 0 1 2 Row 0: 1 0.687198 0.219195 1: 0 0.968527 0.569204 2: 0.411117 0 0.767309 3: 0.225029 0.0421296 0.811169 4: 0.323845 0.513448 0 5: 0.973429 0.810551 1 6: 0.090619 0.661722 0.523542 7: 0.118385 1 0.542806 8: 0.52265 0.0525573 0.887349 9: 0.808576 0.927813 0.810255 mean(XS): 0.447365 0.566395 0.613083 sigma(XS): 0.368167 0.398069 0.3114 xmax(XS): 1 1 1 xmin(XS): 0 0 0 R8MAT_SCALE_AB_TEST R8MAT_SCALE_AB shifts and scales an R8MAT so that every column has min A and max B. Matrix X: Col: 0 1 2 Row 0: 10.9886 1.59296 13.247 1: -1.52019 2.85105 4.30756 2: -2.65682 -4.24722 1.6828 3: 11.8649 11.1615 1.23915 4: 6.71131 1.05408 2.8346 5: 5.70339 1.36398 -3.42644 6: -0.76614 -4.28042 5.02433 7: -1.27195 14.3094 9.60679 8: 5.79951 1.2333 -1.81136 9: 3.20974 10.9655 7.85782 mean(X): 3.80624 3.60042 4.05622 sigma(X): 5.26764 6.42453 5.12305 xmax(X): 11.8649 14.3094 13.247 xmin(X): -2.65682 -4.28042 -3.42644 New scale interval is [-1,1] Matrix XS: Col: 0 1 2 Row 0: 0.879323 -0.368108 1 1: -0.843458 -0.232755 -0.0722952 2: -1 -0.996428 -0.387139 3: 1 0.661335 -0.440355 4: 0.290227 -0.426083 -0.248979 5: 0.151411 -0.392743 -1 6: -0.739606 -1 0.0136831 7: -0.80927 1 0.563356 8: 0.16465 -0.406802 -0.806268 9: -0.192027 0.640246 0.353564 mean(XS): -0.109875 -0.152134 -0.102443 sigma(XS): 0.725487 0.691188 0.614518 xmax(XS): 1 1 1 xmin(XS): -1 -1 -1 R8MAT_SOLVE_TEST R8MAT_SOLVE solves linear systems. The linear system: Col: 0 1 2 3 4 Row 0: 1 2 3 14 7 1: 4 5 6 32 16 2: 7 8 0 23 7 The computed solutions: 1 1 2 0 3 2 R8MAT_SOLVE_2D_TEST R8MAT_SOLVE_2D solves 2D linear systems. Solution / Computed: 0.138669 0.138669 0.76527 0.76527 Solution / Computed: 0.481575 0.481575 0.963835 0.963835 Solution / Computed: 0.173893 0.173893 0.34267 0.34267 Solution / Computed: 0.309623 0.309623 0.757454 0.757454 Solution / Computed: 0.727656 0.727656 0.37791 0.37791 R8MAT_SOLVE_3D_TEST R8MAT_SOLVE_3D solves 3D linear systems. Solution / Computed: 0.757141 0.757141 0.818747 0.818747 0.13788 0.13788 Solution / Computed: 0.0044953 0.0044953 0.897971 0.897971 0.841728 0.841728 Solution / Computed: 0.716521 0.716521 0.404284 0.404284 0.41605 0.41605 Solution / Computed: 0.0824462 0.0824462 0.975874 0.975874 0.913887 0.913887 Solution / Computed: 0.576171 0.576171 0.0917884 0.0917884 0.889786 0.889786 R8MAT_SOLVE2_TEST R8MAT_SOLVE2 is a linear solver. Right hand side: 0: 5 1: 11 The system is nonsingular. Computed solution: 0: 1 1: 2 Right hand side: 0: 4 1: 2 2: 2 R8MAT_SOLVE2 - Warning: Consistent singularity, equation = 3 The system is singular, but consistent. Computed solution: 0: 2 1: 0 2: 0 Right hand side: 0: 5 1: 11 2: 16 3: 15 The system is nonsingular. Computed solution: 0: -2 1: -6 2: 10 3: 7 Right hand side: 0: 13 1: 17 2: 20 R8MAT_SOLVE2 - Warning: Inconsistent singularity, equation = 2 The system is singular and inconsistent. Computed solution: 0: 6.42857 1: 0 2: 0.142857 R8MAT_STANDARDIZE_TEST R8MAT_STANDARDIZE shifts and scales an R8MAT so that every column has zero mean and unit standard deviation. Matrix X: Col: 0 1 2 Row 0: 9.95693 7.38856 5.60075 1: 14.6816 14.3332 5.3378 2: 11.4434 -2.86229 8.43928 3: -0.0973857 8.46751 12.6904 4: 13.3683 14.5199 7.14373 5: 3.11968 -1.15416 10.3045 6: 1.44747 -4.85259 12.0505 7: 5.88887 14.9338 2.82067 8: -1.61768 7.61066 12.2823 9: -2.54127 11.7901 3.64617 mean(X): 5.56499 7.01747 8.03162 sigma(X): 6.41398 7.47683 3.6757 xmax(X): 14.6816 14.9338 12.6904 xmin(X): -2.54127 -4.85259 2.82067 Matrix XS: Col: 0 1 2 Row 0: 0.684746 0.0496323 -0.661334 1: 1.42137 0.978453 -0.732872 2: 0.916493 -1.32138 0.110906 3: -0.882818 0.193938 1.26745 4: 1.21661 1.00342 -0.241556 5: -0.381246 -1.09293 0.618362 6: -0.64196 -1.58758 1.09337 7: 0.0504953 1.05878 -1.41768 8: -1.11985 0.0793378 1.15644 9: -1.26384 0.638327 -1.19309 mean(XS): 2.22045e-17 2.22045e-17 -2.22045e-17 sigma(XS): 1 1 1 xmax(XS): 1.42137 1.05878 1.26745 xmin(XS): -1.26384 -1.58758 -1.41768 R8MAT_SYMM_JACOBI_TEST For a symmetric R8MAT: R8MAT_SYMM_JACOBI diagonalizes; Matrix to diagonalize: Col: 0 1 2 3 4 Row 0: 3.20573 -0.139175 -0.491341 -0.802534 0.697834 1: -0.139175 3.3057 -1.11087 0.343532 -0.325286 2: -0.491341 -1.11087 2.95246 0.352418 -1.32651 3: -0.802534 0.343532 0.352418 2.4046 0.107639 4: 0.697834 -0.325286 -1.32651 0.107639 3.13151 Computed Eigenvalues: 5 4 2 1 3 R8MAT_TO_R8CMAT_NEW_TEST R8MAT_TO_R8CMAT_NEW converts an R8MAT to an R8CMAT. Data is of order (5,4). The R8MAT A: Col: 0 1 2 3 Row 0: 11 12 13 14 1: 21 22 23 24 2: 31 32 33 34 3: 41 42 43 44 4: 51 52 53 54 The R8CMAT B: Col: 0 1 2 3 Row 0: 11 12 13 14 1: 21 22 23 24 2: 31 32 33 34 3: 41 42 43 44 4: 51 52 53 54 The R8MAT C: Col: 0 1 2 3 Row 0: 11 12 13 14 1: 21 22 23 24 2: 31 32 33 34 3: 41 42 43 44 4: 51 52 53 54 R8MAT_TO_R8PLU_TEST R8MAT_TO_R8PLU determines the compressed PLU factors of a real general matrix. Matrix order N = 5 The matrix A: Col: 0 1 2 3 4 Row 0: 0.263008 0.5677 0.122208 0.277871 0.948146 1: 0.389013 0.356458 0.0999266 0.980771 0.0737919 2: 0.363974 0.792521 0.591682 0.285967 0.586253 3: 0.573525 0.489458 0.3183 0.135919 0.970119 4: 0.715337 0.295945 0.963936 0.55775 0.883849 The pivot vector P: 0: 5 1: 3 2: 4 3: 4 4: 5 The compressed LU factors: Col: 0 1 2 3 4 Row 0: 0.715337 0.295945 0.963936 0.55775 0.883849 1: -0.543817 0.64194 0.101217 0.00217575 0.136537 2: -0.508815 -0.304573 -0.494303 -0.312115 0.207851 3: -0.801755 -0.392844 -0.920704 0.964159 -0.639816 4: -0.367671 -0.714847 -0.616136 -0.273349 0.572406 The recovered matrix A2: Col: 0 1 2 3 4 Row 0: 0.263008 0.5677 0.122208 0.277871 0.948146 1: 0.389013 0.356458 0.0999266 0.980771 0.0737919 2: 0.363974 0.792521 0.591682 0.285967 0.586253 3: 0.573525 0.489458 0.3183 0.135919 0.970119 4: 0.715337 0.295945 0.963936 0.55775 0.883849 R8MAT_TO_R8RMAT_TEST R8MAT_TO_R8RMAT converts an R8MAT to an R8RMAT. Data is of order (5,4). The R8MAT A: Col: 0 1 2 3 Row 0: 11 12 13 14 1: 21 22 23 24 2: 31 32 33 34 3: 41 42 43 44 4: 51 52 53 54 The R8RMAT B: Col: 0 1 2 3 Row 0: 11 12 13 14 1: 21 22 23 24 2: 31 32 33 34 3: 41 42 43 44 4: 51 52 53 54 The R8MAT C: Col: 0 1 2 3 Row 0: 11 12 13 14 1: 21 22 23 24 2: 31 32 33 34 3: 41 42 43 44 4: 51 52 53 54 R8MAT_TRACE_TEST R8MAT_TRACE computes the trace of a matrix Matrix: Col: 0 1 2 3 Row 0: 4 3 2 1 1: 3 3 2 1 2: 0 2 2 1 3: 0 0 1 1 Trace is 10 R8MAT_TRANSPOSE_NEW_TEST R8MAT_TRANSPOSE_NEW transposes an R8MAT. Matrix A: Col: 0 1 2 3 Row 0: 11 12 13 14 1: 21 22 23 24 2: 31 32 33 34 3: 41 42 43 44 4: 51 52 53 54 Transposed matrix At: Col: 0 1 2 3 4 Row 0: 11 21 31 41 51 1: 12 22 32 42 52 2: 13 23 33 43 53 3: 14 24 34 44 54 R8MAT_TRANSPOSE_PRINT_TEST R8MAT_TRANSPOSE_PRINT prints an R8MAT, transposed. Matrix row order M = 7 Matrix column order N = 12 The transposed matrix A: Row: 0 1 2 3 4 Col 0: 101 201 301 401 501 1: 102 202 302 402 502 2: 103 203 303 403 503 3: 104 204 304 404 504 4: 105 205 305 405 505 5: 106 206 306 406 506 6: 107 207 307 407 507 7: 108 208 308 408 508 8: 109 209 309 409 509 9: 110 210 310 410 510 10: 111 211 311 411 511 11: 112 212 312 412 512 Row: 5 6 Col 0: 601 701 1: 602 702 2: 603 703 3: 604 704 4: 605 705 5: 606 706 6: 607 707 7: 608 708 8: 609 709 9: 610 710 10: 611 711 11: 612 712 R8MAT_TRANSPOSE_PRINT_SOME_TEST R8MAT_TRANSPOSE_PRINT_SOME prints some of an R8MAT, transposed. Matrix row order M = 7 Matrix column order N = 12 Rows 3:5, Cols 4:8: Row: 2 3 4 Col 3: 304 404 504 4: 305 405 505 5: 306 406 506 6: 307 407 507 7: 308 408 508 R8MAT_U_INVERSE_TEST R8MAT_U_INVERSE inverts an upper triangular matrix. Input matrix A Col: 0 1 2 3 Row 0: 1 2 4 7 1: 0 3 5 8 2: 0 0 6 9 3: 0 0 0 10 Inverse matrix B: Col: 0 1 2 3 Row 0: 1 -0.666667 -0.111111 -0.0666667 1: 0 0.333333 -0.277778 -0.0166667 2: 0 0 0.166667 -0.15 3: 0 0 0 0.1 Product C = A * B: Col: 0 1 2 3 Row 0: 1 0 0 0 1: 0 1 0 0 2: 0 0 1 1.11022e-16 3: 0 0 0 1 R8MAT_U_SOLVE_TEST R8MAT_U_SOLVE solves an upper triangular system. Input matrix A: Col: 0 1 2 3 Row 0: 1 2 4 7 1: 0 3 5 8 2: 0 0 6 9 3: 0 0 0 10 Right hand side b: 0: 45 1: 53 2: 54 3: 40 Solution x: 0: 1 1: 2 2: 3 3: 4 Norm of residual = 0 R8MAT_U1_INVERSE_TEST R8MAT_U1_INVERSE inverts a unit upper triangular matrix. Input matrix A Col: 0 1 2 3 4 Row 0: 1 2 0 5 0 1: 0 1 0 0 0 2: 0 0 1 3 0 3: 0 0 0 1 0 4: 0 0 0 0 1 5: 0 0 0 0 0 Col: 5 Row 0: 75 1: 0 2: 0 3: 6 4: 4 5: 1 Inverse matrix B: Col: 0 1 2 3 4 Row 0: 1 -2 0 -5 0 1: 0 1 0 0 0 2: 0 0 1 -3 0 3: 0 0 0 1 0 4: 0 0 0 0 1 5: 0 0 0 0 0 Col: 5 Row 0: -45 1: 0 2: 18 3: -6 4: -4 5: 1 Product C = A * B: Col: 0 1 2 3 4 Row 0: 1 0 0 0 0 1: 0 1 0 0 0 2: 0 0 1 0 0 3: 0 0 0 1 0 4: 0 0 0 0 1 5: 0 0 0 0 0 Col: 5 Row 0: 0 1: 0 2: 0 3: 0 4: 0 5: 1 R8MAT_UNIFORM_01_NEW_TEST R8MAT_UNIFORM_01_NEW sets an R8MAT to random values in [0,1]. The random R8MAT: Col: 0 1 2 3 Row 0: 0.569432 0.211337 0.994791 0.059523 1: 0.928931 0.526308 0.0593332 0.0791916 2: 0.919708 0.213693 0.254932 0.536317 3: 0.483044 0.374881 0.706591 0.460088 4: 0.991771 0.890866 0.19924 0.835155 R8MAT_UNIFORM_AB_NEW_TEST R8MAT_UNIFORM_AB_NEW sets an R8MAT to random values in [A,B]. The random R8MAT: Col: 0 1 2 3 Row 0: 6.54398 3.13126 2.10981 3.87501 1: 7.21567 3.71682 3.37963 9.04778 2: 4.78117 3.0062 7.43884 8.42031 3: 3.20417 8.10497 5.85013 3.63252 4: 5.93955 4.76105 2.24347 8.66311 R8MAT_UT_SOLVE_TEST R8MAT_UT_SOLVE solves a transposed upper triangular system. Input matrix A: Col: 0 1 2 3 Row 0: 1 2 4 7 1: 0 3 5 8 2: 0 0 6 9 3: 0 0 0 10 Right hand side b: 0: 1 1: 8 2: 32 3: 90 Solution x: 0: 1 1: 2 2: 3 3: 4 Norm of residual (A'x-b) = 0 R8PLU_DET_TEST R8PLU_DET determines the determinant of a matrix from its compressed PLU factors. Matrix order N = 5 The matrix A: Col: 0 1 2 3 4 Row 0: 0.305686 0.334629 0.272175 0.642185 0.55204 1: 0.568749 0.292187 0.916616 0.856548 0.291199 2: 0.24329 0.435409 0.313892 0.523134 0.955757 3: 0.548733 0.117793 0.935114 0.0871591 0.179436 4: 0.0878876 0.877667 0.524453 0.684842 0.568149 The determinant = -0.03535 R8PLU_INVERSE_TEST R8PLU_INVERSE determines the inverse of a matrix from its compressed PLU factors. Matrix order N = 5 The matrix A: Col: 0 1 2 3 4 Row 0: 0.267072 0.267437 0.175153 0.753483 0.199449 1: 0.354515 0.47179 0.114619 0.707964 0.0381786 2: 0.815214 0.029853 0.520026 0.144795 0.354191 3: 0.346457 0.0187163 0.827056 0.441654 0.823587 4: 0.695474 0.880115 0.579219 0.598819 0.0236526 The inverse B: Col: 0 1 2 3 4 Row 0: -2.09908 2.9028 1.59779 -0.285619 -0.966342 1: -10.3002 11.0396 -1.05941 2.48619 -1.66867 2: 11.7399 -14.8496 -0.260548 -2.17037 4.44784 3: 6.78634 -5.88888 -0.0320051 -1.38902 1.12525 4: -14.3115 16.5981 -0.369254 4.20223 -4.62556 Product C = A * B: Col: 0 1 2 3 4 Row 0: 1 -1.33227e-15 -4.02456e-16 -2.22045e-16 5.55112e-16 1: -1.88738e-15 1 -4.14599e-16 1.66533e-16 -5.55112e-17 2: 0 0 1 0 6.66134e-16 3: -1.77636e-15 0 -8.88178e-16 1 8.88178e-16 4: 6.66134e-16 2.22045e-15 -4.09395e-16 -5.13478e-16 1 R8PLU_MUL_TEST R8PLU_MUL computes the product A*x using the compressed PLU factors of A. Matrix order N = 5 The matrix A: Col: 0 1 2 3 4 Row 0: 0.179547 0.436855 0.438578 0.096212 0.304078 1: 0.0542677 0.647911 0.845337 0.945881 0.668565 2: 0.922443 0.529378 0.731605 0.971599 0.0206792 3: 0.861816 0.763698 0.562544 0.801655 0.424685 4: 0.497992 0.306126 0.550394 0.343257 0.185429 The right hand side B (computed from A): 0: 4.27423 1: 11.0125 2: 8.16581 3: 9.40689 4: 5.0616 The right hand side B (computed from PLU): 0: 4.27423 1: 11.0125 2: 8.16581 3: 9.40689 4: 5.0616 R8PLU_SOL_TEST R8PLU_SOL solves the linear system A*x=b using the compressed PLU factors of A. Matrix order N = 5 The matrix A: Col: 0 1 2 3 4 Row 0: 0.834991 0.349185 0.74478 0.793042 0.589594 1: 0.46723 0.66767 0.752903 0.992145 0.635781 2: 0.330732 0.990932 0.388887 0.452483 0.522772 3: 0.924719 0.106777 0.323043 0.612033 0.930233 4: 0.456178 0.130677 0.811293 0.490652 0.611249 The right hand side B (computed from A): 0: 9.88784 1: 11.2088 2: 7.90305 3: 9.2067 4: 8.17026 The computed solution X: 0: 1 1: 2 2: 3 3: 4 4: 5 R8PLU_TO_R8MAT_TEST R8PLU_TO_R8MAT determines the original matrix from the compressed PLU factors. Matrix order N = 5 The matrix A: Col: 0 1 2 3 4 Row 0: 0.785986 0.632074 0.157112 0.658083 0.937489 1: 0.448905 0.0490487 0.854485 0.102102 0.0242693 2: 0.00443041 0.061346 0.371481 0.182432 0.691496 3: 0.736862 0.522838 0.278558 0.250763 0.296517 4: 0.67239 0.794936 0.924482 0.838763 0.690842 The pivot vector P: 0: 1 1: 2 2: 5 3: 4 4: 5 The compressed LU factors: Col: 0 1 2 3 4 Row 0: 0.785986 0.632074 0.157112 0.658083 0.937489 1: -0.571136 -0.311951 0.764752 -0.273753 -0.511164 2: -0.00563675 0.185231 1.41329 0.0527051 -0.52771 3: -0.9375 -0.223532 0.0280776 -0.303517 -0.482933 4: -0.855473 0.814915 -0.362454 0.358834 0.609505 The recovered matrix A2: Col: 0 1 2 3 4 Row 0: 0.785986 0.632074 0.157112 0.658083 0.937489 1: 0.448905 0.0490487 0.854485 0.102102 0.0242693 2: 0.00443041 0.061346 0.371481 0.182432 0.691496 3: 0.736862 0.522838 0.278558 0.250763 0.296517 4: 0.67239 0.794936 0.924482 0.838763 0.690842 R8RMAT_NEW_TEST: R8RMAT_NEW dynamically creates a 2D row major array. Array entries can be addressed using the notation "a[i][j]". Allocating memory for array A of size 4 by 5. Assigning values to A. Dynamically allocated matrix A: 0 1 2 3 4 10 11 12 13 14 20 21 22 23 24 30 31 32 33 34 Dynamically allocated matrix B = A' * A: 1400 1460 1520 1580 1640 1460 1524 1588 1652 1716 1520 1588 1656 1724 1792 1580 1652 1724 1796 1868 1640 1716 1792 1868 1944 R8RMAT_TO_R8MAT_TEST R8RMAT_TO_R8MAT converts an R8RMAT to an R8MAT. Data is of order (5,4). The R8MAT A: Col: 0 1 2 3 Row 0: 11 12 13 14 1: 21 22 23 24 2: 31 32 33 34 3: 41 42 43 44 4: 51 52 53 54 The R8RMAT B: Col: 0 1 2 3 Row 0: 11 12 13 14 1: 21 22 23 24 2: 31 32 33 34 3: 41 42 43 44 4: 51 52 53 54 The R8MAT C: Col: 0 1 2 3 Row 0: 11 12 13 14 1: 21 22 23 24 2: 31 32 33 34 3: 41 42 43 44 4: 51 52 53 54 R8ROWS_TO_R8MAT_TEST R8ROWS_TO_R8MAT allows an R8MAT to be initialized by data stored ROW-WISE in a vector. The data vector: 0: 11 1: 12 2: 13 3: 14 4: 21 5: 22 6: 23 7: 24 8: 31 9: 32 10: 33 11: 34 The data copied into an array: Col: 0 1 2 3 Row 0: 11 12 13 14 1: 21 22 23 24 2: 31 32 33 34 R8SLMAT_PRINT_TEST R8SLMAT_PRINT prints a strictly lower triangular matrix stored compactly. Only the (possibly) nonzero elements are printed. R8SLMAT: Col 1 2 3 4 5 Row 2: 21.000000 3: 31.000000 32.000000 4: 41.000000 42.000000 43.000000 5: 51.000000 52.000000 53.000000 54.000000 6: 61.000000 62.000000 63.000000 64.000000 65.000000 7: 71.000000 72.000000 73.000000 74.000000 75.000000 Col 6 Row 7: 76.000000 R8SLMAT: Col 1 2 3 Row 2: 21.000000 3: 31.000000 32.000000 4: 41.000000 42.000000 43.000000 5: 51.000000 52.000000 53.000000 6: 61.000000 62.000000 63.000000 7: 71.000000 72.000000 73.000000 R8SLMAT: Col 1 2 3 Row 2: 21.000000 3: 31.000000 32.000000 4: 41.000000 42.000000 43.000000 R8VEC_AMAX_TEST R8VEC_AMAX computes maximum magnitude entry of R8VEC; Input vector: 0: -6.11668 1: 9.63786 2: 3.48605 3: -4.43057 4: 8.24608 5: 4.90539 6: -1.3595 7: -9.25586 8: 0.315808 9: -8.13905 Maximum absolute: 9.63786 R8VEC_AMIN_TEST For an R8VEC: R8VEC_AMIN: minimum magnitude entry. Input vector: 0: 1.03783 1: -6.42435 2: 0.633585 3: -7.6873 4: -2.05873 5: -9.57148 6: -8.98515 7: 9.36156 8: 0.418233 9: -2.38033 Minimum absolute: 0.418233 R8VEC_APPEND_TEST R8VEC_APPEND appends a value to the end of an R8VEC; Initial array A: 0: 0.5 1: 1.5 2: 2.5 3: 3.5 4: 4.5 Array A after append: 0: 0.5 1: 1.5 2: 2.5 3: 3.5 4: 4.5 5: 17.25 R8VEC_APPEND_NEW_TEST R8VEC_APPEND_NEW appends a value to the end of an R8VEC; Vector after step 1 0: 1.5 Vector after step 2 0: 1.5 1: 2.5 Vector after step 3 0: 1.5 1: 2.5 2: 3.5 Vector after step 4 0: 1.5 1: 2.5 2: 3.5 3: 4.5 Vector after step 5 0: 1.5 1: 2.5 2: 3.5 3: 4.5 4: 5.5 R8VEC_BINARY_NEXT_TEST R8VEC_BINARY_NEXT generates the next binary vector. 0 0 0 0 0 1 0 1 0 0 1 1 1 0 0 1 0 1 1 1 0 1 1 1 R8VEC_BRACKET_TEST R8VEC_BRACKET finds a pair of entries in a sorted real array which bracket a value. The array (must be in ascending order!) 0: 1 1: 2 2: 3 3: 4 4: 5 5: 5 6: 7 7: 8 8: 9 9: 10 Search for XVAL = -10 X[1-1] = 1 X[2-1] = 2 Search for XVAL = 1 X[1-1] = 1 X[2-1] = 2 Search for XVAL = 4.5 X[4-1] = 4 X[5-1] = 5 Search for XVAL = 5 X[6-1] = 5 X[7-1] = 7 Search for XVAL = 10 X[9-1] = 9 X[10-1] = 10 Search for XVAL = 12 X[9-1] = 9 X[10-1] = 10 R8VEC_BRACKET2_TEST R8VEC_BRACKET2 finds a pair of entries in a sorted R8VEC which bracket a value. The array (must be in ascending order!) 0: 1 1: 2 2: 3 3: 4 4: 5 5: 5 6: 7 7: 8 8: 9 9: 10 Search for XVAL = -10 Start = 1101694677 Left = 1 Right = 2 X[1-1] = 1 X[2-1] = 2 Search for XVAL = 1 Start = 1 Left = 1 Right = 1 X[1-1] = 1 X[1-1] = 1 Search for XVAL = 4.5 Start = 1 Left = 4 Right = 5 X[4-1] = 4 X[5-1] = 5 Search for XVAL = 5 Start = 4 Left = 5 Right = 5 X[5-1] = 5 X[5-1] = 5 Search for XVAL = 10 Start = 5 Left = 9 Right = 10 X[9-1] = 9 X[10-1] = 10 Search for XVAL = 12 Start = 9 Left = 10 Right = -1 X[10-1] = 10 R8VEC_BRACKET3_TEST R8VEC_BRACKET3 finds a pair of entries in a sorted real array which bracket a value. The array (must be in ascending order!): 0: 1 1: 2 2: 3 3: 4 4: 5 5: 5 6: 7 7: 8 8: 9 9: 10 Search for XVAL = -10 Starting guess for interval is = 4 Nearest interval: X[0]= 1 X[1]= 2 Search for XVAL = 1 Starting guess for interval is = 0 Nearest interval: X[0]= 1 X[1]= 2 Search for XVAL = 4.5 Starting guess for interval is = 0 Nearest interval: X[3]= 4 X[4]= 5 Search for XVAL = 5 Starting guess for interval is = 3 Nearest interval: X[3]= 4 X[4]= 5 Search for XVAL = 10 Starting guess for interval is = 3 Nearest interval: X[8]= 9 X[9]= 10 Search for XVAL = 12 Starting guess for interval is = 8 Nearest interval: X[8]= 9 X[9]= 10 R8VEC_BRACKET5_TEST R8VEC_BRACKET5 finds a pair of entries in a sorted R8VEC which bracket a value. Sorted array: 0: 1 1: 2 2: 3 3: 4 4: 5 5: 5 6: 7 7: 8 8: 9 9: 10 LEFT RIGHT X(LEFT) XVAL X(RIGHT) -1 -10.0000 (Not bracketed!) 0 1 1.0000 1.0000 2.0000 3 4 4.0000 4.5000 5.0000 5 6 5.0000 5.0000 7.0000 8 9 9.0000 10.0000 10.0000 -1 12.0000 (Not bracketed!) R8VEC_CHEBY_EXTREME_NEW_TEST R8VEC_CHEBY_EXTREME_NEW computes N Chebyshev Extreme points in [R1,R2]. N = 5, R1 = -1.000000, R2 = 1.000000 Chebyshev points: 0: -1 1: -0.707107 2: 0 3: 0.707107 4: 1 N = 7, R1 = 0.000000, R2 = 10.000000 Chebyshev points: 0: 0 1: 0.669873 2: 2.5 3: 5 4: 7.5 5: 9.33013 6: 10 R8VEC_CHEBY_ZERO_NEW_TEST R8VEC_CHEBY_ZERO_NEW computes N Chebyshev Zero points in [R1,R2]. N = 5, R1 = -1.000000, R2 = 1.000000 Chebyshev points: 0: -0.951057 1: -0.587785 2: 0 3: 0.587785 4: 0.951057 N = 7, R1 = 0.000000, R2 = 10.000000 Chebyshev points: 0: 0.12536 1: 1.09084 2: 2.83058 3: 5 4: 7.16942 5: 8.90916 6: 9.87464 R8VEC_CONCATENATE_NEW_TEST R8VEC_CONCATENATE_NEW concatenates two R8VECs Array 1: 0: 91.1 1: 31.2 2: 71.3 3: 51.4 4: 31.5 Array 2: 0: 42.6 1: 22.7 2: 12.8 Array 3 = Array 1 + Array 2: 0: 91.1 1: 31.2 2: 71.3 3: 51.4 4: 31.5 5: 42.6 6: 22.7 7: 12.8 R8VEC_CONVOLUTION_TEST R8VEC_CONVOLUTION computes the convolution of two vectors. The factor X: 0: 1 1: 2 2: 3 3: 4 The factor Y: 0: -1 1: 5 2: 3 The convolution z = x star y: 0: -1 1: 3 2: 10 3: 17 4: 29 5: 12 Correct answer: 0: -1 1: 3 2: 10 3: 17 4: 29 5: 12 R8VEC_CONVOLUTION_CIRC_TEST R8VEC_CONVOLUTION_CIRC computes the circular convolution of two vectors. The factor X: 0: 1 1: 2 2: 3 3: 4 The factor Y: 0: 1 1: 2 2: 4 3: 8 The circular convolution z = xCCy: 0: 37 1: 44 2: 43 3: 26 Correct answer: 0: 37 1: 44 2: 43 3: 26 r8vec_correlation_test r8vec_correlation computes the correlation of two R8VEC's Vector v1: 0: 43 1: 21 2: 25 3: 42 4: 57 5: 59 Vector v2: 0: 99 1: 65 2: 79 3: 75 4: 87 5: 81 V1 V2 Correlation coefficient r = 0.529809 R8VEC_DIF_TEST R8VEC_DIF estimates derivatives. Estimate the derivative of order N = 4 Using H = 0.01 at argument X = 1 The difference coefficients: 0: 6.25e+06 1: -2.5e+07 2: 3.75e+07 3: -2.5e+07 4: 6.25e+06 Estimate is FDIF = 2.71846 R8VEC_DIFF_NORM_LI_TEST R8VEC_DIFF_NORM_LI computes the L-infinity norm of the difference of two R8VEC's Vector V1: 0: 2.78794 1: 9.00486 2: 2.83675 3: 9.7161 4: -5.34409 Vector V2: 0: -4.73677 1: 7.67939 2: 8.9526 3: 5.71805 4: 7.02737 L-Infinity norm of V1-V2 = 12.3715 R8VEC_DIRECT_PRODUCT_TEST R8VEC_DIRECT_PRODUCT forms the entries of a direct product of a given number of R8VEC factors. J X(1) X(2) X(3) 0 1 50 800 1 2 50 800 2 3 50 800 3 4 50 800 4 1 60 800 5 2 60 800 6 3 60 800 7 4 60 800 8 1 70 800 9 2 70 800 10 3 70 800 11 4 70 800 12 1 50 900 13 2 50 900 14 3 50 900 15 4 50 900 16 1 60 900 17 2 60 900 18 3 60 900 19 4 60 900 20 1 70 900 21 2 70 900 22 3 70 900 23 4 70 900 R8VEC_DIRECT_PRODUCT2_TEST R8VEC_DIRECT_PRODUCT2 forms the entries of a direct product of a given number of R8VEC factors. J W(J) 0 418 1 627 2 1045 3 1463 4 494 5 741 6 1235 7 1729 8 646 9 969 10 1615 11 2261 12 462 13 693 14 1155 15 1617 16 546 17 819 18 1365 19 1911 20 714 21 1071 22 1785 23 2499 R8VEC_DOT_PRODUCT_TEST R8VEC_DOT_PRODUCT computes the dot product of two R8VEC's. V1 and V2: 0: 0.0152305 0.934121 1: 0.0117267 0.287844 2: 0.645063 0.23266 3: 0.291625 0.198401 4: 0.272857 0.832415 5: 0.501093 0.296607 6: 0.69189 0.752538 7: 0.202864 0.998803 8: 0.386936 0.794075 9: 0.929808 0.863964 V1 dot V2 = 2.43517 R8VEC_EVEN_TEST R8VEC_EVEN computes N evenly spaced values between XLO and XHI. XLO = 0 XHI = 99 while N = 10 Resulting array: 0: 0 1: 11 2: 22 3: 33 4: 44 5: 55 6: 66 7: 77 8: 88 9: 99 R8VEC_EVEN2_TEST: R8VEC_EVEN2 interpolates a specified number of points pairs of values in a vector. Input data: 0 (4) 1 (3) 5 (5) 2 (0) 0 Resulting vector: * 0 0.2 0.4 0.6 0.8 * 1 2 3 4 * 5 4.5 4 3.5 3 2.5 * 2 * 0 R8VEC_EXPAND_LINEAR_TEST R8VEC_EXPAND_LINEAR linearly interpolates new data between old values. Original vector: 0: 16 1: 4 2: 0 3: 4 4: 16 5: 36 Expansion factor is 3 Fattened vector: 0: 16 1: 13 2: 10 3: 7 4: 4 5: 3 6: 2 7: 1 8: 0 9: 1 10: 2 11: 3 12: 4 13: 7 14: 10 15: 13 16: 16 17: 21 18: 26 19: 31 20: 36 R8VEC_FRAC_TEST R8VEC_FRAC: K-th smallest R8VEC entry; Array to search: 0: 0.18477 1: 0.588086 2: 0.798545 3: 0.0219127 4: 0.460376 5: 0.869481 6: 0.487747 7: 0.94293 8: 0.839751 9: 0.817334 Fractile Value 1 0.0219127 6 0.798545 R8VEC_HISTOGRAM_TEST R8VEC_HISTOGRAM histograms a real vector. Uniform data: Histogram of data: 0 0 0 0.05 45 0.05 0.1 52 0.1 0.15 46 0.15 0.2 49 0.2 0.25 52 0.25 0.3 61 0.3 0.35 40 0.35 0.4 51 0.4 0.45 53 0.45 0.5 51 0.5 0.55 55 0.55 0.6 48 0.6 0.65 48 0.65 0.7 46 0.7 0.75 56 0.75 0.8 38 0.8 0.85 53 0.85 0.9 64 0.9 0.95 49 0.95 1 43 1 0 Normal data: Histogram of data: -3 1 -3 -2.7 1 -2.7 -2.4 2 -2.4 -2.1 14 -2.1 -1.8 22 -1.8 -1.5 34 -1.5 -1.2 40 -1.2 -0.9 71 -0.9 -0.6 97 -0.6 -0.3 97 -0.3 0 119 0 0.3 109 0.3 0.6 109 0.6 0.9 102 0.9 1.2 62 1.2 1.5 45 1.5 1.8 33 1.8 2.1 15 2.1 2.4 8 2.4 2.7 10 2.7 3 4 3 5 R8VEC_HOUSE_COLUMN_TEST R8VEC_HOUSE_COLUMN returns the compact form of a Householder matrix that packs a column of a matrix. Matrix A: Col: 0 1 2 3 Row 0: 1.56168 4.09973 4.91359 2.67342 1: 3.33208 3.97392 2.76257 3.30542 2: 0.843999 2.87908 1.4775 1.03893 3: 0.208239 0.166494 0.915884 1.67042 Working on column K = 1 Householder matrix H: Col: 0 1 2 3 Row 0: -0.413015 -0.881228 -0.223211 -0.0550725 1: -0.881228 0.450421 -0.139205 -0.034346 2: -0.223211 -0.139205 0.96474 -0.00869967 3: -0.0550725 -0.034346 -0.00869967 0.997854 Product H*A: Col: 0 1 2 3 Row 0: -3.78118 -5.84699 -4.84407 -4.34088 1: 5.11743e-17 -2.22936 -3.32281 -1.06905 2: -1.83447e-16 1.30783 -0.0638995 -0.0691063 3: -2.77556e-17 -0.221181 0.535578 1.39704 Working on column K = 2 Householder matrix H: Col: 0 1 2 3 Row 0: 1 0 0 0 1: 0 -0.859395 0.504153 -0.0852629 2: 0 0.504153 0.863305 0.023118 3: 0 -0.0852629 0.023118 0.99609 Product H*A: Col: 0 1 2 3 Row 0: -3.78118 -5.84699 -4.84407 -4.34088 1: -1.34098e-16 2.59411 2.77773 0.764784 2: -1.33213e-16 -2.83627e-16 -1.71799 -0.566329 3: -3.62513e-17 2.77556e-17 0.815319 1.48113 Working on column K = 3 Householder matrix H: Col: 0 1 2 3 Row 0: 1 0 0 0 1: 0 1 0 0 2: 0 0 -0.903425 0.428746 3: 0 0 0.428746 0.903425 Product H*A: Col: 0 1 2 3 Row 0: -3.78118 -5.84699 -4.84407 -4.34088 1: -1.34098e-16 2.59411 2.77773 0.764784 2: 1.04805e-16 2.68136e-16 1.90164 1.14666 3: -8.98647e-17 -9.6529e-17 -1.11022e-16 1.09528 R8VEC_IDENTITY_ROW_NEW_TEST R8VEC_IDENTITY_ROW_NEW returns a row of the identity. -1: 0.0 0.0 0.0 0.0 0.0 0: 1.0 0.0 0.0 0.0 0.0 1: 0.0 1.0 0.0 0.0 0.0 2: 0.0 0.0 1.0 0.0 0.0 3: 0.0 0.0 0.0 1.0 0.0 4: 0.0 0.0 0.0 0.0 1.0 5: 0.0 0.0 0.0 0.0 0.0 R8VEC_INDEX_DELETE_ALL_TEST R8VEC_INDEX_DELETE_ALL deletes all copies of a particular value. 3 13 14 14 7 6 12 13 16 15 6 9 5 8 13 15 9 2 12 4 Indexed list of entries: I INDX(I) X(I) X(INDX(I)) 1 20 8 2 2 3 7 3 3 22 3 4 4 15 13 5 5 8 14 6 6 13 14 6 7 2 7 7 8 7 6 7 9 23 12 7 10 1 13 8 11 24 16 8 12 16 15 8 13 14 6 9 14 19 9 9 15 9 5 12 16 21 8 12 17 4 13 13 18 10 15 13 19 17 9 13 20 5 2 14 21 6 12 14 22 12 4 15 23 18 7 15 24 11 8 16 Call R8VEC_INDEX_DELETE_ALL to delete all values of 7: Indexed list of entries: I INDX(I) X(I) X(INDX(I)) 1 18 8 2 2 2 3 3 3 20 13 4 4 13 14 5 5 6 14 6 6 11 6 6 7 1 12 8 8 21 13 8 9 14 16 8 10 12 15 9 11 17 6 9 12 7 9 12 13 19 5 12 14 3 8 13 15 8 13 13 16 15 15 13 17 4 9 14 18 5 2 14 19 10 12 15 20 16 4 15 21 9 8 16 R8VEC_INDEX_DELETE_DUPES_TEST R8VEC_INDEX_DELETE_DUPES deletes duplicates. 7 3 11 1 13 19 14 4 14 7 16 8 9 12 9 17 8 13 10 6 Indexed list of entries: I INDX(I) X(I) X(INDX(I)) 1 6 8 1 2 4 7 3 3 10 7 4 4 22 3 6 5 2 11 7 6 12 1 7 7 23 13 7 8 3 19 7 9 1 14 8 10 24 4 8 11 19 14 8 12 14 7 8 13 15 16 9 14 17 8 9 15 21 9 10 16 5 12 11 17 16 9 12 18 7 17 13 19 20 8 13 20 9 13 14 21 11 10 14 22 13 6 16 23 18 7 17 24 8 8 19 Call R8VEC_INDEX_DELETE_DUPES to delete duplicates: Indexed list of unique entries: I INDX(I) X(I) 1 1 1 2 2 3 3 3 4 4 4 6 5 5 7 6 6 8 7 7 9 8 8 10 9 9 11 10 10 12 11 11 13 12 12 14 13 13 16 14 14 17 15 15 19 R8VEC_INDEX_DELETE_ONE_TEST R8VEC_INDEX_DELETE_ONE deletes one copies of a particular value. 19 5 5 8 19 14 20 16 9 20 7 16 16 15 5 13 14 16 6 19 Indexed list of entries: I INDX(I) X(I) X(INDX(I)) 1 4 8 5 2 17 7 5 3 5 19 5 4 21 5 6 5 2 5 7 6 13 8 7 7 23 19 7 8 1 14 8 9 6 20 8 10 24 16 8 11 11 9 9 12 18 20 13 13 8 7 14 14 19 16 14 15 16 16 15 16 10 15 16 17 14 5 16 18 20 13 16 19 15 14 16 20 3 16 19 21 22 6 19 22 7 19 19 23 9 7 20 24 12 8 20 Call R8VEC_INDEX_DELETE_ONE to delete one value of 8: Indexed list of entries: I INDX(I) X(I) X(INDX(I)) 1 4 8 5 2 16 7 5 3 5 19 5 4 20 5 6 5 2 5 7 6 12 19 7 7 22 14 7 8 1 20 8 9 23 16 8 10 10 9 9 11 17 20 13 12 7 7 14 13 18 16 14 14 15 16 15 15 9 15 16 16 13 5 16 17 19 13 16 18 14 14 16 19 3 16 19 20 21 6 19 21 6 19 19 22 8 7 20 23 11 8 20 R8VEC_INDEX_INSERT_TEST R8VEC_INDEX_INSERT inserts values into an index sorted array. 8 6 5 11 1 18 11 0 9 7 3 8 19 18 16 5 19 4 9 2 Indexed list of entries: I INDX(I) X(I) X(INDX(I)) 1 10 8 0 2 7 7 1 3 22 8 2 4 13 6 3 5 20 5 4 6 5 11 5 7 18 1 5 8 4 18 6 9 2 11 7 10 23 0 7 11 12 9 7 12 1 7 8 13 24 3 8 14 14 8 8 15 3 19 8 16 11 18 9 17 21 16 9 18 6 5 11 19 9 19 11 20 17 4 16 21 8 9 18 22 16 2 18 23 15 7 19 24 19 8 19 R8VEC_INDEX_INSERT_UNIQUE_TEST R8VEC_INDEX_INSERT_UNIQUE inserts unique values into an index sorted array. 13 11 18 12 9 5 19 14 7 10 17 15 1 0 11 19 2 4 12 13 Indexed list of entries: I INDX(I) X(I) X(INDX(I)) 1 14 13 0 2 13 11 1 3 15 18 2 4 16 12 4 5 6 9 5 6 9 5 7 7 5 19 9 8 10 14 10 9 2 7 11 10 4 10 12 11 1 17 13 12 8 15 14 13 12 1 15 14 11 0 17 15 3 2 18 16 7 4 19 R8VEC_INDEX_ORDER_TEST R8VEC_INDEX_ORDER sorts an index sorted array. Generate some random values: 1 2 1 19 13 5 19 11 7 16 3 10 12 3 8 6 8 8 15 5 Indexed list of unique entries: I INDX(I) X(I) X(INDX(I)) 1 1 1 1 2 2 2 2 3 9 19 3 4 5 13 5 5 13 5 6 6 7 11 7 7 12 7 8 8 10 16 10 9 6 3 11 10 11 10 12 11 4 12 13 12 14 8 15 13 8 6 16 14 3 15 19 Now call R8VEC_INDEX_ORDER to carry out the sorting: X: 0: 1 1: 2 2: 3 3: 5 4: 6 5: 7 6: 8 7: 10 8: 11 9: 12 10: 13 11: 15 12: 16 13: 19 R8VEC_INDEX_SEARCH_TEST R8VEC_INDEX_SEARCH searches for an entry with a given value. 1 16 13 5 15 3 13 14 13 11 13 4 3 3 10 10 4 9 9 3 Indexed list of entries: I INDX(I) X(I) X(INDX(I)) 1 1 1 1 2 6 16 3 3 9 13 4 4 4 5 5 5 11 15 9 6 10 3 10 7 8 14 11 8 3 11 13 9 7 4 14 10 5 10 15 11 2 9 16 Results of search for given XVAL: XVAL Less Equal More 0 0 0 1 1 0 1 2 2 1 0 2 3 1 2 3 4 2 3 4 5 3 4 5 6 4 0 5 7 4 0 5 8 4 0 5 9 4 5 6 10 5 6 7 11 6 7 8 12 7 0 8 13 7 8 9 14 8 9 10 15 9 10 11 16 10 11 12 17 11 0 12 18 11 0 12 19 11 0 12 20 11 0 12 Skipping r8vec_index_sorted_range_test() R8VEC_INDEXED_HEAP_D_TEST R8VEC_INDEXED_HEAP_D creates a descending heap from an indexed vector. The data vector: 0: 101 1: 102 2: 103 3: 104 4: 105 5: 106 6: 107 7: 108 8: 109 9: 110 10: 111 11: 112 12: 113 13: 114 14: 115 15: 116 16: 117 17: 118 18: 119 19: 120 The index vector: 0: 0 1: 10 2: 16 3: 4 4: 6 5: 12 6: 14 7: 2 8: 18 9: 8 A(INDX): 0 101.000000 1 111.000000 2 117.000000 3 105.000000 4 107.000000 5 113.000000 6 115.000000 7 103.000000 8 119.000000 9 109.000000 The data vector (should NOT change): 0: 101 1: 102 2: 103 3: 104 4: 105 5: 106 6: 107 7: 108 8: 109 9: 110 10: 111 11: 112 12: 113 13: 114 14: 115 15: 116 16: 117 17: 118 18: 119 19: 120 The index vector (may change): 0: 18 1: 10 2: 16 3: 4 4: 8 5: 12 6: 14 7: 2 8: 0 9: 6 A(INDX) is now a descending heap: 0 119.000000 1 111.000000 2 117.000000 3 105.000000 4 109.000000 5 113.000000 6 115.000000 7 103.000000 8 101.000000 9 107.000000 R8VEC_INDEXED_HEAP_D_EXTRACT_TEST For an indexed R8VEC, R8VEC_INDEXED_HEAP_D_EXTRACT extracts the maximum value; The data vector: 0: 1 1: 2 2: 3 3: 4 4: 5 5: 6 6: 7 7: 8 8: 9 9: 10 10: 11 11: 12 12: 13 13: 14 14: 15 15: 16 16: 17 17: 18 18: 19 19: 20 The index vector: 0: 8 1: 1 2: 7 3: 13 4: 4 A(INDX): 0 9.000000 1 2.000000 2 8.000000 3 14.000000 4 5.000000 The index vector after heaping: 0: 13 1: 8 2: 7 3: 1 4: 4 A(INDX) after heaping: 0 14.000000 1 9.000000 2 8.000000 3 2.000000 4 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: 0: 1 1: 2 2: 3 3: 4 4: 5 5: 6 6: 7 7: 8 8: 9 9: 10 10: 11 11: 12 12: 13 13: 14 14: 15 15: 16 16: 17 17: 18 18: 19 19: 20 The index vector after insertions: 0: 19 1: 18 2: 13 3: 8 4: 14 5: 6 6: 7 7: 0 8: 1 9: 4 A(INDX) after insertions: 0 20.000000 1 19.000000 2 14.000000 3 9.000000 4 15.000000 5 7.000000 6 8.000000 7 1.000000 8 2.000000 9 5.000000 Now extract the maximum several times. Extracting maximum element A[19] = 20.000000 Extracting maximum element A[18] = 19.000000 Extracting maximum element A[14] = 15.000000 Extracting maximum element A[13] = 14.000000 Extracting maximum element A[8] = 9.000000 The data vector after extractions: 0: 1 1: 2 2: 3 3: 4 4: 5 5: 6 6: 7 7: 8 8: 9 9: 10 10: 11 11: 12 12: 13 13: 14 14: 15 15: 16 16: 17 17: 18 18: 19 19: 20 The index vector after extractions: 0: 7 1: 4 2: 6 3: 1 4: 0 A(INDX) after extractions: 0 8.000000 1 5.000000 2 7.000000 3 2.000000 4 1.000000 R8VEC_INDEXED_HEAP_D_INSERT_TEST For an indexed R8VEC, R8VEC_INDEXED_HEAP_D_INSERT inserts a value into the heap. The data vector: 0: 1 1: 2 2: 3 3: 4 4: 5 5: 6 6: 7 7: 8 8: 9 9: 10 10: 11 11: 12 12: 13 13: 14 14: 15 15: 16 16: 17 17: 18 18: 19 19: 20 The index vector: 0: 8 1: 1 2: 7 3: 13 4: 4 A(INDX): 0 9.000000 1 2.000000 2 8.000000 3 14.000000 4 5.000000 The index vector after heaping: 0: 13 1: 8 2: 7 3: 1 4: 4 A(INDX) after heaping: 0 14.000000 1 9.000000 2 8.000000 3 2.000000 4 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: 0: 1 1: 2 2: 3 3: 4 4: 5 5: 6 6: 7 7: 8 8: 9 9: 10 10: 11 11: 12 12: 13 13: 14 14: 15 15: 16 16: 17 17: 18 18: 19 19: 20 The index vector after insertions: 0: 19 1: 18 2: 13 3: 8 4: 14 5: 6 6: 7 7: 0 8: 1 9: 4 A(INDX) after insertions: 0 20.000000 1 19.000000 2 14.000000 3 9.000000 4 15.000000 5 7.000000 6 8.000000 7 1.000000 8 2.000000 9 5.000000 R8VEC_INDEXED_HEAP_D_MAX_TEST For an indexed R8VEC, R8VEC_INDEXED_HEAP_D_MAX reports the maximum value. The data vector: 0: 1 1: 2 2: 3 3: 4 4: 5 5: 6 6: 7 7: 8 8: 9 9: 10 10: 11 11: 12 12: 13 13: 14 14: 15 15: 16 16: 17 17: 18 18: 19 19: 20 The index vector: 0: 8 1: 1 2: 7 3: 13 4: 4 A(INDX): 0 9.000000 1 2.000000 2 8.000000 3 14.000000 4 5.000000 The index vector after heaping: 0: 13 1: 8 2: 7 3: 1 4: 4 A(INDX) after heaping: 0 14.000000 1 9.000000 2 8.000000 3 2.000000 4 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: 0: 1 1: 2 2: 3 3: 4 4: 5 5: 6 6: 7 7: 8 8: 9 9: 10 10: 11 11: 12 12: 13 13: 14 14: 15 15: 16 16: 17 17: 18 18: 19 19: 20 The index vector after insertions: 0: 19 1: 18 2: 13 3: 8 4: 14 5: 6 6: 7 7: 0 8: 1 9: 4 A(INDX) after insertions: 0 20.000000 1 19.000000 2 14.000000 3 9.000000 4 15.000000 5 7.000000 6 8.000000 7 1.000000 8 2.000000 9 5.000000 R8VEC_INDICATOR0_NEW_TEST R8VEC_INDICATOR0_NEW returns an indicator vector. Indicator0 vector: 0: 0 1: 1 2: 2 3: 3 4: 4 5: 5 6: 6 7: 7 8: 8 9: 9 R8VEC_INDICATOR1_NEW_TEST R8VEC_INDICATOR1_NEW returns an indicator vector. Indicator1 vector: 0: 1 1: 2 2: 3 3: 4 4: 5 5: 6 6: 7 7: 8 8: 9 9: 10 R8VEC_IS_BINARY_TEST R8VEC_IS_BINARY is TRUE if an R8VEC only contains 0 or 1 entries. X: 0 0 0 X is binary. X: 1 0 1 X is binary. X: 0 2 1 X is NOT binary. R8VEC_IS_INTEGER_TEST R8VEC_IS_INTEGER is TRUE if an R8VEC only contains integer entries. Example 1: Obviously integer: X: 1 2 3 4 5 6 X is integer. Example 2: Obviously NOT integer: X: 1 2 3 4 5 6.5 X is NOT integer. Example 3: Not obviously not integer: X: 1 2 3 4 5 6 X is NOT integer. Example 4: Not obviously not integer: X: 1 2 3e+08 4 5 6 X is NOT integer. R8VEC_LEGENDRE_TEST R8VEC_LEGENDRE_NEW computes N Legendre points in [R1,R2]. N = 5, R1 = -1, R2 = 1 Legendre points: 0: -0.90618 1: -0.538469 2: 0 3: 0.538469 4: 0.90618 N = 7, R1 = 0, R2 = 10 Legendre points: 0: 0.25446 1: 1.29234 2: 2.97077 3: 5 4: 7.02923 5: 8.70766 6: 9.74554 R8VEC_LINSPACE_NEW_TEST For a R8VEC: R8VEC_LINSPACE_NEW: evenly spaced points between A and B; r8vec_linspace ( 5, 10, 20 ) 0: 10 1: 12.5 2: 15 3: 17.5 4: 20 R8VEC_MAX_TEST R8VEC_MAX produces the maximum entry in a real array. The array: 0: 0.368554 1: 0.452079 2: 0.806583 3: 0.637519 4: 0.767711 5: 0.0401205 6: 0.166166 7: 0.0559575 8: 0.894002 9: 0.713856 R8VEC_MAX reports the maximum value is 0.894002. R8VEC_MAX_ABS_INDEX_TEST R8VEC_MAX_ABS_INDEX: index of entry of maximum absolute value; Vector: 0: -3.40328 1: -7.49621 2: 8.73492 3: 8.78834 4: 7.24314 5: -0.690702 6: -7.39282 7: 3.23875 8: 7.96883 9: -7.43941 Index of entry of maximum absolute value : 3 R8VEC_MAX_INDEX_TEST R8VEC_MAX_INDEX: index of maximum entry in an R8VEC; Input vector: 0: -9.81802 1: 0.254737 2: 1.66321 3: 6.74486 4: 2.51786 5: 0.225059 6: -4.3368 7: 6.57885 8: 7.02054 9: 2.1717 Maximum index: 8 R8VEC_MEAN_TEST R8VEC_MEAN computes the mean of an R8VEC. Input vector: 0: 0.915677 1: -3.148 2: 0.807114 3: -0.414139 4: 1.21114 5: 1.77342 6: -0.520504 7: 0.593397 8: 4.06131 9: -2.30293 Mean: 0.297649 R8VEC_MEAN_GEOMETRIC_TEST R8VEC_MEAN computes the geometric mean of an R8VEC. Input vector: 0: 1.90544 1: 3.01155 2: 4.2047 3: 0.886858 4: 4.3471 5: 4.91919 6: 1.91016 7: 0.869479 8: 4.59441 9: 4.87466 Geometric mean: 2.64909 R8VEC_MEAN_RUNNING_TEST R8VEC_MEAN_RUNNING returns the running means of an R8VEC. Random R8VEC: 0: 0.0809619 1: -0.311039 2: 3.86543 3: 6.65505 4: -4.5247 5: 0.250972 6: 2.04791 7: 0.936388 8: -2.40528 9: 3.66119 Running means: 0: 0 1: 0.0809619 2: -0.115039 3: 1.21178 4: 2.5726 5: 1.15314 6: 1.00278 7: 1.15208 8: 1.12512 9: 0.732855 10: 1.02569 R8VEC_MEAN_UPDATE_TEST R8VEC_MEAN_UPDATE updates the mean of a vector when one more element is added. N R MEAN MEAN_UPDATE 0 0.976875 -nan 0.976875 1 0.990403 0.976875 0.983639 2 0.231943 0.983639 0.733074 3 0.997542 0.733074 0.799191 4 0.815933 0.799191 0.802539 5 0.664458 0.802539 0.779526 6 0.215721 0.779526 0.698982 7 0.500441 0.698982 0.674165 8 0.965463 0.674165 0.706531 9 0.88673 0.706531 0.724551 R8VEC_MEDIAN_TEST For an R8VEC: R8VEC_MEAN: mean value; Input vector: 0: -8.2919 1: 8.78065 2: -7.72817 3: -5.77966 4: -9.55662 5: -0.169875 6: 2.9484 7: -3.76909 8: -0.361288 9: 9.98761 Median: -3.76909 R8VEC_MIDSPACE_NEW_TEST For a R8VEC: R8VEC_MIDSPACE_NEW: evenly spaced midpoints between A and B r8vec_midspace ( 5, 10, 20 ) 0: 11 1: 13 2: 15 3: 17 4: 19 R8VEC_MIN_TEST R8VEC_MIN produces the minimum entry. The array: 0: 0.734593 1: 0.693606 2: 0.66273 3: 0.821294 4: 0.475183 5: 0.667222 6: 0.340959 7: 0.258858 8: 0.934713 9: 0.193041 R8VEC_MIN reports the minimum value is 0.193041. R8VEC_MIN_INDEX_TEST For an R8VEC: R8VEC_MIN_INDEX: index of minimum entry; Input vector: 0: -2.02336 1: 1.03185 2: -3.94411 3: -6.06221 4: -7.88005 5: -0.950243 6: 4.85171 7: 1.82073 8: 7.56091 9: -4.51881 Minimum index: 4 R8VEC_MIRROR_NEXT_TEST R8VEC_MIRROR_NEXT generates all sign variations of a real vector. Next vector: 0: 1 1: 2 2: 3 Next vector: 0: -1 1: 2 2: 3 Next vector: 0: 1 1: -2 2: 3 Next vector: 0: -1 1: -2 2: 3 Next vector: 0: 1 1: 2 2: -3 Next vector: 0: -1 1: 2 2: -3 Next vector: 0: 1 1: -2 2: -3 Next vector: 0: -1 1: -2 2: -3 Done. Next vector: 0: 1 1: 0 2: 3 Next vector: 0: -1 1: 0 2: 3 Next vector: 0: 1 1: -0 2: -3 Next vector: 0: -1 1: -0 2: -3 Done. R8VEC_MIRROR_AB_NEXT_TEST R8VEC_MIRROR_AB_NEXT generates all versions of of a real vector X mirrored by A and B.. Case 1: 3x3x3 possibilities: A: -0.5 -0.5 -0.5 X: 0 0 0 B: 0.5 0.5 0.5 1: -1 -1 -1 2: -1 -1 0 3: -1 -1 1 4: -1 0 -1 5: -1 0 0 6: -1 0 1 7: -1 1 -1 8: -1 1 0 9: -1 1 1 10: 0 -1 -1 11: 0 -1 0 12: 0 -1 1 13: 0 0 -1 14: 0 0 0 15: 0 0 1 16: 0 1 -1 17: 0 1 0 18: 0 1 1 19: 1 -1 -1 20: 1 -1 0 21: 1 -1 1 22: 1 0 -1 23: 1 0 0 24: 1 0 1 25: 1 1 -1 26: 1 1 0 27: 1 1 1 Done. Case 2: 3x2x3 possibilities: A: -0.5 -0.5 -0.5 X: 0 0.5 0 B: 0.5 0.5 0.5 1: -1 -1.5 -1 2: -1 -1.5 0 3: -1 -1.5 1 4: -1 0.5 -1 5: -1 0.5 0 6: -1 0.5 1 7: 0 -1.5 -1 8: 0 -1.5 0 9: 0 -1.5 1 10: 0 0.5 -1 11: 0 0.5 0 12: 0 0.5 1 13: 1 -1.5 -1 14: 1 -1.5 0 15: 1 -1.5 1 16: 1 0.5 -1 17: 1 0.5 0 18: 1 0.5 1 Done. Case 3: 1x3x3 possibilities: A: 0 -0.5 -0.5 X: 0 0 0 B: 0 0.5 0.5 1: 0 -1 -1 2: 0 -1 0 3: 0 -1 1 4: 0 0 -1 5: 0 0 0 6: 0 0 1 7: 0 1 -1 8: 0 1 0 9: 0 1 1 Done. R8VEC_NINT_TEST R8VEC_NINT rounds an R8VEC. Vector A: 0: -1.81783 1: 4.90274 2: 3.09969 3: -2.82427 4: 4.03007 Rounded vector A: 0: -2 1: 5 2: 3 3: -3 4: 4 R8VEC_NORM_TEST R8VEC_NORM computes the L2 norm of an R8VEC. The vector X: 0: 0.439173 1: 0.474129 2: 0.586749 3: 0.201094 4: 0.108676 5: 0.933063 6: 0.853545 7: 0.0577181 8: 0.126459 9: 0.504086 R8VEC_NORM(X) = 1.63914 R8VEC_NORM_AFFINE_TEST R8VEC_NORM_AFFINE computes the L2 norm of the difference of two R8VECs. R8VEC_NORM_AFFINE(X,Y) = 0.705087 R8VEC_NORM(X-Y) = 0.705087 R8VEC_NORM_L0_TEST R8VEC_NORM_L0 computes the L0 'norm' of an R8VEC. Input vector: 0: 1 1: 2 2: -1 3: -1 4: 1 5: 2 6: -1 7: 0 8: -1 9: 1 L0 norm: 9 R8VEC_NORM_L1_TEST R8VEC_NORM_L1 computes the L1 norm of an R8VEC. Input vector: 0: -3.87192 1: 8.58349 2: 2.63095 3: -4.31815 4: -1.33051 5: -8.93735 6: -2.15696 7: 1.55143 8: -2.28069 9: 6.06521 L1 norm: 41.7267 R8VEC_NORM_L2_TEST R8VEC_NORM_L2 computes the L2 norm of an R8VEC. Input vector: 0: -3.13585 1: 5.18312 2: 7.28428 3: -6.88299 4: 6.55515 5: -9.21451 6: -9.56288 7: 7.868 8: 5.35068 9: -7.97515 L2 norm: 22.5964 R8VEC_NORM_LI_TEST R8VEC_NORM_LI computes the Loo norm of an R8VEC. Input vector: 0: -2.21226 1: -3.06994 2: -1.48741 3: 9.43508 4: -5.54492 5: -6.86665 6: 9.42131 7: 7.69556 8: 5.08463 9: -1.27 L-Infinity norm: 9.43508 R8VEC_NORMAL_01_NEW_TEST R8VEC_NORMAL_01 computes a vector of normally distributed random numbers. Test #1: Call 5 times, 1 value each time. 0 0.873924 1 -0.333129 2 -1.26492 3 -1.10992 4 -1.3914 Number of samples was 1000 Minimum value was -2.97501 Maximum value was 3.47196 Average value was -0.0473384 Variance was 0.968962 Expected average = 0.0 Expected variance = 1.0 R8VEC_NORMAL_AB_NEW_TEST R8VEC_NORMAL_AB_NEW returns an R8VEC of random normal values with mean A and variance B. For this problem: A = 15 B = 0.25 Random R8VEC: 0: 15.2831 1: 14.984 2: 15.1347 3: 14.841 4: 15.0171 5: 14.7887 6: 15.683 7: 15.355 8: 15.1748 9: 14.8356 Random R8VEC: 0: 15.4319 1: 15.138 2: 15.1166 3: 14.6475 4: 14.9521 5: 14.9705 6: 15.3359 7: 14.8838 8: 14.9905 9: 14.7193 Random R8VEC: 0: 14.334 1: 15.3011 2: 15.3419 3: 14.8667 4: 14.5365 5: 14.6482 6: 14.8165 7: 14.9191 8: 14.5598 9: 15.1789 R8VEC_NORMALIZE_L1_TEST For an R8VEC: R8VEC_NORMALIZE_L1: make unit sum; Input vector: 0: 5.26847 1: 3.65705 2: -4.06498 3: 3.59614 4: -2.97393 5: 8.4284 6: -4.62568 7: -5.08118 8: 7.91088 9: 3.50049 After calling R8VEC_NORMALIZE_L1: 0: 0.337384 1: 0.234191 2: -0.260314 3: 0.230291 4: -0.190445 5: 0.53974 6: -0.296221 7: -0.32539 8: 0.506599 9: 0.224165 R8VEC_ORDER_TYPE_TEST R8VEC_ORDER_TYPE classifies a real vector as -1: no order 0: all equal; 1: ascending; 2: strictly ascending; 3: descending; 4: strictly descending. The following vector has order type -1. 0: 1 1: 3 2: 2 3: 4 The following vector has order type 0. 0: 2 1: 2 2: 2 3: 2 The following vector has order type 1. 0: 1 1: 2 2: 2 3: 4 The following vector has order type 2. 0: 1 1: 2 2: 3 3: 4 The following vector has order type 3. 0: 4 1: 4 2: 3 3: 1 The following vector has order type 4. 0: 9 1: 7 2: 3 3: 0 R8VEC_PERMUTE_TEST R8VEC_PERMUTE permutes an R8VEC. Original array X[]: 0: 1.1 1: 2.2 2: 3.3 3: 4.4 4: 5.5 Permutation vector P[]: 0: 1 1: 3 2: 4 3: 0 4: 2 Permuted array X[P[]]: 0: 2.2 1: 4.4 2: 5.5 3: 1.1 4: 3.3 R8VEC_PERMUTE_CYLIC_TEST R8VEC_PERMUTE_CYLIC carries out a cylic permutation by K places of an R8VEC. K = 4 Original array X: 0: 1 1: 2 2: 3 3: 4 4: 5 5: 6 6: 7 7: 8 8: 9 9: 10 Array after cyclic permutation: 0: 5 1: 6 2: 7 3: 8 4: 9 5: 10 6: 1 7: 2 8: 3 9: 4 R8VEC_PERMUTE_UNIFORM_TEST R8VEC_PERMUTE_UNIFORM randomly reorders an R8VEC. A, before rearrangement: 0: 101 1: 102 2: 103 3: 104 4: 105 5: 106 6: 107 7: 108 8: 109 9: 110 A, after random permutation: 0: 103 1: 110 2: 109 3: 107 4: 104 5: 106 6: 108 7: 105 8: 101 9: 102 R8VEC_POLARIZE_TEST R8VEC_POLARIZE decomposes an R8VEC into components parallel and normal to a direction. Original vector: 0: 1 1: 2 2: 3 Direction vector: 0: 3 1: 1 2: -2 Normal component: 0: 1.21429 1: 2.07143 2: 2.85714 Parallel component: 0: -0.214286 1: -0.0714286 2: 0.142857 Dot product of P and A_normal (should be 0) 8.88178e-16 Cosine of angle between P and A_parallel (should be 1 or -1) = -1 Sum of components (should equal A): 0: 1 1: 2 2: 3 R8VEC_PRINT_TEST R8VEC_PRINT prints an R8VEC. The R8VEC: 0: 123.456 1: 5e-06 2: -1e+06 3: 3.14159 R8VEC_PRINT_PART_TEST R8VEC_PRINT_PART prints part of an R8VEC. Lines 10:21 of this R8VEC: 10: 10 11: 11 12: 12 13: 13 14: 14 15: 15 16: 16 17: 17 18: 18 19: 19 20: 20 21: 21 R8VEC_PRINT_SOME_TEST R8VEC_PRINT_SOME prints some of an R8VEC. No more than 10 lines of this R8VEC: 0: 1 1: 2 2: 3 3: 4 4: 5 5: 6 6: 7 7: 8 ........ .............. 99: 100 R8VEC_REVERSE_TEST R8VEC_REVERSE reverses an R8VEC. Original array: 0: 1 1: 2 2: 3 3: 4 4: 5 Reversed array: 0: 5 1: 4 2: 3 3: 2 4: 1 R8VEC_ROTATE_TEST R8VEC_ROTATE rotates an R8VEC in place. Rotate entries 2 places to the right. Original array: 0: 1 1: 2 2: 3 3: 4 4: 5 Rotated array: 0: 4 1: 5 2: 1 3: 2 4: 3 R8VEC_RSQUARED_TEST R8VEC_RSQUARED evaluates the R^2 goodness-of-fit statistic. Data and model: 0: 0 0 1: 9.58 9 2: 16.76 16 3: 21.52 21 4: 24.38 24 5: 24.97 25 6: 22.9 24 7: 20.45 21 8: 12.4 16 9: 7.65 9 10: -3.82 0 Computed R^2 is 0.967402 R8VEC_RSQUARED_ADJUSTED_TEST R8VEC_RSQUARED_ADJUSTED evaluates the adjusted R^2 goodness-of-fit statistic. Data and model: 0: 0 0 1: 9.58 9 2: 16.76 16 3: 21.52 21 4: 24.38 24 5: 24.97 25 6: 22.9 24 7: 20.45 21 8: 12.4 16 9: 7.65 9 10: -3.82 0 Computed R^2, adjusted for degree 2, is 0.959253 R8VEC_SCALE_01_TEST R8VEC_SCALE_01 shifts and scales an R8VEC so that it has min 0 and max 1 Vector X: 0: 12.7998 1: -0.660942 2: -3.00135 3: -4.20829 4: 8.69637 5: 12.7346 6: 0.177796 7: 9.06179 8: -0.452701 9: 13.5996 mean(X) = 4.87466 std(X) = 6.77099 max(X) = 13.5996 min(X) = -4.20829 Vector XS: 0: 0.955086 1: 0.199201 2: 0.0677758 3: 0 4: 0.72466 5: 0.951424 6: 0.2463 7: 0.74518 8: 0.210895 9: 1 mean(XS) = 0.510052 std(XS) = 0.380224 max(XS) = 1 min(XS) = 0 R8VEC_SCALE_AB_TEST R8VEC_SCALE_AB_shifts and scales an R8VEC so that it has min A and max B Vector X: 0: 5.04256 1: 12.6604 2: 12.1661 3: -0.459897 4: 1.92362 5: 11.003 6: 10.8838 7: 10.7877 8: 1.19038 9: 7.69152 mean(X) = 7.28892 std(X) = 4.72049 max(X) = 12.6604 min(X) = -0.459897 Using scaling interval [-1,1] Vector XS: 0: -0.161232 1: 1 2: 0.924638 3: -1 4: -0.636668 5: 0.747343 6: 0.729182 7: 0.71453 8: -0.74844 9: 0.242561 mean(XS) = 0.181191 std(XS) = 0.719567 max(XS) = 1 min(XS) = -1 R8VEC_SEARCH_BINARY_A_TEST For ascending order: R8VEC_SEARCH_BINARY_A searches a sorted R8VEC; Sorted vector A: 0: 0.0123171 1: 0.179289 2: 0.226636 3: 0.451554 4: 0.615619 5: 0.635428 6: 0.793032 7: 0.807968 8: 0.901465 9: 0.947483 Search the array for the value 0.793032 SEARCH RESULT: The value occurs in index 7 r8vec_shift_circular_test(): r8vec_shift_circular() performs a circular shift of K positions on an R8VEC. The original array: 1.0 2.0 3.0 4.0 5.0 K: 1 2 3 4 5 -2 3.0 4.0 5.0 1.0 2.0 -1 2.0 3.0 4.0 5.0 1.0 0 1.0 2.0 3.0 4.0 5.0 1 5.0 1.0 2.0 3.0 4.0 2 4.0 5.0 1.0 2.0 3.0 3 3.0 4.0 5.0 1.0 2.0 R8VEC_SIGN3_RUNNING_TEST R8VEC_SIGN3_RUNNING returns the running sign3 of an R8VEC. Random R8VEC: 0: 9.13811 1: 9.37602 2: 3.52304 3: 4.55834 4: 1.33019 5: 7.59442 6: -1.30875 7: 5.18417 8: -0.443388 9: 0.916084 Running sign3: 0: 0 1: 1 2: 1 3: 1 4: 1 5: 1 6: 1 7: 1 8: 1 9: 1 10: 1 r8vec_smooth_test r8vec_smooth smooths an R8VEC. The vector X: 0: 1 1: 2 2: 3 3: 4 4: 5 5: 6 6: 7 7: 8 8: 9 9: 10 Vector X using smoothing S = 2 0: 1 1: 2 2: 3 3: 4 4: 5 5: 6 6: 7 7: 8 8: 9 9: 10 The vector X: 0: 1 1: 4 2: 9 3: 16 4: 25 5: 36 6: 49 7: 64 8: 81 9: 100 Vector X using smoothing S = 1 0: 1 1: 4.66667 2: 9.66667 3: 16.6667 4: 25.6667 5: 36.6667 6: 49.6667 7: 64.6667 8: 81.6667 9: 100 R8VEC_SOFTMAX_TEST(): R8VEC_SOFTMAX evaluates the softmax function of an R8VEC. X, Softmax: 0: -3.48118 0.00676452 1: -1.5134 0.0483986 2: -5.58009 0.000829265 3: 0.405115 0.329636 4: -9.72869 1.30912e-05 5: -7.09615 0.000182085 6: -4.89091 0.00165196 7: -6.61284 0.000295241 8: -4.08112 0.00371266 9: 1.01815 0.608517 R8VEC_SORT_BUBBLE_A_TEST R8VEC_SORT_BUBBLE_A sorts an R8VEC. Unsorted array: 0: 0.362027 1: 0.430141 2: 0.197803 3: 0.663273 4: 0.818686 5: 0.319263 6: 0.497002 7: 0.968478 8: 0.00151774 9: 0.309476 10: 0.952028 11: 0.536362 12: 0.509007 13: 0.0809608 14: 0.585211 15: 0.608737 16: 0.680599 17: 0.71812 18: 0.300777 19: 0.513142 Sorted array: 0: 0.00151774 1: 0.0809608 2: 0.197803 3: 0.300777 4: 0.309476 5: 0.319263 6: 0.362027 7: 0.430141 8: 0.497002 9: 0.509007 10: 0.513142 11: 0.536362 12: 0.585211 13: 0.608737 14: 0.663273 15: 0.680599 16: 0.71812 17: 0.818686 18: 0.952028 19: 0.968478 R8VEC_SORT_HEAP_A_TEST R8VEC_SORT_HEAP_A ascending sorts an R8VEC. Original array: 1: 27.2632 2: 37.5425 3: 15.4292 4: 37.8248 5: 26.4866 6: 7.35895 7: 28.0257 8: 19.8015 9: 43.8518 10: 50.7155 Ascending sorted array: 1: 3.18057 2: 4.86915 3: 6.20742 4: 7.35895 5: 12.7863 6: 15.4292 7: 18.9607 8: 19.8015 9: 21.7507 10: 26.4866 R8VEC_SORT_HEAP_D_TEST R8VEC_SORT_HEAP_D descending sorts an R8VEC. Original array: 1: 32.8371 2: 1.41365 3: 59.5157 4: 58.2919 5: 54.2358 6: 44.129 7: 8.98178 8: 37.8918 9: 48.5651 10: 10.6408 Descending sorted array: 1: 1.41365 2: 59.5157 3: 3.73789 4: 58.2919 5: 44.129 6: 8.98178 7: 37.8918 8: 52.7605 9: 4.80999 10: 11.7075 R8VEC_SORT_HEAP_INDEX_A_NEW_TEST R8VEC_SORT_HEAP_INDEX_A_NEW creates an ascending sort index for an R8VEC. Unsorted array: 0: 57.8362 1: 34.1795 2: 36.1712 3: 19.0644 4: 7.66978 5: 34.6014 6: 43.9127 7: 12.2437 8: 37.5323 9: 20.2242 10: 35.3199 11: 23.9684 12: 51.1165 13: 20.2978 14: 8.32849 15: 32.2585 16: 13.6688 17: 47.8004 18: 22.9421 19: 34.3825 After indexed ascending sort: I INDX(I) A(I) 0 4 57.8362 1 14 34.1795 2 7 36.1712 3 16 19.0644 4 3 7.66978 5 9 34.6014 6 13 43.9127 7 18 12.2437 8 11 37.5323 9 15 20.2242 10 1 35.3199 11 19 23.9684 12 5 51.1165 13 10 20.2978 14 2 8.32849 15 8 32.2585 16 6 13.6688 17 17 47.8004 18 12 22.9421 19 0 34.3825 Now use the index array to carry out the permutation implicitly. INDX(I) A(INDX(I)) 4 7.66978 14 8.32849 7 12.2437 16 13.6688 3 19.0644 9 20.2242 13 20.2978 18 22.9421 11 23.9684 15 32.2585 1 34.1795 19 34.3825 5 34.6014 10 35.3199 2 36.1712 8 37.5323 6 43.9127 17 47.8004 12 51.1165 0 57.8362 Call R8VEC_PERMUTE to carry out the permutation explicitly. I, A(I) 0: 7.66978 1: 8.32849 2: 12.2437 3: 13.6688 4: 19.0644 5: 20.2242 6: 20.2978 7: 22.9421 8: 23.9684 9: 32.2585 10: 34.1795 11: 34.3825 12: 34.6014 13: 35.3199 14: 36.1712 15: 37.5323 16: 43.9127 17: 47.8004 18: 51.1165 19: 57.8362 R8VEC_SORT_HEAP_INDEX_D_NEW_TEST R8VEC_SORT_HEAP_INDEX_D_NEW creates a descending sort index for an R8VEC. After indexed descending sort: I INDX(I) A(I) 0 3 25.7831 1 17 55.3713 2 1 48.3163 3 11 58.3202 4 14 38.9339 5 13 20.2511 6 2 28.1296 7 19 25.6759 8 18 31.977 9 9 39.9689 10 4 33.6988 11 15 55.0569 12 10 2.82235 13 8 48.8791 14 16 52.9766 15 6 35.7131 16 0 30.1615 17 7 55.6082 18 5 44.8086 19 12 46.9312 Now use the index array to carry out the permutation implicitly. INDX(I) ARRAY(INDX(I)) 3 58.3202 17 55.6082 1 55.3713 11 55.0569 14 52.9766 13 48.8791 2 48.3163 19 46.9312 18 44.8086 9 39.9689 4 38.9339 15 35.7131 10 33.6988 8 31.977 16 30.1615 6 28.1296 0 25.7831 7 25.6759 5 20.2511 12 2.82235 R8VEC_SORT_HEAP_MASK_A_TEST R8VEC_SORT_HEAP_MASK_A creates an ascending sort index for a masked R8VEC. Unsorted array: 0: 9.21899 1: 38.9547 2: 26.6927 3: 0.669063 4: 54.1478 5: 30.3846 6: 41.7589 7: 1.77824 8: 2.49772 9: 55.2879 10: 28.7233 11: 52.6648 12: 27.1702 13: 32.5763 14: 35.0157 15: 35.3158 16: 4.90841 17: 57.6841 18: 56.9667 19: 53.4201 The mask array: 0: 1 1: 3 2: 6 3: 7 4: 8 5: 11 6: 12 7: 15 8: 17 9: 18 Masked vector printout: The masked unsorted array: 0 1 38.954681 1 3 0.669063 2 6 41.758933 3 7 1.778240 4 8 2.497721 5 11 52.664848 6 12 27.170155 7 15 35.315779 8 17 57.684081 9 18 56.966749 After masked indexed ascending sort: I, INDX(I), MASK(INDX(I)), A(MASK(INDX(I))) 0 4 8 2.49772 1 8 17 57.6841 2 0 1 38.9547 3 1 3 0.669063 4 5 11 52.6648 5 2 6 41.7589 6 7 15 35.3158 7 3 7 1.77824 8 6 12 27.1702 9 9 18 56.9667 Call I4VEC_PERMUTE to carry out the index permutation explicitly on the MASK vector. The reordered mask array: 0: 8 1: 17 2: 1 3: 3 4: 11 5: 6 6: 15 7: 7 8: 12 9: 18 Masked vector printout: The reordered masked sorted array: 0 8 2.497721 1 17 57.684081 2 1 38.954681 3 3 0.669063 4 11 52.664848 5 6 41.758933 6 15 35.315779 7 7 1.778240 8 12 27.170155 9 18 56.966749 R8VEC_SORT_INSERT_A_TEST R8VEC_SORT_INSERT_A ascending sorts an R8VEC. Unsorted array: 1: 42.5537 2: 51.9399 3: 56.5963 4: 8.15876 5: 21.3683 6: 0.640073 7: 47.8634 8: 52.6345 9: 2.46354 10: 41.7159 Sorted array: 1: 0.640073 2: 2.46354 3: 5.25225 4: 8.15876 5: 17.8375 6: 18.5698 7: 21.3683 8: 30.0612 9: 41.7159 10: 41.8758 R8VEC_SORT_INSERT_INDEX_A_TEST R8VEC_SORT_INSERT_INDEX_A creates an ascending sort index for an R8VEC. Unsorted array: 1: 37.7473 2: 22.568 3: 18.8218 4: 22.5609 5: 0.438063 6: 31.4037 7: 49.7386 8: 24.9403 9: 25.7196 10: 40.1317 After indexed ascending sort: I, INDX(I), A(I) 1 4 37.7473 2 12 22.568 3 18 18.8218 4 13 22.5609 5 17 0.438063 6 10 31.4037 7 2 49.7386 8 3 24.9403 9 1 25.7196 10 7 40.1317 11 8 16.0487 12 5 38.3449 13 16 2.28975 14 0 7.51651 15 11 39.8406 16 15 39.3667 17 14 37.0457 18 9 14.321 19 6 6.18569 20 19 56.0587 Now use the index array to carry out the permutation implicitly. I, INDX(I), A(INDX(I)) 1 4 0.438063 2 12 2.28975 3 18 6.18569 4 13 7.51651 5 17 14.321 6 10 16.0487 7 2 18.8218 8 3 22.5609 9 1 22.568 10 7 24.9403 11 8 25.7196 12 5 31.4037 13 16 37.0457 14 0 37.7473 15 11 38.3449 16 15 39.3667 17 14 39.8406 18 9 40.1317 19 6 49.7386 20 19 56.0587 Call R8VEC_PERMUTE to carry out the permutation explicitly. Permuted data 1: 0.438063 2: 2.28975 3: 6.18569 4: 7.51651 5: 14.321 6: 16.0487 7: 18.8218 8: 22.5609 9: 22.568 10: 24.9403 R8VEC_SORT_QUICK_A_TEST R8VEC_SORT_QUICK_A sorts an R8VEC using quick sort. Unsorted array: 0: 3.86497 1: 5.74157 2: 1.25057 3: 5.89757 4: 3.9367 5: 1.72635 6: 6.55222 7: 2.24264 8: 0.90861 9: 6.36204 10: 1.87218 11: 5.10057 12: 6.66755 13: 8.57972 14: 8.64798 15: 0.767335 16: 0.702075 17: 6.1462 18: 8.84429 19: 4.13714 Sorted array: 0: 0.702075 1: 0.767335 2: 0.90861 3: 1.25057 4: 1.72635 5: 1.87218 6: 2.24264 7: 3.86497 8: 3.9367 9: 4.13714 10: 5.10057 11: 5.74157 12: 5.89757 13: 6.1462 14: 6.36204 15: 6.55222 16: 6.66755 17: 8.57972 18: 8.64798 19: 8.84429 R8VEC_SORTED_MERGE_A_TEST For ascending order: R8VEC_SORTED_MERGE_A merges two sorted R8VEC's; Sorted vector A: 0: 0.144747 1: 0.145874 2: 0.342929 3: 0.346404 4: 0.383127 5: 0.415339 6: 0.426173 7: 0.469858 8: 0.744757 9: 0.891108 Sorted vector B: 0: 0.0570692 1: 0.107375 2: 0.117824 3: 0.291477 4: 0.418575 5: 0.550244 6: 0.667643 7: 0.91702 8: 0.990759 9: 0.992283 Merged vector C: 0: 0.0570692 1: 0.107375 2: 0.117824 3: 0.144747 4: 0.145874 5: 0.291477 6: 0.342929 7: 0.346404 8: 0.383127 9: 0.415339 10: 0.418575 11: 0.426173 12: 0.469858 13: 0.550244 14: 0.667643 15: 0.744757 16: 0.891108 17: 0.91702 18: 0.990759 R8VEC_SORTED_NEAREST_TEST R8VEC_SORTED_NEAREST finds the nearest entry in a sorted R8VEC. Sorted array: 0: 2.01638 1: 4.78914 2: 4.9402 3: 5.24019 4: 5.7125 5: 6.7076 6: 6.98231 7: 7.18238 8: 8.03825 9: 9.76213 Test Nearest Value Index Value 0.273879 1 2.01638 0.0637907 1 2.01638 0.442227 1 2.01638 0.933147 1 2.01638 0.658786 1 2.01638 0.206917 1 2.01638 0.437975 1 2.01638 0.208418 1 2.01638 0.457074 1 2.01638 0.622218 1 2.01638 R8VEC_SORTED_RANGE_TEST R8VEC_SORTED_RANGE seeks the range of indices in a sorted R8VEC so that R_LO <= R(I_LO:I_HI) <= R_HI. Sorted array R: 0: 0.0222854 1: 0.180872 2: 0.187822 3: 0.500622 4: 0.528113 5: 0.558968 6: 0.645376 7: 0.699065 8: 0.776972 9: 0.845878 R_LO 0.451518 3 0.500622 4 0.528113 5 0.558968 6 0.645376 7 0.699065 8 0.776972 9 0.845878 R_HI 0.996430 Sorted array R: 0: 0.0127379 1: 0.299551 2: 0.328032 3: 0.437468 4: 0.469416 5: 0.541869 6: 0.626329 7: 0.65272 8: 0.726799 9: 0.79326 R_LO 0.082811 R_HI 0.279814 Empty range in R. Sorted array R: 0: 0.00193114 1: 0.0639991 2: 0.289782 3: 0.361763 4: 0.57212 5: 0.604262 6: 0.68929 7: 0.74873 8: 0.795208 9: 0.896793 R_LO 0.531098 4 0.572120 5 0.604262 6 0.689290 7 0.748730 8 0.795208 9 0.896793 R_HI 0.928867 Sorted array R: 0: 0.119507 1: 0.385114 2: 0.576641 3: 0.583759 4: 0.617962 5: 0.704078 6: 0.768157 7: 0.773002 8: 0.774559 9: 0.778675 R_LO 0.506866 2 0.576641 3 0.583759 4 0.617962 5 0.704078 6 0.768157 7 0.773002 8 0.774559 9 0.778675 R_HI 0.841047 Sorted array R: 0: 0.281771 1: 0.302329 2: 0.477516 3: 0.689347 4: 0.718018 5: 0.775828 6: 0.871585 7: 0.873526 8: 0.957108 9: 0.967817 R_LO 0.964963 9 0.967817 R_HI 0.988604 R8VEC_SORTED_SPLIT_TEST R8VEC_SORTED_SPLIT splits a sorted R8VEC into entries less than and greater than a splitting value. The sorted array: 0: 0.5 1: 0.5 2: 0.5 3: 0.5 4: 0.5 5: 1.5 6: 2 7: 2.5 8: 2.5 9: 3 10: 3 11: 3 12: 3 13: 3 14: 3.5 15: 3.5 16: 3.5 17: 3.5 18: 3.5 19: 4 20: 4 21: 4 22: 4.5 23: 5 24: 5 Splitting value is 2.75 Lower index I_LT = 9 Upper index I_GT = 10 R8VEC_SORTED_UNDEX_TEST R8VEC_SORTED_UNDEX produces index vectors which create a sorted list of the unique elements of a sorted R8VEC, and a map from the original vector to the (implicit) vector of sorted unique elements. The vector X: 0: 11 1: 11 2: 11 3: 22 4: 22 5: 33 6: 33 7: 55 8: 55 Number of unique entries in X is 4 UNDX can be used to list the unique elements of X in sorted order. I UNDX X(UNDX) 0 0 11 1 3 22 2 5 33 3 7 55 UNDX can be used to created XU, a copy of X containing only the unique elements, in sorted order. I UNDX XU(I) 0 0 11 1 3 22 2 5 33 3 7 55 XDNU can be used to match each element of X with one of the unique elements I XDNU X(I) XU(XDNU(I)) 0 0 11 11 1 0 11 11 2 0 11 11 3 1 22 22 4 1 22 22 5 2 33 33 6 2 33 33 7 3 55 55 8 3 55 55 R8VEC_SORTED_UNIQUE_TEST R8VEC_SORTED_UNIQUE finds unique entries in a sorted R8VEC; Unsorted array: 1: 11 2: 6 3: 1 4: 7 5: 9 6: 12 7: 16 8: 14 9: 10 10: 6 Unique entries 0: 0 1: 1 2: 4 3: 5 4: 6 5: 7 6: 9 7: 10 8: 11 9: 12 10: 13 11: 14 12: 16 13: 19 R8VEC_SORTED_UNIQUE_COUNT_TEST R8VEC_SORTED_UNIQUE_COUNT counts unique entries in a sorted R8VEC; Using a tolerance of 0.25 R8VEC_SORTED_UNIQUE_COUNT counts 30 unique entries in A. R8VEC_SORTED_UNIQUE_HIST_TEST R8VEC_SORTED_UNIQUE_HIST stores the unique entries and their multiplicities. Unsorted array: 0: 20.5 1: 13.5 2: 0.5 3: 4.5 4: 19.5 5: 27.5 6: 29.5 7: 15.5 8: 5.5 9: 0.5 10: 11.5 11: 5.5 12: 10.5 13: 7.5 14: 11.5 15: 0.5 16: 17.5 17: 25.5 18: 18.5 19: 15.5 20: 27.5 21: 8.5 22: 13.5 23: 29.5 24: 5.5 25: 16.5 26: 10.5 27: 3.5 28: 4.5 29: 19.5 Sorted array: 0: 0.5 1: 0.5 2: 0.5 3: 3.5 4: 4.5 5: 4.5 6: 5.5 7: 5.5 8: 5.5 9: 7.5 10: 8.5 11: 10.5 12: 10.5 13: 11.5 14: 11.5 15: 13.5 16: 13.5 17: 15.5 18: 15.5 19: 16.5 20: 17.5 21: 18.5 22: 19.5 23: 19.5 24: 20.5 25: 25.5 26: 27.5 27: 27.5 28: 29.5 29: 29.5 R8VEC_SORTED_UNIQUE_HIST counts 18 unique entries. Value Multiplicity 0 0.5 3 1 3.5 1 2 4.5 2 3 5.5 3 4 7.5 1 5 8.5 1 6 10.5 2 7 11.5 2 8 13.5 2 9 15.5 2 10 16.5 1 11 17.5 1 12 18.5 1 13 19.5 2 14 20.5 1 15 25.5 1 16 27.5 2 17 29.5 2 R8VEC_SPLIT_TEST R8VEC_SPLIT splits an R8VEC into entries less than and greater than a splitting value. The array: 0: 2 1: 5 2: 3.5 3: 4.5 4: 3.5 5: 2 6: 1.5 7: 1.5 8: 2 9: 0.5 10: 2 11: 1.5 12: 5 13: 1.5 14: 1.5 15: 2.5 16: 3 17: 4 18: 3.5 19: 2.5 20: 4 21: 3.5 22: 2 23: 1 24: 5 The split array: 0: 2 1: 1 2: 3.5 3: 2 4: 3.5 5: 2 6: 1.5 7: 1.5 8: 2 9: 0.5 10: 2 11: 1.5 12: 3.5 13: 1.5 14: 1.5 15: 2.5 16: 3 17: 2.5 18: 3.5 19: 4 20: 4 21: 5 22: 4.5 23: 5 24: 5 Array entries <= SPLIT up to index 19 R8VEC_STANDARDIZE_TEST R8VEC_STANDARDIZE shifts and scales an R8VEC so that it has zero mean and unit standard deviation. Vector X: 0: 1.8881 1: 6.18852 2: -0.742117 3: -1.58654 4: 6.36269 5: 5.71732 6: 11.1045 7: -4.38024 8: 13.1489 9: -3.47353 mean(X) = 3.42275 std(X) = 6.04063 max(X) = 13.1489 min(X) = -4.38024 Vector XS: 0: -0.254055 1: 0.45786 2: -0.689476 3: -0.829266 4: 0.486693 5: 0.379855 6: 1.27167 7: -1.29175 8: 1.61012 9: -1.14165 mean(XS) = 0 std(XS) = 1 max(XS) = 1.61012 min(XS) = -1.29175 R8VEC_STD_TEST R8VEC_STD computes the standard deviation of an R8VEC. Input vector: 0: 2.46543 1: -3.67837 2: -3.37612 3: -4.31458 4: 0.998207 5: 3.07299 6: 1.78557 7: -2.32299 8: -1.22845 9: 1.45001 STD: 2.63833 R8VEC_STD_SAMPLE_TEST R8VEC_STD_SAMPLE computes the sample standard deviation of an R8VEC. Input vector: 0: -2.27668 1: 1.06226 2: -2.1482 3: 4.53383 4: 2.66332 5: 0.294123 6: -2.68829 7: 2.40991 8: -3.28713 9: -1.52443 Sample STD: 2.6819 r8vec_std_sample_update_test() r8vec_std_sample_update() updates sample standard deviation of a vector when one more element is added. N R STD STD_UPDATE 1 0.148772 0 0 2 0.917418 0.543515 0.543515 3 0.985697 0.464744 0.464744 4 0.0921147 0.481209 0.481209 5 0.806218 0.433907 0.433907 6 0.427716 0.393716 0.393716 7 0.68387 0.362304 0.362304 8 0.343412 0.345723 0.345723 9 0.75312 0.330361 0.330361 10 0.814724 0.320699 0.320699 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.336673 0 0 2 0.489032 0.0761791 0.0761791 3 0.531233 0.0835646 0.0835646 4 0.226125 0.121778 0.121778 5 0.0834902 0.16573 0.16573 6 0.606508 0.182359 0.182359 7 0.447631 0.170539 0.170539 8 0.449834 0.160802 0.160802 9 0.240112 0.159355 0.159355 10 0.826103 0.202111 0.202111 R8VEC_SUM_TEST R8VEC_SUM computes the sum of an R8VEC. Input vector: 0: 2.03531 1: -4.47681 2: 0.927952 3: 0.0673282 4: 2.4753 5: 3.17617 6: 0.663493 7: 1.91578 8: 0.274918 9: -2.73846 Sum: 4.321 R8VEC_SUM_RUNNING_TEST R8VEC_SUM_RUNNING returns the running sums of an R8VEC. Random R8VEC: 0: 4.78578 1: -2.85074 2: -2.88591 3: 6.7969 4: 5.4517 5: -0.661996 6: 8.65214 7: -0.0248365 8: 0.142469 9: 7.52316 Running sums: 0: 0 1: 4.78578 2: 1.93504 3: -0.950872 4: 5.84603 5: 11.2977 6: 10.6357 7: 19.2879 8: 19.263 9: 19.4055 10: 26.9287 R8VEC_TRANSPOSE_PRINT_TEST R8VEC_TRANSPOSE_PRINT prints an R8VEC "tranposed", that is, placing multiple entries on a line. The vector X: 0.456468 0.43707 0.343742 0.78242 0.130866 0.503023 0.346017 0.475729 0.52621 0.707194 0.620671 0.896691 R8VEC_UNDEX_TEST R8VEC_UNDEX produces index vectors which create a sorted list of the unique elements of an (unsorted) R8VEC, and a map from the original vector to the (implicit) vector of sorted unique elements. The vector X: 0: 33 1: 55 2: 11 3: 11 4: 55 5: 33 6: 22 7: 22 8: 11 Number of unique entries in X is 4 UNDX can be used to list the unique elements of X in sorted order. I UNDX X(UNDX) 0 2 11 1 6 22 2 5 33 3 4 55 UNDX can be used to created XU, a copy of X containing only the unique elements, in sorted order. I UNDX XU(I) 0 2 11 1 6 22 2 5 33 3 4 55 XDNU can be used to match each element of X with one of the unique elements I XDNU X(I) XU(XDNU(I)) 0 2 33 33 1 3 55 55 2 0 11 11 3 0 11 11 4 3 55 55 5 2 33 33 6 1 22 22 7 1 22 22 8 0 11 11 R8VEC_UNIFORM_01_TEST R8VEC_UNIFORM_01 returns a random R8VEC with entries in a given range [ 0.0, 1.0 ] Random R8VEC: 0: 0.495617 1: 0.464298 2: 0.614045 3: 0.267739 4: 0.512828 5: 0.575545 6: 0.90236 7: 0.542674 8: 0.610437 9: 0.313111 Random R8VEC: 0: 0.477435 1: 0.258196 2: 0.934438 3: 0.00752907 4: 0.344242 5: 0.59528 6: 0.964732 7: 0.604777 8: 0.269045 9: 0.187586 Random R8VEC: 0: 0.117321 1: 0.280818 2: 0.539982 3: 0.991783 4: 0.101688 5: 0.767872 6: 0.66616 7: 0.383465 8: 0.534004 9: 0.110613 R8VEC_UNIFORM_01_NEW_TEST R8VEC_UNIFORM_01_NEW returns a random R8VEC with entries in a given range [ 0.0, 1.0 ] Random R8VEC: 0: 0.688259 1: 0.996824 2: 0.77136 3: 0.261696 4: 0.860376 5: 0.824109 6: 0.243044 7: 0.202434 8: 0.812461 9: 0.822915 Random R8VEC: 0: 0.111388 1: 0.172314 2: 0.353421 3: 0.0395571 4: 0.436901 5: 0.47453 6: 0.0311336 7: 0.792161 8: 0.0809568 9: 0.136263 Random R8VEC: 0: 0.646761 1: 0.217883 2: 0.925568 3: 0.212517 4: 0.612367 5: 0.878214 6: 0.0855275 7: 0.579611 8: 0.343817 9: 0.740973 R8VEC_UNIFORM_AB_NEW_TEST R8VEC_UNIFORM_AB_NEW returns a random R8VEC with entries in a given range [ A, B ] For this problem: A = 10 B = 20 Random R8VEC: 0: 12.3616 1: 18.456 2: 15.619 3: 17.7705 4: 19.7304 5: 12.6496 6: 12.1585 7: 13.8677 8: 18.9244 9: 18.6674 Random R8VEC: 0: 17.9261 1: 16.2095 2: 13.567 3: 10.5011 4: 15.9607 5: 16.0389 6: 13.5339 7: 16.5844 8: 15.0203 9: 10.7226 Random R8VEC: 0: 15.251 1: 15.7949 2: 10.6115 3: 15.8978 4: 10.3601 5: 16.3122 6: 12.4518 7: 18.1157 8: 10.3737 9: 13.5306 R8VEC_UNIFORM_UNIT_NEW_TEST(): R8VEC_UNIFORM_UNIT_NEW returns a random R8VEC on the surface of the unit M sphere. Vector: 0: -0.447938 1: 0.315347 2: -0.775341 3: 0.0157687 4: 0.313857 Vector: 0: 0.343192 1: 0.171321 2: 0.215788 3: 0.852596 4: 0.281751 Vector: 0: -0.170825 1: -0.555175 2: 0.773717 3: -0.174327 4: -0.183228 Vector: 0: -0.311408 1: 0.316046 2: 0.835391 3: 0.149974 4: 0.287697 Vector: 0: -0.394492 1: -0.108497 2: -0.046257 3: -0.900797 4: -0.137947 r8vec_variance_test r8vec_variance() computes the variance of an R8VEC. Input vector: 0: 1.6665 1: -3.10084 2: -3.10574 3: 3.75617 4: 2.66319 5: 4.16844 6: -2.95657 7: 4.22618 8: -4.71659 9: -1.32546 Variance: 11.1058 R8VEC_VARIANCE_CIRCULAR_TEST R8VEC_VARIANCE_CIRCULAR computes the circular variance of an R8VEC. Uniform Vector in [-PI,+PI]: 0: -2.52584 1: 1.54291 2: -2.5618 3: -0.567023 4: -1.27078 5: -2.35073 6: -2.05749 7: 3.06258 8: 0.701439 9: 0.0403915 Circular variance = 0.739453 Normal vector, mean 0, variance 1 0: -0.58814 1: -0.135032 2: 0.275602 3: 1.9163 4: -0.162863 5: 0.205738 6: -1.26109 7: 1.49259 8: -0.301186 9: 1.7096 Circular variance = 0.423883 r8vec_variance_sample_test() r8vec_variance_sample() computes the sample variance of an R8VEC. Input vector: 0: 4.55327 1: -1.42351 2: -2.27273 3: 1.87356 4: 2.11397 5: 3.68123 6: 4.00574 7: -3.99052 8: 0.687685 9: -3.64632 Sample variance: 10.2308 r8vec_variance_sample_update_test() r8vec_variance_sample_update() updates the sample variance of a vector when one more element is added. N R VARIANCE VARIANCE_UPDATE 1 0.684854 0 0 2 0.825051 0.00982765 0.00982765 3 0.332107 0.0645132 0.0645132 4 0.664876 0.0436558 0.0436558 5 0.900769 0.0477622 0.0477622 6 0.108824 0.0928754 0.0928754 7 0.682594 0.0787268 0.0787268 8 0.351884 0.0751671 0.0751671 9 0.689601 0.0673908 0.0673908 10 0.748993 0.0626821 0.0626821 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.845505 0 0 2 0.134231 0.126478 0.126478 3 0.556688 0.0853107 0.0853107 4 0.184554 0.0841042 0.0841042 5 0.348175 0.068361 0.068361 6 0.151998 0.0664893 0.0664893 7 0.581816 0.0624747 0.0624747 8 0.12 0.0632663 0.0632663 9 0.922089 0.0868476 0.0868476 10 0.10772 0.0873506 0.0873506 R8VEC2_PRINT_TEST R8VEC2_PRINT prints a pair of R8VEC's. Squares and roots: 0: 15241.4 11.1111 1: 2.5e-11 0.00223607 2: 1e+12 -nan 3: 9.8696 1.77245 4: 0 0 R8VEC2_PRINT_SOME_TEST R8VEC2_PRINT_SOME prints some of a pair of R8VEC's. No more than 10 lines of two vectors: 0: 1 1 1: 4 1.41421 2: 9 1.73205 3: 16 2 4: 25 2.23607 5: 36 2.44949 6: 49 2.64575 7: 64 2.82843 ...... .............. .............. 99: 10000 10 R8VEC2_SORT_A_TEST For a pair of R8VEC's: R8VEC2_SORT_A ascending sorts; The pair of arrays: 0: 1.15773 6.41989 1: 1.28379 5.13061 2: 1.15773 6.41989 3: 1.32871 8.42049 4: 1.82593 8.78579 5: 1.28379 5.13061 6: 1.56372 7.11133 7: 2.83316 5.9639 8: 1.15773 6.41989 9: 1.70788 5.27821 Arrays after ascending sort: 0: 1.15773 6.41989 1: 1.15773 6.41989 2: 1.15773 6.41989 3: 1.28379 5.13061 4: 1.28379 5.13061 5: 1.32871 8.42049 6: 1.56372 7.11133 7: 1.70788 5.27821 8: 1.82593 8.78579 9: 2.83316 5.9639 R8VEC2_SORT_D_TEST For a pair of R8VEC's: R8VEC2_SORT_D descending sorts; The pair of arrays: 0: 2.21228 7.61963 1: 1.92914 5.17557 2: 2.21228 7.61963 3: 1.36745 9.89577 4: 1.14532 9.76647 5: 1.92914 5.17557 6: 2.68648 6.38075 7: 2.8647 5.79175 8: 2.21228 7.61963 9: 1.7193 5.74921 Arrays after descending sort: 0: 2.8647 5.79175 1: 2.68648 6.38075 2: 2.21228 7.61963 3: 2.21228 7.61963 4: 2.21228 7.61963 5: 1.92914 5.17557 6: 1.92914 5.17557 7: 1.7193 5.74921 8: 1.36745 9.89577 9: 1.14532 9.76647 R8VEC2_SORT_HEAP_INDEX_A_TEST R8VEC2_SORT_HEAP_INDEX_A creates a sort index for an (X,Y) array. The unsorted array: I X(I), Y(I) 0 0.2 1 1 0.85 0.55 2 0.4 0.05 3 0.25 0.1 4 0 0.65 5 0.05 0.45 6 0.4 0.75 7 0.8 0 8 0.9 0.35 9 0.05 0 10 0.9 0.85 11 0.1 0 12 0.25 0.95 13 0.1 0.35 14 0.85 0.25 15 0.7 0.55 16 0.9 0.45 17 0.95 0.6 18 0.15 0.75 19 0.4 0.15 After sorting: I INDX(I), X(I), Y(I) 0 4 0.2 1 1 9 0.85 0.55 2 5 0.4 0.05 3 11 0.25 0.1 4 13 0 0.65 5 18 0.05 0.45 6 0 0.4 0.75 7 3 0.8 0 8 12 0.9 0.35 9 2 0.05 0 10 19 0.9 0.85 11 6 0.1 0 12 15 0.25 0.95 13 7 0.1 0.35 14 14 0.85 0.25 15 1 0.7 0.55 16 8 0.9 0.45 17 16 0.95 0.6 18 10 0.15 0.75 19 17 0.4 0.15 Now use the index array to carry out the permutation implicitly. I INDX(I), X(INDX(I)), Y(INDX(I)) 0 4 0 0.65 1 9 0.05 0 2 5 0.05 0.45 3 11 0.1 0 4 13 0.1 0.35 5 18 0.15 0.75 6 0 0.2 1 7 3 0.25 0.1 8 12 0.25 0.95 9 2 0.4 0.05 10 19 0.4 0.15 11 6 0.4 0.75 12 15 0.7 0.55 13 7 0.8 0 14 14 0.85 0.25 15 1 0.85 0.55 16 8 0.9 0.35 17 16 0.9 0.45 18 10 0.9 0.85 19 17 0.95 0.6 R8VEC_PERMUTE carries out the permutation. I X(I), Y(I) 0 0 0.65 1 0.05 0 2 0.05 0.45 3 0.1 0 4 0.1 0.35 5 0.15 0.75 6 0.2 1 7 0.25 0.1 8 0.25 0.95 9 0.4 0.05 10 0.4 0.15 11 0.4 0.75 12 0.7 0.55 13 0.8 0 14 0.85 0.25 15 0.85 0.55 16 0.9 0.35 17 0.9 0.45 18 0.9 0.85 19 0.95 0.6 R8VEC2_SORTED_UNIQUE_TEST For a pair of R8VEC's: R8VEC2_SORTED_UNIQUE counts unique entries. The pair of arrays: 0: 1.26417 5.73031 1: 2.26631 5.03917 2: 1.26417 5.73031 3: 1.1921 7.34775 4: 1.32121 6.06552 5: 2.26631 5.03917 6: 1.98992 6.8759 7: 2.45939 7.37807 8: 1.26417 5.73031 9: 2.76331 7.07934 Arrays after ascending sort: 0: 1.1921 7.34775 1: 1.26417 5.73031 2: 1.26417 5.73031 3: 1.26417 5.73031 4: 1.32121 6.06552 5: 1.98992 6.8759 6: 2.26631 5.03917 7: 2.26631 5.03917 8: 2.45939 7.37807 9: 2.76331 7.07934 UNIQed array: 0: 1.1921 7.34775 1: 1.26417 5.73031 2: 1.32121 6.06552 3: 1.98992 6.8759 4: 2.26631 5.03917 5: 2.45939 7.37807 6: 2.76331 7.07934 R8VEC2_SORTED_UNIQUE_INDEX_TEST For a pair of R8VEC's: R8VEC2_SORTED_UNIQUE_INDEX indexes unique entries. The pair of arrays: 0: 2.39801 5.51371 1: 2.43651 9.26455 2: 2.39801 5.51371 3: 2.72577 9.0961 4: 2.68218 6.05616 5: 2.43651 9.26455 6: 1.76917 5.87921 7: 2.23423 8.72769 8: 2.39801 5.51371 9: 1.56301 5.00915 The number of unique elements is 10 Index of Unique Elements: 0: 1 1: 2 2: 3 3: 4 4: 5 5: 6 6: 7 7: 8 8: 9 9: 10 After Indexed Nonunique Deletion. 0: 2.39801 5.51371 1: 2.43651 9.26455 2: 2.39801 5.51371 3: 2.72577 9.0961 4: 2.68218 6.05616 5: 2.43651 9.26455 6: 1.76917 5.87921 7: 2.23423 8.72769 8: 2.39801 5.51371 9: 1.56301 5.00915 R8VEC2_SUM_MAX_INDEX_TEST For a pair of R8VEC's: R8VEC2_SUM_MAX_INDEX: index of the sum vector with maximum value. The pair of vectors: 0: 5.73921 4.09442 1: 5.90629 3.34555 2: 5.51938 3.8051 3: 2.11049 0.41579 4: 9.40154 2.89012 5: 3.19331 3.50956 6: 6.5026 1.51174 7: 4.25456 0.562289 8: 4.31674 0.259673 9: 1.99903 0.531097 Index of maximum in A+B: 5 r8lib_test(): Normal end of execution. 20 February 2026 12:53:54 AM