Home License -- for personal use only. Not for government, academic, research, commercial, or other organizational use. 13-May-2025 16:58:56 r8lib_test(): MATLAB/Octave version 9.11.0.2358333 (R2021b) Update 7 Test r8lib(). c8_sqrt_r8_test(): c8_sqrt_r8() returns the square root of an R8. R1 C2=C8_SQRT_R8(R1) R3=C2*C2 62.94 ( 7.934, 0) 62.94 81.16 ( 9.009, 0) 81.16 -74.6 ( 0, 8.637) -74.6 82.68 ( 9.093, 0) 82.68 26.47 ( 5.145, 0) 26.47 -80.49 ( 0, 8.972) -80.49 -44.3 ( 0, 6.656) -44.3 9.376 ( 3.062, 0) 9.376 91.5 ( 9.566, 0) 91.5 92.98 ( 9.642, 0) 92.98 i4_log_10_test(): i4_log_10(): whole part of log base 10, X, I4_LOG_10 0 0 1 0 2 0 3 0 9 0 10 1 11 1 99 1 101 2 -1 0 -2 0 -3 0 -9 0 i4_modp_test(): i4_modp() factors a number into a multiple and a remainder. Number Divisor Multiple Remainder 107 50 2 7 107 -50 -2 7 -107 50 -3 43 -107 -50 3 43 Repeat using MOD: 107 50 2 7 107 -50 -3 -43 -107 50 -3 43 -107 -50 2 -7 i4_sign_test(): i4_sign() returns the sign of a number. I4 I4_SIGN(I4) -10 -1 -7 -1 0 1 5 1 9 1 i4int_to_r8int_test(): i4int_to_r8int() converts an I4 to an R8; I4 interval: [1, 11] R8 interval: [100.000000, 200.000000] R I(R) R(I(R)) 105.489701 2 110.000000 211.177062 12 210.000000 209.431703 12 210.000000 148.098834 6 150.000000 189.036461 10 190.000000 103.445224 1 100.000000 139.828967 5 140.000000 204.045618 11 200.000000 187.986953 10 190.000000 209.734015 12 210.000000 ksub_next4_test(): ksub_next4() generates K subsets of an N set. N = 5 K = 3 Rank Subset 1 1 2 3 2 1 2 4 3 1 3 4 4 2 3 4 5 1 2 5 6 1 3 5 7 2 3 5 8 1 4 5 9 2 4 5 10 3 4 5 perm0_check_test(): perm0_check() checks a permutation of 0,...,N-1. Permutation 1: 5 2 3 4 1 PERM0_CHECK - Warning! Permutation is missing the value 0. Permutation 2: 4 1 3 0 2 Permutation 3: 0 2 1 3 2 PERM0_CHECK - Warning! Permutation is missing the value 4. perm0_uniform_test(): perm0_uniform() randomly selects a permutation of 0,...,N-1. 6 1 8 9 2 4 5 0 3 7 1 7 2 4 3 5 9 6 8 0 9 1 5 2 8 4 6 3 7 0 6 7 8 4 2 3 0 1 5 9 9 4 6 1 8 2 3 0 7 5 perm1_check_test(): perm1_check() checks a permutation of 1,...,N. Permutation 1: 5 2 3 4 1 Permutation 2: 4 1 3 0 2 PERM1_CHECK - Warning! Permutation is missing the value 5. Permutation 3: 0 2 1 3 2 PERM1_CHECK - Warning! Permutation is missing the value 4. perm1_uniform_test(): perm1_uniform() randomly selects a permutation of 1,...,N. 10 6 4 5 2 1 8 3 9 7 10 5 4 2 8 3 6 1 7 9 6 10 5 9 4 7 3 8 1 2 6 9 10 4 8 5 7 2 1 3 8 4 7 5 1 3 9 10 2 6 r8_abs_test(): r8_abs() returns the absolute value of an R8. X R8_ABS(X) 0.604333 0.604333 -2.329429 2.329429 -1.168184 1.168184 4.306699 4.306699 -1.780976 1.780976 3.606536 3.606536 1.306739 1.306739 4.969078 4.969078 -2.374596 2.374596 0.541426 0.541426 r8_acos_test(): r8_acos() computes the arc-cosine of an angle. C R8_ACOS(C) ACOS(C) -1.16667 3.14159 -1 3.14159 3.14159 -0.833333 2.55591 2.55591 -0.666667 2.30052 2.30052 -0.5 2.0944 2.0944 -0.333333 1.91063 1.91063 -0.166667 1.73824 1.73824 0 1.5708 1.5708 0.166667 1.40335 1.40335 0.333333 1.23096 1.23096 0.5 1.0472 1.0472 0.666667 0.841069 0.841069 0.833333 0.585686 0.585686 1 0 0 1.16667 0 r8_acosh_test(): r8_acosh() computes the arc-hyperbolic-cosine of an angle. X A=R8_ACOSH(X) COSH(A) 1 0 1 1.5 0.962424 1.5 2 1.31696 2 2.5 1.5668 2.5 3 1.76275 3 3.5 1.92485 3.5 4 2.06344 4 4.5 2.18464 4.5 5 2.29243 5 r8_add_test(): r8_add() adds two R8's. R1 R2 R3 R4 R1+R2 R8_ADD(R1,R2) -393.347 461.898 68.5509 68.5509 -495.366 274.91 -220.455 -220.455 317.303 368.695 685.998 685.998 -415.564 -100.217 -515.782 -515.782 -240.13 300.068 59.9389 59.9389 r8_agm_test(): r8_agm() computes the arithmetic geometric mean. X Y AGM AGM Exact Computed 22.000000 96.000000 52.27464119870424 52.27464119870424 83.000000 56.000000 68.83653005985852 68.83653005985852 42.000000 7.000000 20.65930119673401 20.65930119673401 26.000000 11.000000 17.69685487374365 17.69685487374367 4.000000 63.000000 23.8670497217533 23.8670497217533 6.000000 45.000000 20.71701598280599 20.71701598280599 40.000000 75.000000 56.12784225561668 56.12784225561668 80.000000 0.000000 0 0 90.000000 35.000000 59.26956508122964 59.26956508122989 9.000000 1.000000 3.936235503649555 3.936235503649556 53.000000 53.000000 53 53 1.000000 2.000000 1.456791031046907 1.456791031046907 1.000000 4.000000 2.243028580287603 2.243028580287603 1.000000 8.000000 3.615756177597363 3.615756177597363 r8_aint_test(): r8_aint() returns the integer value of an R8. X R8_AINT(X) 0.451311 0.000000 4.285181 4.000000 -1.545224 -1.000000 -0.889577 -0.000000 -1.835688 -1.000000 -1.911452 -1.000000 3.954338 3.000000 1.637637 1.000000 1.398882 1.000000 -1.840362 -1.000000 r8_asinh_test(): r8_asinh() computes the inverse hyperbolic sine of a given value. X R8_ASINH(X) SINH(R8_SINH(X)) 1.000000 0.881374 1.000000 1.200000 1.015973 1.200000 1.400000 1.137982 1.400000 1.600000 1.248983 1.600000 1.800000 1.350441 1.800000 2.000000 1.443635 2.000000 2.200000 1.529660 2.200000 2.400000 1.609438 2.400000 2.600000 1.683743 2.600000 2.800000 1.753229 2.800000 3.000000 1.818446 3.000000 r8_atan_test(): r8_atan() computes the arc-tangent given Y and X; ATAN2 is the system version of this routine. X Y ATAN2(Y,X) R8_ATAN(Y,X) 1.000000 0.000000 0.000000 0.000000 1.000000 1.000000 0.785398 0.785398 0.000000 1.000000 1.570796 1.570796 -1.000000 1.000000 2.356194 2.356194 -1.000000 0.000000 3.141593 3.141593 -1.000000 -1.000000 -2.356194 3.926991 0.000000 -1.000000 -1.570796 4.712389 1.000000 -1.000000 -0.785398 5.497787 r8_atanh_test(): r8_atanh() computes the inverse hyperbolic tangent of a given value. X R8_ATANH(X) TANH(R8_ATANH(X)) -0.200000 -0.202733 -0.200000 -0.100000 -0.100335 -0.100000 0.000000 0.000000 0.000000 0.100000 0.100335 0.100000 0.200000 0.202733 0.200000 0.300000 0.309520 0.300000 0.400000 0.423649 0.400000 0.500000 0.549306 0.500000 0.600000 0.693147 0.600000 0.700000 0.867301 0.700000 0.800000 1.098612 0.800000 0.900000 1.472219 0.900000 r8_big_test(): r8_big() returns a "big" R8 value; R8_BIG = 1000000000000000019884624838656.000000 r8_cas_test(): r8_cas() evaluates the casine of a number. X R8_CAS ( X ) 0.000000 1.000000 0.261799 1.224745 0.523599 1.366025 0.785398 1.414214 1.047198 1.366025 1.308997 1.224745 1.570796 1.000000 1.832596 0.707107 2.094395 0.366025 2.356194 0.000000 2.617994 -0.366025 2.879793 -0.707107 3.141593 -1.000000 r8_ceiling_test(): r8_ceiling() rounds a value up. X R8_CEILING(X) -1.200000 -1 -1.000000 -1 -0.800000 0 -0.600000 0 -0.400000 0 -0.200000 0 0.000000 0 0.200000 1 0.400000 1 0.600000 1 0.800000 1 1.000000 1 1.200000 2 r8_choose_test(): r8_choose() evaluates C(N,K). N K CNK 0 0 1 1 0 1 1 1 1 2 0 1 2 1 2 2 2 1 3 0 1 3 1 3 3 2 3 3 3 1 4 0 1 4 1 4 4 2 6 4 3 4 4 4 1 5 0 1 5 1 5 5 2 10 5 3 10 5 4 5 5 5 1 r8_chop_test(): r8_chop() truncates a value to N binary digits. Here, we chop values of 3.141593 N X2=R8_CHOP(N,X) abs(X2-X) 1 2.00000000 1.1415927 2 3.00000000 0.14159265 3 3.00000000 0.14159265 4 3.00000000 0.14159265 5 3.12500000 0.016592654 6 3.12500000 0.016592654 7 3.12500000 0.016592654 8 3.14062500 0.00096765359 9 3.14062500 0.00096765359 10 3.14062500 0.00096765359 11 3.14062500 0.00096765359 12 3.14062500 0.00096765359 13 3.14111328 0.00047937234 14 3.14135742 0.00023523171 15 3.14147949 0.0001131614 16 3.14154053 5.2126246e-05 17 3.14157104 2.1608668e-05 18 3.14158630 6.3498789e-06 19 3.14158630 6.3498789e-06 20 3.14159012 2.5351816e-06 21 3.14159203 6.2783296e-07 22 3.14159203 6.2783296e-07 23 3.14159250 1.509958e-07 24 3.14159250 1.509958e-07 25 3.14159262 3.1786509e-08 26 3.14159262 3.1786509e-08 27 3.14159265 1.984187e-09 28 3.14159265 1.984187e-09 29 3.14159265 1.984187e-09 30 3.14159265 1.984187e-09 31 3.14159265 1.2154189e-10 32 3.14159265 1.2154189e-10 r8_cosd_test(): r8_cosd() computes the cosine of an angle given in degrees. ANGLE R8_COSD(ANGLE) 0.00 1 15.00 0.965926 30.00 0.866025 45.00 0.707107 60.00 0.5 75.00 0.258819 90.00 6.12323e-17 105.00 -0.258819 120.00 -0.5 135.00 -0.707107 150.00 -0.866025 165.00 -0.965926 180.00 -1 195.00 -0.965926 210.00 -0.866025 225.00 -0.707107 240.00 -0.5 255.00 -0.258819 270.00 -1.83697e-16 285.00 0.258819 300.00 0.5 315.00 0.707107 330.00 0.866025 345.00 0.965926 360.00 1 r8_cot_test(): r8_cot() computes the cotangent of an angle. ANGLE R8_COT(ANGLE) 0.00 Inf 0.26 3.73205 0.52 1.73205 0.79 1 1.05 0.57735 1.31 0.267949 1.57 6.12323e-17 1.83 -0.267949 2.09 -0.57735 2.36 -1 2.62 -1.73205 2.88 -3.73205 3.14 -Inf 3.40 3.73205 3.67 1.73205 3.93 1 4.19 0.57735 4.45 0.267949 4.71 1.83697e-16 4.97 -0.267949 5.24 -0.57735 5.50 -1 5.76 -1.73205 6.02 -3.73205 6.28 Inf r8_cotd_test(): r8_cotd() computes the cotangent of an angle given in degrees. ANGLE R8_COTD(ANGLE) 0.00 Undefined 15.00 3.73205 30.00 1.73205 45.00 1 60.00 0.57735 75.00 0.267949 90.00 6.12323e-17 105.00 -0.267949 120.00 -0.57735 135.00 -1 150.00 -1.73205 165.00 -3.73205 180.00 Undefined 195.00 3.73205 210.00 1.73205 225.00 1 240.00 0.57735 255.00 0.267949 270.00 1.83697e-16 285.00 -0.267949 300.00 -0.57735 315.00 -1 330.00 -1.73205 345.00 -3.73205 360.00 Undefined r8_csc_test(): r8_csc() computes the cosecant of an angle. ANGLE R8_CSC(ANGLE) 0.00 Inf 0.26 3.8637 0.52 2 0.79 1.41421 1.05 1.1547 1.31 1.03528 1.57 1 1.83 1.03528 2.09 1.1547 2.36 1.41421 2.62 2 2.88 3.8637 3.14 8.16562e+15 3.40 -3.8637 3.67 -2 3.93 -1.41421 4.19 -1.1547 4.45 -1.03528 4.71 -1 4.97 -1.03528 5.24 -1.1547 5.50 -1.41421 5.76 -2 6.02 -3.8637 6.28 -4.08281e+15 r8_cscd_test(): r8_cscd() computes the cosecant of an angle given in degrees. ANGLE R8_CSCD(ANGLE) 0.00 Undefined 15.00 3.8637 30.00 2 45.00 1.41421 60.00 1.1547 75.00 1.03528 90.00 1 105.00 1.03528 120.00 1.1547 135.00 1.41421 150.00 2 165.00 3.8637 180.00 Undefined 195.00 -3.8637 210.00 -2 225.00 -1.41421 240.00 -1.1547 255.00 -1.03528 270.00 -1 285.00 -1.03528 300.00 -1.1547 315.00 -1.41421 330.00 -2 345.00 -3.8637 360.00 Undefined r8_cube_root_test(): r8_cube_root() computes the cube root of an R8. X Y Y^3 7.06062 1.91844 7.06062 2.4411 1.34647 2.4411 -2.98095 -1.43919 -2.98095 0.264991 0.642308 0.264991 -1.96384 -1.25228 -1.96384 -8.48067 -2.03928 -8.48067 -5.20168 -1.73266 -5.20168 -7.53362 -1.96035 -7.53362 -6.32184 -1.84905 -6.32184 -5.20095 -1.73258 -5.20095 r8_days_to_dhms_test(): r8_days_to_dhms() converts a decimal day to days/hours/minutes/seconds. r8_dhms_to_days() converts a days/hours/minutes/seconds date to days. Days D H M S Days 2.0863 2 2 4 19.3738 2.0863 0.2483 0 5 57 30.7139 0.2483 4.5136 4 12 19 33.3595 4.5136 4.7239 4 17 22 28.0660 4.7239 2.4543 2 10 54 13.2879 2.4543 r8_degrees_test(): r8_degrees() converts an angle from radians to degrees; Degrees Radians Degrees -60.000000 -1.047198 -60.000000 -30.000000 -0.523599 -30.000000 0.000000 0.000000 0.000000 30.000000 0.523599 30.000000 60.000000 1.047198 60.000000 90.000000 1.570796 90.000000 120.000000 2.094395 120.000000 150.000000 2.617994 150.000000 180.000000 3.141593 180.000000 210.000000 3.665191 210.000000 240.000000 4.188790 240.000000 270.000000 4.712389 270.000000 300.000000 5.235988 300.000000 330.000000 5.759587 330.000000 360.000000 6.283185 360.000000 390.000000 6.806784 390.000000 420.000000 7.330383 420.000000 r8_dhms_to_days_test(): r8_dhms_to_days() converts a days/hours/minutes/seconds date to days. r8_days_to_dhms() converts a decimal day to days/hours/minutes/seconds. Days D H M S Days 2.4463 2 10 42 37.1398 2.4463 1.6886 1 16 31 34.7850 1.6886 4.5003 4 12 0 23.2617 4.5003 1.8462 1 20 18 34.6094 1.8462 0.5560 0 13 20 39.5903 0.5560 r8_diff_test(): r8_diff() computes a difference X-Y to a given number of binary places. For this test, we use 3 binary places. X Y X-Y R8_DIFF(X,Y) 1.000000 0.062500 0.937500 0.875000 1.000000 0.125000 0.875000 0.875000 1.000000 0.250000 0.750000 0.750000 1.000000 0.500000 0.500000 0.500000 1.000000 0.874000 0.126000 0.125000 1.000000 0.876000 0.124000 0.125000 1.000000 0.900000 0.100000 0.125000 1.000000 0.950000 0.050000 0.000000 1.000000 0.990000 0.010000 0.000000 1.000000 1.000000 0.000000 0.000000 1.000000 1.010000 -0.010000 0.000000 1.000000 1.050000 -0.050000 0.000000 1.000000 1.100000 -0.100000 -0.137500 1.000000 3.000000 -2.000000 -1.875000 1.000000 10.000000 -9.000000 -8.750000 r8_digit_test(): r8_digit() extracts decimal digits. Here, we get digits of 3.141593 -1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 -2 -1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 r8_divide_i4_test(): r8_divide_i4() computes an integer ratio as a real result. I J R8_DIVIDE_I4 I/J 6 -2 -3 -3 -5 -2 2.5 2.5 -8 -8 1 1 9 10 0.9 0.9 2 -9 -0.222222 -0.222222 r8_e_test(): r8_e() returns the value of the exponential base. E = 2.7182818284590451 r8_epsilon_test(): r8_epsilon() produces the R8 roundoff unit. R = R8_EPSILON() = 2.220446e-16 ( 1 + R ) - 1 = 2.220446e-16 ( 1 + (R/2) ) - 1 = 0.000000e+00 r8_epsilon_compute_test(): r8_epsilon_compute() computes the R8 roundoff unit. R = R8_EPSILON_COMPUTE() = 2.220446e-16 ( 1 + R ) - 1 = 2.220446e-16 ( 1 + (R/2) ) - 1 = 0.000000e+00 r8_erf_test(): r8_erf() evaluates the error function. X -> Y = r8_erf(X) -> Z = r8_erf_inv(Y) -0.9 -0.796908 -0.9 -0.8 -0.742101 -0.8 -0.7 -0.677801 -0.7 -0.6 -0.603856 -0.6 -0.5 -0.5205 -0.5 -0.4 -0.428392 -0.4 -0.3 -0.328627 -0.3 -0.2 -0.222703 -0.2 -0.1 -0.112463 -0.1 0 0 0 0.1 0.112463 0.1 0.2 0.222703 0.2 0.3 0.328627 0.3 0.4 0.428392 0.4 0.5 0.5205 0.5 0.6 0.603856 0.6 0.7 0.677801 0.7 0.8 0.742101 0.8 0.9 0.796908 0.9 r8_exp_test(): r8_exp() evaluates the exponential function of R8. It truncates very small or large arguments. X R8_EXP(X) -100 0 -75 0 -50 1.92875e-22 -25 1.38879e-11 -1 0.367879 0 1 1 2.71828 25 7.20049e+10 50 5.18471e+21 75 1e+30 100 1e+30 r8_factorial_test(): r8_factorial() evaluates the factorial function. N Exact Computed 0 1 1 1 1 1 2 2 2 3 6 6 4 24 24 5 120 120 6 720 720 7 5040 5040 8 40320 40320 9 362880 362880 10 3628800 3628800 11 39916800 39916800 12 479001600 479001600 13 6227020800 6227020800 14 87178291200 87178291200 15 1307674368000 1307674368000 16 20922789888000 20922789888000 17 355687428096000 355687428096000 18 6402373705728000 6402373705728000 19 1.21645100408832e+17 1.21645100408832e+17 20 2.43290200817664e+18 2.43290200817664e+18 25 1.551121004333099e+25 1.551121004333099e+25 50 3.041409320171338e+64 3.041409320171338e+64 100 9.332621544394415e+157 9.33262154439441e+157 150 5.713383956445855e+262 5.71338395644585e+262 r8_factorial_stirling_test(): r8_factorial_stirling() computes Stirling's approximate factorial function; N Factorial Factorial Stirling 1 1.00227 1 2 2.00065 2 3 6.0006 6 4 24.001 24 5 120.003 120 6 720.009 720 7 5040.04 5040 8 40320.2 40320 9 362881 362880 10 3.62881e+06 3.6288e+06 11 3.99169e+07 3.99168e+07 12 4.79002e+08 4.79002e+08 13 6.22703e+09 6.22702e+09 14 8.71784e+10 8.71783e+10 15 1.30768e+12 1.30767e+12 16 2.09228e+13 2.09228e+13 17 3.55688e+14 3.55687e+14 18 6.40238e+15 6.40237e+15 19 1.21645e+17 1.21645e+17 20 2.4329e+18 2.4329e+18 r8_factorial2_test(): r8_factorial2() evaluates the double factorial function. N Exact Computed 0 1 1 1 1 1 2 2 2 3 3 3 4 8 8 5 15 15 6 48 48 7 105 105 8 384 384 9 945 945 10 3840 3840 11 10395 10395 12 46080 46080 13 135135 135135 14 645120 645120 15 2027025 2027025 r8_fall_test(): r8_fall() evaluates the falling factorial Fall(X,N). X N Exact Computed 5.0000 4 120 120 5.2500 4 163.16015625 163.16015625 5.5000 4 216.5625 216.5625 5.7500 4 281.66015625 281.66015625 6.0000 4 360 360 7.5000 0 1 1 7.5000 1 7.5 7.5 7.5000 2 48.75 48.75 7.5000 3 268.125 268.125 7.5000 4 1206.5625 1206.5625 7.5000 5 4222.96875 4222.96875 7.5000 6 10557.421875 10557.421875 7.5000 7 15836.1328125 15836.1328125 7.5000 8 7918.06640625 7918.06640625 7.5000 9 -3959.033203125 -3959.033203125 r8_floor_test(): r8_floor() rounds an R8 towards -infinity X R8_FLOOR(X) -1.121761 -2.000000 -0.174731 -1.000000 3.569552 3.000000 -2.876772 -3.000000 -2.655810 -3.000000 -1.648080 -2.000000 2.192924 2.000000 2.853779 2.000000 2.181968 2.000000 0.607390 0.000000 r8_fractional_test(): r8_fractional() returns the fractional part of an R8. X R8_FRACTIONAL(X) 1.376071 0.376071 -0.629434 0.629434 2.957542 0.957542 -1.488360 0.488360 2.494203 0.494203 -1.531911 0.531911 -0.052123 0.052123 2.004948 0.004948 3.241819 0.241819 -2.350994 0.350994 r8_gamma_test(): r8_gamma() evaluates the Gamma function. X GAMMA(X) R8_GAMMA(X) -0.5 -3.544907701811032 -3.544907701811032 -0.01 -100.5871979644108 -100.5871979644108 0.01 99.4325851191506 99.4325851191506 0.1 9.513507698668732 9.513507698668731 0.2 4.590843711998803 4.590843711998803 0.4 2.218159543757688 2.218159543757688 0.5 1.772453850905516 1.772453850905516 0.6 1.489192248812817 1.489192248812817 0.8 1.164229713725303 1.164229713725303 1 1 1 1.1 0.9513507698668732 0.9513507698668732 1.2 0.9181687423997607 0.9181687423997607 1.3 0.8974706963062772 0.8974706963062772 1.4 0.8872638175030753 0.8872638175030754 1.5 0.8862269254527581 0.8862269254527581 1.6 0.8935153492876903 0.8935153492876903 1.7 0.9086387328532904 0.9086387328532904 1.8 0.9313837709802427 0.9313837709802427 1.9 0.9617658319073874 0.9617658319073874 2 1 1 3 2 2 4 6 6 10 362880 362880 20 1.21645100408832e+17 1.216451004088321e+17 30 8.841761993739702e+30 8.841761993739753e+30 r8_gamma_log_test(): r8_gamma_log() evaluates the logarithm of the Gamma function. X GAMMA_LOG(X) R8_GAMMA_LOG(X) 0.2 1.524063822430784 1.524063822430784 0.4 0.7966778177017837 0.7966778177017837 0.6 0.3982338580692348 0.3982338580692349 0.8 0.1520596783998375 0.1520596783998376 1 0 0 1.1 -0.04987244125983972 -0.04987244125983976 1.2 -0.08537409000331583 -0.08537409000331585 1.3 -0.1081748095078604 -0.1081748095078605 1.4 -0.1196129141723712 -0.1196129141723713 1.5 -0.1207822376352452 -0.1207822376352453 1.6 -0.1125917656967557 -0.1125917656967558 1.7 -0.09580769740706586 -0.09580769740706586 1.8 -0.07108387291437215 -0.07108387291437215 1.9 -0.03898427592308333 -0.03898427592308337 2 0 0 3 0.6931471805599453 0.6931471805599454 4 1.791759469228055 1.791759469228055 10 12.80182748008147 12.80182748008147 20 39.33988418719949 39.33988418719949 30 71.25703896716801 71.257038967168 r8_haversine_test(): r8_haversine() computes the haversine of an angle. Degrees Radians Haversine 0.000000 0.000000 0.000000 0.009139 0.523599 0.066987 0.018277 1.047198 0.250000 0.027416 1.570796 0.500000 0.036554 2.094395 0.750000 0.045693 2.617994 0.933013 0.054831 3.141593 1.000000 0.063970 3.665191 0.933013 0.073108 4.188790 0.750000 0.082247 4.712389 0.500000 0.091385 5.235988 0.250000 0.100524 5.759587 0.066987 0.109662 6.283185 0.000000 r8_huge_test(): r8_huge() returns the largest R8 value; R8_HUGE = 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.000000 r8_hypot_test(): r8_hypot() computes sqrt(A^2+B^2) carefully. A B R8_HYPOT Norm sqrt(A^2+B^2) 7.71904e+307 4.95647e+307 9.17334e+307 9.17334e+307 Inf -2.37446e+306 -1.15307e+307 1.17726e+307 1.17726e+307 Inf -9.56665e+306 -3.48124e+307 3.6103e+307 3.6103e+307 Inf 1.5296e+306 1.9364e+306 2.46765e+306 2.46765e+306 Inf 5.70997e+307 5.30016e+307 7.79073e+307 7.79073e+307 Inf r8_is_in_01_test(): r8_is_in_01() is true if an R8 is in [0,1] R8 R8_IS_IN_01?: 0.7376 1 0.3922 1 0.9551 1 0.5927 1 0.3559 1 1.1207 0 1.0387 0 0.6152 1 0.7092 1 0.6632 1 r8_is_inf_test(): r8_is_inf() reports whether an R8 is infinite. R8_IS_INF(1.0) = 0 R8_IS_INF(1.0/0.0) = 1 R8_IS_INF(0.0/0.0) = 0 R8_IS_INF(0^0) = 0 R8_IS_INF(acos(-2)) = 0 R8_IS_INF(exp(1000)) = 1 R8_IS_INF(log(0)) = 1 R8_IS_INF(sqrt(-1)) = 0 r8_is_insignificant_test(): r8_is_insignificant() is true if S is insignicant compared to R. R S R8_IS_INSIGNIFICANT(R,S) 1 100 0 1 10 0 1 1 0 1 0.1 0 1 0.01 0 1 0.001 0 1 0.0001 0 1 1e-05 0 1 1e-06 0 1 1e-07 0 1 1e-08 0 1 1e-09 0 1 1e-10 0 1 1e-11 0 1 1e-12 0 1 1e-13 0 1 1e-14 0 1 1e-15 0 1 1e-16 1 1 1e-17 1 1 1e-18 1 1 1e-19 1 1 1e-20 1 1 1e-21 1 1 1e-22 1 r8_is_integer_test(): r8_is_integer() reports whether an R8 stores an integer value. R8_IS_INTEGER(-1.142857) = 0 R8_IS_INTEGER(-1.000000) = 1 R8_IS_INTEGER(-0.857143) = 0 R8_IS_INTEGER(-0.714286) = 0 R8_IS_INTEGER(-0.571429) = 0 R8_IS_INTEGER(-0.428571) = 0 R8_IS_INTEGER(-0.285714) = 0 R8_IS_INTEGER(-0.142857) = 0 R8_IS_INTEGER(0.000000) = 1 R8_IS_INTEGER(0.142857) = 0 R8_IS_INTEGER(0.285714) = 0 R8_IS_INTEGER(0.428571) = 0 R8_IS_INTEGER(0.571429) = 0 R8_IS_INTEGER(0.714286) = 0 R8_IS_INTEGER(0.857143) = 0 R8_IS_INTEGER(1.000000) = 1 R8_IS_INTEGER(1.142857) = 0 R8_IS_INTEGER(1.285714) = 0 R8_IS_INTEGER(1.428571) = 0 R8_IS_INTEGER(1.571429) = 0 R8_IS_INTEGER(1.714286) = 0 R8_IS_INTEGER(1.857143) = 0 R8_IS_INTEGER(2.000000) = 1 R8_IS_INTEGER(2.142857) = 0 r8_is_nan_test(): r8_is_nan() reports whether an R8 is Not-a-Number. R8_IS_NAN(1.0) = 0 R8_IS_NAN(1.0/0.0) = 0 R8_IS_NAN(0.0/0.0) = 1 R8_IS_NAN(0^0) = 0 R8_IS_NAN(acos(-2)) = 0 R8_IS_NAN(exp(1000)) = 0 R8_IS_NAN(log(0)) = 0 R8_IS_NAN(sqrt(-1)) = 0 r8_log_2_test(): r8_log_2() computes the logarithm base 2. X R8_LOG_2 0.000000 -Inf 1.000000 0.000000 2.000000 1.000000 3.000000 1.584963 9.000000 3.169925 10.000000 3.321928 11.000000 3.459432 99.000000 6.629357 101.000000 6.658211 -1.000000 0.000000 -2.000000 1.000000 -3.000000 1.584963 -9.000000 3.169925 0.500000 -1.000000 0.330000 -1.599462 0.250000 -2.000000 0.200000 -2.321928 0.010000 -6.643856 r8_log_10_test(): r8_log_10() computes the logarithm base 10. X R8_LOG_10 0.000000 -Inf 1.000000 0.000000 2.000000 0.301030 3.000000 0.477121 9.000000 0.954243 10.000000 1.000000 11.000000 1.041393 99.000000 1.995635 101.000000 2.004321 -1.000000 0.000000 -2.000000 0.301030 -3.000000 0.477121 -9.000000 0.954243 0.500000 -0.301030 0.330000 -0.481486 0.250000 -0.602060 0.200000 -0.698970 0.010000 -2.000000 r8_log_b_test(): r8_log_b() computes the logarithm base B. X B R8_LOG_B 16.000000 2.000000 4.000000 16.000000 3.000000 2.523719 16.000000 4.000000 2.000000 16.000000 5.000000 1.722706 16.000000 6.000000 1.547411 16.000000 7.000000 1.424829 16.000000 8.000000 1.333333 16.000000 16.000000 1.000000 16.000000 32.000000 0.800000 16.000000 256.000000 0.500000 r8_mant_test(): r8_mant() decomposes a value. Number to be decomposed: -314.159000 R8_MANT: X = -1 * 1.227184 * 2^ 8 r8_max_test(): r8_max() returns the maximum of two R8's. A B C=R8_MAX(A,B) -2.9226 -1.9875 -1.9875 -0.2908 -2.6951 -0.2908 3.4431 -3.0524 3.4431 -2.7408 -3.2929 -2.7408 -2.7234 -0.6430 -0.6430 -1.8890 4.2338 4.2338 -0.6979 -3.1518 -0.6979 4.0488 4.7975 4.7975 -0.6113 -3.8888 -0.6113 -2.4194 -0.9128 -0.9128 r8_min_test(): r8_min() returns the minimum of two R8's. A B C=R8_MIN(A,B) 0.9490 -2.3779 -2.3779 1.0284 2.1122 1.0284 -2.7825 -3.8258 -3.8258 -2.0332 -1.8122 -2.0332 -0.7583 0.0786 -0.7583 -4.1448 -2.3752 -4.1448 3.0101 -4.7078 -4.7078 4.2885 2.3033 2.3033 -0.1139 0.7853 -0.1139 -2.6272 -0.4115 -2.6272 r8_mod_test(): r8_mod() returns the remainder after division. X Y MOD(X,Y) r8_mod(X,Y) 9.261771 0.936114 0.836741 0.836741 0.422717 -5.368112 -4.945396 0.422717 -0.222045 2.481202 2.259157 -0.222045 3.582711 -2.089696 -0.596681 1.493015 -2.651267 9.759640 7.108373 -2.651267 -9.245223 7.703360 6.161498 -1.541863 8.265737 5.923677 2.342059 2.342059 -8.025754 -4.762576 -3.263178 -3.263178 -3.292863 3.594559 0.301696 -3.292863 -7.268937 4.424550 1.580163 -2.844387 r8_modp_test(): r8_modp() returns the remainder after division. Unlike the MATLAB mod, r8_modp ( X, Y ) is positive. X Y MOD(X,Y) R8_MODP(X,Y) -7.864763 3.075147 1.360678 1.360678 -0.116521 5.581034 5.464513 5.464513 4.300742 8.074411 4.300742 4.300742 7.818450 -3.316739 -2.131767 1.184972 3.974917 -6.043803 -2.068887 3.974917 -9.389181 4.881485 0.373789 0.373789 0.000449 -0.401557 -0.401108 0.000449 8.094445 2.197333 1.502446 1.502446 2.353328 7.188846 2.353328 2.353328 6.109788 1.534430 1.506498 1.506498 r8_mop_test(): r8_mop() evaluates (-1.0)^I4 as an R8. I4 R8_MOP(I4) -64 1.0 -52 1.0 78 1.0 -95 -1.0 -2 1.0 -67 -1.0 96 1.0 43 -1.0 0 1.0 -6 1.0 r8_nint_test(): r8_nint() produces the nearest integer. X R8_NINT(X) -8.807623 -9 3.639438 4 -9.151377 -10 -8.571091 -9 0.432997 1 -8.065399 -9 6.362971 7 6.350942 7 4.448792 5 -7.002691 -8 r8_normal_01_test(): r8_normal_01() generates normally distributed random values. -0.906046 -0.138788 -0.639502 0.590160 1.492895 -1.449418 0.199975 -1.909879 -0.980873 -0.636070 -1.426630 2.872664 1.485620 0.450106 -0.637087 0.276258 -0.184926 -1.433514 1.026768 1.313793 r8_normal_ab_test(): r8_normal_ab() generates normally distributed values with given mean and standard deviation. MEAN = 100 STD = 10 95.316249 91.260291 95.754585 112.883679 100.204000 75.744347 97.561620 87.623437 112.366749 111.856334 93.322530 83.619775 108.774900 101.532443 88.013108 95.825284 99.058039 106.178118 95.589450 108.082476 r8_nth_root_test(): r8_nth_root() computes the nth root of an R8. X -3 -2 -1 0 1 2 3 -3 -0.6934 -0.5774 -0.3333 1 -3 NaN -1.442 -2 -0.7937 -0.7071 -0.5 1 -2 NaN -1.26 -1 -1 -1 -1 1 -1 NaN -1 0 NaN NaN NaN 1 0 0 0 1 1 1 1 1 1 1 1 2 0.7937 0.7071 0.5 1 2 1.414 1.26 3 0.6934 0.5774 0.3333 1 3 1.732 1.442 r8_pi_test(): r8_pi() returns the value of PI. R8_PI = 3.1415926535897931 4 * Atan(1) = 3.1415926535897931 PI = 3.1415926535897931 r8_power_test(): r8_power() computes R^P. R P R8_POWER 2.000000 -5 0.031250 2.000000 -4 0.062500 2.000000 -3 0.125000 2.000000 -2 0.250000 2.000000 -1 0.500000 2.000000 0 1.000000 2.000000 1 2.000000 2.000000 2 4.000000 2.000000 3 8.000000 2.000000 4 16.000000 2.000000 5 32.000000 r8_power_fast_test(): r8_power_fast() computes R^P, economizing on multiplications. R P R^P Mults 2.000000 -10 0.000977 7 2.000000 -9 0.001953 7 2.000000 -8 0.003906 6 2.000000 -7 0.007812 7 2.000000 -6 0.015625 6 2.000000 -5 0.031250 6 2.000000 -4 0.062500 5 2.000000 -3 0.125000 5 2.000000 -2 0.250000 4 2.000000 -1 0.500000 1 2.000000 0 1.000000 0 2.000000 1 2.000000 0 2.000000 2 4.000000 3 2.000000 3 8.000000 4 2.000000 4 16.000000 4 2.000000 5 32.000000 5 2.000000 6 64.000000 5 2.000000 7 128.000000 6 2.000000 8 256.000000 5 2.000000 9 512.000000 6 2.000000 10 1024.000000 6 2.000000 11 2048.000000 7 2.000000 12 4096.000000 6 2.000000 13 8192.000000 7 2.000000 14 16384.000000 7 2.000000 15 32768.000000 8 2.000000 16 65536.000000 6 2.000000 17 131072.000000 7 2.000000 18 262144.000000 7 2.000000 19 524288.000000 8 2.000000 20 1048576.000000 7 2.000000 21 2097152.000000 8 2.000000 22 4194304.000000 8 2.000000 23 8388608.000000 9 2.000000 24 16777216.000000 7 2.000000 25 33554432.000000 8 2.000000 26 67108864.000000 8 2.000000 27 134217728.000000 9 2.000000 28 268435456.000000 8 2.000000 29 536870912.000000 9 2.000000 30 1073741824.000000 9 2.000000 31 2147483648.000000 10 2.000000 32 4294967296.000000 7 2.000000 33 8589934592.000000 8 2.000000 34 17179869184.000000 8 2.000000 35 34359738368.000000 9 2.000000 36 68719476736.000000 8 2.000000 37 137438953472.000000 9 2.000000 38 274877906944.000000 9 2.000000 39 549755813888.000000 10 2.000000 40 1099511627776.000000 8 r8_print_test(): r8_print() prints an R8 with a label. The value of pi is 3.14159 Seven divided by four is 1.75 1234.56 r8_radians_test(): r8_radians() converts an angle from degrees to radians; Degrees Radians Degrees -60.000000 -1.047198 -60.000000 -30.000000 -0.523599 -30.000000 0.000000 0.000000 0.000000 30.000000 0.523599 30.000000 60.000000 1.047198 60.000000 90.000000 1.570796 90.000000 120.000000 2.094395 120.000000 150.000000 2.617994 150.000000 180.000000 3.141593 180.000000 210.000000 3.665191 210.000000 240.000000 4.188790 240.000000 270.000000 4.712389 270.000000 300.000000 5.235988 300.000000 330.000000 5.759587 330.000000 360.000000 6.283185 360.000000 390.000000 6.806784 390.000000 420.000000 7.330383 420.000000 r8_relu_test(): r8_relu() evaluates the ReLU function of an R8. This is max(x,0). X R8_RELU(X) -500 0 -50 0 -5 0 -4 0 -3 0 -2 0 -1 0 -0.5 0 -0.05 0 -0.005 0 -0.0005 0 0 0 0.0005 0.0005 0.005 0.005 0.05 0.05 0.5 0.5 1 1 2 2 3 3 4 4 5 5 50 50 500 500 5000 5000 50000 50000 r8_rise_test(): r8_rise() evaluates the rising factorial Rise(X,N). X N Exact Computed 5.0000 4 1680 1680 5.2500 4 1962.59765625 1962.59765625 5.5000 4 2279.0625 2279.0625 5.7500 4 2631.97265625 2631.97265625 6.0000 4 3024 3024 7.5000 0 1 1 7.5000 1 7.5 7.5 7.5000 2 63.75 63.75 7.5000 3 605.625 605.625 7.5000 4 6359.0625 6359.0625 7.5000 5 73129.21875 73129.21875 7.5000 6 914115.234375 914115.234375 7.5000 7 12340555.6640625 12340555.6640625 7.5000 8 178938057.1289063 178938057.1289062 7.5000 9 2773539885.498047 2773539885.498047 r8_round_test(): r8_round() rounds an R8 X R8_ROUND(X) 4.250465 4.000000 4.037230 4.000000 3.542084 4.000000 -0.914176 -1.000000 1.754850 2.000000 -2.819899 -3.000000 0.402075 0.000000 -0.498249 -0.000000 -1.708122 -2.000000 -1.569871 -2.000000 r8_round2_test(): r8_round2() rounds a number to a specified number of base 2 digits. Test effect on PI: X = 3.141593 NPLACE XROUND 0 0.000000 1 2.000000 2 3.000000 3 3.000000 4 3.000000 5 3.125000 6 3.125000 7 3.125000 8 3.140625 9 3.140625 10 3.140625 11 3.140625 12 3.140625 13 3.141113 14 3.141357 15 3.141479 16 3.141541 17 3.141571 18 3.141586 19 3.141586 20 3.141590 r8_roundb_test(): r8_roundb() rounds a number to a specified number of base BASE digits. Here, we will use BASE = 3 Test effect on PI: X = 3.141593 NPLACE XROUND 0 0.000000 1 3.000000 2 3.000000 3 3.000000 4 3.111111 5 3.111111 6 3.135802 7 3.139918 8 3.141289 9 3.141289 10 3.141442 11 3.141543 12 3.141577 13 3.141589 14 3.141592 15 3.141592 16 3.141593 17 3.141593 18 3.141593 19 3.141593 20 3.141593 Try with a negative base: Input quantity is X = 121.000000 to be rounded in base -3 Output value to 1 places is 81.000000 Output value to 2 places is 108.000000 Output value to 3 places is 117.000000 Output value to 4 places is 120.000000 Output value to 5 places is 121.000000 r8_roundx_test(): r8_roundx() rounds a number to a specified number of decimal digits. Test effect on PI: X = 3.141593 NPLACE XROUND 0 0.000000 1 3.000000 2 3.100000 3 3.140000 4 3.141000 5 3.141500 6 3.141590 7 3.141592 8 3.141593 9 3.141593 10 3.141593 Test effect on random values: NPLACE X XROUND 0 0.422886 0.000000 2 0.422886 0.420000 4 0.422886 0.422800 6 0.422886 0.422885 8 0.422886 0.422886 10 0.422886 0.422886 0 0.094229 0.000000 2 0.094229 0.094000 4 0.094229 0.094220 6 0.094229 0.094229 8 0.094229 0.094229 10 0.094229 0.094229 0 0.598524 0.000000 2 0.598524 0.590000 4 0.598524 0.598500 6 0.598524 0.598523 8 0.598524 0.598524 10 0.598524 0.598524 0 0.470924 0.000000 2 0.470924 0.470000 4 0.470924 0.470900 6 0.470924 0.470924 8 0.470924 0.470924 10 0.470924 0.470924 0 0.695949 0.000000 2 0.695949 0.690000 4 0.695949 0.695900 6 0.695949 0.695949 8 0.695949 0.695949 10 0.695949 0.695949 r8_secd_test(): r8_secd() computes the secant of an angle given in degrees. ANGLE R8_SECD(ANGLE) 0.00 1 15.00 1.03528 30.00 1.1547 45.00 1.41421 60.00 2 75.00 3.8637 90.00 Undefined 105.00 -3.8637 120.00 -2 135.00 -1.41421 150.00 -1.1547 165.00 -1.03528 180.00 -1 195.00 -1.03528 210.00 -1.1547 225.00 -1.41421 240.00 -2 255.00 -3.8637 270.00 Undefined 285.00 3.8637 300.00 2 315.00 1.41421 330.00 1.1547 345.00 1.03528 360.00 1 r8_sech_test(): r8_sech() computes the hyperbolic-secant of an angle. X A=R8_SECH(X) ASECH(A) 1 0.648054 1 1.5 0.425096 1.5 2 0.265802 2 2.5 0.163071 2.5 3 0.0993279 3 3.5 0.0603397 3.5 4 0.036619 4 4.5 0.0222153 4.5 5 0.0134753 5 r8_sigmoid_test(): r8_sigmoid() evaluates the sigmoid function of R8. X R8_SIGMOID(L,B,M,X) -4 0.0179862 -2 0.119203 -1 0.268941 -0.5 0.377541 -0.25 0.437823 0 0.5 0.25 0.562177 0.5 0.622459 1 0.731059 2 0.880797 4 0.982014 r8_sign_test(): r8_sign() returns the sign of an R8. R8 R8_SIGN(R8) -1.250000 -1.000000 -0.250000 -1.000000 0.000000 1.000000 0.500000 1.000000 9.000000 1.000000 r8_sign_char_test(): r8_sign3_char() returns the three-way sign of an R8 as a character. R8 R8_SIGN_CHAR(R8) -1.2500 "-" -0.2500 "-" 0.0000 "0" 0.5000 "+" 9.0000 "+" r8_sign_match_test(): r8_sign_match() returns true if two R8's have matching sign. R1 R2 R8_SIGN_MATCH(R1,R2) -1.00 -1.00 1 -1.00 0.00 1 -1.00 1.00 0 0.00 -1.00 1 0.00 0.00 1 0.00 1.00 1 1.00 -1.00 0 1.00 0.00 1 1.00 1.00 1 r8_sign_match_strict_test(): r8_sign_match_strict() returns true if two R8's have strictly matching sign. R1 R2 R8_SIGN_MATCH_STRICT(R1,R2) -1.00 -1.00 1 -1.00 0.00 0 -1.00 1.00 0 0.00 -1.00 0 0.00 0.00 1 0.00 1.00 0 1.00 -1.00 0 1.00 0.00 0 1.00 1.00 1 r8_sign_opposite_test(): r8_sign_opposite() returns true if two R8's have opposite sign. R1 R2 R8_SIGN_OPPOSITE(R1,R2) -1.00 -1.00 0 -1.00 0.00 1 -1.00 1.00 1 0.00 -1.00 1 0.00 0.00 1 0.00 1.00 1 1.00 -1.00 1 1.00 0.00 1 1.00 1.00 0 r8_sign_opposite_strict_test(): r8_sign_opposite_strict() returns true if two R8's have srictly opposite sign. R1 R2 R8_SIGN_OPPOSITE_STRICT(R1,R2) -1.00 -1.00 0 -1.00 0.00 0 -1.00 1.00 1 0.00 -1.00 0 0.00 0.00 0 0.00 1.00 0 1.00 -1.00 1 1.00 0.00 0 1.00 1.00 0 r8_sign3_test(): r8_sign3() returns the three-way sign of an R8. R8 R8_SIGN3(R8) -1.250000 -1.000000 -0.250000 -1.000000 0.000000 0.000000 0.500000 1.000000 9.000000 1.000000 r8_sincos_sum_test(): r8_sincos_sum() simplifies a linear sine and cosine sum 1.99888 * sin ( -4.66396 * x ) + 1.38531 * cos ( -4.66396 * x ) = 2.43199 * sin ( -4.66396 * x + 0.606041 ) = 2.43199 * cos ( -4.66396 * x + -0.964755 ) I X form 1 form 2 form 3 1 0.000000 1.38531 1.38531 1.38531 2 0.314159 -1.84178 -1.84178 -1.84178 3 0.628319 -1.77346 -1.77346 -1.77346 4 0.942478 1.46802 1.46802 1.46802 5 1.256637 2.08284 2.08284 2.08284 6 1.570796 -1.02907 -1.02907 -1.02907 7 1.884956 -2.29971 -2.29971 -2.29971 8 2.199115 0.544414 0.544414 0.544414 9 2.513274 2.41445 2.41445 2.41445 10 2.827433 -0.0355766 -0.0355766 -0.0355766 11 3.141593 -2.42194 -2.42194 -2.42194 r8_sind_test(): r8_sind() computes the sine of an angle given in degrees. ANGLE R8_SIND(ANGLE) 0.00 0 15.00 0.258819 30.00 0.5 45.00 0.707107 60.00 0.866025 75.00 0.965926 90.00 1 105.00 0.965926 120.00 0.866025 135.00 0.707107 150.00 0.5 165.00 0.258819 180.00 1.22465e-16 195.00 -0.258819 210.00 -0.5 225.00 -0.707107 240.00 -0.866025 255.00 -0.965926 270.00 -1 285.00 -0.965926 300.00 -0.866025 315.00 -0.707107 330.00 -0.5 345.00 -0.258819 360.00 -2.44929e-16 r8_softplus_test(): r8_softplus() evaluates the softplus function of an R8. This is a smoothed version of max(x,0). X R8_SOFTPLUS(X) -500 0 -50 0 -5 0.00671535 -4 0.0181499 -3 0.0485874 -2 0.126928 -1 0.313262 -0.5 0.474077 -0.05 0.66846 -0.005 0.69065 -0.0005 0.692897 0 0.693147 0.0005 0.693397 0.005 0.69565 0.05 0.71846 0.5 0.974077 1 1.31326 2 2.12693 3 3.04859 4 4.01815 5 5.00672 50 50 500 500 5000 5000 50000 50000 r8_sqrt_i4_test(): r8_sqrt_i4() returns the square root of an integer. I1 R2=R8_SQRT_I4(I1) R3=R2*R2 250 15.811388 250 1530 39.115214 1530 2607 51.05879 2607 3238 56.903427 3238 1979 44.485953 1979 4082 63.890531 4082 3564 59.699246 3564 4841 69.577295 4841 2610 51.088159 2610 1558 39.471509 1558 r8_sqrt_pi_test(): r8_sqrt_pi() returns the square root of PI. R8_SQRT_PI = 1.7724538509055161 2 * sqrt ( atan(1) ) = 1.7724538509055159 sqrt ( PI ) = 1.7724538509055159 r8_swap_test(): r8_swap() swaps two reals. Before swapping: X = 1.000000 Y = 3.141590 After swapping: X = 3.141590 Y = 1.000000 r8_swap3_test(): r8_swap3() swaps three reals. Before 1 3.14159 1952: Swap 1: 3.14159 1952 1 Swap 2: 1952 1 3.14159 Swap 3: 1 3.14159 1952 r8_tand_test(): r8_tand() computes the tangent of an angle given in degrees. ANGLE R8_TAND(ANGLE) 0.00 0 15.00 0.267949 30.00 0.57735 45.00 1 60.00 1.73205 75.00 3.73205 90.00 Undefined 105.00 -3.73205 120.00 -1.73205 135.00 -1 150.00 -0.57735 165.00 -0.267949 180.00 -1.22465e-16 195.00 0.267949 210.00 0.57735 225.00 1 240.00 1.73205 255.00 3.73205 270.00 Undefined 285.00 -3.73205 300.00 -1.73205 315.00 -1 330.00 -0.57735 345.00 -0.267949 360.00 -2.44929e-16 r8_tiny_test(): r8_tiny() returns a "tiny" R8 value; R8_TINY = 2.22507e-308 r8_to_i4_test(): r8_to_i4() finds an integer IX in [IXMIN,IXMAX] corresponding to X in [XMIN,XMAX]. XMIN = 2.500000, X = 3.500000, XMAX = 5.500000 IXMIN = 10, IX = 20, IXMAX = 40 r8_to_r8_discrete_test(): r8_to_r8_discrete() maps numbers to a discrete set of equally spaced numbers in an interval. Number of discrete values = 19 Real interval: [1.000000, 10.000000] R RD 0.373180 1.000000 6.942463 7.157895 9.124429 9.052632 4.504888 4.315789 0.180703 1.000000 2.464129 2.421053 0.997537 1.000000 2.653069 2.421053 4.721107 4.789474 5.852856 5.736842 4.946517 4.789474 10.379831 10.000000 5.734677 5.736842 11.267094 10.000000 7.290218 7.157895 r8_uniform_01_test(): r8_uniform_01() produces a sequence of random values. Using random key 123456789 key R8_UNIFORM_01(key) 469049721 0.218418 2053676357 0.956318 1781357515 0.829509 1206231778 0.561695 891865166 0.415307 141988902 0.066119 553144097 0.257578 236130416 0.109957 94122056 0.043829 1361431000 0.633966 Verify that the sequence can be restarted. Set the key back to its original value, and see that we generate the same sequence. key R8_UNIFORM_01(key) 469049721 0.218418 2053676357 0.956318 1781357515 0.829509 1206231778 0.561695 891865166 0.415307 141988902 0.066119 553144097 0.257578 236130416 0.109957 94122056 0.043829 1361431000 0.633966 r8_uniform_ab_test(): r8_uniform_ab() returns random values in a given range: [ A, B ] For this problem: A = 10.000000 B = 20.000000 19.576939 12.407070 16.761223 12.890646 16.718082 16.951405 10.679928 12.547902 12.240400 16.678327 r8_unswap3_test(): r8_unswap3() reverses R8_SWAP3. Before R8_SWAP3: 1 3.14159 1952 After R8_SWAP3 #1: 3.14159 1952 1 After R8_SWAP3 #2: 1952 1 3.14159 After R8_UNSWAP3 #1: 3.14159 1952 1 After R8_UNSWAP3 #2: 1 3.14159 1952 r8_walsh_1d_test(): r8_walsh_1d() evaluates 1D Walsh functions: X W(+2) W(+1) W(0) W(-1) W(-2) W(-3) 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.250000 0.000000 0.000000 0.000000 0.000000 1.000000 0.000000 0.500000 0.000000 0.000000 0.000000 1.000000 0.000000 0.000000 0.750000 0.000000 0.000000 0.000000 1.000000 1.000000 0.000000 1.000000 0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 1.250000 0.000000 0.000000 1.000000 0.000000 1.000000 0.000000 1.500000 0.000000 0.000000 1.000000 1.000000 0.000000 0.000000 1.750000 0.000000 0.000000 1.000000 1.000000 1.000000 0.000000 2.000000 0.000000 1.000000 0.000000 0.000000 0.000000 0.000000 2.250000 0.000000 1.000000 0.000000 0.000000 1.000000 0.000000 2.500000 0.000000 1.000000 0.000000 1.000000 0.000000 0.000000 2.750000 0.000000 1.000000 0.000000 1.000000 1.000000 0.000000 3.000000 0.000000 1.000000 1.000000 0.000000 0.000000 0.000000 3.250000 0.000000 1.000000 1.000000 0.000000 1.000000 0.000000 3.500000 0.000000 1.000000 1.000000 1.000000 0.000000 0.000000 3.750000 0.000000 1.000000 1.000000 1.000000 1.000000 0.000000 4.000000 1.000000 0.000000 0.000000 0.000000 0.000000 0.000000 4.250000 1.000000 0.000000 0.000000 0.000000 1.000000 0.000000 4.500000 1.000000 0.000000 0.000000 1.000000 0.000000 0.000000 4.750000 1.000000 0.000000 0.000000 1.000000 1.000000 0.000000 5.000000 1.000000 0.000000 1.000000 0.000000 0.000000 0.000000 5.250000 1.000000 0.000000 1.000000 0.000000 1.000000 0.000000 5.500000 1.000000 0.000000 1.000000 1.000000 0.000000 0.000000 5.750000 1.000000 0.000000 1.000000 1.000000 1.000000 0.000000 6.000000 1.000000 1.000000 0.000000 0.000000 0.000000 0.000000 6.250000 1.000000 1.000000 0.000000 0.000000 1.000000 0.000000 6.500000 1.000000 1.000000 0.000000 1.000000 0.000000 0.000000 6.750000 1.000000 1.000000 0.000000 1.000000 1.000000 0.000000 7.000000 1.000000 1.000000 1.000000 0.000000 0.000000 0.000000 7.250000 1.000000 1.000000 1.000000 0.000000 1.000000 0.000000 7.500000 1.000000 1.000000 1.000000 1.000000 0.000000 0.000000 7.750000 1.000000 1.000000 1.000000 1.000000 1.000000 0.000000 8.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 r8_wrap_test(): r8_wrap() "wraps" an R8 to lie within an interval: Wrapping interval is 3.000000, 6.500000 R R8_WRAP ( R ) 9.82149 6.32149 2.82247 6.32247 8.92728 5.42728 7.45465 3.95465 -1.90599 5.09401 6.43039 6.43039 3.4148 3.4148 10.8239 3.82388 -1.98389 5.01611 4.47429 4.47429 3.94089 3.94089 4.45283 4.45283 8.78224 5.28224 2.51461 6.01461 8.98635 5.48635 4.599 4.599 -1.49932 5.50068 0.462242 3.96224 8.10461 4.60461 4.6288 4.6288 r82_print_test(): r82_print() prints a pair of R8's with a label. The square roots of 9: : ( 3, -3 ) r82col_print_part_test(): r82col_print_part() prints part of an R82COL. Output with MAX_PRINT = 2 1 11 12 2 21 22 ...more entries... Output with MAX_PRINT = 5 1 11 12 2 21 22 3 31 32 .... .............. .............. 10 101 102 Output with MAX_PRINT = 25 1 11 12 2 21 22 3 31 32 4 41 42 5 51 52 6 61 62 7 71 72 8 81 82 9 91 92 10 101 102 r82row_order_type_test(): r82row_order_type() classifies an R8VEC as -1: no order 0: all equal; 1: ascending; 2: strictly ascending; 3: descending; 4: strictly descending. Order type = 1 1: 0 1 2: 2 1 3: 2 1 4: 3 1 Order type = -1 1: 2 1 2: 1 0 3: 2 2 4: 2 1 Order type = -1 1: 2 2 2: 2 2 3: 3 1 4: 2 1 Order type = -1 1: 0 2 2: 1 1 3: 2 2 4: 1 2 Order type = 2 1: 1 3 2: 2 1 3: 2 2 4: 2 3 Order type = -1 1: 1 1 2: 0 3 3: 2 1 4: 2 2 Order type = -1 1: 2 2 2: 2 2 3: 3 1 4: 0 0 Order type = 2 1: 0 1 2: 1 1 3: 2 2 4: 2 3 Order type = -1 1: 3 1 2: 0 2 3: 0 2 4: 2 3 Order type = -1 1: 1 1 2: 2 2 3: 2 1 4: 0 2 r82row_part_quick_a_test(): r82row_part_quick_a() reorders an R82ROW as part of a quick sort. Before rearrangement: 1: 2.62145 0.444541 2: 7.54933 2.42785 3: 4.42402 6.87796 4: 3.59228 7.3634 5: 3.94707 6.83416 6: 7.04047 4.42305 7: 0.195776 3.30858 8: 4.24309 2.7027 9: 1.97054 8.21721 10: 4.29921 8.87771 11: 3.91183 7.69114 12: 3.96792 8.08514 Rearranged array Left index = 2 Key index = 3 Right index = 4 Left half: 1: 1.97054 8.21721 2: 0.195776 3.30858 Key: 1: 2.62145 0.444541 Right half: 1: 3.94707 6.83416 2: 7.04047 4.42305 3: 3.59228 7.3634 4: 4.24309 2.7027 5: 4.42402 6.87796 6: 4.29921 8.87771 7: 3.91183 7.69114 8: 3.96792 8.08514 9: 7.54933 2.42785 r82row_print_part_test(): r82row_print_part() prints part of an R82ROW. Output with MAX_PRINT = 2 1 11 21 2 12 22 ...more entries... Output with MAX_PRINT = 5 1 11 21 2 12 22 3 13 23 .... .............. .............. 10 20 30 Output with MAX_PRINT = 25 1 11 21 2 12 22 3 13 23 4 14 24 5 15 25 6 16 26 7 17 27 8 18 28 9 19 29 10 20 30 r82row_sort_heap_index_a_test(): r82row_sort_heap_index_a() index sorts an R82ROW using heapsort. Before rearrangement: 1: 7.55077 3.77396 2: 2.16019 1.99863 3: 8.33501 3.27565 4: 3.18524 4.38645 5: 8.33501 7.68854 6: 1.67254 3.77396 7: 8.25584 7.89963 8: 8.84281 5.88026 9: 1.54752 1.99863 10: 4.06955 7.48706 11: 8.25584 7.89963 12: 3.18524 5.34064 I Index A(Index) 1 9 1.547523e+00 1.998628e+00 2 6 1.672535e+00 3.773955e+00 3 2 2.160189e+00 1.998628e+00 4 4 3.185242e+00 4.386450e+00 5 12 3.185242e+00 5.340641e+00 6 10 4.069548e+00 7.487057e+00 7 1 7.550771e+00 3.773955e+00 8 7 8.255838e+00 7.899630e+00 9 11 8.255838e+00 7.899630e+00 10 3 8.335006e+00 3.275654e+00 11 5 8.335006e+00 7.688543e+00 12 8 8.842810e+00 5.880261e+00 After rearrangement by R82ROW_PERMUTE: 1: 1.54752 1.99863 2: 1.67254 3.77396 3: 2.16019 1.99863 4: 3.18524 4.38645 5: 3.18524 5.34064 6: 4.06955 7.48706 7: 7.55077 3.77396 8: 8.25584 7.89963 9: 8.25584 7.89963 10: 8.33501 3.27565 11: 8.33501 7.68854 12: 8.84281 5.88026 r82row_sort_quick_a_test(): r82row_sort_quick_a() sorts an R82ROW using quick sort. Before rearrangement: 1: 0.899507 1.11706 2: 1.36293 0.00522375 3: 0.549741 1.8971 4: 4.79523 1.47608 5: 0.549741 8.50713 6: 5.6056 1.11706 7: 9.8995 5.2768 8: 8.15397 8.79014 9: 9.88912 0.00522375 10: 8.65439 6.12566 11: 9.8995 5.2768 12: 4.79523 8.01348 Sorted array: 1: 0.549741 1.8971 2: 0.549741 8.50713 3: 0.899507 1.11706 4: 1.36293 0.00522375 5: 4.79523 1.47608 6: 4.79523 8.01348 7: 5.6056 1.11706 8: 8.15397 8.79014 9: 8.65439 6.12566 10: 9.88912 0.00522375 11: 9.8995 5.2768 12: 9.8995 5.2768 r82row_uniform_ab_test(): r82row_uniform_ab() computes a random R82ROW. Uniform R82ROW: 1: 12.2784 14.9809 2: 19.0085 15.7466 3: 18.4518 17.3864 4: 15.8599 12.4673 r82vec_order_type_test(): r82vec_order_type() classifies an R8VEC as -1: no order 0: all equal; 1: ascending; 2: strictly ascending; 3: descending; 4: strictly descending. Order type = 2 1: 2 0 2: 2 2 3: 2 3 4: 3 2 Order type = -1 1: 2 3 2: 2 0 3: 0 3 4: 1 3 Order type = -1 1: 1 2 2: 2 0 3: 2 1 4: 0 1 Order type = 1 1: 1 0 2: 1 0 3: 1 0 4: 2 1 Order type = -1 1: 2 2 2: 1 2 3: 1 0 4: 1 3 Order type = -1 1: 3 1 2: 1 2 3: 2 1 4: 1 3 Order type = -1 1: 0 0 2: 0 0 3: 2 2 4: 0 3 Order type = -1 1: 2 2 2: 0 3 3: 3 3 4: 3 2 Order type = -1 1: 2 1 2: 1 0 3: 0 3 4: 1 1 Order type = -1 1: 1 1 2: 2 0 3: 3 2 4: 3 1 r82vec_part_quick_a_test(): r82vec_part_quick_a() reorders an R82VEC as part of a quick sort. Before rearrangement: 1: 4.46027 0.542395 2: 1.77108 6.62808 3: 3.30829 8.98486 4: 1.18155 9.88418 5: 5.39982 7.06917 6: 9.99492 2.87849 7: 4.14523 4.6484 8: 7.63957 8.18204 9: 1.00222 1.78117 10: 3.59635 0.567047 11: 5.21886 3.35849 12: 1.75669 2.08947 Rearranged array Left index = 7 Key index = 8 Right index = 9 Left half: 1: 1.77108 6.62808 2: 3.30829 8.98486 3: 1.18155 9.88418 4: 1.75669 2.08947 5: 3.59635 0.567047 6: 4.14523 4.6484 7: 1.00222 1.78117 Key: 1: 4.46027 0.542395 Right half: 1: 7.63957 8.18204 2: 5.21886 3.35849 3: 9.99492 2.87849 4: 5.39982 7.06917 r82vec_permute_test(): r82vec_permute() permutes an R82VEC. Original array XY[]: 1: 1 11 2: 2 22 3: 3 33 4: 4 44 5: 5 55 Permutation vector P[]: 1: 2 2: 4 3: 5 4: 1 5: 3 Permuted array X[P[]]: 1: 2 22 2: 4 44 3: 5 55 4: 1 11 5: 3 33 r82vec_print_test(): r82vec_print() prints an R82VEC. The R82VEC: 1: 9.05154 6.75391 2: 4.68468 9.12132 3: 1.04012 7.45546 4: 7.36267 5.61861 r82vec_print_part_test(): r82vec_print_part() prints part of an R82VEC. The R82VEC: 1 1.84194 5.97211 2 2.99937 1.34123 3 2.12602 8.94942 4 0.714528 2.42487 5 0.537544 4.41722 6 0.132832 8.97191 7 1.96658 0.933705 8 3.07367 4.56058 .... .............. .............. 100 3.17521 6.5369 r82vec_sort_heap_index_a_test(): r82vec_sort_heap_index_a() index sorts an R82VEC using heapsort. Before rearrangement: 1: 9.56936 9.35731 2: 4.57886 8.94389 3: 1.0592 7.59327 4: 5.40884 7.43688 5: 1.0592 6.8156 6: 4.63261 9.35731 7: 1.5359 9.53457 8: 1.7501 1.6357 9: 6.65987 8.94389 10: 5.16558 7.02702 11: 1.5359 9.53457 12: 5.40884 6.79734 I Index A(Index) 1 5 1.059204e+00 6.815604e+00 2 3 1.059204e+00 7.593274e+00 3 7 1.535904e+00 9.534571e+00 4 11 1.535904e+00 9.534571e+00 5 8 1.750097e+00 1.635699e+00 6 2 4.578863e+00 8.943894e+00 7 6 4.632606e+00 9.357309e+00 8 10 5.165582e+00 7.027023e+00 9 12 5.408841e+00 6.797339e+00 10 4 5.408841e+00 7.436883e+00 11 9 6.659872e+00 8.943894e+00 12 1 9.569359e+00 9.357309e+00 After rearrangement by R82VEC_PERMUTE: 1: 1.0592 6.8156 2: 1.0592 7.59327 3: 1.5359 9.53457 4: 1.5359 9.53457 5: 1.7501 1.6357 6: 4.57886 8.94389 7: 4.63261 9.35731 8: 5.16558 7.02702 9: 5.40884 6.79734 10: 5.40884 7.43688 11: 6.65987 8.94389 12: 9.56936 9.35731 r82vec_sort_quick_a_test(): r82vec_sort_quick_a() sorts an R82VEC using quick sort. Before rearrangement: 1: 0.36563 8.09204 2: 7.48619 7.94658 3: 4.15093 3.25834 4: 2.28669 3.98881 5: 4.15093 1.80738 6: 2.55387 8.09204 7: 2.57614 7.51946 8: 9.32614 1.63512 9: 9.21097 7.94658 10: 5.77394 4.40036 11: 2.57614 7.51946 12: 2.28669 0.641871 Sorted array: 1: 0.36563 8.09204 2: 2.28669 0.641871 3: 2.28669 3.98881 4: 2.55387 8.09204 5: 2.57614 7.51946 6: 2.57614 7.51946 7: 4.15093 1.80738 8: 4.15093 3.25834 9: 5.77394 4.40036 10: 7.48619 7.94658 11: 9.21097 7.94658 12: 9.32614 1.63512 r82vec_uniform_01_test(): r82vec_uniform_01() computes a random R82VEC. Uniform R82VEC: 1: 0.76733 0.671202 2: 0.715213 0.642061 3: 0.419048 0.390762 4: 0.81614 0.317428 r82vec_uniform_ab_test(): r82vec_uniform_ab() computes a random R82VEC in [A,B]. Uniform R82VEC: 1: 8.95994 8.67981 2: 9.3749 5.562 3: 6.99228 10.4598 4: 4.88361 0.660207 r83col_print_part_test(): r83col_print_part() prints part of an R83COL. Output with MAX_PRINT = 2 1 11 12 13 2 21 22 23 ...more entries... Output with MAX_PRINT = 5 1 11 12 13 2 21 22 23 3 31 32 33 .... .............. .............. .............. 10 101 102 103 Output with MAX_PRINT = 25 1 11 12 13 2 21 22 23 3 31 32 33 4 41 42 43 5 51 52 53 6 61 62 63 7 71 72 73 8 81 82 83 9 91 92 93 10 101 102 103 r83row_print_part_test(): r83row_print_part() prints part of an R83ROW. Output with MAX_PRINT = 2 1 11 21 31 2 12 22 32 ...more entries... Output with MAX_PRINT = 5 1 11 21 31 2 12 22 32 3 13 23 33 .... .............. .............. .............. 10 20 30 40 Output with MAX_PRINT = 25 1 11 21 31 2 12 22 32 3 13 23 33 4 14 24 34 5 15 25 35 6 16 26 36 7 17 27 37 8 18 28 38 9 19 29 39 10 20 30 40 r8block_expand_linear_test(): r8block_expand_linear() linearly interpolates new data between old values in a 3D block. Original block: K = 1 1 2 3 1: 1 1 1 2: 2 4 8 3: 3 9 27 4: 4 16 64 K = 2 1 2 3 1: 2 2 2 2: 4 8 16 3: 6 18 54 4: 8 32 128 LFAT = 1 MFAT = 2 NFAT = 1 Fattened block: K = 1 1 2 3 4 5 1: 1 1 1 1 1 2: 1.5 1.83333 2.16667 2.5 3.16667 3: 2 2.66667 3.33333 4 5.33333 4: 2.5 3.83333 5.16667 6.5 10.1667 5: 3 5 7 9 15 6: 3.5 6.5 9.5 12.5 23.5 7: 4 8 12 16 32 6 7 1: 1 1 2: 3.83333 4.5 3: 6.66667 8 4: 13.8333 17.5 5: 21 27 6: 34.5 45.5 7: 48 64 K = 2 1 2 3 4 5 1: 1.5 1.5 1.5 1.5 1.5 2: 2.25 2.75 3.25 3.75 4.75 3: 3 4 5 6 8 4: 3.75 5.75 7.75 9.75 15.25 5: 4.5 7.5 10.5 13.5 22.5 6: 5.25 9.75 14.25 18.75 35.25 7: 6 12 18 24 48 6 7 1: 1.5 1.5 2: 5.75 6.75 3: 10 12 4: 20.75 26.25 5: 31.5 40.5 6: 51.75 68.25 7: 72 96 K = 3 1 2 3 4 5 1: 2 2 2 2 2 2: 3 3.66667 4.33333 5 6.33333 3: 4 5.33333 6.66667 8 10.6667 4: 5 7.66667 10.3333 13 20.3333 5: 6 10 14 18 30 6: 7 13 19 25 47 7: 8 16 24 32 64 6 7 1: 2 2 2: 7.66667 9 3: 13.3333 16 4: 27.6667 35 5: 42 54 6: 69 91 7: 96 128 r8block_print_test(): r8block_print() prints an R8BLOCK. The 3D array: K = 1 1 2 3 1: 1 1 1 2: 2 4 8 3: 3 9 27 4: 4 16 64 K = 2 1 2 3 1: 2 2 2 2: 4 8 16 3: 6 18 54 4: 8 32 128 r8int_to_i4int_test(): r8int_to_i4int() converts an R8 to an I4. I4 interval: [1, 11] R8 interval: [100.000000, 200.000000] R I(R) R(I(R)) 197.677487 11 200.000000 167.054535 8 170.000000 131.159575 4 130.000000 214.610425 12 210.000000 114.142295 2 110.000000 169.818639 8 170.000000 163.648783 7 160.000000 135.341906 5 140.000000 103.484331 1 100.000000 88.267548 0 90.000000 r8mat_add_test(): r8mat_add() computes C = alpha * A + beta * B for R8MAT's. A: Col: 1 2 3 4 Row 1 : 11 12 13 14 2 : 21 22 23 24 3 : 31 32 33 34 4 : 41 42 43 44 B: Col: 1 2 3 4 Row 1 : 11 21 31 41 2 : 12 22 32 42 3 : 13 23 33 43 4 : 14 24 34 44 ALPHA = 3, BETA = 0.5 C = alpha * A + beta * B: Col: 1 2 3 4 Row 1 : 38.5 46.5 54.5 62.5 2 : 69 77 85 93 3 : 99.5 107.5 115.5 123.5 4 : 130 138 146 154 r8mat_amax_test(): r8mat_amax() computes the maximum absolute value; Random array: Col: 1 2 3 Row 1 : -1.57775 4.68459 8.49162 2 : -6.31799 1.42052 -5.52459 3 : 4.51551 -6.4629 -2.52872 4 : -2.59275 9.14768 -8.24999 5 : 6.8312 -4.69356 2.80233 Maximum value = 9.147680 r8mat_border_add_test(): r8mat_border_add() adds a zero border to a matrix. Matrix A: Col: 1 2 3 Row 1 : 1 2 3 2 : 0 2 1 3 : 0 4 3 4 : 5 6 7 Matrix A + border: Col: 1 2 3 4 5 Row 1 : 0 0 0 0 0 2 : 0 1 2 3 0 3 : 0 0 2 1 0 4 : 0 0 4 3 0 5 : 0 5 6 7 0 6 : 0 0 0 0 0 r8mat_border_cut_test(): r8mat_border_cut() cuts the border from a matrix. Matrix A: Col: 1 2 3 4 Row 1 : 11 12 13 14 2 : 21 22 23 24 3 : 31 32 33 34 4 : 41 42 43 44 5 : 51 52 53 54 Matrix A - border: Col: 1 2 Row 1 : 22 23 2 : 32 33 3 : 42 43 r8mat_cholesky_factor_test(): r8mat_cholesky_factor() determines the lower triangular Cholesky factorization of a positive definite symmetric matrix, Matrix to be factored: Col: 1 2 3 4 5 Row 1 : 2 -1 0 0 0 2 : -1 2 -1 0 0 3 : 0 -1 2 -1 0 4 : 0 0 -1 2 -1 5 : 0 0 0 -1 2 Cholesky factor L: Col: 1 2 3 4 5 Row 1 : 1.41421 0 0 0 0 2 : -0.707107 1.22474 0 0 0 3 : 0 -0.816497 1.1547 0 0 4 : 0 0 -0.866025 1.11803 0 5 : 0 0 0 -0.894427 1.09545 Product L * L': Col: 1 2 3 4 5 Row 1 : 2 -1 0 0 0 2 : -1 2 -1 0 0 3 : 0 -1 2 -1 0 4 : 0 0 -1 2 -1 5 : 0 0 0 -1 2 r8mat_cholesky_factor_upper_test(): r8mat_cholesky_factor_upper() determines the upper triangular Cholesky factorization of a positive definite symmetric matrix, Matrix to be factored: Col: 1 2 3 4 5 Row 1 : 2 -1 0 0 0 2 : -1 2 -1 0 0 3 : 0 -1 2 -1 0 4 : 0 0 -1 2 -1 5 : 0 0 0 -1 2 Cholesky factor R: Col: 1 2 3 4 5 Row 1 : 1.41421 -0.707107 0 0 0 2 : 0 1.22474 -0.816497 0 0 3 : 0 0 1.1547 -0.866025 0 4 : 0 0 0 1.11803 -0.894427 5 : 0 0 0 0 1.09545 Product R'*R: Col: 1 2 3 4 5 Row 1 : 2 -1 0 0 0 2 : -1 2 -1 0 0 3 : 0 -1 2 -1 0 4 : 0 0 -1 2 -1 5 : 0 0 0 -1 2 r8mat_cholesky_inverse_test(): r8mat_cholesky_inverse() computes the inverse of a symmetric positive definite matrix. Matrix to be inverted: Col: 1 2 3 4 5 Row 1 : 2 -1 0 0 0 2 : -1 2 -1 0 0 3 : 0 -1 2 -1 0 4 : 0 0 -1 2 -1 5 : 0 0 0 -1 2 Inverse matrix: Col: 1 2 3 4 5 Row 1 : 0.833333 0.666667 0.5 0.333333 0.166667 2 : 0.666667 1.33333 1 0.666667 0.333333 3 : 0.5 1 1.5 1 0.5 4 : 0.333333 0.666667 1 1.33333 0.666667 5 : 0.166667 0.333333 0.5 0.666667 0.833333 Product inv(A) * A: Col: 1 2 3 4 5 Row 1 : 1 2.22045e-16 0 -1.11022e-16 0 2 :-6.66134e-16 1 2.22045e-16 -1.66533e-16 -1.11022e-16 3 :-6.66134e-16 1.11022e-15 1 -2.22045e-16 0 4 :-4.44089e-16 6.66134e-16 0 1 0 5 :-1.66533e-16 2.22045e-16 0 -2.22045e-16 1 r8mat_cholesky_solve_test(): r8mat_cholesky_solve() solves a linear system using the lower Cholesky factorization. Matrix to be factored: Col: 1 2 3 4 5 Row 1 : 2 -1 0 0 0 2 : -1 2 -1 0 0 3 : 0 -1 2 -1 0 4 : 0 0 -1 2 -1 5 : 0 0 0 -1 2 Cholesky factor L: Col: 1 2 3 4 5 Row 1 : 1.41421 0 0 0 0 2 : -0.707107 1.22474 0 0 0 3 : 0 -0.816497 1.1547 0 0 4 : 0 0 -0.866025 1.11803 0 5 : 0 0 0 -0.894427 1.09545 Product L * L': Col: 1 2 3 4 5 Row 1 : 2 -1 0 0 0 2 : -1 2 -1 0 0 3 : 0 -1 2 -1 0 4 : 0 0 -1 2 -1 5 : 0 0 0 -1 2 Right hand side: 1: 0 2: 0 3: 0 4: 0 5: 6 Computed solution: 1: 1 2: 2 3: 3 4: 4 5: 5 r8mat_cholesky_solve_upper_test(): r8mat_cholesky_solve_upper() solves a linear system using the upper Cholesky factorization. Matrix to be factored: Col: 1 2 3 4 5 Row 1 : 2 -1 0 0 0 2 : -1 2 -1 0 0 3 : 0 -1 2 -1 0 4 : 0 0 -1 2 -1 5 : 0 0 0 -1 2 Cholesky factor R: Col: 1 2 3 4 5 Row 1 : 1.41421 -0.707107 0 0 0 2 : 0 1.22474 -0.816497 0 0 3 : 0 0 1.1547 -0.866025 0 4 : 0 0 0 1.11803 -0.894427 5 : 0 0 0 0 1.09545 Product R' * R: Col: 1 2 3 4 5 Row 1 : 2 -1 0 0 0 2 : -1 2 -1 0 0 3 : 0 -1 2 -1 0 4 : 0 0 -1 2 -1 5 : 0 0 0 -1 2 Right hand side: 1: 0 2: 0 3: 0 4: 0 5: 6 Computed solution: 1: 1 2: 2 3: 3 4: 4 5: 5 r8mat_covariance_test(): r8mat_covariance() computes the covariance. Array of M vectors of length N: Col: 1 2 3 4 5 Row 1 : 1.80617 6.60617 9.1057 3.83306 2.7507 2 : 0.450511 3.83869 8.00559 6.17279 2.48629 3 : 7.23173 6.27347 7.45847 5.75495 4.51639 4 : 3.47438 0.216498 8.13113 5.30052 2.27713 MxM covariance matrix: Col: 1 2 3 4 Row 1 : 8.97421 7.14094 1.58456 3.70319 2 : 7.14094 8.875 0.725903 6.14296 3 : 1.58456 0.725903 1.4188 1.68218 4 : 3.70319 6.14296 1.68218 9.06123 r8mat_det_2d_test(): r8mat_det_2d(): determinant of a 2 by 2 matrix; Matrix: Col: 1 2 Row 1 : 1 1 2 : 1 10 R8MAT_DET_2D computes determinant: 9.000000 Exact determinant is 9.000000 r8mat_det_3d_test(): r8mat_det_3d(): determinant of a 3 by 3 matrix; Matrix: Col: 1 2 3 Row 1 : 1 1 1 2 : 1 10 100 3 : 1 4 16 R8MAT_DET_3D computes determinant: -162.000000 Exact determinant is -162.000000 r8mat_det_4d_test(): r8mat_det_4d() determinant of a 4 by 4 matrix; Matrix: Col: 1 2 3 4 Row 1 : 1 1 1 1 2 : 1 10 100 1000 3 : 1 4 16 64 4 : 1 2 4 8 R8MAT_DET_4D computes determinant: -2592.000000 Exact determinant is -2592.000000 r8mat_det_5d_test(): r8mat_det_5d(): determinant of 5 by 5 matrix. Matrix: Col: 1 2 3 4 5 Row 1 : 1 1 1 1 1 2 : 1 10 100 1000 10000 3 : 1 4 16 64 256 4 : 1 2 4 8 16 5 : 1 3 9 27 81 R8MAT_DET_5D computes determinant: -36288.000000 Exact determinant is -36288.000000 r8mat_diag_add_scalar_test(): r8mat_diag_add_scalar() adds a scalar to each diagonal entry of an R8MAT. Initial matrix A: Col: 1 2 3 4 5 Row 1 : 11 12 13 14 15 2 : 21 22 23 24 25 3 : 31 32 33 34 35 4 : 41 42 43 44 45 5 : 51 52 53 54 55 Using scalar S = 7 A + s*I: Col: 1 2 3 4 5 Row 1 : 18 12 13 14 15 2 : 21 29 23 24 25 3 : 31 32 40 34 35 4 : 41 42 43 51 45 5 : 51 52 53 54 62 r8mat_diag_add_vector_test(): r8mat_diag_add_vector() adds a vector to the diagonal of an R8MAT. Initial matrix A: Col: 1 2 3 4 5 Row 1 : 11 12 13 14 15 2 : 21 22 23 24 25 3 : 31 32 33 34 35 4 : 41 42 43 44 45 5 : 51 52 53 54 55 Vector to add to diagonal: 1: 0.80445 2: 0.986104 3: 0.029992 4: 0.535664 5: 0.0870772 A + V: Col: 1 2 3 4 5 Row 1 : 11.8044 12 13 14 15 2 : 21 22.9861 23 24 25 3 : 31 32 33.03 34 35 4 : 41 42 43 44.5357 45 5 : 51 52 53 54 55.0871 r8mat_diag_get_vector_test(): r8mat_diag_get_vector() gets a vector of the diagonal entries of an R8MAT. Initial matrix A: Col: 1 2 3 4 5 Row 1 : 11 12 13 14 15 2 : 21 22 23 24 25 3 : 31 32 33 34 35 4 : 41 42 43 44 45 5 : 51 52 53 54 55 Diagonal vector: 1: 11 2: 22 3: 33 4: 44 5: 55 r8mat_diag_set_scalar_test(): r8mat_diag_set_scalar() sets the diagonal etnries of an R8MAT to a given scalar. Initial matrix A: Col: 1 2 3 4 5 Row 1 : 11 12 13 14 15 2 : 21 22 23 24 25 3 : 31 32 33 34 35 4 : 41 42 43 44 45 5 : 51 52 53 54 55 Scalar value for diagonal is 123.45 A with new diagonal: Col: 1 2 3 4 5 Row 1 : 123.45 12 13 14 15 2 : 21 123.45 23 24 25 3 : 31 32 123.45 34 35 4 : 41 42 43 123.45 45 5 : 51 52 53 54 123.45 r8mat_diag_set_vector_test(): r8mat_diag_set_vector() sets the diagonal etnries of an R8MAT to a given vector. Initial matrix A: Col: 1 2 3 4 5 Row 1 : 11 12 13 14 15 2 : 21 22 23 24 25 3 : 31 32 33 34 35 4 : 41 42 43 44 45 5 : 51 52 53 54 55 Vector to add to diagonal: 1: 0.802091 2: 0.989145 3: 0.0669463 4: 0.939398 5: 0.0181775 A with new diagonal: Col: 1 2 3 4 5 Row 1 : 0.802091 12 13 14 15 2 : 21 0.989145 23 24 25 3 : 31 32 0.0669463 34 35 4 : 41 42 43 0.939398 45 5 : 51 52 53 54 0.0181775 r8mat_diagonal_test(): r8mat_diagonal() returns a matrix with given diagonal. Desired diagonal entriesss: 1: 11 2: 22 3: 33 4: 44 Matrix with given diagonal: Col: 1 2 3 4 Row 1 : 11 0 0 0 2 : 0 22 0 0 3 : 0 0 33 0 4 : 0 0 0 44 r8mat_expand_linear_test(): r8mat_expand_linear() linearly interpolates new data between old values in a matrix. Original matrix: Col: 1 2 3 Row 1 : 1 1 1 2 : 2 4 8 3 : 3 9 27 4 : 4 16 64 MFAT = 2 NFAT = 1 Fattened matrix: Col: 1 2 3 4 5 Row 1 : 1 1 1 1 1 2 : 1.33333 1.66667 2 2.66667 3.33333 3 : 1.66667 2.33333 3 4.33333 5.66667 4 : 2 3 4 6 8 5 : 2.33333 4 5.66667 10 14.3333 6 : 2.66667 5 7.33333 14 20.6667 7 : 3 6 9 18 27 8 : 3.33333 7.33333 11.3333 25.3333 39.3333 9 : 3.66667 8.66667 13.6667 32.6667 51.6667 10 : 4 10 16 40 64 r8mat_expand_linear2_test(): r8mat_expand_linear2() fills in a large array by interpolating data from a small array. Original matrix has dimensions: M = 3, N = 2 Expanded matrix has dimensions: M2 = 10, N2 = 5 The little matrix A: Col: 1 2 Row 1 : 11 12 2 : 21 22 3 : 31 32 Expanded array A2: Col: 1 2 3 4 5 Row 1 : 11 11.25 11.5 11.75 12 2 : 13.2222 13.4722 13.7222 13.9722 14.2222 3 : 15.4444 15.6944 15.9444 16.1944 16.4444 4 : 17.6667 17.9167 18.1667 18.4167 18.6667 5 : 19.8889 20.1389 20.3889 20.6389 20.8889 6 : 22.1111 22.3611 22.6111 22.8611 23.1111 7 : 24.3333 24.5833 24.8333 25.0833 25.3333 8 : 26.5556 26.8056 27.0556 27.3056 27.5556 9 : 28.7778 29.0278 29.2778 29.5278 29.7778 10 : 31 31.25 31.5 31.75 32 r8mat_flip_cols_test(): r8mat_flip_cols() "flips" the columns of a matrix; Matrix A: Col: 1 2 3 Row 1 : 11 12 13 2 : 21 22 23 3 : 31 32 33 4 : 41 42 43 5 : 51 52 53 Matrix after column flipping: Col: 1 2 3 Row 1 : 13 12 11 2 : 23 22 21 3 : 33 32 31 4 : 43 42 41 5 : 53 52 51 r8mat_flip_rows_test(): r8mat_flip_rows() "flips" the rows of a matrix; Matrix A: Col: 1 2 3 Row 1 : 11 12 13 2 : 21 22 23 3 : 31 32 33 4 : 41 42 43 5 : 51 52 53 Matrix after row flipping: Col: 1 2 3 Row 1 : 51 52 53 2 : 41 42 43 3 : 31 32 33 4 : 21 22 23 5 : 11 12 13 r8mat_fs_test(): r8mat_fs() factors and solves a linear system. Matrix order N = 10 Solution: 1: 1 2: 2 3: 3 4: 4 5: 5 6: 6 7: 7 8: 8 9: 9 10: 10 r8mat_fss_test(): r8mat_fss() factors and solves multiple linear systems. Matrix order N = 10 Solution: Col: 1 2 3 Row 1 : 1 1 1 2 : 1 2 2 3 : 1 3 3 4 : 1 4 1 5 : 1 5 2 6 : 1 6 3 7 : 1 7 1 8 : 1 8 2 9 : 1 9 3 10 : 1 10 1 r8mat_givens_post_test(): r8mat_givens_post() computes a Givens postmultiplier rotation matrix. Matrix A: Col: 1 2 3 Row 1 : 1 1 1 2 : 1 2 4 3 : 1 3 9 I = 3, J = 2 G Col: 1 2 3 Row 1 : 1 0 0 2 : 0 0.948683 0.316228 3 : 0 -0.316228 0.948683 A * G Col: 1 2 3 Row 1 : 1 0.632456 1.26491 2 : 1 0.632456 4.42719 3 : 1 -4.44089e-16 9.48683 r8mat_givens_pre_test(): r8mat_givens_pre() computes a Givens premultiplier rotation matrix. Matrix A: Col: 1 2 3 Row 1 : 1 1 1 2 : 1 2 4 3 : 1 3 9 I = 3, J = 2 G Col: 1 2 3 Row 1 : 1 0 0 2 : 0 0.5547 0.83205 3 : 0 -0.83205 0.5547 G*A Col: 1 2 3 Row 1 : 1 1 1 2 : 1.38675 3.60555 9.70725 3 : -0.27735 2.22045e-16 1.6641 r8mat_hess_test(): r8mat_hess() estimates the Hessian matrix of a scalar function. Estimated Hessian: Col: 1 2 3 Row 1 : 2 1 0 2 : 1 2.381e-06 9.88032 3 : 0 9.88032 -30.8503 Exact Hessian: Col: 1 2 3 Row 1 : 2 1 0 2 : 1 0 9.88032 3 : 0 9.88032 -30.8503 r8mat_house_axh_test(): r8mat_house_axh() multiplies a matrix A times a compact Householder matrix. Matrix A: Col: 1 2 3 4 5 Row 1 : 3.3897 2.49018 -0.244271 -3.66496 4.80904 2 : -0.667394 0.0388777 -1.37541 -4.78444 -2.1338 3 : -0.293753 1.4681 2.88113 0.598407 3.0082 4 : 0.607134 -1.92254 2.80296 -1.99181 3.96111 5 : -2.30908 -3.61275 1.68512 4.3941 0.975266 Compact vector V so H*A packs column 3: 1: 0 2: 0 3: 0.911325 4: 0.352833 5: 0.212121 Householder matrix H: Col: 1 2 3 4 5 Row 1 : 1 0 0 0 0 2 : 0 1 0 0 0 3 : 0 0 -0.661027 -0.643091 -0.386623 4 : 0 0 -0.643091 0.751018 -0.149687 5 : 0 0 -0.386623 -0.149687 0.910009 Indirect product A*H: Col: 1 2 3 4 5 Row 1 : 3.3897 2.49018 0.659091 -3.31521 5.0193 2 : -0.667394 0.0388777 4.81099 -2.38929 -0.693844 3 : -0.293753 1.4681 -3.45238 -1.8537 1.53401 4 : 0.607134 -1.92254 -2.10337 -3.89137 2.81911 5 : -2.30908 -3.61275 -4.31678 2.07037 -0.421743 Direct product A*H: Col: 1 2 3 4 5 Row 1 : 3.3897 2.49018 0.659091 -3.31521 5.0193 2 : -0.667394 0.0388777 4.81099 -2.38929 -0.693844 3 : -0.293753 1.4681 -3.45238 -1.8537 1.53401 4 : 0.607134 -1.92254 -2.10337 -3.89137 2.81911 5 : -2.30908 -3.61275 -4.31678 2.07037 -0.421743 H*A should have packed column 3: Col: 1 2 3 4 5 Row 1 : 3.3897 2.49018 -0.244271 -3.66496 4.80904 2 : -0.667394 0.0388777 -1.37541 -4.78444 -2.1338 3 : 0.69648 1.66269 -4.35857 -0.813505 -4.91292 4 : 0.990517 -1.8472 1.66533e-16 -2.53845 0.894335 5 : -2.0786 -3.56746 2.22045e-16 4.06546 -0.868464 r8mat_house_form_test(): r8mat_house_form() forms a Householder matrix from its compact form. Compact vector form V: 1: 0 2: 0 3: 1 4: 2 5: 3 Householder matrix H: Col: 1 2 3 4 5 Row 1 : 1 0 0 0 0 2 : 0 1 0 0 0 3 : 0 0 0.857143 -0.285714 -0.428571 4 : 0 0 -0.285714 0.428571 -0.857143 5 : 0 0 -0.428571 -0.857143 -0.285714 r8mat_house_post_test(): r8mat_house_post() computes a Householder postmultiplier; Matrix A: Col: 1 2 3 4 5 Row 1 : 4.42008 0.129287 4.68567 4.36276 0.360258 2 : 4.71866 2.23265 4.14766 4.66751 2.03363 3 : 2.74579 3.23151 4.24543 3.34232 3.33466 4 : 3.64193 2.60601 1.86267 1.03388 4.66863 5 : 2.88379 1.86156 2.96592 3.26925 4.05475 I = 2, J = 3 Householder matrix H: Col: 1 2 3 4 5 Row 1 : 1 0 0 0 0 2 : 0 1 0 0 0 3 : 0 0 -0.6316 -0.710761 -0.309679 4 : 0 0 -0.710761 0.690377 -0.134903 5 : 0 0 -0.309679 -0.134903 0.941223 Product A*H: Col: 1 2 3 4 5 Row 1 : 4.42008 0.129287 -6.17191 -0.367042 -1.70052 2 : 4.71866 2.23265 -6.56692 2.22045e-16 2.22045e-16 3 : 2.74579 3.23151 -6.08967 -1.15988 1.37305 4 : 3.64193 2.60601 -3.35708 -1.23996 3.67792 5 : 2.88379 1.86156 -5.4526 -0.398042 2.45691 r8mat_house_pre_test(): r8mat_house_pre() computes a Householder premultiplier; Matrix A: Col: 1 2 3 4 5 Row 1 : 2.42274 4.32074 4.41419 4.49857 4.41243 2 : 3.78375 1.94442 4.56856 2.25197 1.42475 3 : 2.08524 2.27371 2.79142 1.02836 3.36613 4 : 4.85893 1.23344 2.99434 4.49825 3.3214 5 : 4.93987 3.92212 0.744384 3.81293 0.614075 I = 2, J = 3 Householder matrix H: Col: 1 2 3 4 5 Row 1 : 1 0 0 0 0 2 : 0 -0.739331 -0.451737 -0.484575 -0.120464 3 : 0 -0.451737 0.882676 -0.125853 -0.0312867 4 : 0 -0.484575 -0.125853 0.864998 -0.033561 5 : 0 -0.120464 -0.0312867 -0.033561 0.991657 Product H*A: Col: 1 2 3 4 5 Row 1 : 2.42274 4.32074 4.41419 4.49857 4.41243 2 : -6.68901 -3.53485 -6.17932 -4.76856 -4.25741 3 : -0.634733 0.85064 1.04083e-16 -0.795 1.89037 4 : 1.94124 -0.29308 -6.52256e-16 2.54235 1.73836 5 : 4.21454 3.54263 0 3.3267 0.220536 r8mat_indicator_test(): r8mat_indicator() returns an indicator matrix. Indicator matrix: Col: 1 2 3 4 Row 1 : 11 12 13 14 2 : 21 22 23 24 3 : 31 32 33 34 4 : 41 42 43 44 5 : 51 52 53 54 r8mat_inverse_2d_test(): r8mat_inverse_2d() inverts a 2 by 2 matrix. Matrix A to invert: Col: 1 2 Row 1 : 1 2 2 : 3 4 Inverse matrix B: Col: 1 2 Row 1 : -2 1 2 : 1.5 -0.5 Product C = A * B: Col: 1 2 Row 1 : 1 0 2 : 0 1 r8mat_inverse_3d_test(): r8mat_inverse_3d() inverts a 3 by 3 matrix. Matrix A to be inverted: Col: 1 2 3 Row 1 : 1 2 3 2 : 4 5 6 3 : 7 8 0 Inverse matrix B: Col: 1 2 3 Row 1 : -1.77778 0.888889 -0.111111 2 : 1.55556 -0.777778 0.222222 3 : -0.111111 0.222222 -0.111111 Product C = A * B: Col: 1 2 3 Row 1 : 1 -1.11022e-16 0 2 : 3.33067e-16 1 1.11022e-16 3 : 1.77636e-15 -8.88178e-16 1 r8mat_inverse_4d_test(): r8mat_inverse_4d() inverts a 4 x 4 matrix. Matrix A to be inverted: Col: 1 2 3 4 Row 1 : 4 3 2 1 2 : 3 3 2 1 3 : 0 2 2 1 4 : 0 0 1 1 Determinant is 1.000000 Inverse B: Col: 1 2 3 4 Row 1 : 1 -1 0 -0 2 : -3 4 -1 0 3 : 6 -8 3 -1 4 : -6 8 -3 2 Product C = A * B: Col: 1 2 3 4 Row 1 : 1 0 0 0 2 : 0 1 0 0 3 : 0 0 1 0 4 : 0 0 0 1 r8mat_is_binary_test(): r8mat_is_binary() is true if an R8MAT only contains 0 or 1 entries. Matrix: Col: 1 2 3 Row 1 : 0 1 0 2 : 1 0 1 X is binary Matrix: Col: 1 2 3 Row 1 : 1 1 1 2 : 1 1 1 X is binary Matrix: Col: 1 2 3 Row 1 : 0 1 0 2 : 1 2 1 X is NOT binary. r8mat_jac_test(): r8mat_jac() estimates the M by N jacobian matrix of a nonlinear function. Estimated jacobian: Col: 1 2 3 4 Row 1 : -0.83233 -0.41616 0 0 2 : 0.70711 0 1 0 3 : 1 2 3 4 Exact jacobian: Col: 1 2 3 4 Row 1 : -0.832294 -0.416147 0 0 2 : 0.707107 0 1 0 3 : 1 2 3 4 r8mat_kronecker_test(): r8mat_kronecker() computes the Kronecker product of two matrices. Factor matrix A: Col: 1 2 3 Row 1 : 1 2 3 2 : 4 5 6 Factor matrix B: Col: 1 2 Row 1 : 7 8 2 : 9 10 3 : 11 12 Kronecker product C = kron(A,B) Col: 1 2 3 4 5 Row 1 : 7 8 14 16 21 2 : 9 10 18 20 27 3 : 11 12 22 24 33 4 : 28 32 35 40 42 5 : 36 40 45 50 54 6 : 44 48 55 60 66 Col: 6 Row 1 : 24 2 : 30 3 : 36 4 : 48 5 : 60 6 : 72 r8mat_l_inverse_test(): r8mat_l_inverse() inverts a lower triangular matrix. Matrix A to be inverted: Col: 1 2 3 4 Row 1 : 1 0 0 0 2 : 2 3 0 0 3 : 4 5 6 0 4 : 7 8 9 10 Inverse matrix B: Col: 1 2 3 4 Row 1 : 1 0 0 0 2 : -0.666667 0.333333 0 0 3 : -0.111111 -0.277778 0.166667 0 4 : -0.0666667 -0.0166667 -0.15 0.1 Product C = A * B: Col: 1 2 3 4 Row 1 : 1 0 0 0 2 : 0 1 0 0 3 : 0 0 1 0 4 : 4.44089e-16 0 0 1 r8mat_l_print_test(): r8mat_l_print() prints a lower triangular matrix stored compactly. Only the (possibly) nonzero elements are printed. A 7 by 7 matrix. Col 1 2 3 4 5 6 7 Row 1 11 2 11 21 3 11 21 31 4 11 21 31 41 5 11 21 31 41 51 6 11 21 31 41 51 61 7 11 21 31 41 51 61 71 A 7 by 3 matrix. Col 1 2 3 Row 1 11 2 11 21 3 11 21 31 4 11 21 31 5 11 21 31 6 11 21 31 7 11 21 31 A 4 by 7 matrix. Col 1 2 3 4 Row 1 11 2 11 21 3 11 21 31 4 11 21 31 41 r8mat_l_solve_test(): r8mat_l_solve() solves a lower triangular system. Input matrix A: Col: 1 2 3 4 Row 1 : 1 0 0 0 2 : 2 3 0 0 3 : 4 5 6 0 4 : 7 8 9 10 Right hand side b: 1: 1 2: 8 3: 32 4: 90 Computed solution x: 1: 1 2: 2 3: 3 4: 4 Norm of A*x-b = 0 r8mat_l1_solve_test(): r8mat_l1_solve() solves a unit lower triangular system. Input matrix A: Col: 1 2 3 4 Row 1 : 1 0 0 0 2 : 2 1 0 0 3 : 4 5 1 0 4 : 7 8 9 1 Right hand side b: 1: 1 2: 4 3: 17 4: 54 Computed solution x: 1: 1 2: 2 3: 3 4: 4 Norm of A*x-b = 0 r8mat_l1_inverse_test(): r8mat_l1_inverse() inverts a unit lower triangular matrix. Matrix A to be inverted: Col: 1 2 3 4 5 Row 1 : 1 0 0 0 0 2 : 2 1 0 0 0 3 : 0 0 1 0 0 4 : 5 0 3 1 0 5 : 0 0 0 0 1 6 : 75 0 0 6 4 Col: 6 Row 1 : 0 2 : 0 3 : 0 4 : 0 5 : 0 6 : 1 Inverse matrix B: Col: 1 2 3 4 5 Row 1 : 1 0 0 0 0 2 : -2 1 0 0 0 3 : -0 -0 1 0 0 4 : -5 -0 -3 1 0 5 : -0 -0 -0 -0 1 6 : -45 -0 18 -6 -4 Col: 6 Row 1 : 0 2 : 0 3 : 0 4 : 0 5 : 0 6 : 1 Product C = A * B: Col: 1 2 3 4 5 Row 1 : 1 0 0 0 0 2 : 0 1 0 0 0 3 : 0 0 1 0 0 4 : 0 0 0 1 0 5 : 0 0 0 0 1 6 : 0 0 0 0 0 Col: 6 Row 1 : 0 2 : 0 3 : 0 4 : 0 5 : 0 6 : 1 r8mat_ldlt_solve_test(): r8mat_ldlt_solve() solves a linear system associated with a symmetric matrix A that has been LDLT factored. Matrix to be factored: Col: 1 2 3 4 5 Row 1 : 1 0.5 0.333333 0.25 0.2 2 : 0.5 0.333333 0.25 0.2 0.166667 3 : 0.333333 0.25 0.2 0.166667 0.142857 4 : 0.25 0.2 0.166667 0.142857 0.125 5 : 0.2 0.166667 0.142857 0.125 0.111111 L factor: Col: 1 2 3 4 5 Row 1 : 1 0 0 0 0 2 : 0.5 1 0 0 0 3 : 0.333333 1 1 0 0 4 : 0.25 0.9 1.5 1 0 5 : 0.2 0.8 1.71429 2 1 D factor: Col: 1 2 3 4 5 Row 1 : 1 0 0 0 0 2 : 0 0.0833333 0 0 0 3 : 0 0 0.00555556 0 0 4 : 0 0 0 0.000357143 0 5 : 0 0 0 0 2.26757e-05 Product L * D * L': Col: 1 2 3 4 5 Row 1 : 1 0.5 0.333333 0.25 0.2 2 : 0.5 0.333333 0.25 0.2 0.166667 3 : 0.333333 0.25 0.2 0.166667 0.142857 4 : 0.25 0.2 0.166667 0.142857 0.125 5 : 0.2 0.166667 0.142857 0.125 0.111111 Right hand side: 1: 5 2: 3.55 3: 2.81429 4: 2.34643 5: 2.01746 Computed solution: 1: 1 2: 2 3: 3 4: 4 5: 5 r8mat_lt_solve_test(): r8mat_lt_solve() solves a transposed lower triangular system. Input matrix A: Col: 1 2 3 4 Row 1 : 1 0 0 0 2 : 2 3 0 0 3 : 4 5 6 0 4 : 7 8 9 10 Right hand side b: 1: 45 2: 53 3: 54 4: 40 Computed solution x: 1: 1 2: 2 3: 3 4: 4 Norm of A'*x-b = 0 r8mat_max_test(): r8mat_max() computes the maximum value; Random array: Col: 1 2 3 Row 1 : 4.07318 8.26579 6.0963 2 : 2.75287 3.90027 5.74737 3 : 7.1667 4.97903 3.26042 4 : 2.83384 6.94805 4.56425 5 : 8.96199 8.34369 7.13796 Maximum value = 8.961989 r8mat_max_index_test(): r8mat_max_index() locates the maximum entry; Random array: Col: 1 2 3 Row 1 : 8.84405 4.3782 3.42713 2 : 7.20856 1.17037 3.75692 3 : 0.186128 8.14682 5.46554 4 : 6.74776 3.24855 5.6192 5 : 4.38509 2.46228 3.95822 Maximum I,J indices = (1,1) r8mat_min_test(): r8mat_min() computes the minimum value; Random array: Col: 1 2 3 Row 1 : 3.98131 4.0008 1.63898 2 : 5.15367 8.31871 3.2422 3 : 6.57531 1.34338 3.01727 4 : 9.50915 0.604668 0.11681 5 : 7.22349 0.842471 5.39905 Minimum value = 0.116810 r8mat_min_index_test(): r8mat_min_index() locates the minimum entry; Random array: Col: 1 2 3 Row 1 : 0.953727 5.70838 4.30002 2 : 1.46515 9.9685 4.91806 3 : 6.31141 5.53542 0.710371 4 : 8.5932 5.15458 8.87739 5 : 9.74222 3.30682 0.646336 Minimum I,J indices = (5,3) r8mat_maxcol_minrow_test(): r8mat_maxcol_minrow() computes the maximum over columns of the mininum over rows; Random array: Col: 1 2 3 Row 1 : 4.36185 8.86235 5.93362 2 : 8.2663 9.31112 5.0384 3 : 3.94535 1.90785 6.1281 4 : 6.13475 2.58582 8.19422 5 : 8.18641 8.97866 5.31889 MAXCOL_MINROW = 5.318892 r8mat_maxrow_mincol_test(): r8mat_maxrow_mincol() computes the maximum over rows of the mininum over columns; Random array: Col: 1 2 3 Row 1 : 2.02075 6.9539 1.56495 2 : 4.53893 7.20165 5.62056 3 : 4.27911 3.46895 6.94803 4 : 9.66053 5.1699 4.26456 5 : 6.20055 5.56695 8.3627 MAXROW_MINCOL = 3.468952 r8mat_mean_test(): r8mat_mean() computes the mean of all values in an R8MAT. Random array: Col: 1 2 3 Row 1 : 7.31387 7.34271 7.05572 2 : 3.60031 4.30278 1.09334 3 : 4.54212 6.93753 3.89931 4 : 3.8639 9.45213 5.90905 5 : 7.75555 7.84233 4.5938 Mean value = 5.700296 r8mat_mincol_maxrow_test(): r8mat_mincol_maxrow() computes the minimum over columns of the maxinum over rows; Random array: Col: 1 2 3 Row 1 : 0.5034 0.780691 1.22189 2 : 2.28688 6.69043 6.71166 3 : 8.34189 5.00211 5.99586 4 : 0.156447 2.17994 0.559762 5 : 8.63711 5.71616 0.56343 MINCOL_MAXROW = 5.002113 r8mat_minrow_maxcol_test(): r8mat_minrow_maxcol() computes the minimum over rows of the maxinum over columns; Random array: Col: 1 2 3 Row 1 : 1.52501 5.20129 5.16997 2 : 0.196211 8.63868 1.43156 3 : 4.35176 0.976979 5.59371 4 : 8.32221 9.08052 0.0457962 5 : 6.1739 1.08017 7.66682 MINROW_MAXCOL = 7.666820 r8mat_mm_test(): r8mat_mm() computes a matrix-matrix product C = A * B. A: Col: 1 2 3 Row 1 : 1 0 0 2 : 1 1 0 3 : 1 2 1 4 : 1 3 3 B: Col: 1 2 3 4 Row 1 : 1 1 1 1 2 : 0 1 2 3 3 : 0 0 1 3 C = A*B: Col: 1 2 3 4 Row 1 : 1 1 1 1 2 : 1 2 3 4 3 : 1 3 6 10 4 : 1 4 10 19 r8mat_mmt_test(): r8mat_mmt() computes a matrix-transpose(matrix) product C = A * B'. A: Col: 1 2 3 Row 1 : 1 0 0 2 : 1 1 0 3 : 1 2 1 4 : 1 3 3 B: Col: 1 2 3 Row 1 : 1 0 0 2 : 1 1 0 3 : 1 2 1 4 : 1 3 3 C = A*B': Col: 1 2 3 4 Row 1 : 1 1 1 1 2 : 1 2 3 4 3 : 1 3 6 10 4 : 1 4 10 19 r8mat_mtm_test(): r8mat_mtm() computes a transpose(matrix)-matrix product C = A' * B. A: Col: 1 2 3 Row 1 : 1 0 0 2 : 1 1 0 3 : 1 2 1 4 : 1 3 3 B: Col: 1 2 3 Row 1 : 1 0 0 2 : 1 1 0 3 : 1 2 1 4 : 1 3 3 C = A'*B: Col: 1 2 3 Row 1 : 4 6 4 2 : 6 14 11 3 : 4 11 10 r8mat_mtv_test(): r8mat_mtv() computes a matrix-vector product b = A' * x; A: Col: 1 2 3 4 Row 1 : 1 2 3 4 2 : 1 1 1 1 x: 1: 1 2: 2 b = A'*x: 1: 3 2: 4 3: 5 4: 6 r8mat_mv_test(): r8mat_mv() computes a matrix-vector product b = A * x; A: Col: 1 2 Row 1 : 1 1 2 : 2 1 3 : 3 1 4 : 4 1 X: 1: 1 2: 2 B = A*X: 1: 3 2: 4 3: 5 4: 6 r8mat_nint_test(): r8mat_nint() rounds an R8MAT. Matrix A: Col: 1 2 3 4 Row 1 : 3.48709 -3.99249 1.61596 -0.593653 2 : 4.16821 0.0784883 0.16979 4.41919 3 : 4.86968 0.856091 -3.28952 1.55914 4 : 0.051331 2.62887 4.38558 -0.480543 5 : -2.28578 -4.17037 0.904832 3.39697 Rounded matrix A: Col: 1 2 3 4 Row 1 : 3 -4 2 -1 2 : 4 0 0 4 3 : 5 1 -3 2 4 : 0 3 4 -0 5 : -2 -4 1 3 r8mat_nonzeros_test(): r8mat_nonzeros() counts nonzeros in an R8MAT. Matrix A: Col: 1 2 3 4 Row 1 : 0 0 0 0 2 : 0 1 0 1 3 : 0 0 0 0 4 : 0 1 0 1 5 : 0 0 0 0 Expected nonzeros = 4 Computed nonzeros = 4 r8mat_norm_eis_test(): r8mat_norm_eis() computes the EISPACK norm of an R8MAT; A: Col: 1 2 3 4 Row 1 : 1 2 3 4 2 : 5 6 7 8 3 : 9 10 11 12 4 : 13 14 15 16 5 : 17 18 19 20 EISPACK norm of A = 210 r8mat_norm_fro_test(): r8mat_norm_fro() computes a Frobenius norm of an R8MAT; A: Col: 1 2 3 4 Row 1 : 1 2 3 4 2 : 5 6 7 8 3 : 9 10 11 12 4 : 13 14 15 16 5 : 17 18 19 20 Expected norm = 53.5724 Computed norm = 53.5724 r8mat_norm_fro_affine_test(): r8mat_norm_fro_affine() computes the Frobenius norm of the difference of two R8MAT's; Expected norm = 1.52151 Computed norm = 1.52151 r8mat_norm_l1_test(): r8mat_norm_l1() computes the L1 norm of an R8MAT; A: Col: 1 2 3 4 Row 1 : 4 -2 5 2 2 : -3 -4 -1 2 3 : -0 -1 5 1 4 : -1 -3 3 1 5 : 0 -5 -5 -3 Computed L1 norm = 19 r8mat_norm_l2_test(): r8mat_norm_l2() computes the L2 norm of an R8MAT; A: Col: 1 2 3 4 Row 1 : 3 -1 1 -5 2 : -3 -2 -2 0 3 : -1 1 4 2 4 : 4 4 -1 -3 5 : 4 4 4 -2 Computed L2 norm = 10.456 r8mat_norm_li_test(): r8mat_norm_l1() computes the Loo norm of an R8MAT; A: Col: 1 2 3 4 Row 1 : -3 1 5 -1 2 : -2 -2 4 -3 3 : -1 -3 3 -5 4 : 0 -3 2 -2 5 : -5 -3 -3 2 Computed Loo norm = 13 r8mat_norm_rms_test(): r8mat_norm_rms() computes the RMS norm of an R8MAT; A: Col: 1 2 3 4 Row 1 : 1 2 3 4 2 : 5 6 7 8 3 : 9 10 11 12 4 : 13 14 15 16 5 : 17 18 19 20 RMS norm of A = 11.9791 r8mat_normal_01_test(): r8mat_normal_01() computes a matrix of Normal 01 values. The matrix: Col: 1 2 3 4 Row 1 : -0.933861 -1.1715 -2.04558 1.85251 2 : -0.259025 -0.654063 -0.0565389 -0.809924 3 : -0.298963 -0.338746 1.21738 0.37177 4 : 1.24778 -0.465396 0.79582 -0.036396 5 : 0.0851383 -0.604163 0.62556 0.853275 r8mat_nullspace_test(): r8mat_nullspace() computes the nullspace of a matrix. Input A: Col: 1 2 3 4 5 Row 1 : 1 3 0 2 6 2 : -2 -6 0 -2 -8 3 : 3 9 0 0 6 4 : -1 -3 0 1 0 Col: 6 7 Row 1 : 3 1 2 : 3 1 3 : 6 2 4 : 9 3 Nullspace size is 4 Nullspace vectors: Col: 1 2 3 4 Row 1 : -3 0 -2 0 2 : 1 0 0 0 3 : 0 1 0 0 4 : 0 0 -2 0 5 : 0 0 1 0 6 : 0 0 0 -0.333333 7 : 0 0 0 1 Product A * Nullspace vectors: Col: 1 2 3 4 Row 1 : 0 0 0 0 2 : 0 0 0 0 3 : 0 0 0 0 4 : 0 0 0 0 r8mat_nullspace_size_test(): r8mat_nullspace_size() computes the size of the nullspace of a matrix. Input A: Col: 1 2 3 4 5 Row 1 : 1 3 0 2 6 2 : -2 -6 0 -2 -8 3 : 3 9 0 0 6 4 : -1 -3 0 1 0 Col: 6 7 Row 1 : 3 1 2 : 3 1 3 : 6 2 4 : 9 3 Nullspace size is 4 r8mat_orth_uniform_test(): r8mat_orth_uniform() computes a random orthogonal matrix. Random orthogonal matrix A Col: 1 2 3 4 5 Row 1 : -0.683806 0.38242 -0.327721 0.463556 0.252743 2 : 0.0297691 -0.579629 -0.130074 -0.00814227 0.80384 3 : -0.301499 -0.38951 -0.675813 -0.392357 -0.383032 4 : -0.371679 -0.595155 0.444487 0.441774 -0.338987 5 : 0.549978 -0.10889 -0.470519 0.660259 -0.168335 AT*A Col: 1 2 3 4 5 Row 1 : 1 -2.77556e-17 5.55112e-17 -5.55112e-17 5.55112e-17 2 :-2.77556e-17 1 4.85723e-17 -6.93889e-17 -4.16334e-17 3 : 5.55112e-17 4.85723e-17 1 0 1.11022e-16 4 :-5.55112e-17 -6.93889e-17 0 1 5.55112e-17 5 : 5.55112e-17 -4.16334e-17 1.11022e-16 5.55112e-17 1 r8mat_plot_test(): r8mat_plot() prints a symbolic picture of a matrix. Typically, "-" for negative, " " for zero, and "+" for positive entries or "X" for nonzero and, " " for zero. A plot of the matrix: 1234567890123456789012345678901234567890123456789012345678901234567890 1 -+00000000000000000000000000000000000000000000000000000000000000000000 2 +-+0000000000000000000000000000000000000000000000000000000000000000000 3 0+-+000000000000000000000000000000000000000000000000000000000000000000 4 00+-+00000000000000000000000000000000000000000000000000000000000000000 5 000+-+0000000000000000000000000000000000000000000000000000000000000000 6 0000+-+000000000000000000000000000000000000000000000000000000000000000 7 00000+-+00000000000000000000000000000000000000000000000000000000000000 8 000000+-+0000000000000000000000000000000000000000000000000000000000000 9 0000000+-+000000000000000000000000000000000000000000000000000000000000 10 00000000+-+00000000000000000000000000000000000000000000000000000000000 123456789012345678901234567890 1 00000000000000000000000000000+ 2 000000000000000000000000000000 3 000000000000000000000000000000 4 000000000000000000000000000000 5 000000000000000000000000000000 6 000000000000000000000000000000 7 000000000000000000000000000000 8 000000000000000000000000000000 9 000000000000000000000000000000 10 000000000000000000000000000000 r8mat_plu_test(): r8mat_plu() computes the PLU factors of a matrix. Matrix to be factored: Col: 1 2 3 4 5 Row 1 : 1 1 1 1 1 2 : 1 10 100 1000 10000 3 : 1 4 16 64 256 4 : 1 2 4 8 16 5 : 1 3 9 27 81 P factor: Col: 1 2 3 4 5 Row 1 : 1 0 0 0 0 2 : 1 1 0 0 0 3 : 1 0.333333 1 0 0 4 : 1 0.111111 0.444444 1 0 5 : 1 0.222222 0.777778 0.875 1 L factor: Col: 1 2 3 4 5 Row 1 : 1 0 0 0 0 2 : 0 1 0 0 0 3 : 0 0 1 0 0 4 : 0 0 0 1 0 5 : 0 0 0 0 1 U factor: Col: 1 2 3 4 5 Row 1 : 1 1 1 1 1 2 : 0 9 99 999 9999 3 : 0 0 -18 -270 -3078 4 : 0 0 0 16 272 5 : 0 0 0 0 14 P*L*U: Col: 1 2 3 4 5 Row 1 : 1 10 82 746 7208 2 : 0 9 93 910.778 9006.33 3 : 0 0 -18 -262.889 -2946.22 4 : 0 0 0 16 284.25 5 : 0 0 0 0 14 r8mat_power_test(): r8mat_power() computes the P-th power of a matrix; Matrix A: Col: 1 2 3 Row 1 : 1 2 3 2 : 0 2 1 3 : 0 4 3 Matrix A^0 Col: 1 2 3 Row 1 : 1 0 0 2 : 0 1 0 3 : 0 0 1 Matrix A^1 Col: 1 2 3 Row 1 : 1 2 3 2 : 0 2 1 3 : 0 4 3 Matrix A^2 Col: 1 2 3 Row 1 : 1 18 14 2 : 0 8 5 3 : 0 20 13 Matrix A^3 Col: 1 2 3 Row 1 : 1 94 63 2 : 0 36 23 3 : 0 92 59 r8mat_power_method_test(): r8mat_power_method() applies the power method to a matrix. Estimated eigenvalue = 3.731980 Estimated eigenvector V: 1: 0.292877 2: -0.499987 3: 0.573126 4: -0.499987 5: 0.292877 Value of A*V: 1: 1.08574 2: -1.86598 3: 2.14622 4: -1.86598 5: 1.08574 r8mat_print_test(): r8mat_print() prints an R8MAT. The R8MAT: Col: 1 2 3 4 Row 1 : 11 12 13 14 2 : 21 22 23 24 3 : 31 32 33 34 4 : 41 42 43 44 5 : 51 52 53 54 6 : 61 62 63 64 r8mat_print_some_test(): r8mat_print_some() prints some of an R8MAT. The R8MAT, rows 2:4, cols 1:2: Col: 1 2 Row 2 : 21 22 3 : 31 32 4 : 41 42 r8mat_product_elementwise_test(): r8mat_product_elementwise() computes the elementwise product of two R8MATs. A: Col: 1 2 3 Row 1 : 1 2 3 2 : 4 5 6 B: Col: 1 2 3 Row 1 : 1 3 5 2 : 2 4 6 Elementwise product = 86 r8mat_ref_test(): r8mat_ref() computes the row echelon form of a matrix. Input A: Col: 1 2 3 4 5 Row 1 : 1 3 0 2 6 2 : -2 -6 0 -2 -8 3 : 3 9 0 0 6 4 : -1 -3 0 1 0 Col: 6 7 Row 1 : 3 1 2 : 3 1 3 : 6 2 4 : 9 3 The pseudo-determinant = 48 REF form: Col: 1 2 3 4 5 Row 1 : 1 3 0 2 6 2 : 0 0 0 1 2 3 : 0 0 0 0 0 4 : 0 0 0 0 0 Col: 6 7 Row 1 : 3 1 2 : 4.5 1.5 3 : 1 0.333333 4 : 0 0 r8mat_rref_test(): r8mat_rref() computes the reduced row echelon form of a matrix. Input A: Col: 1 2 3 4 5 Row 1 : 1 3 0 2 6 2 : -2 -6 0 -2 -8 3 : 3 9 0 0 6 4 : -1 -3 0 1 0 Col: 6 7 Row 1 : 3 1 2 : 3 1 3 : 6 2 4 : 9 3 The pseudo-determinant = 48 RREF form: Col: 1 2 3 4 5 Row 1 : 1 3 0 0 2 2 : 0 0 0 1 2 3 : 0 0 0 0 0 4 : 0 0 0 0 0 Col: 6 7 Row 1 : 0 0 2 : 0 0 3 : 1 0.333333 4 : 0 0 r8mat_rref_solve_binary_test(): r8mat_rref_solve_binary() seeks binary solutions of a Row-Reduced Echelon Form linear system A*x=b. The RREF matrix A: Col: 1 2 3 4 5 Row 1 : 1 0 0 0 0 2 : 0 1 0 0 0 3 : 0 0 1 0 0 4 : 0 0 0 1 0 5 : 0 0 0 0 1 6 : 0 0 0 0 0 7 : 0 0 0 0 0 8 : 0 0 0 0 0 9 : 0 0 0 0 0 Col: 6 7 8 9 10 Row 1 : 0 1 0 -1 0 2 : 0 0 0 1 0 3 : 0 1 0 -1 0 4 : 0 0 0 1 1 5 : 0 0 0 0 1 6 : 1 -1 0 1 0 7 : 0 0 1 0 -1 8 : 0 0 0 0 0 9 : 0 0 0 0 0 The RREF right hand side b: 1: 0 2: 1 3: 0 4: 1 5: 1 6: 1 7: 0 8: 0 9: 0 Binary solution vectors x: Col: 1 2 3 4 Row 1 : 0 0 1 0 2 : 1 1 0 0 3 : 0 0 1 0 4 : 1 0 0 0 5 : 1 0 1 1 6 : 1 1 0 1 7 : 0 0 0 1 8 : 0 1 0 0 9 : 0 0 1 1 10 : 0 1 0 0 r8mat_rref_solve_binary_nz_test(): r8mat_rref_solve_binary_nz() seeks binary solutions of a Row-Reduced Echelon Form linear system A*x=b which have exactly NZ nonzeros. The RREF matrix A: Col: 1 2 3 4 5 Row 1 : 1 0 0 0 0 2 : 0 1 0 0 0 3 : 0 0 1 0 0 4 : 0 0 0 1 0 5 : 0 0 0 0 1 6 : 0 0 0 0 0 7 : 0 0 0 0 0 8 : 0 0 0 0 0 9 : 0 0 0 0 0 Col: 6 7 8 9 10 Row 1 : 0 1 0 -1 0 2 : 0 0 0 1 0 3 : 0 1 0 -1 0 4 : 0 0 0 1 1 5 : 0 0 0 0 1 6 : 1 -1 0 1 0 7 : 0 0 1 0 -1 8 : 0 0 0 0 0 9 : 0 0 0 0 0 The RREF right hand side b: 1: 0 2: 1 3: 0 4: 1 5: 1 6: 1 7: 0 8: 0 9: 0 Only consider binary solutions with exactly 4 nonzeros. VERBOSE: System has 3 degrees of freedom. VERBOSE: Augmented Row-Reduced Echelon Form system matrix A and right hand side B: Columns associated with a free variable are headed with a "*" : : : : : : * : * * 1 0 0 0 0 0 1 0-1 0 0 0 1 0 0 0 0 0 0 1 0 1 0 0 1 0 0 0 1 0-1 0 0 0 0 0 1 0 0 0 0 1 1 1 0 0 0 0 1 0 0 0 0 1 1 0 0 0 0 0 1-1 0 1 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0-1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 VERBOSE: Tried 8 right hands sides, found 4 solutions. Binary solution vectors x: Col: 1 2 3 4 Row 1 : 0 1 0 0 2 : 1 0 1 0 3 : 0 1 0 0 4 : 1 0 0 0 5 : 1 1 0 1 6 : 1 0 1 1 7 : 0 0 0 1 8 : 0 0 1 0 9 : 0 1 0 1 10 : 0 0 1 0 r8mat_scale_01_test(): r8mat_scale_01() shifts and scales the columns of an R8MAT so they each have min 0 and max 1 Array X: Col: 1 2 3 Row 1 : 14.5953 -1.1392 -1.96106 2 : 0.696475 1.83288 2.94218 3 : 6.89949 13.658 2.49445 4 : 14.2432 2.81335 -2.37771 5 : -1.28443 0.464334 3.70081 mean(X): 7.03001 3.52586 0.959735 std(X): 7.39129 5.85596 2.8926 max(X): 14.5953 13.658 3.70081 min(X): -1.28443 -1.1392 -2.37771 Array XS: Col: 1 2 3 Row 1 : 1 0 0.0685442 2 : 0.124744 0.200855 0.875194 3 : 0.515369 1 0.801536 4 : 0.977828 0.267116 0 5 : 0 0.108368 1 mean(XS): 0.523588 0.315268 0.549055 std(XS): 0.465454 0.395749 0.475872 max(XS): 1 1 1 min(XS): 0 0 0 r8mat_scale_ab_test(): r8mat_scale_ab() shifts and scales the columns of an R8MAT so they each have min A and max B Array X: Col: 1 2 3 Row 1 : -3.16974 -0.292665 7.8463 2 : 7.29254 3.96039 -0.574685 3 : -4.78042 6.38716 11.7411 4 : 6.46521 -3.77197 14.4215 5 : 10.7946 4.92578 11.9275 mean(X): 3.32044 2.24174 9.07234 std(X): 6.87889 4.18122 5.88337 max(X): 10.7946 6.38716 14.4215 min(X): -4.78042 -3.77197 -0.574685 Rescale to interval [-1,1] Array XS: Col: 1 2 3 Row 1 : -0.793171 -0.315039 0.123084 2 : 0.550298 0.522249 -1 3 : -1 1 0.642526 4 : 0.44406 -1 1 5 : 1 0.712301 0.667376 mean(XS): 0.0402373 0.183902 0.286597 std(XS): 0.883324 0.823144 0.784648 max(XS): 1 1 1 min(XS): -1 -1 -1 r8mat_solve_test(): r8mat_solve() solves linear systems. The linear system: Col: 1 2 3 4 5 Row 1 : 1 2 3 14 7 2 : 4 5 6 32 16 3 : 7 8 0 23 7 The computed solutions Col: 1 2 Row 1 : 1 1 2 : 2 0 3 : 3 2 r8mat_solve_2d_test(): r8mat_solve_2d() solves 2D linear systems. Solution / Computed: 0.957345 0.957345 0.620260 0.620260 Solution / Computed: 0.858571 0.858571 0.911067 0.911067 Solution / Computed: 0.810628 0.810628 0.403843 0.403843 Solution / Computed: 0.060606 0.060606 0.725688 0.725688 Solution / Computed: 0.789029 0.789029 0.317833 0.317833 r8mat_solve_3d_test(): r8mat_solve_3d() solves 3D linear systems. Solution / Computed: 0.291457 0.291457 0.850357 0.850357 0.911647 0.911647 Solution / Computed: 0.827732 0.827732 0.190986 0.190986 0.442530 0.442530 Solution / Computed: 0.147656 0.147656 0.476080 0.476080 0.908102 0.908102 Solution / Computed: 0.711657 0.711657 0.871477 0.871477 0.328690 0.328690 Solution / Computed: 0.186571 0.186571 0.781145 0.781145 0.195798 0.195798 r8mat_solve2_test(): r8mat_solve2() is a linear solver. Right hand side: 1: 5 2: 11 The system is nonsingular. Computed solution: 1: 1 2: 2 Right hand side: 1: 4 2: 2 3: 2 R8MAT_SOLVE2 - Warning: Consistent singularity, equation = 3 The system is singular, but consistent. Computed solution: 1: 2 2: 0 3: 0 Right hand side: 1: 5 2: 11 3: 16 4: 15 The system is nonsingular. Computed solution: 1: -2 2: -6 3: 10 4: 7 Right hand side: 1: 13 2: 17 3: 20 R8MAT_SOLVE2 - Error: Inconsistent singularity, equation = 2 The system is singular and inconsistent. Computed solution: 1: 6.42857 2: 0 3: 0.142857 r8mat_standardize_test(): r8mat_standardize() shifts and scales an R8MAT so that each column has zero mean and unit standard deviation. Vector X: Col: 1 2 3 Row 1 : 14.8472 -1.12468 14.8849 2 : 11.0452 3.64736 12.097 3 : 3.48453 9.98319 14.2481 4 : 9.57728 -4.21631 8.57882 5 : 4.96707 13.9265 3.07003 6 : 11.1798 10.2735 13.6996 7 : 2.13018 6.17641 4.58969 8 : -3.53513 -1.32314 -0.364168 9 : 6.81983 4.95898 2.9258 10 : 13.2038 5.35691 9.10155 mean(X) = 7.37197 4.76587 8.28313 std(X) = 5.68024 5.74991 5.45791 max(X) = 14.8472 13.9265 14.8849 min(X) = -3.53513 -4.21631 -0.364168 Vector XS: Col: 1 2 3 Row 1 : -1.29783 -0.82886 -1.51764 2 : -1.29783 -0.82886 -1.51764 3 : -1.29783 -0.82886 -1.51764 4 : -1.29783 -0.82886 -1.51764 5 : -1.29783 -0.82886 -1.51764 6 : -1.29783 -0.82886 -1.51764 7 : -1.29783 -0.82886 -1.51764 8 : -1.29783 -0.82886 -1.51764 9 : -1.29783 -0.82886 -1.51764 10 : -1.29783 -0.82886 -1.51764 mean(X) = -1.29783 -0.82886 -1.51764 std(X) = 2.34056e-16 0 2.34056e-16 max(X) = -1.29783 -0.82886 -1.51764 min(X) = -1.29783 -0.82886 -1.51764 r8mat_sum_test(): r8mat_sum() sums all values in an R8MAT. Random array: Col: 1 2 3 Row 1 : 5.58559 9.6387 5.30964 2 : 7.56631 1.15626 9.01208 3 : 9.95481 0.514483 5.4055 4 : 9.62431 3.04349 4.31981 5 : 5.35067 5.80192 5.42667 Sum of matrix entries = 87.710250 r8mat_symm_jacobi_test(): r8mat_symm_jacobi() diagonalizes a symmetric R8MAT; Matrix to diagonalize: Col: 1 2 3 4 5 Row 1 : 2.50383 -0.165614 0.3331 0.746353 -0.938194 2 : -0.165614 3.86228 0.0140892 -1.35089 0.127247 3 : 0.3331 0.0140892 3.09278 -0.431526 -0.348934 4 : 0.746353 -1.35089 -0.431526 2.1044 -0.528729 5 : -0.938194 0.127247 -0.348934 -0.528729 3.43671 Computed Eigenvalues: 2.000000 5.000000 3.000000 1.000000 4.000000 r8lib_to_r8plu_test(): r8mat_to_r8plu() determines the compressed PLU factors of an R8MAT. Matrix order N = 5 The matrix A: Col: 1 2 3 4 5 Row 1 : 8.44487 4.64954 5.96647 9.54103 1.8198 2 : 6.15325 8.13977 9.01991 5.42813 0.929889 3 : 3.76611 8.98444 7.02066 5.40106 4.63489 4 : 8.77182 4.29239 3.77455 3.1111 0.0933251 5 : 7.84852 3.34329 7.34956 0.712346 9.15026 The pivot vector P: 1: 4 2: 3 3: 5 4: 4 5: 5 The compressed LU factors: Col: 1 2 3 4 5 Row 1 : 8.77182 4.29239 3.77455 3.1111 0.0933251 2 : -0.70148 7.14154 5.40009 4.06533 4.59482 3 : -0.429342 -0.718157 4.34833 -1.7882 9.38671 4 : -0.962728 -0.0724134 -0.446508 7.04995 -2.79401 5 : -0.894743 0.0696332 -0.573559 -0.191753 -7.28345 The recovered matrix A2: Col: 1 2 3 4 5 Row 1 : 8.44487 4.64954 5.96647 9.54103 1.8198 2 : 6.15325 8.13977 9.01991 5.42813 0.929889 3 : 3.76611 8.98444 7.02066 5.40106 4.63489 4 : 8.77182 4.29239 3.77455 3.1111 0.0933251 5 : 7.84852 3.34329 7.34956 0.712346 9.15026 r8mat_trace_test(): r8mat_trace() computes the trace of a matrix Matrix: Col: 1 2 3 4 Row 1 : 4 3 2 1 2 : 3 3 2 1 3 : 0 2 2 1 4 : 0 0 1 1 Trace is 10.000000 r8mat_transpose_print_test(): r8mat_transpose_print() prints an R8MAT, transposed. Matrix row order M = 7 Matrix column order N = 12 The transposed matrix A: Row: 1 2 3 4 5 Col 1: 101 201 301 401 501 2: 102 202 302 402 502 3: 103 203 303 403 503 4: 104 204 304 404 504 5: 105 205 305 405 505 6: 106 206 306 406 506 7: 107 207 307 407 507 8: 108 208 308 408 508 9: 109 209 309 409 509 10: 110 210 310 410 510 11: 111 211 311 411 511 12: 112 212 312 412 512 Row: 6 7 Col 1: 601 701 2: 602 702 3: 603 703 4: 604 704 5: 605 705 6: 606 706 7: 607 707 8: 608 708 9: 609 709 10: 610 710 11: 611 711 12: 612 712 r8mat_transpose_print_some_test(): r8mat_transpose_print_some() prints some of an R8MAT, transposed. Matrix row order M = 5 Matrix column order N = 4 The matrix A: Col: 1 2 3 4 Row 1 : 11 12 13 14 2 : 21 22 23 24 3 : 31 32 33 34 4 : 41 42 43 44 5 : 51 52 53 54 The transposed matrix A, rows 1:3, cols 2:3: Row: 1 2 3 Col 2: 12 22 32 3: 13 23 33 r8mat_u_inverse_test(): r8mat_u_inverse() inverts an upper triangular matrix. Input matrix A Col: 1 2 3 4 Row 1 : 1 2 4 7 2 : 0 3 5 8 3 : 0 0 6 9 4 : 0 0 0 10 Inverse matrix B: Col: 1 2 3 4 Row 1 : 1 -0.666667 -0.111111 -0.0666667 2 : 0 0.333333 -0.277778 -0.0166667 3 : 0 0 0.166667 -0.15 4 : 0 0 0 0.1 Product C = A * B: Col: 1 2 3 4 Row 1 : 1 0 0 0 2 : 0 1 0 0 3 : 0 0 1 1.11022e-16 4 : 0 0 0 1 r8mat_u_solve_test(): r8mat_u_solve() solves an upper triangular system. Input matrix A: Col: 1 2 3 4 Row 1 : 1 2 4 7 2 : 0 3 5 8 3 : 0 0 6 9 4 : 0 0 0 10 Right hand side b: 1: 45 2: 53 3: 54 4: 40 Computed solution x: 1: 1 2: 2 3: 3 4: 4 Norm of A*x-b = 0 r8mat_u1_inverse_test(): r8mat_u1_inverse() inverts a unit upper triangular matrix. Input matrix A Col: 1 2 3 4 5 Row 1 : 1 2 0 5 0 2 : 0 1 0 0 0 3 : 0 0 1 3 0 4 : 0 0 0 1 0 5 : 0 0 0 0 1 6 : 0 0 0 0 0 Col: 6 Row 1 : 75 2 : 0 3 : 0 4 : 6 5 : 4 6 : 1 Inverse matrix B: Col: 1 2 3 4 5 Row 1 : 1 -2 -0 -5 -0 2 : 0 1 -0 -0 -0 3 : 0 0 1 -3 -0 4 : 0 0 0 1 -0 5 : 0 0 0 0 1 6 : 0 0 0 0 0 Col: 6 Row 1 : -45 2 : -0 3 : 18 4 : -6 5 : -4 6 : 1 Product C = A * B: Col: 1 2 3 4 5 Row 1 : 1 0 0 0 0 2 : 0 1 0 0 0 3 : 0 0 1 0 0 4 : 0 0 0 1 0 5 : 0 0 0 0 1 6 : 0 0 0 0 0 Col: 6 Row 1 : 0 2 : 0 3 : 0 4 : 0 5 : 0 6 : 1 r8mat_uniform_01_test(): r8mat_uniform_01() computes a random R8MAT. Uniform R8MAT: Col: 1 2 3 4 Row 1 : 0.642742 0.127266 0.436657 0.594037 2 : 0.00141906 0.00864769 0.436555 0.241084 3 : 0.0303853 0.72708 0.0492132 0.841369 4 : 0.20847 0.354116 0.0496319 0.857213 5 : 0.454966 0.780446 0.0911002 0.963612 r8mat_uniform_ab_test(): r8mat_uniform_ab() sets an R8MAT to random values in [A,B]. The random matrix: Col: 1 2 3 4 Row 1 : 5.9112 4.78054 7.72508 3.4318 2 : 3.76248 5.68985 6.62191 7.06667 3 : 3.80967 7.11459 5.46639 6.992 4 : 6.2943 9.33869 9.07394 4.62353 5 : 8.09688 3.29258 5.14441 8.42372 r8mat_uniform_abvec_test(): r8mat_uniform_abvec() sets an R8MAT to random values in [A,B] where A and B are vectors of row limits. Lower and upper row limits: 1: 2 10 2: 0 1 3: -1 0 4: 100 110 5: 0.1 0.2 The random matrix: Col: 1 2 3 4 Row 1 : 9.99582 9.84783 3.0163 3.85792 2 : 0.0236325 0.607433 0.110809 0.40746 3 : -0.115923 -0.451867 -0.630997 -0.791654 4 : 104.409 109.562 101.24 104.708 5 : 0.18569 0.104339 0.169163 0.197899 r8mat_ut_solve_test(): r8mat_ut_solve() solves a transposed upper triangular system. Input matrix A: Col: 1 2 3 4 Row 1 : 1 2 4 7 2 : 0 3 5 8 3 : 0 0 6 9 4 : 0 0 0 10 Right hand side b: 1: 1 2: 8 3: 32 4: 90 Computed solution x: 1: 1 2: 2 3: 3 4: 4 Norm of A'*x-b = 0 r8mat_vand2_test(): r8mat_vand2() returns a row Vandermonde matrix. The factor vector X: 1: 1 2: 2 3: 3 4: 4 5: 5 The row Vandermonde matrix: Col: 1 2 3 4 Row 1 : 1 1 1 1 2 : 1 2 4 8 3 : 1 3 9 27 4 : 1 4 16 64 5 : 1 5 25 125 r8plu_det_test(): r8plu_det() determines the determinant of a matrix from its compressed PLU factors. Matrix order N = 5 The matrix A: Col: 1 2 3 4 5 Row 1 : 0.283268 0.899983 0.15572 0.0672227 0.83113 2 : 0.13378 0.193434 0.819001 0.95079 0.156502 3 : 0.68528 0.754425 0.624924 0.497577 0.457309 4 : 0.909455 0.346261 0.73856 0.755146 0.6181 5 : 0.610869 0.418625 0.805112 0.742405 0.932183 The determinant = 0.045717 r8plu_inverse_test(): r8plu_inverse() determines the inverse of a matrix from its compressed PLU factors. Matrix order N = 5 The matrix A: Col: 1 2 3 4 5 Row 1 : 0.835088 0.0348657 0.154829 0.401791 0.188092 2 : 0.895424 0.88542 0.143908 0.406373 0.0946289 3 : 0.582519 0.407731 0.605959 0.386191 0.323186 4 : 0.582747 0.036382 0.254481 0.609802 0.769597 5 : 0.854926 0.746148 0.324154 0.166891 0.234118 The inverse matrix B: Col: 1 2 3 4 5 Row 1 : 1.48289 -0.775306 -0.725123 -0.34707 1.26389 2 : -1.39938 1.0936 -0.049038 0.189986 0.125411 3 : 0.0964372 -0.950609 2.22634 -0.825559 -0.0527828 4 : 0.00107468 2.36071 1.17628 0.26721 -3.45721 5 : -1.08944 -1.02084 -1.11683 1.61446 1.79386 The product matrix C = A * B: Col: 1 2 3 4 5 Row 1 : 1 3.33067e-16 5.55112e-17 5.55112e-17 -1.11022e-16 2 : 0 1 -2.77556e-17 -2.77556e-17 -1.94289e-16 3 : 5.55112e-17 2.77556e-16 1 0 -1.11022e-16 4 : 0 3.33067e-16 0 1 -4.44089e-16 5 : 1.11022e-16 5.55112e-17 0 -5.55112e-17 1 r8plu_mul_test(): r8plu_mul() computes the product A*x=b using the compressed PLU factors of A. Matrix order N = 5 The matrix A: Col: 1 2 3 4 5 Row 1 : 0.740365 0.309369 0.556998 0.384567 0.234783 2 : 0.692818 0.52303 0.262964 0.538601 0.528559 3 : 0.824078 0.325299 0.680566 0.991704 0.0514361 4 : 0.827978 0.831843 0.233653 0.75522 0.756875 5 : 0.293368 0.810295 0.456425 0.980455 0.60198 The right hand side B (computed from A): 1: 5.74228 2: 7.32497 3: 7.74037 4: 9.99788 5: 10.215 The right hand side B (computed from PLU): 1: 5.74228 2: 7.32497 3: 7.74037 4: 9.99788 5: 10.215 r8plu_sol_test(): r8plu_sol() solves a linear system A*x=b using the compressed PLU factors of A. Matrix order N = 5 The matrix A: Col: 1 2 3 4 5 Row 1 : 0.857169 0.540878 0.747534 0.552572 0.346682 2 : 0.988277 0.207731 0.748509 0.957543 0.622803 3 : 0.929484 0.219284 0.543299 0.892833 0.796625 4 : 0.409515 0.325806 0.338132 0.356504 0.745875 5 : 0.000341462 0.0959494 0.832334 0.546402 0.125536 The right hand side B: 1: 8.12522 2: 10.5935 3: 10.5524 4: 7.23091 5: 5.50253 The computed solution X: 1: 1 2: 2 3: 3 4: 4 5: 5 r8plu_to_r8mat_test(): r8plu_to_r8mat() determines the original matrix from the compressed PLU factors. Matrix order N = 5 The matrix A: Col: 1 2 3 4 5 Row 1 : 0.822394 0.367286 0.225068 0.592667 0.999329 2 : 0.0251505 0.744868 0.350014 0.162899 0.355407 3 : 0.414429 0.892267 0.287085 0.838406 0.0470777 4 : 0.731407 0.242603 0.927488 0.167561 0.213661 5 : 0.781374 0.129597 0.0513138 0.502201 0.397839 The pivot vector P: 1: 1 2: 2 3: 4 4: 4 5: 5 The compressed LU factors: Col: 1 2 3 4 5 Row 1 : 0.822394 0.367286 0.225068 0.592667 0.999329 2 : -0.0305821 0.733635 0.343131 0.144774 0.324846 3 : -0.50393 -0.96394 0.766631 -0.34295 -0.637892 4 : -0.889364 0.114563 0.204912 0.329916 -0.900357 5 : -0.950121 0.299017 0.0781683 0.134648 -0.625605 The recovered matrix A2: Col: 1 2 3 4 5 Row 1 : 0.822394 0.367286 0.225068 0.592667 0.999329 2 : 0.0251505 0.744868 0.350014 0.162899 0.355407 3 : 0.414429 0.892267 0.287085 0.838406 0.0470777 4 : 0.731407 0.242603 0.927488 0.167561 0.213661 5 : 0.781374 0.129597 0.0513138 0.502201 0.397839 r8r8_print_test(): r8r8_print() prints a pair of R8's with a label. Center : ( 1.23, 7.45 ) ( 1.23, 7.45 ) Focus : ( 1.23457, 7.45679e+06 ) r8r8vec_index_insert_unique_test(): r8r8vec_index_insert_unique() inserts unique values into an index sorted array. Generate 30 random values: Index XVAL YVAL 1 2.000000 1.000000 2 4.000000 2.000000 2 4.000000 2.000000 3 4.000000 1.000000 4 3.000000 3.000000 5 2.000000 3.000000 4 3.000000 3.000000 4 3.000000 3.000000 1 2.000000 1.000000 6 2.000000 2.000000 7 3.000000 2.000000 5 2.000000 3.000000 4 3.000000 3.000000 5 2.000000 3.000000 8 3.000000 1.000000 6 2.000000 2.000000 4 3.000000 3.000000 9 1.000000 3.000000 2 4.000000 2.000000 6 2.000000 2.000000 7 3.000000 2.000000 7 3.000000 2.000000 5 2.000000 3.000000 4 3.000000 3.000000 6 2.000000 2.000000 4 3.000000 3.000000 10 1.000000 2.000000 8 3.000000 1.000000 11 4.000000 3.000000 5 2.000000 3.000000 Vector of unique X Y values: I X(I) Y(I) 1 2.000000 1.000000 2 4.000000 2.000000 3 4.000000 1.000000 4 3.000000 3.000000 5 2.000000 3.000000 6 2.000000 2.000000 7 3.000000 2.000000 8 3.000000 1.000000 9 1.000000 3.000000 10 1.000000 2.000000 11 4.000000 3.000000 X, Y sorted by index I INDX(I) X(INDX(I)) Y(INDX(I)) 1 10.000000 1.000000 2 2 9.000000 1.000000 3 3 1.000000 2.000000 1 4 6.000000 2.000000 2 5 5.000000 2.000000 3 6 8.000000 3.000000 1 7 7.000000 3.000000 2 8 4.000000 3.000000 3 9 3.000000 4.000000 1 10 2.000000 4.000000 2 11 11.000000 4.000000 3 r8r8r8vec_index_insert_unique_test(): r8r8r8vec_index_insert_unique() inserts unique values into an index sorted array. Number of random values to generate = 30 XVAL YVAL ZVAL Index 1 1.000000 2.000000 2.000000 2 2.000000 3.000000 2.000000 3 2.000000 2.000000 2.000000 4 3.000000 3.000000 1.000000 3 2.000000 2.000000 2.000000 5 4.000000 3.000000 3.000000 6 4.000000 2.000000 3.000000 7 4.000000 2.000000 4.000000 8 3.000000 2.000000 3.000000 9 4.000000 1.000000 2.000000 6 4.000000 2.000000 3.000000 5 4.000000 3.000000 3.000000 10 1.000000 1.000000 3.000000 11 3.000000 3.000000 3.000000 12 3.000000 2.000000 2.000000 13 4.000000 2.000000 1.000000 14 3.000000 2.000000 1.000000 15 4.000000 2.000000 2.000000 1 1.000000 2.000000 2.000000 16 3.000000 1.000000 2.000000 2 2.000000 3.000000 2.000000 8 3.000000 2.000000 3.000000 17 1.000000 3.000000 4.000000 1 1.000000 2.000000 2.000000 18 3.000000 1.000000 3.000000 12 3.000000 2.000000 2.000000 1 1.000000 2.000000 2.000000 1 1.000000 2.000000 2.000000 11 3.000000 3.000000 3.000000 9 4.000000 1.000000 2.000000 Vector of unique X Y Z values: I X(I) Y(I) Z(I) 1 1.000000 2.000000 2.000000 2 2.000000 3.000000 2.000000 3 2.000000 2.000000 2.000000 4 3.000000 3.000000 1.000000 5 4.000000 3.000000 3.000000 6 4.000000 2.000000 3.000000 7 4.000000 2.000000 4.000000 8 3.000000 2.000000 3.000000 9 4.000000 1.000000 2.000000 10 1.000000 1.000000 3.000000 11 3.000000 3.000000 3.000000 12 3.000000 2.000000 2.000000 13 4.000000 2.000000 1.000000 14 3.000000 2.000000 1.000000 15 4.000000 2.000000 2.000000 16 3.000000 1.000000 2.000000 17 1.000000 3.000000 4.000000 18 3.000000 1.000000 3.000000 X Y Z sorted by index: I INDX(I) X(I) X(INDX(I)) 1 10.000000 1.000000 1.000000 3 2 1.000000 1.000000 2.000000 2 3 17.000000 1.000000 3.000000 4 4 3.000000 2.000000 2.000000 2 5 2.000000 2.000000 3.000000 2 6 16.000000 3.000000 1.000000 2 7 18.000000 3.000000 1.000000 3 8 14.000000 3.000000 2.000000 1 9 12.000000 3.000000 2.000000 2 10 8.000000 3.000000 2.000000 3 11 4.000000 3.000000 3.000000 1 12 11.000000 3.000000 3.000000 3 13 9.000000 4.000000 1.000000 2 14 13.000000 4.000000 2.000000 1 15 15.000000 4.000000 2.000000 2 16 6.000000 4.000000 2.000000 3 17 7.000000 4.000000 2.000000 4 18 5.000000 4.000000 3.000000 3 m = 3 n = 4 r8rows_to_r8mat_test(): r8rows_to_r8mat() allows an R8MAT to be initialized by data stored row-wise in a vector. The data vector: 1: 11 2: 12 3: 13 4: 14 5: 21 6: 22 7: 23 8: 24 9: 31 10: 32 11: 33 12: 34 The data copied into an array: Col: 1 2 3 4 Row 1 : 11 12 13 14 2 : 21 22 23 24 3 : 31 32 33 34 r8slmat_print_test(): r8slmat_print() prints a strictly lower triangular matrix stored compactly. Only the (possibly) nonzero elements are printed. R8SLMAT Col 1 2 3 4 5 6 Row: 2 21 3 31 32 4 41 42 43 5 51 52 53 54 6 61 62 63 64 65 7 71 72 73 74 75 76 R8SLMAT Col 1 2 3 Row: 2 21 3 31 32 4 41 42 43 5 51 52 53 6 61 62 63 7 71 72 73 R8SLMAT Col 1 2 3 Row: 2 21 3 31 32 4 41 42 43 r8vec_amax_test(): r8vec_amax(): maximum magnitude entry; Input vector: 1: -0.80716 2: 9.17067 3: 5.80091 4: -0.962508 5: -3.33144 6: -8.81809 7: 4.81811 8: 0.13589 9: -6.00149 10: -1.45613 Maximum absolute: 9.170672 r8vec_amax_index_test(): r8vec_amax_index(): index of maximum magnitude entry; Input vector: 1: -6.62619 2: 5.03389 3: -2.63298 4: 8.83636 5: -9.65655 6: 6.58112 7: 2.53182 8: 0.77493 9: 3.01015 10: 4.53259 Maximum absolute occurs at a[5] r8vec_amin_test(): r8vec_amin(): minimum magnitude entry. Input vector: 1: -8.11023 2: 7.55148 3: -9.71276 4: -4.11395 5: -6.4017 6: 8.52589 7: -8.63639 8: 1.62186 9: 2.74302 10: 3.02539 Minimum absolute: 1.621865 r8vec_amin_index_test(): r8vec_amin_index(): index of minimum magnitude entry; Input vector: 1: 7.29244 2: -8.88095 3: 6.3371 4: 0.578449 5: 3.88701 6: -5.7519 7: 0.865599 8: 4.05041 9: 9.12869 10: -1.10916 Minimum absolute occurs at a[4] r8vec_any_normal_test(): r8vec_any_normal() computes a vector V2 that is normal to a given vector V1. Test |V1| |V2| V1.V2 1 1.92871 1 0 2 1.9137 1 1.11022e-16 3 1.92837 1 0 4 1.8781 1 0 5 1.98122 1 0 r8vec_asum_test(): r8vec_asum() computes the absolute sum of an R8VEC. Input vector: 1: 0.385256 2: -2.17795 3: 4.75958 4: -4.63574 5: -1.73755 6: 4.73014 7: -1.34967 8: -1.9085 9: -3.79088 10: 4.15766 Absolute sum = 29.6329 r8vec_bin_test(): r8vec_bin() sorts an R8VEC into bins. Some of the R8VEC: 1 10.3031 2 13.646 3 23.2572 4 16.494 5 18.4599 6 17.9133 7 19.8703 8 8.49865 ...... .............. 100 8.0112 Bin Population Limits 1 18 -Inf < x < 10 2 5 10 < x < 11 3 3 11 < x < 12 4 10 12 < x < 13 5 8 13 < x < 14 6 3 14 < x < 15 7 3 15 < x < 16 8 7 16 < x < 17 9 4 17 < x < 18 10 7 18 < x < 19 11 9 19 < x < 20 12 23 20 < x < +Inf r8vec_binary_next_test(): r8vec_binary_next() generates the next binary vector. 000 001 010 011 100 101 110 111 r8vec_blend_test(): r8vec_blend() blends two vectors. V1 and V2: 1: 1 0 2: 2 5 3: 3 10 T1 = 0.25, T2 = 0.75 1: 1 0.25 0 2: 2 4.25 5 3: 3 8.25 10 T1 = 0.5, T2 = 0.5 1: 1 0.5 0 2: 2 3.5 5 3: 3 6.5 10 T1 = 0.75, T2 = 0.25 1: 1 0.75 0 2: 2 2.75 5 3: 3 4.75 10 r8vec_bracket_test(): r8vec_bracket() finds a pair of entries in a sorted real array which bracket a value. Sorted array: 1: 1 2: 2 3: 3 4: 4 5: 5 6: 5 7: 7 8: 8 9: 9 10: 10 LEFT RIGHT X(LEFT) XVAL X(RIGHT) 1 2 1.000000 -10.000000 2.000000 1 2 1.000000 1.000000 2.000000 4 5 4.000000 4.500000 5.000000 6 7 5.000000 5.000000 7.000000 9 10 9.000000 10.000000 10.000000 9 10 9.000000 12.000000 10.000000 r8vec_bracket2_test(): r8vec_bracket2() finds a pair of entries in a sorted R8VEC which bracket a value. Sorted array: 1: 1 2: 2 3: 3 4: 4 5: 5 6: 5 7: 7 8: 8 9: 9 10: 10 Search for XVAL = Start = 5 Left = 1 Right = 2 X(LEFT) = 1.000000 X(RIGHT) = 2.000000 Search for XVAL = Start = 1 Left = 1 Right = 1 X(LEFT) = 1.000000 X(RIGHT) = 1.000000 Search for XVAL = Start = 1 Left = 4 Right = 5 X(LEFT) = 4.000000 X(RIGHT) = 5.000000 Search for XVAL = Start = 4 Left = 5 Right = 5 X(LEFT) = 5.000000 X(RIGHT) = 5.000000 Search for XVAL = Start = 5 Left = 9 Right = 10 X(LEFT) = 9.000000 X(RIGHT) = 10.000000 Search for XVAL = Start = 9 Left = 10 Right = -1 X(LEFT) = 10.000000 r8vec_bracket3_test(): r8vec_bracket3() finds a pair of entries in a sorted real array which bracket a value. Sorted array: 1: 1 2: 2 3: 3 4: 4 5: 5 6: 5 7: 7 8: 8 9: 9 10: 10 Search for XVAL = -10.000000 Starting guess for interval is = 5 Nearest interval: X[1]= 1.000000 X[2]= 2.000000 Search for XVAL = 1.000000 Starting guess for interval is = 1 Nearest interval: X[1]= 1.000000 X[2]= 2.000000 Search for XVAL = 4.500000 Starting guess for interval is = 1 Nearest interval: X[4]= 4.000000 X[5]= 5.000000 Search for XVAL = 5.000000 Starting guess for interval is = 4 Nearest interval: X[4]= 4.000000 X[5]= 5.000000 Search for XVAL = 10.000000 Starting guess for interval is = 4 Nearest interval: X[9]= 9.000000 X[10]= 10.000000 Search for XVAL = 12.000000 Starting guess for interval is = 9 Nearest interval: X[9]= 9.000000 X[10]= 10.000000 r8vec_bracket4_test(): r8vec_bracket4() finds a pair of entries in a sorted real array which bracket a value. Sorted array: 1: 0.75 2: 1.75 3: 2.75 4: 3.75 5: 4.75 6: 4.75 7: 6.75 8: 7.75 9: 8.75 10: 9.75 11: 10.75 Values to be bracketed: 1: -10.1 2: 1.2 3: 4.5 4: 5.2 5: 10.4 6: 12.5 Item Value Left Right 1 -10.10 1 2 2 1.20 1 2 3 4.50 4 5 4 5.20 6 7 5 10.40 10 11 6 12.50 10 11 r8vec_bracket5_test(): r8vec_bracket5() finds a pair of entries in a sorted R8VEC which bracket a value. Sorted array: 1: 1 2: 2 3: 3 4: 4 5: 5 6: 5 7: 7 8: 8 9: 9 10: 10 LEFT RIGHT X(LEFT) XVAL X(RIGHT) -1 1 2 1.0000 1.0000 2.0000 4 5 4.0000 4.5000 5.0000 6 7 5.0000 5.0000 7.0000 9 10 9.0000 10.0000 10.0000 -1 r8vec_bracket6_test(): r8vec_bracket6() finds a pair of entries in a sorted real array which bracket a value. Sorted array: 1: 0.75 2: 1.75 3: 2.75 4: 3.75 5: 4.75 6: 4.75 7: 6.75 8: 7.75 9: 8.75 10: 9.75 11: 10.75 Values to be bracketed: 1: -10.1 2: 1.2 3: 4.5 4: 5.2 5: 10.4 6: 12.5 Item Value Left Right 1 -10.10 -1 0 2 1.20 1 2 3 4.50 4 5 4 5.20 6 7 5 10.40 10 11 6 12.50 -1 0 r8vec_cheby_extreme_test(): r8vec_cheby_extreme() computes Chebyshev Extreme points in [R1,R2]. N = 5, R1 = -1.000000, R2 = 1.000000 Chebyshev points: 1: -1 2: -0.707107 3: 0 4: 0.707107 5: 1 N = 7, R1 = 0.000000, R2 = 10.000000 Chebyshev points: 1: 0 2: 0.669873 3: 2.5 4: 5 5: 7.5 6: 9.33013 7: 10 r8vec_cheby_zero_test(): r8vec_cheby_zero() computes Chebyshev Zero points in [R1,R2]. N = 5, R1 = -1.000000, R2 = 1.000000 Chebyshev points: 1: -0.951057 2: -0.587785 3: 0 4: 0.587785 5: 0.951057 N = 7, R1 = 0.000000, R2 = 10.000000 Chebyshev points: 1: 0.12536 2: 1.09084 3: 2.83058 4: 5 5: 7.16942 6: 8.90916 7: 9.87464 r8vec_cheby1space_test(): r8vec_cheby1space(): Chebyshev Type 1 spaced points in [A,B]; r8vec_cheby1space ( 5, 10, 20 ) 1: 10 2: 11.4645 3: 15 4: 18.5355 5: 20 r8vec_cheby2space_test(): r8vec_cheby2space(): Chebyshev Type 2 spaced points in [A,B]; r8vec_cheby2space ( 5, 10, 20 ) 1: 10.6699 2: 12.5 3: 15 4: 17.5 5: 19.3301 r8vec_compare_test(): r8vec_compare() compares the order of two R8VEC's. V1 and V2: 1: 1 0 2: 2 5 3: 3 10 V1 > V2 V1 and V2: 1: 1 1 2: 2 2 3: 3 3 V1 = V2 V1 and V2: 1: 1 1 2: 2 3 3: 3 0 V1 < V2 r8vec_concatenate_test(): r8vec_concatenate() concatenates two R8VECs Array 1: 1: 91.1 2: 31.2 3: 71.3 4: 51.4 5: 31.5 Array 2: 1: 42.6 2: 22.7 3: 12.8 Array 3 = Array 1 + Array 2: 1: 91.1 2: 31.2 3: 71.3 4: 51.4 5: 31.5 6: 42.6 7: 22.7 8: 12.8 r8vec_convolution_test(): r8vec_convolution() computes the convolution of two vectors. The factor X: 1: 1 2: 2 3: 3 4: 4 The factor Y: 1: -1 2: 5 3: 3 The convolution z = x star y: 1: -1 2: 3 3: 10 4: 17 5: 29 6: 12 Correct answer: 1: -1 2: 3 3: 10 4: 17 5: 29 6: 12 r8vec_convolution_circ_test(): r8vec_convolution_circ() computes the circular convolution of two vectors. The factor X: 1: 1 2: 2 3: 3 4: 4 The factor Y: 1: 1 2: 2 3: 4 4: 8 The circular convolution z = xCCy: 1: 37 2: 44 3: 43 4: 26 Correct answer: 1: 37 2: 44 3: 43 4: 26 r8vec_copy_test(): r8vec_copy() copies an R8VEC. Original array A: 1: 1 2: 2 3: 3 4: 4 5: 5 Copied array B: 1: 1 2: 2 3: 3 4: 4 5: 5 r8vec_correlation_test(): r8vec_correlation() computes the correlation of two R8VEC's. Vector V1: 1: 43 2: 21 3: 25 4: 42 5: 57 6: 59 Vector V2: 1: 99 2: 65 3: 79 4: 75 5: 87 6: 81 V1 V2 Correlation coefficient r = 0.529809 r8vec_cross_product_2d_test(): r8vec_cross_product_2d() computes the cross product of two R8VEC's. Vector V1: 1: 1 2: 0.5 Vector V2: 1: 2.83595 2: 0 V1xV2 = -1.41798 Vector V2: 1: 4.77016 2: 2.75405 V1xV2 = 0.368973 Vector V2: 1: 4.35451 2: 7.54223 V1xV2 = 5.36498 Vector V2: 1: 2.58728e-17 2: 0.422534 V1xV2 = 0.422534 Vector V2: 1: -4.52361 2: 7.83512 V1xV2 = 10.0969 Vector V2: 1: -1.13427 2: 0.65487 V1xV2 = 1.222 Vector V2: 1: -8.33729 2: 1.02102e-15 V1xV2 = 4.16864 Vector V2: 1: -6.93226 2: -4.00234 V1xV2 = -0.536212 Vector V2: 1: -4.5894 2: -7.94907 V1xV2 = -5.65437 Vector V2: 1: -2.52223e-16 2: -1.37304 V1xV2 = -1.37304 Vector V2: 1: 2.52366 2: -4.37111 V1xV2 = -5.63294 Vector V2: 1: 3.50704 2: -2.02479 V1xV2 = -3.77831 Vector V2: 1: 1.73572 2: -4.25129e-16 V1xV2 = -0.867861 r8vec_cross_product_3d_test(): r8vec_cross_product_3d() computes the cross product of two R8VEC's. Vector V1: 1: 1 2: 0.5 3: 0 Vector V2: 1: 5.75184 2: 6.06218 3: 2.14446 V3 = V1 x V2: 1: 1.07223 2: -2.14446 3: 3.18626 Vector V2: 1: 5.19932 2: 9.89186 3: 4.89915 V3 = V1 x V2: 1: 2.44958 2: -4.89915 3: 7.2922 Vector V2: 1: 6.94873 2: 4.11422 3: 0.347767 V3 = V1 x V2: 1: 0.173884 2: -0.347767 3: 0.639852 Vector V2: 1: 2.92832 2: 8.01442 3: 3.46502 V3 = V1 x V2: 1: 1.73251 2: -3.46502 3: 6.55026 Vector V2: 1: 0.833159 2: 5.11106 3: 3.66833 V3 = V1 x V2: 1: 1.83417 2: -3.66833 3: 4.69448 r8vec_dif_test(): r8vec_dif() estimates derivatives. Estimate the derivative of order N = 4 Using H = 0.010000 at argument X = 1.000000 The difference coefficients: 1: 6.25e+06 2: -2.5e+07 3: 3.75e+07 4: -2.5e+07 5: 6.25e+06 Estimate is FDIF = 2.718463 r8vec_diff_norm_test(): r8vec_diff_norm(): L2 norm of the difference of two R8VEC's. Vector V1: 1: 4.78959 2: 0.494803 3: 6.09042 4: 6.33822 5: -6.21057 Vector V2: 1: -7.52613 2: 6.41993 3: 2.75795 4: -9.6776 5: 7.91909 L2 norm of V1-V2: 25.5743 r8vec_diff_norm_l1_test(): r8vec_diff_norm_l1(): L1 norm of the difference of two R8VEC's. Vector V1: 1: 0.307501 2: 0.890439 3: 2.12884 4: 5.20872 5: 7.10694 Vector V2: 1: -2.34263 2: -8.30702 3: 4.67747 4: -3.36021 5: 6.79499 L1 norm of V1-V2: 23.2771 r8vec_diff_norm_l2_test(): r8vec_diff_norm_l2(): L2 norm of the difference of two R8VEC's. Vector V1: 1: -2.56553 2: 6.56431 3: -6.46963 4: -7.4096 5: 7.59767 Vector V2: 1: -9.11842 2: 3.7344 3: 4.67546 4: -1.25655 5: -2.40322 L2 norm of V1-V2: 17.6929 r8vec_diff_norm_li_test(): r8vec_diff_norm_li(): L-infinity norm of the difference of two R8VEC's. Vector V1: 1: 9.59315 2: -2.02013 3: -1.19626 4: -6.86384 5: -3.47931 Vector V2: 1: -3.71876 2: 7.89001 3: -5.05952 4: -3.78642 5: -1.82262 L-Infinity norm of V1-V2: 13.3119 r8vec_direct_product_test(): r8vec_direct_product() forms the entries of a direct product of a given number of R8VEC factors. J X(1) X(2) X(3) 1 1.000000 50.000000 800.000000 2 2.000000 50.000000 800.000000 3 3.000000 50.000000 800.000000 4 4.000000 50.000000 800.000000 5 1.000000 60.000000 800.000000 6 2.000000 60.000000 800.000000 7 3.000000 60.000000 800.000000 8 4.000000 60.000000 800.000000 9 1.000000 70.000000 800.000000 10 2.000000 70.000000 800.000000 11 3.000000 70.000000 800.000000 12 4.000000 70.000000 800.000000 13 1.000000 50.000000 900.000000 14 2.000000 50.000000 900.000000 15 3.000000 50.000000 900.000000 16 4.000000 50.000000 900.000000 17 1.000000 60.000000 900.000000 18 2.000000 60.000000 900.000000 19 3.000000 60.000000 900.000000 20 4.000000 60.000000 900.000000 21 1.000000 70.000000 900.000000 22 2.000000 70.000000 900.000000 23 3.000000 70.000000 900.000000 24 4.000000 70.000000 900.000000 r8vec_direct_product2_test(): r8vec_direct_product2() forms the entries of a direct product of a given number of R8VEC factors. J W(J) 1 40000.000000 2 80000.000000 3 120000.000000 4 160000.000000 5 48000.000000 6 96000.000000 7 144000.000000 8 192000.000000 9 56000.000000 10 112000.000000 11 168000.000000 12 224000.000000 13 45000.000000 14 90000.000000 15 135000.000000 16 180000.000000 17 54000.000000 18 108000.000000 19 162000.000000 20 216000.000000 21 63000.000000 22 126000.000000 23 189000.000000 24 252000.000000 r8vec_dot_product_test(): r8vec_dot_product() computes the dot product of two R8VEC's. V1 and V2: 1: 0.708011 0.557293 2: 0.143638 0.850679 3: 0.871322 0.558565 4: 0.0831559 0.901774 5: 0.461738 0.419518 6: 0.030389 0.358128 7: 0.753201 0.488988 8: 0.700043 0.255962 9: 0.214512 0.929169 10: 0.679905 0.466757 V1 dot V2 = 2.34719 r8vec_eq_test(): r8vec_eq() determines if R8VEC V1 is equal to V2. V1 and V2: 1: 1 0 2: 2 5 3: 3 10 V1 == V2? = False V1 and V2: 1: 1 1 2: 2 2 3: 3 3 V1 == V2? = True V1 and V2: 1: 1 1 2: 2 3 3: 3 0 V1 == V2? = False r8vec_even2_test(): r8vec_even2() interpolates a specified number of points pairs of values in a vector. Input data: 0.000000 4 1.000000 3 5.000000 5 2.000000 0 0.000000 Resulting vector: * 0.000000 0.200000 0.400000 0.600000 0.800000 * 1.000000 2.000000 3.000000 4.000000 * 5.000000 4.500000 4.000000 3.500000 3.000000 2.500000 * 2.000000 * 0.000000 r8vec_even3_test(): r8vec_even3() tries to evenly interpolate new data between old values. Original vector: 1: 0 2: 5.1 3: 7 4: 10 New vector: 1: 0 2: 1.02 3: 2.04 4: 3.06 5: 4.08 6: 5.1 7: 5.73333 8: 6.36667 9: 7 10: 8 11: 9 12: 10 r8vec_expand_linear_test(): r8vec_expand_linear() linearly interpolates new data between old values. Original vector: 1: 16 2: 4 3: 0 4: 4 5: 16 6: 36 Expansion factor is 3 Fattened vector: 1: 16 2: 13 3: 10 4: 7 5: 4 6: 3 7: 2 8: 1 9: 0 10: 1 11: 2 12: 3 13: 4 14: 7 15: 10 16: 13 17: 16 18: 21 19: 26 20: 31 21: 36 r8vec_fill_test(): r8vec_fill() sets all entries of an R8VEC to a given value. Using FILL = 123.45 Random R8VEC: 1: 123.45 2: 123.45 3: 123.45 4: 123.45 5: 123.45 r8vec_frac_test(): r8vec_frac(): K-th smallest entry; Array to search: 1: 0.254008 2: 0.431218 3: 0.70253 4: 0.40233 5: 0.18184 6: 0.856251 7: 0.584201 8: 0.373579 9: 0.221695 10: 0.218994 Fractile Value 1 0.181840 6 0.402330 r8vec_ge_test(): r8vec_ge() determines if R8VEC V1 is greater than or equal to V2. V1 and V2: 1: 1 0 2: 2 5 3: 3 10 V1 => V2? = True V1 and V2: 1: 1 1 2: 2 2 3: 3 3 V1 => V2? = True V1 and V2: 1: 1 1 2: 2 3 3: 3 0 V1 => V2? = True r8vec_gt_test(): r8vec_gt() determines if R8VEC V1 is greater than V2. V1 and V2: 1: 1 0 2: 2 5 3: 3 10 V1 > V2? = True V1 and V2: 1: 1 1 2: 2 2 3: 3 3 V1 > V2? = False V1 and V2: 1: 1 1 2: 2 3 3: 3 0 V1 > V2? = False r8vec_heap_a_test(): r8vec_heap_a() puts an R8VEC into ascending heap form. Unsorted array: 1: 10.4446 2: 8.66845 3: 14.8261 4: 1.40899 5: 16.9467 6: 13.5976 7: 2.73303 8: 17.168 9: 3.99668 10: 12.1468 Ascending heap form: 1: 1.40899 2: 3.99668 3: 2.73303 4: 8.66845 5: 12.1468 6: 13.5976 7: 14.8261 8: 17.168 9: 10.4446 10: 16.9467 r8vec_heap_d_test(): r8vec_heap_d() puts an R8VEC into descending heap form. Unsorted array: 1: 10.8609 2: 3.24649 3: 0.113061 4: 15.4297 5: 15.2958 6: 8.42139 7: 1.13626 8: 11.7149 9: 3.4831 10: 14.5722 Descending heap form: 1: 15.4297 2: 15.2958 3: 8.42139 4: 11.7149 5: 14.5722 6: 0.113061 7: 1.13626 8: 3.24649 9: 3.4831 10: 10.8609 r8vec_histogram_test(): r8vec_histogram() histograms a vector. Uniform data: Histogram of data: 0.000000 0 0.000000 0.050000 41 0.050000 0.100000 60 0.100000 0.150000 44 0.150000 0.200000 31 0.200000 0.250000 53 0.250000 0.300000 48 0.300000 0.350000 45 0.350000 0.400000 55 0.400000 0.450000 43 0.450000 0.500000 65 0.500000 0.550000 61 0.550000 0.600000 49 0.600000 0.650000 43 0.650000 0.700000 45 0.700000 0.750000 59 0.750000 0.800000 39 0.800000 0.850000 56 0.850000 0.900000 67 0.900000 0.950000 43 0.950000 1.000000 53 1.000000 0 Normal data: Histogram of data: -3.000000 0 -3.000000 -2.700000 3 -2.700000 -2.400000 3 -2.400000 -2.100000 11 -2.100000 -1.800000 16 -1.800000 -1.500000 31 -1.500000 -1.200000 48 -1.200000 -0.900000 61 -0.900000 -0.600000 91 -0.600000 -0.300000 113 -0.300000 0.000000 116 0.000000 0.300000 114 0.300000 0.600000 111 0.600000 0.900000 89 0.900000 1.200000 73 1.200000 1.500000 42 1.500000 1.800000 39 1.800000 2.100000 21 2.100000 2.400000 12 2.400000 2.700000 5 2.700000 3.000000 0 3.000000 1 r8vec_house_column_test(): r8vec_house_column() returns the compact form of a Householder matrix that "packs" a column of a matrix. Matrix A: Col: 1 2 3 4 Row 1 : 0.0637783 3.27484 0.9629 1.49983 2 : 3.02677 4.39114 3.95488 3.6709 3 : 2.88226 4.51186 0.303526 0.521046 4 : 4.03689 0.761164 1.94914 3.96288 Working on column K = 1 Householder matrix H: Col: 1 2 3 4 Row 1 : -0.0109752 -0.520856 -0.495989 -0.694682 2 : -0.520856 0.731654 -0.255534 -0.357902 3 : -0.495989 -0.255534 0.756666 -0.340814 4 : -0.694682 -0.357902 -0.340814 0.522655 Product H*A: Col: 1 2 3 4 Row 1 : -5.81114 -5.0897 -3.57507 -4.93985 2 :-4.44089e-16 0.0817182 1.61691 0.353167 3 :-4.44089e-16 0.408189 -1.92282 -2.63828 4 :-4.44089e-16 -4.98645 -1.16909 -0.462087 Working on column K = 2 Householder matrix H: Col: 1 2 3 4 Row 1 : 1 0 0 0 2 : 0 -0.0163312 -0.0815759 0.996533 3 : 0 -0.0815759 0.993452 0.0799868 4 : 0 0.996533 0.0799868 0.0228789 Product H*A: Col: 1 2 3 4 Row 1 : -5.81114 -5.0897 -3.57507 -4.93985 2 : -3.9907e-16 -5.0038 -1.03458 -0.251033 3 :-4.40476e-16 0 -2.13564 -2.68678 4 :-4.88231e-16 4.57967e-16 1.43076 0.130343 Working on column K = 3 Householder matrix H: Col: 1 2 3 4 Row 1 : 1 0 0 0 2 : 0 1 0 0 3 : 0 0 -0.830792 0.556583 4 : 0 0 0.556583 0.830792 Product H*A: Col: 1 2 3 4 Row 1 : -5.81114 -5.0897 -3.57507 -4.93985 2 : -3.9907e-16 -5.0038 -1.03458 -0.251033 3 : 9.42027e-17 2.54897e-16 2.57061 2.3047 4 : -6.5078e-16 3.80475e-16 2.22045e-16 -1.38713 r8vec_identity_row_test(): r8vec_identity_row() returns a row of the identity matrix. 0: 0 0 0 0 0 1: 1 0 0 0 0 2: 0 1 0 0 0 3: 0 0 1 0 0 4: 0 0 0 1 0 5: 0 0 0 0 1 6: 0 0 0 0 0 r8vec_index_delete_all_test(): r8vec_index_delete_all() deletes all copies of a particular value. 16.000000 11.000000 5.000000 1.000000 13.000000 0.000000 1.000000 3.000000 9.000000 13.000000 17.000000 10.000000 1.000000 6.000000 13.000000 16.000000 6.000000 10.000000 16.000000 12.000000 Indexed list of entries: I INDX(I) X(I) X(INDX(I)) 1 8 8.000000 0.000000 2 6 7.000000 1.000000 3 15 16.000000 1.000000 4 9 11.000000 1.000000 5 10 5.000000 3.000000 6 5 1.000000 5.000000 7 16 13.000000 6.000000 8 19 0.000000 6.000000 9 2 1.000000 7.000000 10 23 3.000000 7.000000 11 1 9.000000 8.000000 12 24 13.000000 8.000000 13 11 17.000000 9.000000 14 14 10.000000 10.000000 15 20 1.000000 10.000000 16 4 6.000000 11.000000 17 22 13.000000 12.000000 18 7 16.000000 13.000000 19 12 6.000000 13.000000 20 17 10.000000 13.000000 21 3 16.000000 16.000000 22 21 12.000000 16.000000 23 18 7.000000 16.000000 24 13 8.000000 17.000000 Call R8VEC_INDEX_DELETE_ALL to delete all values of 7: Indexed list of entries: I INDX(I) X(I) X(INDX(I)) 1 7 8.000000 0.000000 2 5 16.000000 1.000000 3 14 11.000000 1.000000 4 8 5.000000 1.000000 5 9 1.000000 3.000000 6 4 13.000000 5.000000 7 15 0.000000 6.000000 8 18 1.000000 6.000000 9 1 3.000000 8.000000 10 22 9.000000 8.000000 11 10 13.000000 9.000000 12 13 17.000000 10.000000 13 19 10.000000 10.000000 14 3 1.000000 11.000000 15 21 6.000000 12.000000 16 6 13.000000 13.000000 17 11 16.000000 13.000000 18 16 6.000000 13.000000 19 2 10.000000 16.000000 20 20 16.000000 16.000000 21 17 12.000000 16.000000 22 12 8.000000 17.000000 r8vec_index_delete_dupes_test(): r8vec_index_delete_dupes() deletes duplicates. 11.000000 7.000000 8.000000 16.000000 7.000000 9.000000 7.000000 14.000000 11.000000 13.000000 10.000000 8.000000 10.000000 1.000000 8.000000 19.000000 16.000000 15.000000 15.000000 15.000000 Indexed list of entries: I INDX(I) X(I) X(INDX(I)) 1 16 8.000000 1.000000 2 2 7.000000 7.000000 3 9 11.000000 7.000000 4 23 7.000000 7.000000 5 7 8.000000 7.000000 6 4 16.000000 7.000000 7 1 7.000000 8.000000 8 14 9.000000 8.000000 9 5 7.000000 8.000000 10 24 14.000000 8.000000 11 17 11.000000 8.000000 12 8 13.000000 9.000000 13 13 10.000000 10.000000 14 15 8.000000 10.000000 15 3 10.000000 11.000000 16 11 1.000000 11.000000 17 12 8.000000 13.000000 18 10 19.000000 14.000000 19 20 16.000000 15.000000 20 21 15.000000 15.000000 21 22 15.000000 15.000000 22 6 15.000000 16.000000 23 19 7.000000 16.000000 24 18 8.000000 19.000000 Call R8VEC_INDEX_DELETE_DUPES to delete duplicates: Indexed list of unique entries: I INDX(I) X(I) 1 1 1.000000 2 2 7.000000 3 3 8.000000 4 4 9.000000 5 5 10.000000 6 6 11.000000 7 7 13.000000 8 8 14.000000 9 9 15.000000 10 10 16.000000 11 11 19.000000 r8vec_index_delete_one_test(): r8vec_index_delete_one() deletes one copy of a particular value. 17.000000 15.000000 20.000000 2.000000 8.000000 10.000000 5.000000 1.000000 19.000000 15.000000 3.000000 3.000000 14.000000 8.000000 2.000000 8.000000 3.000000 16.000000 19.000000 0.000000 Indexed list of entries: I INDX(I) X(I) X(INDX(I)) 1 22 8.000000 0.000000 2 10 7.000000 1.000000 3 6 17.000000 2.000000 4 17 15.000000 2.000000 5 13 20.000000 3.000000 6 14 2.000000 3.000000 7 19 8.000000 3.000000 8 9 10.000000 5.000000 9 2 5.000000 7.000000 10 23 1.000000 7.000000 11 1 19.000000 8.000000 12 7 15.000000 8.000000 13 24 3.000000 8.000000 14 18 3.000000 8.000000 15 16 14.000000 8.000000 16 8 8.000000 10.000000 17 15 2.000000 14.000000 18 4 8.000000 15.000000 19 12 3.000000 15.000000 20 20 16.000000 16.000000 21 3 19.000000 17.000000 22 11 0.000000 19.000000 23 21 7.000000 19.000000 24 5 8.000000 20.000000 Call R8VEC_INDEX_DELETE_ONE to delete one value of 8: Indexed list of entries: I INDX(I) X(I) X(INDX(I)) 1 21 8.000000 0.000000 2 9 7.000000 1.000000 3 6 17.000000 2.000000 4 16 15.000000 2.000000 5 12 20.000000 3.000000 6 13 2.000000 3.000000 7 18 10.000000 3.000000 8 8 5.000000 5.000000 9 2 1.000000 7.000000 10 22 19.000000 7.000000 11 1 15.000000 8.000000 12 23 3.000000 8.000000 13 17 3.000000 8.000000 14 15 14.000000 8.000000 15 7 8.000000 10.000000 16 14 2.000000 14.000000 17 4 8.000000 15.000000 18 11 3.000000 15.000000 19 19 16.000000 16.000000 20 3 19.000000 17.000000 21 10 0.000000 19.000000 22 20 7.000000 19.000000 23 5 8.000000 20.000000 r8vec_index_insert_test(): r8vec_index_insert() inserts values into an index sorted array. 13.000000 14.000000 5.000000 17.000000 6.000000 1.000000 2.000000 16.000000 14.000000 16.000000 12.000000 17.000000 1.000000 8.000000 5.000000 10.000000 18.000000 6.000000 12.000000 1.000000 Indexed list of entries: I INDX(I) X(I) X(INDX(I)) 1 8 8.000000 1.000000 2 22 7.000000 1.000000 3 15 13.000000 1.000000 4 9 14.000000 2.000000 5 5 5.000000 5.000000 6 17 17.000000 5.000000 7 7 6.000000 6.000000 8 20 1.000000 6.000000 9 2 2.000000 7.000000 10 23 16.000000 7.000000 11 1 14.000000 8.000000 12 16 16.000000 8.000000 13 24 12.000000 8.000000 14 18 17.000000 10.000000 15 13 1.000000 12.000000 16 21 8.000000 12.000000 17 3 5.000000 13.000000 18 4 10.000000 14.000000 19 11 18.000000 14.000000 20 10 6.000000 16.000000 21 12 12.000000 16.000000 22 6 1.000000 17.000000 23 14 7.000000 17.000000 24 19 8.000000 18.000000 r8vec_index_insert_unique_test(): r8vec_index_insert_unique() inserts unique values into an index sorted array. Generate some random values: 3.000000 17.000000 4.000000 17.000000 7.000000 13.000000 1.000000 15.000000 10.000000 19.000000 6.000000 8.000000 2.000000 19.000000 9.000000 2.000000 14.000000 10.000000 7.000000 15.000000 Indexed list of unique entries: I INDX(I) X(I) X(INDX(I)) 1 6 3.000000 1.000000 2 12 17.000000 2.000000 3 1 4.000000 3.000000 4 3 7.000000 4.000000 5 10 13.000000 6.000000 6 4 1.000000 7.000000 7 11 15.000000 8.000000 8 13 10.000000 9.000000 9 8 19.000000 10.000000 10 5 6.000000 13.000000 11 14 8.000000 14.000000 12 7 2.000000 15.000000 13 2 9.000000 17.000000 14 9 14.000000 19.000000 r8vec_index_order_test(): r8vec_index_order() sorts an index sorted array. Generate some random values: 17.000000 5.000000 11.000000 9.000000 3.000000 12.000000 19.000000 2.000000 18.000000 11.000000 9.000000 3.000000 5.000000 9.000000 11.000000 7.000000 15.000000 18.000000 15.000000 8.000000 Indexed list of unique entries: I INDX(I) X(I) X(INDX(I)) 1 8 17.000000 2.000000 2 5 5.000000 3.000000 3 2 11.000000 5.000000 4 10 9.000000 7.000000 5 12 3.000000 8.000000 6 4 12.000000 9.000000 7 3 19.000000 11.000000 8 6 2.000000 12.000000 9 11 18.000000 15.000000 10 1 7.000000 17.000000 11 9 15.000000 18.000000 12 7 8.000000 19.000000 Now call DVEC_INDEX_ORDER to carry out the sorting: X: 1: 2 2: 3 3: 5 4: 7 5: 8 6: 9 7: 11 8: 12 9: 15 10: 17 11: 18 12: 19 r8vec_index_search_test(): r8vec_index_search() searches for an entry with a given value. Generate some random values: 12.000000 13.000000 3.000000 10.000000 6.000000 12.000000 19.000000 9.000000 1.000000 19.000000 18.000000 7.000000 5.000000 16.000000 10.000000 11.000000 14.000000 2.000000 17.000000 19.000000 Indexed list of entries: I INDX(I) X(I) X(INDX(I)) 1 8 12.000000 1.000000 2 15 13.000000 2.000000 3 3 3.000000 3.000000 4 11 10.000000 5.000000 5 5 6.000000 6.000000 6 10 19.000000 7.000000 7 7 9.000000 9.000000 8 4 1.000000 10.000000 9 13 18.000000 11.000000 10 1 7.000000 12.000000 11 2 5.000000 13.000000 12 14 16.000000 14.000000 13 12 11.000000 16.000000 14 16 14.000000 17.000000 15 9 2.000000 18.000000 16 6 17.000000 19.000000 Results of search for given XVAL: XVAL Less Equal More 0.000000 0 0 1 1.000000 0 1 2 2.000000 1 2 3 3.000000 2 3 4 4.000000 3 0 4 5.000000 3 4 5 6.000000 4 5 6 7.000000 5 6 7 8.000000 6 0 7 9.000000 6 7 8 10.000000 7 8 9 11.000000 8 9 10 12.000000 9 10 11 13.000000 10 11 12 14.000000 11 12 13 15.000000 12 0 13 16.000000 12 13 14 17.000000 13 14 15 18.000000 14 15 16 19.000000 15 16 17 20.000000 16 0 17 r8vec_index_sorted_range_test(): r8vec_index_sorted_range() seeks the range I_LO:I_HI of entries of sorted indexed R so that R_LO <= R(INDX(I)) <= R_HI for I_LO <= I <= I_HI. Array 1: 0.0965942 2: 0.845883 3: 0.909396 4: 0.0113411 5: 0.523683 6: 0.650345 7: 0.385145 8: 0.649302 9: 0.762853 10: 0.575686 11: 0.631919 12: 0.278204 13: 0.839836 14: 0.426835 15: 0.631622 16: 0.833467 17: 0.270185 18: 0.400801 19: 0.554255 20: 0.443865 I INDX R(INDX(I)) 1 4 0.011341 2 1 0.096594 3 17 0.270185 4 12 0.278204 5 7 0.385145 6 18 0.400801 7 14 0.426835 8 20 0.443865 9 5 0.523683 10 19 0.554255 11 10 0.575686 12 15 0.631622 13 11 0.631919 14 8 0.649302 15 6 0.650345 16 9 0.762853 17 16 0.833467 18 13 0.839836 19 2 0.845883 20 3 0.909396 R_LO 0.090384 2 1 0.096594 3 17 0.270185 4 12 0.278204 5 7 0.385145 6 18 0.400801 7 14 0.426835 8 20 0.443865 9 5 0.523683 10 19 0.554255 11 10 0.575686 12 15 0.631622 13 11 0.631919 14 8 0.649302 15 6 0.650345 R_HI 0.744381 Array 1: 0.0326154 2: 0.429743 3: 0.0372623 4: 0.975798 5: 0.52234 6: 0.90963 7: 0.383248 8: 0.884452 9: 0.255018 10: 0.90905 11: 0.89456 12: 0.398517 13: 0.62502 14: 0.567597 15: 0.894512 16: 0.214166 17: 0.00385916 18: 0.880581 19: 0.235122 20: 0.244865 I INDX R(INDX(I)) 1 17 0.003859 2 1 0.032615 3 3 0.037262 4 16 0.214166 5 19 0.235122 6 20 0.244865 7 9 0.255018 8 7 0.383248 9 12 0.398517 10 2 0.429743 11 5 0.522340 12 14 0.567597 13 13 0.625020 14 18 0.880581 15 8 0.884452 16 15 0.894512 17 11 0.894560 18 10 0.909050 19 6 0.909630 20 4 0.975798 R_LO 0.304524 8 7 0.383248 9 12 0.398517 10 2 0.429743 11 5 0.522340 12 14 0.567597 13 13 0.625020 R_HI 0.640917 Array 1: 0.825621 2: 0.883689 3: 0.945373 4: 0.390795 5: 0.80132 6: 0.157113 7: 0.625165 8: 0.698985 9: 0.0858689 10: 0.53118 11: 0.888567 12: 0.263666 13: 0.234786 14: 0.839657 15: 0.49554 16: 0.152366 17: 0.230768 18: 0.657954 19: 0.562948 20: 0.291829 I INDX R(INDX(I)) 1 9 0.085869 2 16 0.152366 3 6 0.157113 4 17 0.230768 5 13 0.234786 6 12 0.263666 7 20 0.291829 8 4 0.390795 9 15 0.495540 10 10 0.531180 11 19 0.562948 12 7 0.625165 13 18 0.657954 14 8 0.698985 15 5 0.801320 16 1 0.825621 17 14 0.839657 18 2 0.883689 19 11 0.888567 20 3 0.945373 R_LO 0.622305 12 7 0.625165 13 18 0.657954 14 8 0.698985 R_HI 0.715905 Array 1: 0.280731 2: 0.412273 3: 0.362206 4: 0.781392 5: 0.135487 6: 0.90207 7: 0.289636 8: 0.499558 9: 0.78359 10: 0.677062 11: 0.149812 12: 0.696619 13: 0.129013 14: 0.945946 15: 0.886412 16: 0.515005 17: 0.679409 18: 0.976793 19: 0.12546 20: 0.752243 I INDX R(INDX(I)) 1 19 0.125460 2 13 0.129013 3 5 0.135487 4 11 0.149812 5 1 0.280731 6 7 0.289636 7 3 0.362206 8 2 0.412273 9 8 0.499558 10 16 0.515005 11 10 0.677062 12 17 0.679409 13 12 0.696619 14 20 0.752243 15 4 0.781392 16 9 0.783590 17 15 0.886412 18 6 0.902070 19 14 0.945946 20 18 0.976793 R_LO 0.781430 16 9 0.783590 R_HI 0.827052 Array 1: 0.190883 2: 0.428641 3: 0.0144567 4: 0.325285 5: 0.134702 6: 0.450517 7: 0.572275 8: 0.792023 9: 0.419737 10: 0.532537 11: 0.925704 12: 0.899082 13: 0.544833 14: 0.901124 15: 0.0518267 16: 0.808603 17: 0.334905 18: 0.228683 19: 0.822402 20: 0.348235 I INDX R(INDX(I)) 1 3 0.014457 2 15 0.051827 3 5 0.134702 4 1 0.190883 5 18 0.228683 6 4 0.325285 7 17 0.334905 8 20 0.348235 9 9 0.419737 10 2 0.428641 11 6 0.450517 12 10 0.532537 13 13 0.544833 14 7 0.572275 15 8 0.792023 16 16 0.808603 17 19 0.822402 18 12 0.899082 19 14 0.901124 20 11 0.925704 R_LO 0.028134 2 15 0.051827 3 5 0.134702 R_HI 0.165471 r8vec_indexed_heap_d_test(): r8vec_indexed_heap_d() creates a descending heap from an indexed R8VEC. The data vector: 1: 101 2: 102 3: 103 4: 104 5: 105 6: 106 7: 107 8: 108 9: 109 10: 110 11: 111 12: 112 13: 113 14: 114 15: 115 16: 116 17: 117 18: 118 19: 119 20: 120 The index vector: 1: 1 2: 11 3: 17 4: 5 5: 7 6: 13 7: 15 8: 3 9: 19 10: 9 A(INDX): 1 101 2 111 3 117 4 105 5 107 6 113 7 115 8 103 9 119 10 109 The data vector (should NOT change): 1: 101 2: 102 3: 103 4: 104 5: 105 6: 106 7: 107 8: 108 9: 109 10: 110 11: 111 12: 112 13: 113 14: 114 15: 115 16: 116 17: 117 18: 118 19: 119 20: 120 The index vector (may change): 1: 19 2: 11 3: 17 4: 5 5: 9 6: 13 7: 15 8: 3 9: 1 10: 7 A(INDX) is now a heap: 1 119 2 111 3 117 4 105 5 109 6 113 7 115 8 103 9 101 10 107 r8vec_indexed_heap_d_extract_test(): r8vec_indexed_heap_d_extract() extracts the maximum value; The data vector: 1: 1 2: 2 3: 3 4: 4 5: 5 6: 6 7: 7 8: 8 9: 9 10: 10 11: 11 12: 12 13: 13 14: 14 15: 15 16: 16 17: 17 18: 18 19: 19 20: 20 The index vector: 1: 9 2: 2 3: 8 4: 14 5: 5 A(INDX): 1 9.000000 2 2.000000 3 8.000000 4 14.000000 5 5.000000 The index vector after heaping: 1: 14 2: 9 3: 8 4: 2 5: 5 A(INDX) after heaping: 1 14.000000 2 9.000000 3 8.000000 4 2.000000 5 5.000000 Now extract the maximum several times. Extracting maximum element A(14) = 14.000000 Extracting maximum element A(9) = 9.000000 Extracting maximum element A(8) = 8.000000 Extracting maximum element A(5) = 5.000000 Extracting maximum element A(2) = 2.000000 The data vector after extractions: 1: 1 2: 2 3: 3 4: 4 5: 5 6: 6 7: 7 8: 8 9: 9 10: 10 11: 11 12: 12 13: 13 14: 14 15: 15 16: 16 17: 17 18: 18 19: 19 20: 20 The index vector after extractions: A(INDX) after extractions: r8vec_indexed_heap_d_insert_test(): r8vec_indexed_heap_d_insert() inserts a value into the heap. The data vector: 1: 1 2: 2 3: 3 4: 4 5: 5 6: 6 7: 7 8: 8 9: 9 10: 10 11: 11 12: 12 13: 13 14: 14 15: 15 16: 16 17: 17 18: 18 19: 19 20: 20 The index vector: 1: 9 2: 2 3: 8 4: 14 5: 5 A(INDX): 1 9.000000 2 2.000000 3 8.000000 4 14.000000 5 5.000000 The index vector after heaping: 1: 14 2: 9 3: 8 4: 2 5: 5 A(INDX) after heaping: 1 14.000000 2 9.000000 3 8.000000 4 2.000000 5 5.000000 Inserting value 7.000000 Inserting value 15.000000 Inserting value 1.000000 Inserting value 19.000000 Inserting value 20.000000 The data vector after insertions: 1: 1 2: 2 3: 3 4: 4 5: 5 6: 6 7: 7 8: 8 9: 9 10: 10 11: 11 12: 12 13: 13 14: 14 15: 15 16: 16 17: 17 18: 18 19: 19 20: 20 The index vector after insertions: 1: 20 2: 19 3: 14 4: 9 5: 15 6: 7 7: 8 8: 1 9: 2 10: 5 A(INDX) after insertions: 1 20.000000 2 19.000000 3 14.000000 4 9.000000 5 15.000000 6 7.000000 7 8.000000 8 1.000000 9 2.000000 10 5.000000 r8vec_indexed_heap_d_max_test(): r8vec_indexed_heap_d_max() reports the maximum value. The data vector: 1: 1 2: 2 3: 3 4: 4 5: 5 6: 6 7: 7 8: 8 9: 9 10: 10 11: 11 12: 12 13: 13 14: 14 15: 15 16: 16 17: 17 18: 18 19: 19 20: 20 The index vector: 1: 9 2: 2 3: 8 4: 14 5: 5 A(INDX): 1 9.000000 2 2.000000 3 8.000000 4 14.000000 5 5.000000 The index vector after heaping: 1: 14 2: 9 3: 8 4: 2 5: 5 A(INDX) after heaping: 1 14.000000 2 9.000000 3 8.000000 4 2.000000 5 5.000000 Inserting value 7.000000 Current maximum is 14.000000 Inserting value 15.000000 Current maximum is 15.000000 Inserting value 1.000000 Current maximum is 15.000000 Inserting value 19.000000 Current maximum is 19.000000 Inserting value 20.000000 Current maximum is 20.000000 The data vector after insertions: 1: 1 2: 2 3: 3 4: 4 5: 5 6: 6 7: 7 8: 8 9: 9 10: 10 11: 11 12: 12 13: 13 14: 14 15: 15 16: 16 17: 17 18: 18 19: 19 20: 20 The index vector after insertions: 1: 20 2: 19 3: 14 4: 9 5: 15 6: 7 7: 8 8: 1 9: 2 10: 5 A(INDX) after insertions: 1 20.000000 2 19.000000 3 14.000000 4 9.000000 5 15.000000 6 7.000000 7 8.000000 8 1.000000 9 2.000000 10 5.000000 r8vec_indicator0_test(): r8vec_indicator0() returns an indicator vector. The indicator0 vector: 1: 0 2: 1 3: 2 4: 3 5: 4 6: 5 7: 6 8: 7 9: 8 10: 9 r8vec_indicator1_test(): r8vec_indicator1() returns a 1-based indicator vector. The indicator1 vector: 1: 1 2: 2 3: 3 4: 4 5: 5 6: 6 7: 7 8: 8 9: 9 10: 10 r8vec_insert_test(): r8vec_insert() inserts a value into an R8VEC. a = 0 1 2 3 4 5 6 7 8 9 The initial vector: 1: 0 2: 1 3: 2 4: 3 5: 4 6: 5 7: 6 8: 7 9: 8 10: 9 After insertion of 5.5 at position 7: 1: 0 2: 1 3: 2 4: 3 5: 4 6: 5 7: 5.5 8: 6 9: 7 10: 8 11: 9 r8vec_is_ascending_test(): r8vec_is_ascending() is true if an R8VEC is ascending. Vector #1 4.5537 1.80291 3.60562 r8vec_is_ascending() = 0 Vector #2 4.39094 1.80194 4.17424 r8vec_is_ascending() = 0 Vector #3 -2.43308 3.85618 4.20043 r8vec_is_ascending() = 1 Vector #4 -1.99937 -4.26609 2.67399 r8vec_is_ascending() = 0 Vector #5 -4.15048 2.28764 -0.521104 r8vec_is_ascending() = 0 r8vec_is_binary_test(): r8vec_is_binary() is true if an R8VEC only contains 0 or 1 entries. X: 0 0 0 X is binary X: 1 0 1 X is binary X: 0 2 1 X is NOT binary. r8vec_is_distinct_test(): r8vec_is_distinct() is true if an R8VEC only contains distinct entries. X: 0 1 3 X is distinct X: 1.5 1.6 1.5 X is NOT distinct. X: -1 1 10 X is distinct r8vec_is_integer_test(): r8vec_is_integer() is true if every entry of an R8VEC is an integer. Example 1: Obviously integer: a = 1 2 3 4 5 6 A is an integer vector. Example 2: Obviously NOT integer: a = 1.0000 2.0000 3.0000 4.0000 5.0000 6.5000 A is NOT an integer vector. Example 3: Not Integer, Not obvious: a = 1.0000 2.0000 3.0000 4.0000 5.0000 6.0000 A is NOT an integer vector. Example 4: Not Integer, Not obvious: a = 1.0e+08 * 0.0000 0.0000 3.0000 0.0000 0.0000 0.0000 A is NOT an integer vector. r8vec_legendre_test(): r8vec_legendre() computes N Legendre points in [R1,R2]. N = 5, R1 = -1, R2 = 1 Legendre points: 1: -0.90618 2: -0.538469 3: 0 4: 0.538469 5: 0.90618 N = 7, R1 = 0, R2 = 10 Legendre points: 1: 0.25446 2: 1.29234 3: 2.97077 4: 5 5: 7.02923 6: 8.70766 7: 9.74554 r8vec_linspace2_test(): r8vec_linspace2(): evenly spaced points between A and B; r8vec_linspace2 ( 5, 10, 20 ) 1: 11.6667 2: 13.3333 3: 15 4: 16.6667 5: 18.3333 r8vec_le_test(): r8vec_le() determines if V1 is less than or equal to V2, using lexical order, for the R8VEC data type. V1 and V2: 1: 1 0 2: 2 5 3: 3 10 V1 <= V2? = False V1 and V2: 1: 1 1 2: 2 2 3: 3 3 V1 <= V2? = True V1 and V2: 1: 1 1 2: 2 3 3: 3 0 V1 <= V2? = True r8vec_lt_test(): r8vec_lt() determines if V1 is less than V2, using lexical order, for the R8VEC data type. V1 and V2: 1: 1 0 2: 2 5 3: 3 10 V1 < V2? = False V1 and V2: 1: 1 1 2: 2 2 3: 3 3 V1 < V2? = False V1 and V2: 1: 1 1 2: 2 3 3: 3 0 V1 < V2? = True r8vec_max_test(): r8vec_max(): maximum entry; Input vector: 1: 3.02497 2: -6.60996 3: 0.628985 4: 2.67602 5: -9.71808 6: -0.592573 7: 7.72652 8: -7.71943 9: -1.14918 10: 3.19096 Maximum: 7.726519 r8vec_max_abs_index_test(): r8vec_max_abs_index(): index of entry of maximum absolute value; Input vector: 1: -4.10454 2: 9.00737 3: 3.88572 4: -5.86387 5: 1.09525 6: 7.58557 7: 1.15715 8: 5.04668 9: 7.89802 10: 6.83688 Index of entry of maximum absolute value: 2 r8vec_max_index_test(): r8vec_max_index(): index of maximum entry; Input vector: 1: -7.38287 2: -6.21692 3: -6.9272 4: -9.42196 5: -9.8183 6: 1.92903 7: 2.18099 8: 8.37847 9: 4.67149 10: -3.97706 Maximum index: 8 r8vec_mean_test(): r8vec_mean() computes the mean value of an R8VEC. Input vector: 1: -0.0442552 2: -2.41837 3: 2.32854 4: -3.83239 5: 2.46042 6: 3.09789 7: 2.45234 8: -1.62857 9: 0.84325 10: -0.310479 Value = 0.294837 r8vec_mean_geometric_test(): r8vec_mean_geometric() computes the geometric mean of an R8VEC. Input vector: 1: 0.436325 2: 4.14359 3: 3.42972 4: 1.33663 5: 4.84742 6: 0.918871 7: 1.4997 8: 2.05592 9: 1.18245 10: 0.975277 Geometric mean = 1.6286 r8vec_mean_running_test(): r8vec_mean_running() returns the running means of an R8VEC. Random R8VEC: 1: 5.58069 2: -2.29178 3: 2.83499 4: -0.557423 5: 1.94173 6: 8.87849 7: -1.76166 8: -4.98487 9: 8.59909 10: 5.20063 Running means: 1: 0 2: 5.58069 3: 1.64446 4: 2.0413 5: 1.39162 6: 1.50164 7: 2.73112 8: 2.08929 9: 1.20502 10: 2.02658 11: 2.34399 r8vec_mean_update_test(): r8vec_mean_update() updates the mean of a vector when one more element is added. N R MEAN MEAN_UPDATE 1 0.514952 0.514952 0.514952 2 0.522069 0.51851 0.51851 3 0.102919 0.37998 0.37998 4 0.99688 0.534205 0.534205 5 0.358969 0.499158 0.499158 6 0.625243 0.520172 0.520172 7 0.393367 0.502057 0.502057 8 0.00766245 0.440258 0.440258 9 0.545285 0.451927 0.451927 10 0.50911 0.457646 0.457646 r8vec_median_test(): r8vec_median(): median value; Input vector: 1: -5.06442 2: -9.09209 3: 6.83459 4: -9.035 5: -3.67359 6: 5.66839 7: 9.448 8: 1.72928 9: 5.56088 10: 4.55395 Median: 4.553949 r8vec_midspace_test(): r8vec_midspace(): evenly spaced midpoints between A and B r8vec_midspace ( 5, 10, 20 ) 1: 11 2: 13 3: 15 4: 17 5: 19 r8vec_min_test(): r8vec_min(): minimum entry. Input vector: 1: 3.01974 2: 3.2923 3: 8.7756 4: 0.701625 5: -2.0312 6: 3.40915 7: -1.18931 8: -7.34252 9: -1.21593 10: 0.952855 Minimum: -7.342521 r8vec_min_index_test(): r8vec_min_index(): index of minimum entry; Input vector: 1: -2.09727 2: -2.03456 3: 5.02697 4: 0.447007 5: -0.191339 6: -8.22642 7: -4.98297 8: -1.04882 9: 2.75922 10: 4.18891 Maximum index: 3 Minimum index: 6 r8vec_min_pos_test(): r8vec_min_pos() returns the minimum positive entry in an R8VEC. Input vector: 1: 9.8524 2: 8.6439 3: -8.15541 4: 9.0708 5: -6.74409 6: 9.4091 7: 1.94013 8: -5.19546 9: -8.5941 10: -3.99918 Minimum positive entry: 1.940133 r8vec_mirror_next_test(): r8vec_mirror_next() generates all sign variations of a real vector. Next vector: 1: 1 2: 2 3: 3 Next vector: 1: -1 2: 2 3: 3 Next vector: 1: 1 2: -2 3: 3 Next vector: 1: -1 2: -2 3: 3 Next vector: 1: 1 2: 2 3: -3 Next vector: 1: -1 2: 2 3: -3 Next vector: 1: 1 2: -2 3: -3 Next vector: 1: -1 2: -2 3: -3 Done. Next vector: 1: 1 2: 0 3: 3 Next vector: 1: -1 2: 0 3: 3 Next vector: 1: 1 2: -0 3: -3 Next vector: 1: -1 2: -0 3: -3 Done. r8vec_mirror_ab_next_test(): r8vec_mirror_ab_next() generates all versions of of a real vector X mirrored by A and B. Case 1: 3x3x3 possibilities: A: -0.5 -0.5 -0.5 X: 0 0 0 B: 0.5 0.5 0.5 1: -1 -1 -1 2: -1 -1 0 3: -1 -1 1 4: -1 0 -1 5: -1 0 0 6: -1 0 1 7: -1 1 -1 8: -1 1 0 9: -1 1 1 10: 0 -1 -1 11: 0 -1 0 12: 0 -1 1 13: 0 0 -1 14: 0 0 0 15: 0 0 1 16: 0 1 -1 17: 0 1 0 18: 0 1 1 19: 1 -1 -1 20: 1 -1 0 21: 1 -1 1 22: 1 0 -1 23: 1 0 0 24: 1 0 1 25: 1 1 -1 26: 1 1 0 27: 1 1 1 Done. Case 2: 3x2x3 possibilities: A: -0.5 -0.5 -0.5 X: 0 0.5 0 B: 0.5 0.5 0.5 1: -1 -1.5 -1 2: -1 -1.5 0 3: -1 -1.5 1 4: -1 0.5 -1 5: -1 0.5 0 6: -1 0.5 1 7: 0 -1.5 -1 8: 0 -1.5 0 9: 0 -1.5 1 10: 0 0.5 -1 11: 0 0.5 0 12: 0 0.5 1 13: 1 -1.5 -1 14: 1 -1.5 0 15: 1 -1.5 1 16: 1 0.5 -1 17: 1 0.5 0 18: 1 0.5 1 Done. Case 3: 1x3x3 possibilities: A: 0 -0.5 -0.5 X: 0 0 0 B: 0 0.5 0.5 1: 0 -1 -1 2: 0 -1 0 3: 0 -1 1 4: 0 0 -1 5: 0 0 0 6: 0 0 1 7: 0 1 -1 8: 0 1 0 9: 0 1 1 Done. r8vec_multispace_test(): r8vec_multispace() makes a list of scaled value h, h*alpha, h*alpha^2, ..., h*alpha^(n-1) r8vec_multispace ( 16.0, 0.25, 10 ) 1: 16 2: 4 3: 1 4: 0.25 5: 0.0625 6: 0.015625 7: 0.00390625 8: 0.000976562 9: 0.000244141 10: 6.10352e-05 r8vec_ne_test(): r8vec_ne() determines if R8VEC V1 is not equal to V2. V1 and V2: 1: 1 0 2: 2 5 3: 3 10 V1 =/= V2? = True V1 and V2: 1: 1 1 2: 2 2 3: 3 3 V1 =/= V2? = False V1 and V2: 1: 1 1 2: 2 3 3: 3 0 V1 =/= V2? = True r8vec_nint_test(): r8vec_nint() rounds an R8VEC. Vector A: 1: 3.13545 2: -4.2329 3: -1.45527 4: -3.67989 5: -3.4182 Rounded vector A: 1: 3 2: -4 3: -1 4: -4 5: -3 r8vec_norm_test(): r8vec_norm() computes the L2 norm of an R8VEC. Input vector: 1: -8.75706 2: 4.03687 3: -8.27037 4: 2.33574 5: -6.52457 6: 3.02802 7: -0.0260719 8: -4.30979 9: 6.61119 10: 6.3672 L2 norm = 17.927632 r8vec_norm_affine_test(): r8vec_norm_affine() computes the L2 norm of the difference of two R8VECs. R8VEC_NORM_AFFINE(X,Y) = 22.2678 R8VEC_NORM (X-Y): 22.2678 r8vec_norm_l0_test(): r8vec_norm_l0() computes the L0 "norm" of an R8VEC. Input vector: 1: 0 2: 1 3: -2 4: -2 5: 0 6: 1 7: 1 8: -2 9: 1 10: 2 L0 norm: 8.000000 r8vec_norm_l1_test(): r8vec_norm_l1(): L1 norm. Input vector: 1: -0.955364 2: -8.58625 3: -5.17444 4: 4.6373 5: -9.19017 6: -1.50954 7: 0.804302 8: 9.07656 9: -5.82189 10: -7.67336 L1 norm: 53.429163 r8vec_norm_l2_test(): r8vec_norm_l2() computes the L2 norm of an R8VEC. Input vector: 1: 2.9244 2: -7.83178 3: 9.66994 4: -5.03312 5: 2.12711 6: 6.33391 7: 6.60108 8: -0.219213 9: 5.21457 10: 8.30216 L2 norm = 19.316101 r8vec_norm_li_test(): r8vec_norm_li(): L-infinity norm. Input vector: 1: 8.0195 2: -5.71525 3: 0.941222 4: 5.69419 5: -6.11118 6: 4.93778 7: -0.488836 8: 1.66517 9: -4.78904 10: -8.30355 L-Infinity norm: 8.303551 r8vec_norm_lp_test(): r8vec_norm_lp() computes the LP norm of an R8VEC. Input vector V: 1: -4.03734 2: 8.34259 3: -0.589636 4: -4.61065 5: 5.25941 6: 5.44344 7: -9.57401 8: 7.59972 9: 5.9634 10: -3.5167 P LP-norm(V) 0.2500 48656 0.5000 511.099 1.0000 54.9369 1.5000 26.8406 2.0000 19.0301 2.5000 15.6255 3.0000 13.792 5.0000 11.07 10.0000 9.87834 20.0000 9.60809 r8vec_norm_rms_test(): r8vec_norm_rms() computes the RMS norm of an R8VEC. Input vector: 1: -6 2: -4 3: -2 4: 0 5: 2 6: 4 7: 6 8: 8 9: 10 RMS norm = 5.537749 r8vec_normal_01_test(): r8vec_normal_01() computes a vector of normally distributed random numbers. Test #1: Call 5 times, 1 value each time. 1 -0.257122 2 -0.076019 3 -0.057268 4 -0.693585 5 -0.100583 Call 1 time for 5 values. 1 0.583464 Number of samples was 1000 Minimum value was -3.028622 Maximum value was 3.617429 Average value was -0.006183 Variance was 1.064718 Expected average 0.000000 Expected variance 1.000000 r8vec_normal_ab_test(): r8vec_normal_ab() computes a scaled pseudonormal vector. MU = 15 SIGMA = 0.25 The vector: 1: 15.6167 2: 14.9791 3: 14.6534 4: 14.7228 5: 14.9268 6: 14.644 7: 15.6105 8: 15.2726 9: 15.0829 10: 15.051 r8vec_normalize_test(): r8vec_normalize() normalizes an R8VEC in L2 norm. Input vector: 1: -3.35203 2: 0.523618 3: -5.06716 4: 0.857989 5: 5.61736 6: 0.437648 7: 8.639 8: -7.05776 9: -1.66469 10: -4.39414 After calling R8VEC_NORMALIZE: 1: -0.227975 2: 0.0356118 3: -0.344623 4: 0.0583527 5: 0.382042 6: 0.0297649 7: 0.587547 8: -0.480006 9: -0.113217 10: -0.29885 r8vec_normalize_l1_test(): r8vec_normalize_l1(): make unit sum in L1 norm; Input vector: 1: 1.96201 2: -9.2705 3: -8.72627 4: -3.54235 5: -8.03243 6: -6.59911 7: -2.57672 8: -9.20477 9: 4.18482 10: 2.82683 After calling R8VEC_NORMALIZE_L1: 1: 0.034466 2: -0.162852 3: -0.153292 4: -0.0622275 5: -0.141103 6: -0.115925 7: -0.0452646 8: -0.161698 9: 0.0735136 10: 0.0496581 r8vec_normsq_test(): r8vec_normsq() computes the squared L2 norm of an R8VEC. Input vector: 1: -6.51878 2: -8.75696 3: -1.86681 4: -0.738741 5: -5.94651 6: 7.391 7: 1.95881 8: -9.53973 9: 7.98853 10: -0.941078 Square of L2 norm = 372.743079 r8vec_order_type_test(): r8vec_order_type() classifies a real vector as -1: no order 0: all equal; 1: ascending; 2: strictly ascending; 3: descending; 4: strictly descending. The following vector has order type -1 1: 1 2: 3 3: 2 4: 4 The following vector has order type 0 1: 2 2: 2 3: 2 4: 2 The following vector has order type 1 1: 1 2: 2 3: 2 4: 4 The following vector has order type 2 1: 1 2: 2 3: 3 4: 4 The following vector has order type 3 1: 4 2: 4 3: 3 4: 1 The following vector has order type 4 1: 9 2: 7 3: 3 4: 0 r8vec_part_quick_a_test(): r8vec_part_quick_a() reorders an R8VEC as part of a quick sort. Before rearrangement: 1: 0.580262 2: 1.06269 3: 9.98425 4: 8.66327 5: 6.15206 6: 0.269445 7: 3.22523 8: 4.63776 9: 0.990172 10: 5.70988 11: 3.25875 12: 4.50492 Rearranged array Left index = 1 Key index = 2 Right index = 3 Left half: 1: 0.269445 Key: 1: 0.580262 Right half: 1: 8.66327 2: 6.15206 3: 9.98425 4: 3.22523 5: 4.63776 6: 0.990172 7: 5.70988 8: 3.25875 9: 4.50492 10: 1.06269 r8vec_permute_test(): r8vec_permute() permutes an R8VEC. Original array X[]: 1: 1 2: 2 3: 3 4: 4 5: 5 Permutation vector P[]: 1: 2 2: 4 3: 5 4: 1 5: 3 Permuted array X[P[]]: 1: 2 2: 4 3: 5 4: 1 5: 3 r8vec_permute_cyclic_test(): r8vec_permute_cyclic() carries out a cyclic permutation of K positions on an R8VEC. K = 4 Original array X[]: 1: 1 2: 2 3: 3 4: 4 5: 5 6: 6 7: 7 8: 8 9: 9 10: 10 Array after cyclic permutation: 1: 5 2: 6 3: 7 4: 8 5: 9 6: 10 7: 1 8: 2 9: 3 10: 4 r8vec_permute_uniform_test(): r8vec_permute_uniform() randomly reorders an R8VEC. A, before rearrangement: 1: 101 2: 102 3: 103 4: 104 5: 105 6: 106 7: 107 8: 108 9: 109 10: 110 11: 111 12: 112 A, after rearrangement: 1: 107 2: 102 3: 103 4: 106 5: 109 6: 105 7: 108 8: 112 9: 101 10: 111 11: 104 12: 110 r8vec_polarize_test(): r8vec_polarize() decomposes a vector into components parallel and normal to a direction. Original vector: 1: 1 2: 2 3: 3 Direction vector: 1: 3 2: 1 3: -2 Normal component: 1: 1.21429 2: 2.07143 3: 2.85714 Parallel component: 1: -0.214286 2: -0.0714286 3: 0.142857 Dot product of P and A_normal (should be 0) 0.000000 Cosine of angle between P and A_parallel (should be 1 or -1) -1.000000 Sum of components (should equal A): 1: 1 2: 2 3: 3 r8vec_print_test(): r8vec_print() prints an R8VEC. The R8VEC: 1: 123.456 2: 5e-06 3: -1e+06 4: 3.14159 r8vec_print_16_test(): r8vec_print_16() prints an R8VEC to 16 places. The R8VEC: 1: 3.141592653589793 2: 1.414213562373095 3: 0.1428571428571428 r8vec_print_mask_test(): r8vec_print_mask() prints masked elements of an R8VEC. The full vector: 1: 15.7827 2: 12.3442 3: 18.1059 4: 14.5127 5: 12.4997 6: 19.5544 7: 11.4265 8: 15.1256 9: 19.7193 10: 16.4832 Masked vector printout: R > 15.0: 1: 1 15.7827 2: 3 18.1059 3: 6 19.5544 4: 8 15.1256 5: 9 19.7193 6: 10 16.4832 Masked vector printout: R near 12: 1: 2 12.3442 2: 5 12.4997 3: 7 11.4265 Masked vector printout: Odd index R: 1: 1 15.7827 2: 3 18.1059 3: 5 12.4997 4: 7 11.4265 5: 9 19.7193 r8vec_print_part_test(): r8vec_print_part() prints part of an R8VEC. Lines 10:20 of the vector: 10: 10 11: 11 12: 12 13: 13 14: 14 15: 15 16: 16 17: 17 18: 18 19: 19 20: 20 r8vec_print_some_test(): r8vec_print_some() prints "some" of an R8VEC. Printing at most 8 lines: 1 1 2 2 3 3 4 4 5 5 6 6 ...... .............. 100 100 r8vec_product_test(): r8vec_product() computes the product of an R8VEC. Input vector: 1: 1.14671 2: -0.303496 3: 0.777807 4: 4.11313 5: -1.2378 6: -2.71235 7: -0.764751 8: -2.26404 9: -0.554342 10: 1.27515 Product = 4.57499 r8vec_rsquared_test(): r8vec_rsquared() evaluates the R^2 goodness-of-fit statistic. Data and model: 1: 0 0 2: 9.58 9 3: 16.76 16 4: 21.52 21 5: 24.38 24 6: 24.97 25 7: 22.9 24 8: 20.45 21 9: 12.4 16 10: 7.65 9 11: -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: 1: 0 0 2: 9.58 9 3: 16.76 16 4: 21.52 21 5: 24.38 24 6: 24.97 25 7: 22.9 24 8: 20.45 21 9: 12.4 16 10: 7.65 9 11: -3.82 0 Computed R^2, adjusted for degree = 2, is 0.959253 r8vec_rotate_test(): r8vec_rotate() rotates an R8VEC in place. Rotate entries 2 places to the right. Original array: 1: 1 2: 2 3: 3 4: 4 5: 5 Rotated array: 1: 4 2: 5 3: 1 4: 2 5: 3 r8vec_reverse_test(): r8vec_reverse() reverses an R8VEC. Original array: 1: 1 2: 2 3: 3 4: 4 5: 5 Reversed array: 1: 5 2: 4 3: 3 4: 2 5: 1 r8vec_scalar_triple_product_test(): r8vec_scalar_triple_product() computes the scalar triple product of three R8VEC's. S = V1 dot ( V2 x V3 ). V1, V2 and V3: 1: -1 -2 0 2: 3 3 4 3: 3 1 0 Computed = -20, Exact = -20 r8vec_scale_test(): r8vec_scale() scales a vector by a factor. The vector: 1: 1 2: 2 3: 3 4: 4 5: 5 6: 6 7: 7 8: 8 9: 9 10: 10 Using a scale of S = 10 Scaled vector: 1: 10 2: 20 3: 30 4: 40 5: 50 6: 60 7: 70 8: 80 9: 90 10: 100 r8vec_scale_01_test(): r8vec_scale_01() shifts and scales an R8VEC so that it has min 0 and max 1 Vector X: 1: 5.69283 2: 2.70884 3: 12.469 4: 1.00697 5: 3.00059 6: 5.35447 7: -3.76351 8: -0.372656 9: -2.63028 10: -3.0244 mean(X) = 2.04419 std(X) = 4.97205 max(X) = 12.469 min(X) = -3.76351 Vector XS: 1: 0.582555 2: 0.398728 3: 1 4: 0.293884 5: 0.416701 6: 0.561711 7: 0 8: 0.208893 9: 0.0698121 10: 0.0455325 mean(XS) = 0.357782 std(XS) = 0.306302 max(XS) = 1 min(XS) = 0 r8vec_scale_ab_test(): r8vec_scale_ab() shifts and scales an R8VEC so that it has min A and max B Vector X: 1: 12.8055 2: -4.33222 3: 11.7807 4: 5.14533 5: -2.72567 6: 4.80891 7: 6.98883 8: -3.19568 9: 14.5645 10: 8.06038 mean(X) = 5.39006 std(X) = 6.86526 max(X) = 14.5645 min(X) = -4.33222 Rescale to [-1,1] Vector XS: 1: 0.813833 2: -1 3: 0.705369 4: 0.00309084 5: -0.829965 6: -0.0325155 7: 0.198204 8: -0.87971 9: 1 10: 0.311615 mean(XS) = 0.028992 std(XS) = 0.726609 max(XS) = 1 min(XS) = -1 r8vec_search_binary_a_test(): r8vec_search_binary_a() searches an ascending sorted array; Sorted vector A: 1: 0.244108 2: 0.262829 3: 0.328975 4: 0.461132 5: 0.510825 6: 0.56458 7: 0.823963 8: 0.863758 9: 0.941301 10: 0.95711 Search the array for the value 0.461132 SEARCH RESULT: The value occurs in index 4 r8vec_shift_test(): r8vec_shift() shifts a vector by K positions. The vector: 1: 1 2: 2 3: 3 4: 4 5: 5 6: 6 7: 7 8: 8 9: 9 10: 10 Using a shift of K = 3 Shifted vector: 1: 0 2: 0 3: 0 4: 1 5: 2 6: 3 7: 4 8: 5 9: 6 10: 7 r8vec_shift_circular_test(): r8vec_shift_circular() circularly shifts a vector by K positions. The vector: 1: 1 2: 2 3: 3 4: 4 5: 5 6: 6 7: 7 8: 8 9: 9 10: 10 Using a circular shift of K = 3 Shifted vector: 1: 8 2: 9 3: 10 4: 1 5: 2 6: 3 7: 4 8: 5 9: 6 10: 7 r8vec_sign3_running_test(): r8vec_sign3_running() returns the running sign3 of an R8VEC. Random R8VEC: 1: 9.90574 2: 6.56476 3: -0.292971 4: -4.13191 5: -4.33889 6: 7.19416 7: 1.1811 8: 0.762448 9: 2.8469 10: 8.38223 Running sign3: 1: 0 2: 1 3: 1 4: 1 5: 1 6: 1 7: 1 8: 1 9: 1 10: 1 11: 1 r8vec_smooth_test(): r8vec_smooth() smooths an R8VEC. The vector X: 1: 1 2: 2 3: 3 4: 4 5: 5 6: 6 7: 7 8: 8 9: 9 10: 10 Vector X using smoothing S = 2 1: 1 2: 2 3: 3 4: 4 5: 5 6: 6 7: 7 8: 8 9: 9 10: 10 The vector X: 1: 1 2: 4 3: 9 4: 16 5: 25 6: 36 7: 49 8: 64 9: 81 10: 100 Vector X using smoothing S = 1 1: 1 2: 4.66667 3: 9.66667 4: 16.6667 5: 25.6667 6: 36.6667 7: 49.6667 8: 64.6667 9: 81.6667 10: 100 r8vec_softmax_test(): r8vec_softmax() evaluates the softmax function of an R8VEC. X, Softmax(X): 1: -0.564476 0.0890699 2: 0.626333 0.293017 3: -2.43118 0.0137731 4: -0.984112 0.0585444 5: -2.13095 0.018596 6: -1.53072 0.0338921 7: -0.72617 0.0757719 8: -1.37808 0.0394808 9: -1.7064 0.0284314 10: 0.802387 0.349423 r8vec_sort_bubble_a_test(): r8vec_sort_bubble_a() ascending sorts a real vector. Original array: 1: 47.9829 2: 12.5108 3: 53.7754 4: 44.7426 5: 32.1831 6: 58.1979 7: 33.893 8: 13.0614 9: 51.4658 10: 51.72 Ascending sorted array: 1: 3.11415 2: 12.5108 3: 13.0614 4: 16.7977 5: 18.7981 6: 19.6191 7: 20.0105 8: 22.0164 9: 25.6003 10: 29.552 r8vec_sort_bubble_d_test(): r8vec_sort_bubble_d() descending sorts an R8VEC. Original array: 1: 47.6875 2: 2.32145 3: 43.6002 4: 52.3611 5: 17.1489 6: 39.411 7: 13.9132 8: 37.3172 9: 4.50743 10: 58.0054 Descending sorted array: 1: 58.0054 2: 55.1444 3: 52.3611 4: 51.4539 5: 50.8704 6: 47.6875 7: 43.6002 8: 39.411 9: 37.3172 10: 36.5982 r8vec_sort_heap_a_test(): r8vec_sort_heap_a() ascending sorts an R8VEC. Original array: 1: 43.9419 2: 9.06632 3: 48.914 4: 54.5762 5: 46.6765 6: 45.4274 7: 24.3119 8: 42.1141 9: 33.9277 10: 35.0842 Ascending sorted array: 1: 0.090836 2: 9.06632 3: 9.65182 4: 20.6949 5: 24.3119 6: 32.789 7: 33.0497 8: 33.7201 9: 33.9277 10: 35.0842 r8vec_sort_heap_d_test(): r8vec_sort_heap_d() descending sorts an R8VEC. Original array: 1: 54.1958 2: 36.2464 3: 55.5726 4: 7.01678 5: 20.4481 6: 2.20383 7: 32.3022 8: 44.2337 9: 10.8734 10: 25.5748 Descending sorted array: 1: 55.5726 2: 54.1958 3: 53.5889 4: 46.8074 5: 46.1443 6: 44.2337 7: 38.3366 8: 36.2464 9: 32.3022 10: 32.2176 r8vec_sort_heap_index_a_test(): r8vec_sort_heap_index_a() creates an ascending sort index for an R8VEC. Unsorted array: 1: 44.3875 2: 53.5773 3: 1.5512 4: 8.25378 5: 25.4452 6: 45.874 7: 31.4662 8: 45.2689 9: 10.1879 10: 40.3636 After indexed ascending sort: I, INDX(I), A(I) 1 12 44.387510 2 3 53.577288 3 15 1.551198 4 4 8.253782 5 9 25.445246 6 19 45.874007 7 17 31.466231 8 16 45.268882 9 5 10.187907 10 7 40.363620 11 11 37.119165 12 10 0.410765 13 18 44.413531 14 1 59.504129 15 13 7.690881 16 8 21.634966 17 6 11.464396 18 2 42.863860 19 20 10.672021 20 14 59.210925 Now use the index array to carry out the permutation implicitly. INDX(I), A(INDX(I)) 12 0.410765 3 1.551198 15 7.690881 4 8.253782 9 10.187907 19 10.672021 17 11.464396 16 21.634966 5 25.445246 7 31.466231 11 37.119165 10 40.363620 18 42.863860 1 44.387510 13 44.413531 8 45.268882 6 45.874007 2 53.577288 20 59.210925 14 59.504129 Call R8VEC_PERMUTE to carry out the permutation explicitly. I, A(I) 1: 0.410765 2: 1.5512 3: 7.69088 4: 8.25378 5: 10.1879 6: 10.672 7: 11.4644 8: 21.635 9: 25.4452 10: 31.4662 11: 37.1192 12: 40.3636 13: 42.8639 14: 44.3875 15: 44.4135 16: 45.2689 17: 45.874 18: 53.5773 19: 59.2109 20: 59.5041 r8vec_sort_heap_index_d_test(): r8vec_sort_heap_index_d() creates a descending sort index for an R8VEC. Unsorted array: 1: 1.01995 2: 2.38779 3: 48.2598 4: 51.5875 5: 33.9752 6: 45.2468 7: 31.1709 8: 35.1543 9: 11.444 10: 30.2065 After indexed descending sort: I, INDX(I), A(I) 1 15 1.019948 2 4 2.387788 3 3 48.259832 4 19 51.587537 5 6 33.975152 6 18 45.246761 7 17 31.170886 8 16 35.154268 9 20 11.443982 10 14 30.206488 11 8 3.054878 12 5 3.365745 13 7 20.111844 14 10 37.854285 15 13 53.518669 16 9 40.403798 17 12 41.116022 18 11 41.744688 19 2 47.989886 20 1 39.636310 Now use the index array to carry out the permutation implicitly. INDX(I), A(INDX(I)) 15 53.518669 4 51.587537 3 48.259832 19 47.989886 6 45.246761 18 41.744688 17 41.116022 16 40.403798 20 39.636310 14 37.854285 8 35.154268 5 33.975152 7 31.170886 10 30.206488 13 20.111844 9 11.443982 12 3.365745 11 3.054878 2 2.387788 1 1.019948 Call R8VEC_PERMUTE to carry out the permutation explicitly. I, A(I) 1: 53.5187 2: 51.5875 3: 48.2598 4: 47.9899 5: 45.2468 6: 41.7447 7: 41.116 8: 40.4038 9: 39.6363 10: 37.8543 11: 35.1543 12: 33.9752 13: 31.1709 14: 30.2065 15: 20.1118 16: 11.444 17: 3.36574 18: 3.05488 19: 2.38779 20: 1.01995 r8vec_sort_heap_mask_a_test(): r8vec_sort_heap_mask_a() creates an ascending sort index for a masked R8VEC. Unsorted array: 1: 31.1962 2: 19.9042 3: 56.0504 4: 14.7886 5: 30.6724 6: 44.4191 7: 15.2501 8: 50.7351 9: 32.2893 10: 54.6082 11: 21.0424 12: 56.1195 13: 55.6632 14: 35.262 15: 6.10573 16: 22.0126 17: 16.5507 18: 15.9659 19: 13.5923 20: 0.0792468 The mask array: 1: 2 2: 4 3: 7 4: 8 5: 9 6: 12 7: 13 8: 16 9: 18 10: 19 Masked vector printout: The masked unsorted array: 1: 2 19.9042 2: 4 14.7886 3: 7 15.2501 4: 8 50.7351 5: 9 32.2893 6: 12 56.1195 7: 13 55.6632 8: 16 22.0126 9: 18 15.9659 10: 19 13.5923 After masked indexed ascending sort: I, INDX(I), MASK(INDX(I)), A(MASK(INDX(I))) 1 10 $6d 19.000000 1.359232e+01 2 2 $6d 4.000000 1.478862e+01 3 3 $6d 7.000000 1.525011e+01 4 9 $6d 18.000000 1.596585e+01 5 1 $6d 2.000000 1.990418e+01 6 8 $6d 16.000000 2.201256e+01 7 5 $6d 9.000000 3.228927e+01 8 4 $6d 8.000000 5.073509e+01 9 7 $6d 13.000000 5.566317e+01 10 6 $6d 12.000000 5.611949e+01 Call I4VEC_PERMUTE to carry out the index permutation explicitly on the MASK vector. The reordered mask array: 1: 19 2: 4 3: 7 4: 18 5: 2 6: 16 7: 9 8: 8 9: 13 10: 12 Masked vector printout: The reordered masked sorted array: 1: 19 13.5923 2: 4 14.7886 3: 7 15.2501 4: 18 15.9659 5: 2 19.9042 6: 16 22.0126 7: 9 32.2893 8: 8 50.7351 9: 13 55.6632 10: 12 56.1195 r8vec_sort_insert_a_test(): r8vec_sort_insert_a() ascending sorts an R8VEC. Unsorted array: 1: 53.5804 2: 27.2099 3: 34.7053 4: 18.9363 5: 59.641 6: 59.0336 7: 57.8729 8: 39.9759 9: 43.5695 10: 20.0426 Sorted array: 1: 4.86385 2: 12.2376 3: 13.2948 4: 16.4013 5: 18.9363 6: 20.0426 7: 27.2099 8: 31.3664 9: 34.7053 10: 37.446 r8vec_sort_insert_index_a_test(): r8vec_sort_insert_index_a() creates an ascending sort index for an R8VEC. Unsorted array: 1: 1.13372 2: 12.1271 3: 28.1456 4: 22.7037 5: 20.4236 6: 3.83107 7: 45.6802 8: 24.1597 9: 40.4574 10: 33.0645 After indexed ascending sort: I, INDX(I), A(I) 1 1 1.133723 2 11 12.127058 3 6 28.145578 4 20 22.703711 5 2 20.423624 6 12 3.831071 7 5 45.680156 8 15 24.159725 9 4 40.457383 10 8 33.064540 11 3 3.087430 12 10 18.449756 13 17 57.926686 14 16 55.888509 15 9 22.681604 16 7 37.060212 17 18 33.752003 18 14 49.833643 19 19 57.461924 20 13 4.530339 Now use the index array to carry out the permutation implicitly. I, INDX(I), A(INDX(I)) 1 1 1.133723 2 11 3.087430 3 6 3.831071 4 20 4.530339 5 2 12.127058 6 12 18.449756 7 5 20.423624 8 15 22.681604 9 4 22.703711 10 8 24.159725 11 3 28.145578 12 10 33.064540 13 17 33.752003 14 16 37.060212 15 9 40.457383 16 7 45.680156 17 18 49.833643 18 14 55.888509 19 19 57.461924 20 13 57.926686 Call R8VEC_PERMUTE to carry out the permutation explicitly. Permuted data 1: 1.13372 2: 3.08743 3: 3.83107 4: 4.53034 5: 12.1271 6: 18.4498 7: 20.4236 8: 22.6816 9: 22.7037 10: 24.1597 r8vec_sort_insert_index_d_test(): r8vec_sort_insert_index_d() creates a descending sort index for an R8VEC. Unsorted array: 1: 53.2815 2: 33.7468 3: 11.6613 4: 13.2872 5: 42.3458 6: 35.8057 7: 35.1778 8: 58.1096 9: 34.9046 10: 5.98802 11: 9.99617 12: 6.12563 13: 8.77483 14: 40.2939 15: 38.3912 16: 22.3461 17: 9.77238 18: 23.3711 19: 47.9986 20: 23.9876 After indexed descending sort: I, INDX(I), A(I) 1 8 53.281464 2 1 33.746837 3 19 11.661308 4 5 13.287167 5 14 42.345783 6 15 35.805686 7 6 35.177764 8 7 58.109649 9 9 34.904606 10 2 5.988017 11 20 9.996169 12 18 6.125628 13 16 8.774826 14 4 40.293886 15 3 38.391191 16 11 22.346127 17 17 9.772378 18 13 23.371128 19 12 47.998594 20 10 23.987622 Now use the index array to carry out the permutation implicitly. I, INDX(I), A(INDX(I)) 1 8 58.109649 2 1 53.281464 3 19 47.998594 4 5 42.345783 5 14 40.293886 6 15 38.391191 7 6 35.805686 8 7 35.177764 9 9 34.904606 10 2 33.746837 11 20 23.987622 12 18 23.371128 13 16 22.346127 14 4 13.287167 15 3 11.661308 16 11 9.996169 17 17 9.772378 18 13 8.774826 19 12 6.125628 20 10 5.988017 Call R8VEC_PERMUTE to carry out the permutation explicitly. Permuted data 1: 58.1096 2: 53.2815 3: 47.9986 4: 42.3458 5: 40.2939 6: 38.3912 7: 35.8057 8: 35.1778 9: 34.9046 10: 33.7468 11: 23.9876 12: 23.3711 13: 22.3461 14: 13.2872 15: 11.6613 16: 9.99617 17: 9.77238 18: 8.77483 19: 6.12563 20: 5.98802 r8vec_sort_quick_a_test(): r8vec_sort_quick_a() quicksorts an R8VEC. Unsorted array: 1: 7.55119 2: 2.9521 3: 6.40006 4: 8.85117 5: 2.09643 6: 4.80356 7: 1.12988 8: 1.3237 9: 0.640023 10: 0.792974 11: 6.26954 12: 4.11334 13: 6.3859 14: 8.56557 15: 7.63575 16: 9.7616 17: 7.81537 18: 9.35583 19: 7.39152 20: 2.5362 Sorted array: 1: 0.640023 2: 0.792974 3: 1.12988 4: 1.3237 5: 2.09643 6: 2.5362 7: 2.9521 8: 4.11334 9: 4.80356 10: 6.26954 11: 6.3859 12: 6.40006 13: 7.39152 14: 7.55119 15: 7.63575 16: 7.81537 17: 8.56557 18: 8.85117 19: 9.35583 20: 9.7616 r8vec_sort_shell_a_test(): r8vec_sort_shell_a() ascending sorts a real vector using Shell's sort. Original array: 1: 43.155 2: 41.6108 3: 46.3991 4: 44.833 5: 19.103 6: 30.6259 7: 46.384 8: 34.3689 9: 57.231 10: 10.2943 11: 54.4341 12: 45.1332 13: 17.1705 14: 37.6446 15: 27.7697 16: 7.76635 17: 32.9631 18: 58.1706 19: 26.5284 20: 35.4578 Ascending sorted array: 1: 7.76635 2: 10.2943 3: 17.1705 4: 19.103 5: 26.5284 6: 27.7697 7: 30.6259 8: 32.9631 9: 34.3689 10: 35.4578 11: 37.6446 12: 41.6108 13: 43.155 14: 44.833 15: 45.1332 16: 46.384 17: 46.3991 18: 54.4341 19: 57.231 20: 58.1706 r8vec_sorted_merge_a_test(): r8vec_sorted_merge_a() merges two sorted DVEC's; Sorted vector A: 1: 0.0368774 2: 0.11097 3: 0.134343 4: 0.162964 5: 0.199852 6: 0.230134 7: 0.272725 8: 0.358545 9: 0.513521 10: 0.998595 Sorted vector B: 1: 0.00480846 2: 0.249853 3: 0.364752 4: 0.387846 5: 0.399058 6: 0.495473 7: 0.587729 8: 0.609187 9: 0.777462 10: 0.926301 Merged vector C: 1: 0.00480846 2: 0.0368774 3: 0.11097 4: 0.134343 5: 0.162964 6: 0.199852 7: 0.230134 8: 0.249853 9: 0.272725 10: 0.358545 11: 0.364752 12: 0.387846 13: 0.399058 14: 0.495473 15: 0.513521 16: 0.587729 17: 0.609187 18: 0.777462 19: 0.926301 20: 0.998595 r8vec_sorted_nearest_test(): r8vec_sorted_nearest() finds the nearest entry in a sorted real array. Sorted array: 1: 0.148949 2: 0.941498 3: 2.85176 4: 3.13736 5: 3.28723 6: 5.28315 7: 6.57183 8: 7.97085 9: 8.25773 10: 9.62434 Test Nearest Value Index Value 3.055663 4 3.137365 0.180221 1 0.148949 1.622074 2 0.941498 4.439895 6 5.283147 7.667700 8 7.970851 6.812559 7 6.571832 7.145367 7 6.571832 4.597809 6 5.283147 9.192684 10 9.624338 9.889434 10 9.624338 r8vec_sorted_range_test(): r8vec_sorted_range() seeks the range of indices in a sorted vector R so that R_LO <= R(I_LO:I_HI) <= R_HI. Sorted array R: 1: 0.284805 2: 0.386452 3: 0.461523 4: 0.560319 5: 0.602258 6: 0.603017 7: 0.663318 8: 0.84584 9: 0.904922 10: 0.932601 R_LO 0.309934 2 0.386452 3 0.461523 4 0.560319 5 0.602258 6 0.603017 R_HI 0.656463 Sorted array R: 1: 0.0281781 2: 0.100683 3: 0.188197 4: 0.286564 5: 0.331644 6: 0.354826 7: 0.535762 8: 0.709532 9: 0.905157 10: 0.990833 R_LO 0.119169 3 0.188197 4 0.286564 5 0.331644 6 0.354826 7 0.535762 8 0.709532 R_HI 0.865829 Sorted array R: 1: 0.0209917 2: 0.0768203 3: 0.355151 4: 0.376714 5: 0.440901 6: 0.631146 7: 0.864549 8: 0.864952 9: 0.87576 10: 0.955275 R_LO 0.034097 2 0.076820 R_HI 0.149194 Sorted array R: 1: 0.173619 2: 0.229626 3: 0.327245 4: 0.358944 5: 0.363164 6: 0.676118 7: 0.757155 8: 0.78225 9: 0.817476 10: 0.8756 R_LO 0.267443 3 0.327245 R_HI 0.337303 Sorted array R: 1: 0.00603583 2: 0.0290355 3: 0.0594588 4: 0.0869606 5: 0.169196 6: 0.45156 7: 0.454664 8: 0.554567 9: 0.637102 10: 0.68468 R_LO 0.288085 R_HI 0.376612 Empty range in R. r8vec_sorted_split_test(): r8vec_sorted_split() splits a sorted vector into entries less than and greater than a splitting value. The sorted array: 1: 0 2: 0 3: 0.5 4: 0.5 5: 1 6: 1 7: 1 8: 1.5 9: 1.5 10: 1.5 11: 1.5 12: 2 13: 2 14: 2 15: 2 16: 2.5 17: 2.5 18: 2.5 19: 3 20: 3.5 21: 3.5 22: 4 23: 4 24: 4.5 25: 4.5 Splitting value is 2.250000 Lower index I_LT = 15 Upper index I_GT = 16 r8vec_sorted_undex_test(): r8vec_sorted_undex() produces index vectors which create a sorted list of the unique elements of a sorted R8VEC, and a map from the original vector to the (implicit) vector of sorted unique elements. The vector X: 1: 11 2: 11 3: 11 4: 22 5: 22 6: 33 7: 33 8: 55 9: 55 Tolerance for equality is 2.220446e-16 Number of unique entries in X is 4 UNDX can be used to list the unique elements of X in sorted order. I UNDX X(UNDX) 1 1 11.000000 2 4 22.000000 3 6 33.000000 4 8 55.000000 UNDX can be used to created XU, a copy of X containing only the unique elements, in sorted order. I UNDX XU(I) 1 1 11.000000 2 4 22.000000 3 6 33.000000 4 8 55.000000 XDNU can be used to match each element of X with one of the unique elements I XDNU X(I) XU(XDNU(I)) 1 1 11.000000 11.000000 2 1 11.000000 11.000000 3 1 11.000000 11.000000 4 2 22.000000 22.000000 5 2 22.000000 22.000000 6 3 33.000000 33.000000 7 3 33.000000 33.000000 8 4 55.000000 55.000000 9 4 55.000000 55.000000 r8vec_sorted_unique_test(): r8vec_sorted_unique() finds the unique entries in a sorted R8VEC; Unsorted array: 1: 28 2: 18 3: 6 4: 3 5: 16 6: 8 7: 2 8: 4 9: 1 10: 20 Unique entries 1: 0 2: 1 3: 2 4: 3 5: 4 6: 6 7: 7 8: 8 9: 9 10: 10 11: 13 12: 15 13: 16 14: 18 15: 20 16: 23 17: 24 18: 25 19: 26 20: 28 21: 29 r8vec_sorted_unique_count_test(): r8vec_sorted_unique_count() counts the unique entries of a sorted R8VEC; Using a tolerance of 0.250000 R8VEC_SORTED_UNIQUE_COUNT counts 29 unique entries in A. r8vec_sorted_unique_hist_test(): r8vec_sorted_unique_hist() makes a histogram of the unique entries in a real vector. Unsorted array: 1: 18.5 2: 6.5 3: 6.5 4: 26.5 5: 4.5 6: 19.5 7: 13.5 8: 18.5 9: 22.5 10: 9.5 11: 1.5 12: 25.5 13: 11.5 14: 20.5 15: 27.5 16: 8.5 17: 30.5 18: 25.5 19: 24.5 20: 20.5 21: 16.5 22: 12.5 23: 25.5 24: 18.5 25: 23.5 26: 30.5 27: 24.5 28: 26.5 29: 15.5 30: 26.5 Ascending sorted array: 1: 1.5 2: 4.5 3: 6.5 4: 6.5 5: 8.5 6: 9.5 7: 11.5 8: 12.5 9: 13.5 10: 15.5 11: 16.5 12: 18.5 13: 18.5 14: 18.5 15: 19.5 16: 20.5 17: 20.5 18: 22.5 19: 23.5 20: 24.5 21: 24.5 22: 25.5 23: 25.5 24: 25.5 25: 26.5 26: 26.5 27: 26.5 28: 27.5 29: 30.5 30: 30.5 R8VEC_SORTED_UNIQUE_HIST counts 20 unique entries. Value Multiplicity 1 1.500000 1 2 4.500000 1 3 6.500000 2 4 8.500000 1 5 9.500000 1 6 11.500000 1 7 12.500000 1 8 13.500000 1 9 15.500000 1 10 16.500000 1 11 18.500000 3 12 19.500000 1 13 20.500000 2 14 22.500000 1 15 23.500000 1 16 24.500000 2 17 25.500000 3 18 26.500000 3 19 27.500000 1 20 30.500000 2 r8vec_split_test(): r8vec_split() splits a vector into entries less than and greater than a splitting value. The array: 1: 1.5 2: 1 3: 2.5 4: 0 5: 4 6: 1.5 7: 3.5 8: 4 9: 3.5 10: 3.5 11: 1 12: 2.5 13: 4.5 14: 1 15: 1 16: 1.5 17: 4 18: 1.5 19: 3 20: 1 21: 0.5 22: 1.5 23: 1 24: 4.5 25: 4.5 Splitting value is 3.000000 The split array: 1: 1.5 2: 1 3: 2.5 4: 0 5: 1 6: 1.5 7: 1.5 8: 0.5 9: 1 10: 3 11: 1 12: 2.5 13: 1.5 14: 1 15: 1 16: 1.5 17: 4 18: 4.5 19: 3.5 20: 3.5 21: 4 22: 3.5 23: 4.5 24: 4.5 25: 4 Array entries <= SPLIT up to index 16 r8vec_standardize_test(): r8vec_standardize() shifts and scales an R8VEC so that it has zero mean and unit standard deviation. Vector X: 1: -4.36242 2: 6.87294 3: -4.12365 4: 3.49806 5: 5.43163 6: 11.8068 7: 7.50059 8: 0.104094 9: 13.0938 10: 10.346 mean(X) = 5.01679 std(X) = 6.21368 max(X) = 13.0938 min(X) = -4.36242 Vector XS: 1: -1.50945 2: 0.298721 3: -1.47102 4: -0.244417 5: 0.0667623 6: 1.09275 7: 0.399732 8: -0.790625 9: 1.29988 10: 0.85766 mean(XS) = 1.11022e-17 std(XS) = 1 max(XS) = 1.29988 min(XS) = -1.50945 r8vec_std_test(): r8vec_std() computes the standard deviation of an R8VEC. Input vector: 1: 0.626655 2: 3.97154 3: -1.31921 4: -1.62269 5: 1.18855 6: -4.13105 7: -1.24502 8: -3.12619 9: 3.10527 10: 2.23248 STD: 2.548666 r8vec_std_sample_test(): r8vec_std_sample() computes the sample standard deviation of an R8VEC. Input vector: 1: 1.74674 2: 4.13981 3: 3.20961 4: 0.487246 5: -4.84458 6: -4.05314 7: 0.147583 8: 4.52483 9: 3.43061 10: 4.35012 Sample STD: 3.408350 r8vec_std_sample_update_test(): r8vec_std_sample_update() updates the sample standard deviation when one more element is added. N R STD STD_UPDATE 1 0.973413 0 0 2 0.372526 0.424891 0.424891 3 0.320901 0.362745 0.362745 4 0.783248 0.317296 0.317296 5 0.212222 0.327957 0.327957 6 0.959152 0.341158 0.341158 7 0.930233 0.335013 0.335013 8 0.365729 0.326066 0.326066 9 0.344912 0.317986 0.317986 10 0.692682 0.301738 0.301738 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.716604 0 0 2 0.800343 0.0418698 0.0418698 3 0.59367 0.0848781 0.0848781 4 0.097175 0.272659 0.272659 5 0.559509 0.243892 0.243892 6 0.04309 0.292826 0.292826 7 0.757632 0.28938 0.28938 8 0.659648 0.275194 0.275194 9 0.599459 0.260414 0.260414 10 0.226995 0.263906 0.263906 r8vec_step_test(): r8vec_step() evaluates a step function; Step function jump is at X=17.25 Table of step function values: 1: 10 0 2: 10.5 0 3: 11 0 4: 11.5 0 5: 12 0 6: 12.5 0 7: 13 0 8: 13.5 0 9: 14 0 10: 14.5 0 11: 15 0 12: 15.5 0 13: 16 0 14: 16.5 0 15: 17 0 16: 17.5 1 17: 18 1 18: 18.5 1 19: 19 1 20: 19.5 1 21: 20 1 r8vec_stutter_test(): r8vec_stutter() makes a "stuttering" copy of an R8VEC; Original vector X: 1: 1 2: 5 3: -2 Stuttering vector: 1: 1 2: 1 3: 1 4: 1 5: 5 6: 5 7: 5 8: 5 9: -2 10: -2 11: -2 12: -2 r8vec_sum_test(): r8vec_sum() computes the sum of an R8VEC. Input vector: 1: 2.13714 2: 2.24502 3: -1.55782 4: -4.67249 5: 3.43616 6: 2.703 7: 0.0964664 8: 2.06963 9: 2.91174 10: -1.69331 Sum = 7.67554 r8vec_sum_running_test(): r8vec_sum_running() returns the running sums of an R8VEC. Random R8VEC: 1: 8.70513 2: 3.65057 3: -0.681361 4: -0.997027 5: 8.35267 6: 0.491518 7: -2.74977 8: 9.19491 9: 4.76253 10: 9.73322 Running sums: 1: 0 2: 8.70513 3: 12.3557 4: 11.6743 5: 10.6773 6: 19.03 7: 19.5215 8: 16.7717 9: 25.9666 10: 30.7292 11: 40.4624 r8vec_swap_test(): r8vec_swap() swaps two R8VEC's. V1 and V2: 1: 1 0 2: 2 5 3: 3 10 V1 and V2 after swap: 1: 0 1 2: 5 2 3: 10 3 r8vec_transpose_print_test(): r8vec_transpose_print() prints an R8VEC "tranposed", that is, placing multiple entries on a line. The vector X: 1 2.2 -3.3 4.45 5.678 600 0.0078 8.123 9.45 10.03 11.1 12.99 r8vec_undex_test(): r8vec_undex() produces index vectors which create a sorted list of the unique elements of an (unsorted) R8VEC, and a map from the original vector to the (implicit) vector of sorted unique elements. The vector X: 1: 33 2: 55 3: 11 4: 11 5: 55 6: 33 7: 22 8: 22 9: 11 Tolerance for equality is 2.220446e-16 Number of unique entries in X is 4 UNDX can be used to list the unique elements of X in sorted order. I UNDX X(UNDX) 1 3 11.000000 2 7 22.000000 3 6 33.000000 4 5 55.000000 UNDX can be used to created XU, a copy of X containing only the unique elements, in sorted order. I UNDX XU(I) 1 3 11.000000 2 7 22.000000 3 6 33.000000 4 5 55.000000 XDNU can be used to match each element of X with one of the unique elements I XDNU X(I) XU(XDNU(I)) 1 3 33.000000 33.000000 2 4 55.000000 55.000000 3 1 11.000000 11.000000 4 1 11.000000 11.000000 5 4 55.000000 55.000000 6 3 33.000000 33.000000 7 2 22.000000 22.000000 8 2 22.000000 22.000000 9 1 11.000000 11.000000 r8vec_uniform_01(): r8vec_uniform_01() returns a random R8VEC with entries in [ 0.0, 1.0 ] Random R8VEC: 1: 0.193834 2: 0.828743 3: 0.493802 4: 0.590779 5: 0.0448906 6: 0.564458 7: 0.633544 8: 0.4981 9: 0.0596236 10: 0.515163 Random R8VEC: 1: 0.0531949 2: 0.843632 3: 0.594673 4: 0.691019 5: 0.647227 6: 0.62344 7: 0.953858 8: 0.176944 9: 0.474905 10: 0.842404 Random R8VEC: 1: 0.496963 2: 0.762405 3: 0.179877 4: 0.691622 5: 0.914425 6: 0.162657 7: 0.428096 8: 0.0418519 9: 0.225746 10: 0.66615 r8vec_uniform_ab_test(): r8vec_uniform_ab() returns a random R8VEC with entries in a given range [ A, B ] For this problem: A = 10.000000 B = 20.000000 Random R8VEC: 1: 18.7134 2: 13.4473 3: 10.2725 4: 19.0528 5: 14.7106 6: 19.1046 7: 13.2798 8: 16.911 9: 10.1745 10: 15.1235 Random R8VEC: 1: 13.3181 2: 13.3611 3: 19.5335 4: 17.5051 5: 13.3392 6: 16.3283 7: 14.1555 8: 15.765 9: 19.595 10: 16.1585 Random R8VEC: 1: 11.5058 2: 18.3827 3: 17.2617 4: 11.0885 5: 11.6135 6: 12.9701 7: 14.2358 8: 15.2841 9: 12.751 10: 18.2796 r8vec_uniform_abvec_test(): r8vec_uniform_abvec() returns a random R8VEC, with a range specified for each dimension. A[I] <= X[I] <= B[I]. I A(I) <= R(I) <= B(I) 1: 1 1.793 2 2: 10 12.74 20 3: 100 100.6 101 4: -5 -4.492 0 r8vec_uniform_unit_test(): r8vec_uniform_unit() returns a random R8VEC on the surface of the unit M sphere. Vector: 1: 0.489232 2: -0.12683 3: 0.427038 4: -0.589214 5: 0.463715 Vector: 1: -0.140693 2: -0.0369936 3: -0.138379 4: 0.341839 5: 0.91806 Vector: 1: 0.582689 2: 0.0191498 3: -0.486112 4: 0.0546518 5: -0.648703 Vector: 1: -0.054453 2: 0.587229 3: -0.0545411 4: 0.743502 5: -0.310527 Vector: 1: 0.232455 2: 0.175342 3: -0.743853 4: -0.277259 5: 0.533882 r8vec_unique_count_test(): r8vec_unique_count() counts the unique elements in an R8VEC, witha tolerance. Vector X: 1: 1 2: 2 3: 3 4: 2 5: 1.1 6: 2.01 7: 3.00001 8: 99 9: 2.1 10: 99.1 Using a tolerance of 0, number of unique entries is 9 Using a tolerance of 0.0001, number of unique entries is 8 Using a tolerance of 0.2, number of unique entries is 4 r8vec_unique_index_test(): r8vec_unique_index() indexes the unique elements in an R8VEC, with a tolerance. Vector A: 1: 1 2: 2 3: 3 4: 2 5: 1.1 6: 2.01 7: 3.00001 8: 99 9: 2.1 10: 99.1 Using tolerance of 0.0: 1: 1 1 2: 2 2 3: 3 3 4: 2 2 5: 1.1 4 6: 2.01 5 7: 3.00001 6 8: 99 7 9: 2.1 8 10: 99.1 9 Using a tolerance of 0.0001: 1: 1 1 2: 2 2 3: 3 3 4: 2 2 5: 1.1 4 6: 2.01 5 7: 3.00001 3 8: 99 6 9: 2.1 7 10: 99.1 8 Using a tolerance of 0.2: 1: 1 1 2: 2 2 3: 3 3 4: 2 2 5: 1.1 1 6: 2.01 2 7: 3.00001 3 8: 99 4 9: 2.1 2 10: 99.1 4 r8vec_variance_test() r8vec_variance() computes the variance of an R8VEC. Input vector: 1: -4.4445 2: -1.15952 3: -2.5936 4: -2.72191 5: -1.4288 6: 4.24103 7: 0.0249835 8: 3.03238 9: -1.49728 10: -0.413175 VARIANCE: 6.202514 r8vec_variance_circular_test(): r8vec_variance_circular() computes the circular variance of an R8VEC. Uniform Vector in [-PI,+PI]: 1: 2.83432 2: -2.30603 3: -2.69984 4: 1.29485 5: 2.71247 6: -2.45735 7: 0.953139 8: -2.22386 9: 1.21871 10: 0.789254 Circular variance: 0.669555 Normal vector, mean 0, variance 1 1: 0.0437234 2: 0.797924 3: 0.986211 4: 0.436745 5: 0.344749 6: 0.0488061 7: 0.225203 8: 0.581013 9: 0.601375 10: 0.252518 Circular variance: 0.0429413 r8vec_variance_sample_test(): r8vec_variance_sample() computes the sample variance of an R8VEC. Input vector: 1: 1.54342 2: -4.39904 3: 4.40506 4: -4.07469 5: -1.66022 6: 1.5105 7: 0.0391078 8: 0.309251 9: -1.20876 10: 2.68907 Sample variance: 7.944124 r8vec_variance_sample_update_test(): r8vec_variance_sample_update() updates the sample variance of a vector when one more element is added. n r var1 var2 var3 1 -0.460335 0 0 0 2 0.697998 0.670868 0.670868 0.670868 3 1.21126 0.733232 0.733232 0.733232 4 -0.339759 0.658043 0.658043 0.658043 5 1.44865 0.767947 0.767947 0.767947 6 0.443911 0.61512 0.61512 0.61512 7 -1.4878 1.07724 1.07724 1.07724 8 -0.471276 0.982441 0.982441 0.982441 9 -0.145215 0.868072 0.868072 0.868072 10 0.637923 0.800587 0.800587 0.800587 r8vec_variance_update_test(): r8vec_variance_update() updates the variance of a vector when one more element is added. n r var1 var2 var3 1 0.712707 0 0 0 2 0.697064 6.11761e-05 6.11761e-05 6.11761e-05 3 -1.447 1.02906 1.02906 1.02906 4 -1.52575 1.20121 1.20121 1.20121 5 1.34551 1.4433 1.4433 1.4433 6 0.823447 1.30714 1.30714 1.30714 7 0.412185 1.13226 1.13226 1.13226 8 1.54619 1.20533 1.20533 1.20533 9 1.84695 1.30152 1.30152 1.30152 10 -0.772296 1.31481 1.31481 1.31481 r8vec_vector_triple_product_test(): r8vec_vector_triple_product() computes the vector triple product of three R8VEC's. V4 = V1 x ( V2 x V3 ). V1, V2 and V3: 1: 2 1 3 2: -1 4 -2 3: 3 -5 1 V4 and Vexact 1: 62 62 2: 10 10 3: -38 -38 r8vec_write_test(): r8vec_write() writes an R8VEC file. R8VEC data: 1: 0.509767 2: 0.78774 3: 0.522452 4: 0.617392 5: 0.558241 6: 0.730992 7: 0.0634021 8: 0.492787 9: 0.229924 10: 0.337391 Wrote the file "r8vec_10.txt". r8vec2_print_test(): r8vec2_print() prints a pair of R8VEC's. Square and square root: 1: 1 1 2: 4 1.41421 3: 9 1.73205 4: 16 2 5: 25 2.23607 r8vec2_print_some_test(): r8vec2_print_some() prints some of a pair of R8VEC's. No more than 10 lines of two vectors: 1: 1 1 2: 4 1.41421 3: 9 1.73205 4: 16 2 5: 25 2.23607 6: 36 2.44949 7: 49 2.64575 8: 64 2.82843 ...... .............. .............. 100: 10000 10 r8vec2_sort_a_test(): r8vec2_sort_a() ascending sorts a pair of R8VEC's; The pair of arrays: 1: 2.10328 9.45791 2: 2.48737 7.9307 3: 2.10328 9.45791 4: 2.01524 8.0904 5: 1.25794 6.2536 6: 2.48737 7.9307 7: 1.58566 7.73182 8: 1.89993 7.21323 9: 2.10328 9.45791 10: 1.52653 8.7972 Arrays after ascending sort: 1: 1.25794 6.2536 2: 1.52653 8.7972 3: 1.58566 7.73182 4: 1.89993 7.21323 5: 2.01524 8.0904 6: 2.10328 9.45791 7: 2.10328 9.45791 8: 2.10328 9.45791 9: 2.48737 7.9307 10: 2.48737 7.9307 r8vec2_sort_d_test(): r8vec2_sort_d() descending sorts a pair of R8VEC's; The pair of arrays: 1: 1.79884 8.28461 2: 2.13483 8.89484 3: 1.79884 8.28461 4: 2.88706 7.51615 5: 2.02561 9.39366 6: 2.13483 8.89484 7: 1.45828 6.21318 8: 2.90586 6.40813 9: 1.79884 8.28461 10: 2.41575 8.51338 Arrays after descending sort: 1: 2.90586 6.40813 2: 2.88706 7.51615 3: 2.41575 8.51338 4: 2.13483 8.89484 5: 2.13483 8.89484 6: 2.02561 9.39366 7: 1.79884 8.28461 8: 1.79884 8.28461 9: 1.79884 8.28461 10: 1.45828 6.21318 r8vec2_sort_heap_index_a_test(): r8vec2_sort_heap_index_a() creates a sort index for an (X,Y) array. The unsorted array: I, X(I), Y(I) 1 0.853056 0.019822 2 0.378684 0.570473 3 0.633022 0.036335 4 0.031557 0.264743 5 0.920034 0.190658 6 0.469747 0.449300 7 0.519903 0.768655 8 0.766312 0.627936 9 0.336217 0.314700 10 0.625985 0.292043 11 0.326902 0.078238 12 0.311107 0.171944 13 0.646078 0.721280 14 0.433692 0.089449 15 0.102887 0.917812 16 0.236151 0.429677 17 0.971783 0.079723 18 0.698897 0.572144 19 0.659450 0.831772 20 0.326097 0.347368 After sorting: I, INDX(I), X(I), Y(I) 1 4 0.853056 0.019822 2 15 0.378684 0.570473 3 16 0.633022 0.036335 4 12 0.031557 0.264743 5 20 0.920034 0.190658 6 11 0.469747 0.449300 7 9 0.519903 0.768655 8 2 0.766312 0.627936 9 14 0.336217 0.314700 10 6 0.625985 0.292043 11 7 0.326902 0.078238 12 10 0.311107 0.171944 13 3 0.646078 0.721280 14 13 0.433692 0.089449 15 19 0.102887 0.917812 16 18 0.236151 0.429677 17 8 0.971783 0.079723 18 1 0.698897 0.572144 19 5 0.659450 0.831772 20 17 0.326097 0.347368 Now use the index array to carry out the permutation implicitly. I, INDX(I), X(INDX(I)), Y(INDX(I)) 1 4 0.031557 0.264743 2 15 0.102887 0.917812 3 16 0.236151 0.429677 4 12 0.311107 0.171944 5 20 0.326097 0.347368 6 11 0.326902 0.078238 7 9 0.336217 0.314700 8 2 0.378684 0.570473 9 14 0.433692 0.089449 10 6 0.469747 0.449300 11 7 0.519903 0.768655 12 10 0.625985 0.292043 13 3 0.633022 0.036335 14 13 0.646078 0.721280 15 19 0.659450 0.831772 16 18 0.698897 0.572144 17 8 0.766312 0.627936 18 1 0.853056 0.019822 19 5 0.920034 0.190658 20 17 0.971783 0.079723 R8VEC_PERMUTE carries out the permutation. I, X(I), Y(I) 1 0.031557 0.264743 2 0.102887 0.917812 3 0.236151 0.429677 4 0.311107 0.171944 5 0.326097 0.347368 6 0.326902 0.078238 7 0.336217 0.314700 8 0.378684 0.570473 9 0.433692 0.089449 10 0.469747 0.449300 11 0.519903 0.768655 12 0.625985 0.292043 13 0.633022 0.036335 14 0.646078 0.721280 15 0.659450 0.831772 16 0.698897 0.572144 17 0.766312 0.627936 18 0.853056 0.019822 19 0.920034 0.190658 20 0.971783 0.079723 r8vec2_sorted_unique_test(): r8vec2_sorted_unique() counts unique entries in a pair of R8VEC's. The pair of arrays: 1: 2.55978 7.82408 2: 2.41668 5.24571 3: 2.55978 7.82408 4: 1.75399 9.30012 5: 1.78765 6.69129 6: 2.41668 5.24571 7: 1.84605 9.77388 8: 1.43785 9.9431 9: 2.55978 7.82408 10: 1.07974 5.01459 Arrays after ascending sort: 1: 1.07974 5.01459 2: 1.43785 9.9431 3: 1.75399 9.30012 4: 1.78765 6.69129 5: 1.84605 9.77388 6: 2.41668 5.24571 7: 2.41668 5.24571 8: 2.55978 7.82408 9: 2.55978 7.82408 10: 2.55978 7.82408 UNIQed array: 1: 1.07974 5.01459 2: 1.43785 9.9431 3: 1.75399 9.30012 4: 1.78765 6.69129 5: 1.84605 9.77388 6: 2.41668 5.24571 7: 2.55978 7.82408 r8vec2_sorted_unique_index_test(): r8vec2_sorted_unique_index() indexes unique entries in a pair of R8VEC's. Sorted arrays: 1: 1.0254 8.80479 2: 1.45186 9.67617 3: 1.49636 5.66111 4: 1.49636 5.66111 5: 1.49636 5.66111 6: 1.51889 6.87629 7: 1.69159 9.92431 8: 1.69258 6.94031 9: 1.69258 6.94031 10: 2.51178 6.06633 The number of unique elements is 7 Index of Unique Elements: 1: 1 2: 2 3: 3 4: 6 5: 7 6: 8 7: 10 After Indexed Nonunique Deletion. 1: 1.0254 8.80479 2: 1.45186 9.67617 3: 1.49636 5.66111 4: 1.51889 6.87629 5: 1.69159 9.92431 6: 1.69258 6.94031 7: 2.51178 6.06633 8: 1.69258 6.94031 9: 1.69258 6.94031 10: 2.51178 6.06633 r8vec2_sum_max_index_test(): r8vec2_sum_max_index(): index of the sum vector of 2 R8VEC's with maximum value. The pair of vectors: 1: 5.79362 2.9574 2: 6.21157 1.13374 3: 4.89904 3.41922 4: 2.2045 1.60321 5: 1.44134 3.74459 6: 6.35176 4.99072 7: 8.02416 1.34867 8: 6.69643 4.65935 9: 4.71603 3.48194 10: 9.44478 0.476296 Index of maximum in A+B: 8 r8vec3_print_test(): r8vec3_print() prints three R8VEC's. n, n^2, sqrt(n): 1: 1 1 1 2: 2 4 1.41421 3: 3 9 1.73205 4: 4 16 2 5: 5 25 2.23607 rms_test() rms() evaluates the root-mean-square norm of a vector or matrix X: 1 2 3 4 5 6 7 8 9 10 rms(x) 6.2048 A: 5 4 3 2 1 4 4 3 2 1 0 3 3 2 1 0 0 2 2 1 rms(A): 3.2016 3.2016 2.7839 2.0000 1.0000 z (complex): Columns 1 through 4 1.0000 + 0.0000i 0.9239 + 0.3827i 0.7071 + 0.7071i 0.3827 + 0.9239i Columns 5 through 8 0.0000 + 1.0000i -0.3827 + 0.9239i -0.7071 + 0.7071i -0.9239 + 0.3827i Columns 9 through 12 -1.0000 + 0.0000i -0.9239 - 0.3827i -0.7071 - 0.7071i -0.3827 - 0.9239i Columns 13 through 16 -0.0000 - 1.0000i 0.3827 - 0.9239i 0.7071 - 0.7071i 0.9239 - 0.3827i rms(z): 1 sort_heap_external_test() sort_heap_external() sorts objects externally. Unsorted array: 1: 5 2: 19 3: 10 4: 18 5: 16 6: 1 7: 16 8: 14 9: 18 10: 12 11: 13 12: 3 13: 5 14: 1 15: 9 16: 7 17: 6 18: 10 19: 4 20: 19 Sorted array: 1: 1 2: 1 3: 3 4: 4 5: 5 6: 5 7: 6 8: 7 9: 9 10: 10 11: 10 12: 12 13: 13 14: 14 15: 16 16: 16 17: 18 18: 18 19: 19 20: 19 r8lib_test() Normal end of execution. 13-May-2025 16:58:58