21 October 2012 10:55:10.066 AM R8LIB_PRB FORTRAN77 version Test the R8LIB library. TEST001 R8_ABS returns the absolute value of an R8. X R8_ABS(X) -1.252654 1.252654 4.650541 4.650541 3.636074 3.636074 1.493564 1.493564 0.322457 0.322457 -2.471050 2.471050 -0.939378 0.939378 -2.120346 2.120346 -2.649368 2.649368 2.071726 2.071726 TEST002 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.00000 0.00000 0.00000 0.00000 1.00000 1.00000 0.785398 0.785398 0.00000 1.00000 1.57080 1.57080 -1.00000 1.00000 2.35619 2.35619 -1.00000 0.00000 3.14159 3.14159 -1.00000 -1.00000 -2.35619 3.92699 0.00000 -1.00000 -1.57080 4.71239 1.00000 -1.00000 -0.785398 5.49779 TEST003 R8_CAS evaluates the casine of a number. X R8_CAS ( X ) 0.00000 1.00000 0.261799 1.22474 0.523599 1.36603 0.785398 1.41421 1.04720 1.36603 1.30900 1.22474 1.57080 1.00000 1.83260 0.707107 2.09440 0.366025 2.35619 0.111022E-15 2.61799 -0.366025 2.87979 -0.707107 3.14159 -1.00000 TEST004 R8_CEILING rounds a value up. -1.20000 -1.00000 -1.00000 -1.00000 -0.800000 0.00000 -0.600000 0.00000 -0.400000 0.00000 -0.200000 0.00000 0.00000 0.00000 0.200000 1.00000 0.400000 1.00000 0.600000 1.00000 0.800000 1.00000 1.00000 1.00000 1.20000 2.00000 TEST005 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.0000 0.0625 0.9375 0.8750 1.0000 0.1250 0.8750 0.8750 1.0000 0.2500 0.7500 0.7500 1.0000 0.5000 0.5000 0.5000 1.0000 0.8740 0.1260 0.1250 1.0000 0.8760 0.1240 0.1250 1.0000 0.9000 0.1000 0.1250 1.0000 0.9500 0.0500 0.0000 1.0000 0.9900 0.0100 0.0000 1.0000 1.0000 0.0000 0.0000 1.0000 1.0100 -0.0100 0.0000 1.0000 1.0500 -0.0500 0.0000 1.0000 1.1000 -0.1000 -0.1375 1.0000 3.0000 -2.0000 -1.8750 1.0000 10.0000 -9.0000 -8.7500 TEST006 R8_DIGIT extracts decimal digits. Here, we get digits of 3.141592653589793 -2 -1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 0 0 0 3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 1 1 5 9 TEST007 R8_EPSILON returns the R8 machine precision. R8_EPSILON_COMPUTE computes the R8 machine precision. R1 = R8_EPSILON() = 0.2220446049250313E-15 R2 = R8_EPSILON_COMPUTE() = 0.2220446049250313E-15 ( 1 + R2 ) - 1 = 0.2220446049250313E-15 ( 1 + (R2/2) ) - 1 = 0.00000 TEST008 R8_FRACTIONAL returns the fractional part of an R8. -1.252654 0.252654 4.650541 0.650541 3.636074 0.636074 1.493564 0.493564 0.322457 0.322457 -2.471050 0.471050 -0.939378 0.939378 -2.120346 0.120346 -2.649368 0.649368 2.071726 0.071726 TEST009 R8_HUGE returns a "huge" R8; R8_HUGE ( ) = 0.1000000000000000E+31 TEST010 R8_LOG_2 computes the logarithm base 2. X, R8_LOG_2 0.00000 -0.100000E+31 1.00000 0.00000 2.00000 1.00000 3.00000 1.58496 9.00000 3.16993 10.0000 3.32193 11.0000 3.45943 99.0000 6.62936 101.000 6.65821 -1.00000 0.00000 -2.00000 1.00000 -3.00000 1.58496 -9.00000 3.16993 0.500000 -1.00000 0.330000 -1.59946 0.250000 -2.00000 0.200000 -2.32193 0.100000E-01 -6.64386 TEST011 R8_LOG_B computes the logarithm base B. X, B, R8_LOG_B 16.0000 2.00000 4.00000 16.0000 3.00000 2.52372 16.0000 4.00000 2.00000 16.0000 5.00000 1.72271 16.0000 6.00000 1.54741 16.0000 7.00000 1.42483 16.0000 8.00000 1.33333 16.0000 16.0000 1.00000 16.0000 32.0000 0.800000 16.0000 256.000 0.500000 TEST012 R8_MANT decomposes a value. Number to be decomposed: -314.159 R8_MANT: X = -1 * 1.22718 * 2** 8 TEST013 R8_MOD returns the remainder after division. X Y MOD(X,Y) R8_MOD(X,Y) -5.6316 9.1264 -5.6316 -5.6316 6.5902 1.2339 0.4206 0.4206 -1.6939 -8.6776 -1.6939 -1.6939 -4.8484 -7.8009 -4.8484 -4.8484 -9.1234 2.6793 -1.0855 -1.0855 -8.7655 -1.0092 -0.6917 -0.6917 -1.9739 5.0935 -1.9739 -1.9739 5.9457 -9.9632 5.9457 5.9457 7.9501 -2.9850 1.9802 1.9802 -8.1091 -9.7277 -8.1091 -8.1091 TEST014 R8_MODP returns the remainder after division. Unlike the FORTRAN MOD, R8_MODP ( X, Y ) is positive. X Y MOD(X,Y) R8_MODP(X,Y) -5.6316 9.1264 -5.6316 3.4947 6.5902 1.2339 0.4206 0.4206 -1.6939 -8.6776 -1.6939 6.9838 -4.8484 -7.8009 -4.8484 2.9524 -9.1234 2.6793 -1.0855 1.5938 -8.7655 -1.0092 -0.6917 0.3175 -1.9739 5.0935 -1.9739 3.1196 5.9457 -9.9632 5.9457 5.9457 7.9501 -2.9850 1.9802 1.9802 -8.1091 -9.7277 -8.1091 1.6186 TEST015 R8_NINT produces the nearest integer to an R8. -5.6316 -6 9.1264 9 6.5902 7 1.2339 1 -1.6939 -2 -8.6776 -9 -4.8484 -5 -7.8009 -8 -9.1234 -9 2.6793 3 TEST016 R8_NORMAL_01 generates normally distributed random values. Using initial random number seed = 123456789 1.67904 -0.472769 -0.566060 -0.231124 1.21293 0.535037 1.26938 1.04954 -1.66609 -1.86523 -2.24246 0.735809 0.396749E-01 -1.35074 0.673068 0.777484E-02 -0.275127 0.374940 2.16400 0.185600 TEST017 R8_PI returns the value of PI. R8_PI = 3.141592653589793 4*atan(1) = 3.141592653589793 TEST018 R8_POWER computes R**P. R P R**P 2.00000 -5 0.312500E-01 2.00000 -4 0.625000E-01 2.00000 -3 0.125000 2.00000 -2 0.250000 2.00000 -1 0.500000 2.00000 0 1.00000 2.00000 1 2.00000 2.00000 2 4.00000 2.00000 3 8.00000 2.00000 4 16.0000 2.00000 5 32.0000 TEST019 R8_POWER_FAST computes R**P, economizing on multiplications. R P R**P Mults 2.00000 -10 0.976563E-03 7 2.00000 -9 0.195313E-02 7 2.00000 -8 0.390625E-02 6 2.00000 -7 0.781250E-02 7 2.00000 -6 0.156250E-01 6 2.00000 -5 0.312500E-01 6 2.00000 -4 0.625000E-01 5 2.00000 -3 0.125000 5 2.00000 -2 0.250000 4 2.00000 -1 0.500000 1 2.00000 0 1.00000 0 2.00000 1 2.00000 0 2.00000 2 4.00000 3 2.00000 3 8.00000 4 2.00000 4 16.0000 4 2.00000 5 32.0000 5 2.00000 6 64.0000 5 2.00000 7 128.000 6 2.00000 8 256.000 5 2.00000 9 512.000 6 2.00000 10 1024.00 6 2.00000 11 2048.00 7 2.00000 12 4096.00 6 2.00000 13 8192.00 7 2.00000 14 16384.0 7 2.00000 15 32768.0 8 2.00000 16 65536.0 6 2.00000 17 131072. 7 2.00000 18 262144. 7 2.00000 19 524288. 8 2.00000 20 0.104858E+07 7 2.00000 21 0.209715E+07 8 2.00000 22 0.419430E+07 8 2.00000 23 0.838861E+07 9 2.00000 24 0.167772E+08 7 2.00000 25 0.335544E+08 8 2.00000 26 0.671089E+08 8 2.00000 27 0.134218E+09 9 2.00000 28 0.268435E+09 8 2.00000 29 0.536871E+09 9 2.00000 30 0.107374E+10 9 2.00000 31 0.214748E+10 10 2.00000 32 0.429497E+10 7 2.00000 33 0.858993E+10 8 2.00000 34 0.171799E+11 8 2.00000 35 0.343597E+11 9 2.00000 36 0.687195E+11 8 2.00000 37 0.137439E+12 9 2.00000 38 0.274878E+12 9 2.00000 39 0.549756E+12 10 2.00000 40 0.109951E+13 8 TEST020 R8_ROUND2 rounds a number to a specified number of base 2 digits. Test effect on PI: X = 3.141592653589793 NPLACE XROUND 0 0.000000000000000 1 2.000000000000000 2 3.000000000000000 3 3.000000000000000 4 3.000000000000000 5 3.125000000000000 6 3.125000000000000 7 3.125000000000000 8 3.140625000000000 9 3.140625000000000 10 3.140625000000000 11 3.140625000000000 12 3.140625000000000 13 3.141113281250000 14 3.141357421875000 15 3.141479492187500 16 3.141540527343750 17 3.141571044921875 18 3.141586303710938 19 3.141586303710938 20 3.141590118408203 TEST021 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.141592653589793 NPLACE XROUND 0 0.000000000000000 1 3.000000000000000 2 3.000000000000000 3 3.000000000000000 4 3.111111111111111 5 3.111111111111111 6 3.135802469135802 7 3.139917695473252 8 3.141289437585734 9 3.141289437585734 10 3.141441853376010 11 3.141543463902860 12 3.141577334078477 13 3.141588624137016 14 3.141592387489863 15 3.141592387489863 16 3.141592596565021 17 3.141592596565021 18 3.141592643026167 19 3.141592650769691 20 3.141592653350866 Try with a negative base: Input quantity is X = 121.0000000000000 to be rounded in base -3 Output value to 1 places is 81.00000000000000 Output value to 2 places is 108.0000000000000 Output value to 3 places is 117.0000000000000 Output value to 4 places is 120.0000000000000 Output value to 5 places is 121.0000000000000 TEST022 R8_ROUNDX rounds a number to a specified number of decimal digits. Test effect on PI: X = 3.141592653589793 NPLACE XROUND 0 0.000000000000000 1 3.000000000000000 2 3.100000000000000 3 3.140000000000000 4 3.141000000000000 5 3.141500000000000 6 3.141590000000000 7 3.141592000000000 8 3.141592600000000 9 3.141592650000000 10 3.141592653000000 Test effect on random values: NPLACE X XROUND 0 0.2184182969823758 0.000000000000000 2 0.2184182969823758 0.2100000000000000 4 0.2184182969823758 0.2184000000000000 6 0.2184182969823758 0.2184180000000000 8 0.2184182969823758 0.2184182900000000 10 0.2184182969823758 0.2184182969000000 0 0.9563175765089297 0.000000000000000 2 0.9563175765089297 0.9500000000000001 4 0.9563175765089297 0.9563000000000000 6 0.9563175765089297 0.9563170000000000 8 0.9563175765089297 0.9563175700000001 10 0.9563175765089297 0.9563175765000000 0 0.8295092339327006 0.000000000000000 2 0.8295092339327006 0.8200000000000001 4 0.8295092339327006 0.8295000000000000 6 0.8295092339327006 0.8295089999999999 8 0.8295092339327006 0.8295092300000000 10 0.8295092339327006 0.8295092339000000 0 0.5616954427668942 0.000000000000000 2 0.5616954427668942 0.5600000000000001 4 0.5616954427668942 0.5616000000000000 6 0.5616954427668942 0.5616949999999999 8 0.5616954427668942 0.5616954400000000 10 0.5616954427668942 0.5616954427000000 0 0.4153070814759612 0.000000000000000 2 0.4153070814759612 0.4100000000000000 4 0.4153070814759612 0.4153000000000000 6 0.4153070814759612 0.4153070000000000 8 0.4153070814759612 0.4153070800000000 10 0.4153070814759612 0.4153070814000000 TEST023 R8_SIGN returns the sign of a number. -1.2500 -1.0000 -0.2500 -1.0000 0.0000 1.0000 0.5000 1.0000 9.0000 1.0000 TEST0235 R8_SWAP swaps two reals. Before swapping: X = 1.00000 Y = 3.14159 After swapping: X = 3.14159 Y = 1.00000 TEST024 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.00000 10.0000 R RD 1.83944 1.94737 11.4321 10.0000 9.78362 10.0000 6.30204 6.21053 4.39899 4.31579 -0.140456 1.00000 2.34851 2.42105 0.429438 1.00000 -0.430223 1.00000 7.24155 7.15789 -0.197546 1.00000 4.84401 4.78947 4.21698 4.31579 8.81076 8.57895 9.36473 9.52632 TEST025 R8_TO_I4 finds an integer IX in [IXMIN,IXMAX] corresponding to X in [XMIN,XMAX]. XMIN 2.50000 X = 3.50000 XMAX = 5.50000 IXMIN 10 IX = 20 IXMAX = 40 TEST026 R8_UNIFORM_AB returns random values in a given range: [ A, B ] For this problem: B = 10.0000 C = 20.0000 12.1842 19.5632 18.2951 15.6170 14.1531 10.6612 12.5758 11.0996 10.4383 16.3397 TEST027 R8_UNIFORM_01 produces a sequence of random values. Using random seed 123456789 SEED R8_UNIFORM_01(SEED) 469049721 0.218418 2053676357 0.956318 1781357515 0.829509 1206231778 0.561695 891865166 0.415307 141988902 0.661187E-01 553144097 0.257578 236130416 0.109957 94122056 0.438290E-01 1361431000 0.633966 Verify that the sequence can be restarted. Set the seed back to its original value, and see that we generate the same sequence. SEED R8_UNIFORM_01(SEED) 469049721 0.218418 2053676357 0.956318 1781357515 0.829509 1206231778 0.561695 891865166 0.415307 141988902 0.661187E-01 553144097 0.257578 236130416 0.109957 94122056 0.438290E-01 1361431000 0.633966 TEST028 R8_UNIFORM_01 samples a uniform random distribution in [0,1]. Starting with seed = 123456789 First few values: 1 0.218418 2 0.956318 3 0.829509 4 0.561695 5 0.415307 Number of values computed was N = 1000 Average value was 0.503040 Minimum value was 0.183837E-02 Maximum value was 0.997908 Variance was 0.823320E-01 TEST029 R8_WALSH_1D evaluates 1D Walsh functions: X W(+2) W(+1) W(0) W(-1) W(-2) W(-3) 0.000000 0.0 0.0 0.0 0.0 0.0 0.0 0.250000 0.0 0.0 0.0 0.0 1.0 0.0 0.500000 0.0 0.0 0.0 1.0 0.0 0.0 0.750000 0.0 0.0 0.0 1.0 1.0 0.0 1.000000 0.0 0.0 1.0 0.0 0.0 0.0 1.250000 0.0 0.0 1.0 0.0 1.0 0.0 1.500000 0.0 0.0 1.0 1.0 0.0 0.0 1.750000 0.0 0.0 1.0 1.0 1.0 0.0 2.000000 0.0 1.0 0.0 0.0 0.0 0.0 2.250000 0.0 1.0 0.0 0.0 1.0 0.0 2.500000 0.0 1.0 0.0 1.0 0.0 0.0 2.750000 0.0 1.0 0.0 1.0 1.0 0.0 3.000000 0.0 1.0 1.0 0.0 0.0 0.0 3.250000 0.0 1.0 1.0 0.0 1.0 0.0 3.500000 0.0 1.0 1.0 1.0 0.0 0.0 3.750000 0.0 1.0 1.0 1.0 1.0 0.0 4.000000 1.0 0.0 0.0 0.0 0.0 0.0 4.250000 1.0 0.0 0.0 0.0 1.0 0.0 4.500000 1.0 0.0 0.0 1.0 0.0 0.0 4.750000 1.0 0.0 0.0 1.0 1.0 0.0 5.000000 1.0 0.0 1.0 0.0 0.0 0.0 5.250000 1.0 0.0 1.0 0.0 1.0 0.0 5.500000 1.0 0.0 1.0 1.0 0.0 0.0 5.750000 1.0 0.0 1.0 1.0 1.0 0.0 6.000000 1.0 1.0 0.0 0.0 0.0 0.0 6.250000 1.0 1.0 0.0 0.0 1.0 0.0 6.500000 1.0 1.0 0.0 1.0 0.0 0.0 6.750000 1.0 1.0 0.0 1.0 1.0 0.0 7.000000 1.0 1.0 1.0 0.0 0.0 0.0 7.250000 1.0 1.0 1.0 0.0 1.0 0.0 7.500000 1.0 1.0 1.0 1.0 0.0 0.0 7.750000 1.0 1.0 1.0 1.0 1.0 0.0 8.000000 0.0 0.0 0.0 0.0 0.0 0.0 TEST0295 R8_WRAP "wraps" an R8 to lie within an interval: Wrapping interval is 3.00000 , 6.50000 R R8_WRAP ( R ) 1.05786 4.55786 11.3884 4.38845 9.61313 6.11313 5.86374 5.86374 3.81430 3.81430 -1.07434 5.92566 1.60609 5.10609 -0.460605 3.03940 -1.38639 5.61361 6.87552 3.37552 -1.13582 5.86418 4.29355 4.29355 3.61829 3.61829 8.56543 5.06543 9.16202 5.66202 -1.97426 5.02574 10.5651 3.56506 2.91053 6.41053 -0.676373 6.32363 -1.80936 5.19064 TEST031 R82POLY2_TYPE determines the type of a second order equation in two variables. 9.0000 * x^2 + -4.0000 * y^2 + 0.0000 * xy + -36.0000 * x + -24.0000 * y + -36.0000 = 0 Type = 1 The set of solutions forms a hyperbola. 4.0000 * x^2 + 1.0000 * y^2 + -4.0000 * xy + 3.0000 * x + -4.0000 * y + 1.0000 = 0 Type = 2 The set of solutions forms a parabola. 9.0000 * x^2 + 16.0000 * y^2 + 0.0000 * xy + 36.0000 * x + -32.0000 * y + -92.0000 = 0 Type = 3 The set of solutions forms an ellipse. 1.0000 * x^2 + 1.0000 * y^2 + 0.0000 * xy + -6.0000 * x + -10.0000 * y + 115.0000 = 0 Type = 4 The set of solutions forms an imaginary ellipse. (There are no real solutions). 0.0000 * x^2 + 0.0000 * y^2 + 1.0000 * xy + 3.0000 * x + -1.0000 * y + -3.0000 = 0 Type = 5 The set of solutions forms a pair of intersecting lines. 1.0000 * x^2 + 2.0000 * y^2 + 0.0000 * xy + -2.0000 * x + 16.0000 * y + 33.0000 = 0 Type = 6 The set of solutions is a single point. 0.0000 * x^2 + 1.0000 * y^2 + 0.0000 * xy + 0.0000 * x + -6.0000 * y + 8.0000 = 0 Type = 7 The set of solutions form a pair of distinct parallel lines. 0.0000 * x^2 + 1.0000 * y^2 + 0.0000 * xy + 0.0000 * x + -6.0000 * y + 10.0000 = 0 Type = 8 The set of solutions forms a pair of imaginary parallel lines. (There are no real solutions). 0.0000 * x^2 + 1.0000 * y^2 + 0.0000 * xy + 0.0000 * x + -2.0000 * y + 1.0000 = 0 Type = 9 The set of solutions forms a pair of coincident lines. 0.0000 * x^2 + 0.0000 * y^2 + 0.0000 * xy + 2.0000 * x + -1.0000 * y + 1.0000 = 0 Type = 10 The set of solutions forms a single line. 0.0000 * x^2 + 0.0000 * y^2 + 0.0000 * xy + 0.0000 * x + 0.0000 * y + 0.0000 = 0 Type = 11 The set of solutions is all space. 0.0000 * x^2 + 0.0000 * y^2 + 0.0000 * xy + 0.0000 * x + 0.0000 * y + 1.0000 = 0 Type = 12 The set of solutions is empty. TEST032 R82VEC_ORDER_TYPE classifies a R8VEC as -1: no order 0: all equal; 1: ascending; 2: strictly ascending; 3: descending; 4: strictly descending. Order type = -1 1 1.00000 3.00000 2 2.00000 2.00000 3 1.00000 0.00000 4 1.00000 0.00000 Order type = -1 1 0.00000 2.00000 2 0.00000 1.00000 3 1.00000 2.00000 4 2.00000 0.00000 Order type = -1 1 3.00000 1.00000 2 0.00000 0.00000 3 3.00000 3.00000 4 0.00000 0.00000 Order type = -1 1 1.00000 3.00000 2 0.00000 1.00000 3 2.00000 1.00000 4 2.00000 2.00000 Order type = -1 1 3.00000 1.00000 2 3.00000 2.00000 3 1.00000 2.00000 4 1.00000 1.00000 Order type = 3 1 2.00000 1.00000 2 2.00000 1.00000 3 1.00000 2.00000 4 0.00000 1.00000 Order type = -1 1 2.00000 2.00000 2 0.00000 2.00000 3 0.00000 2.00000 4 2.00000 1.00000 Order type = -1 1 3.00000 2.00000 2 2.00000 1.00000 3 3.00000 2.00000 4 0.00000 2.00000 Order type = -1 1 0.00000 1.00000 2 1.00000 3.00000 3 0.00000 0.00000 4 0.00000 0.00000 Order type = -1 1 1.00000 0.00000 2 1.00000 1.00000 3 2.00000 2.00000 4 2.00000 1.00000 TEST033 R82VEC_PART_QUICK_A reorders an R82VEC as part of a quick sort. Using initial random number seed = 123456789 Before rearrangement: 1 2.18418 9.56318 2 8.29509 5.61695 3 4.15307 0.661187 4 2.57578 1.09957 5 0.438290 6.33966 6 0.617272 4.49539 7 4.01306 7.54673 8 7.97287 0.183837E-01 9 8.97504 3.50752 10 0.945448 0.136169 11 8.59097 8.40847 12 1.23104 0.751236E-01 Rearranged array Left index = 4 Key index = 5 Right index = 6 Left half: 1 1.23104 0.751236E-01 2 0.945448 0.136169 3 0.617272 4.49539 4 0.438290 6.33966 Key: 1 2.18418 9.56318 Right half: 1 4.01306 7.54673 2 7.97287 0.183837E-01 3 8.97504 3.50752 4 2.57578 1.09957 5 8.59097 8.40847 6 4.15307 0.661187 7 8.29509 5.61695 TEST034 R82VEC_SORT_HEAP_INDEX_A index sorts an R82VEC using heapsort. Using initial random number seed = 123456789 Before rearrangement: 1 2.18418 9.56318 2 8.29509 3.50752 3 0.438290 0.661187 4 1.23104 1.09957 5 0.438290 6.33966 6 0.617272 9.56318 7 8.59097 8.40847 8 7.97287 0.183837E-01 9 8.97504 3.50752 10 0.945448 0.136169 11 8.59097 8.40847 12 1.23104 0.751236E-01 I Index A(Index) 1 3 0.438290 0.661187 2 5 0.438290 6.33966 3 6 0.617272 9.56318 4 10 0.945448 0.136169 5 12 1.23104 0.751236E-01 6 4 1.23104 1.09957 7 1 2.18418 9.56318 8 8 7.97287 0.183837E-01 9 2 8.29509 3.50752 10 7 8.59097 8.40847 11 11 8.59097 8.40847 12 9 8.97504 3.50752 After rearrangement by R82VEC_PERMUTE: 1 0.438290 0.661187 2 0.438290 6.33966 3 0.617272 9.56318 4 0.945448 0.136169 5 1.23104 0.751236E-01 6 1.23104 1.09957 7 2.18418 9.56318 8 7.97287 0.183837E-01 9 8.29509 3.50752 10 8.59097 8.40847 11 8.59097 8.40847 12 8.97504 3.50752 TEST035 R82VEC_SORT_QUICK_A sorts an R82VEC using quick sort. Using initial random number seed = 123456789 Before rearrangement: 1 2.18418 9.56318 2 8.29509 3.50752 3 0.438290 0.661187 4 1.23104 1.09957 5 0.438290 6.33966 6 0.617272 9.56318 7 8.59097 8.40847 8 7.97287 0.183837E-01 9 8.97504 3.50752 10 0.945448 0.136169 11 8.59097 8.40847 12 1.23104 0.751236E-01 Sorted array: 1 0.438290 0.661187 2 0.438290 6.33966 3 0.617272 9.56318 4 0.945448 0.136169 5 1.23104 0.751236E-01 6 1.23104 1.09957 7 2.18418 9.56318 8 7.97287 0.183837E-01 9 8.29509 3.50752 10 8.59097 8.40847 11 8.59097 8.40847 12 8.97504 3.50752 TEST036 R8BLOCK_EXPAND_LINEAR linearly interpolates new data between old values in a 3D block. Original block: K = 1 1 2 3 1 1.00000 1.00000 1.00000 2 2.00000 4.00000 8.00000 3 3.00000 9.00000 27.0000 4 4.00000 16.0000 64.0000 K = 2 1 2 3 1 2.00000 2.00000 2.00000 2 4.00000 8.00000 16.0000 3 6.00000 18.0000 54.0000 4 8.00000 32.0000 128.000 LFAT = 1 MFAT = 2 NFAT = 1 Fattened block: K = 1 1 2 3 4 5 1 1.00000 1.00000 1.00000 1.00000 1.00000 2 1.50000 1.83333 2.16667 2.50000 3.16667 3 2.00000 2.66667 3.33333 4.00000 5.33333 4 2.50000 3.83333 5.16667 6.50000 10.1667 5 3.00000 5.00000 7.00000 9.00000 15.0000 6 3.50000 6.50000 9.50000 12.5000 23.5000 7 4.00000 8.00000 12.0000 16.0000 32.0000 6 7 1 1.00000 1.00000 2 3.83333 4.50000 3 6.66667 8.00000 4 13.8333 17.5000 5 21.0000 27.0000 6 34.5000 45.5000 7 48.0000 64.0000 K = 2 1 2 3 4 5 1 1.50000 1.50000 1.50000 1.50000 1.50000 2 2.25000 2.75000 3.25000 3.75000 4.75000 3 3.00000 4.00000 5.00000 6.00000 8.00000 4 3.75000 5.75000 7.75000 9.75000 15.2500 5 4.50000 7.50000 10.5000 13.5000 22.5000 6 5.25000 9.75000 14.2500 18.7500 35.2500 7 6.00000 12.0000 18.0000 24.0000 48.0000 6 7 1 1.50000 1.50000 2 5.75000 6.75000 3 10.0000 12.0000 4 20.7500 26.2500 5 31.5000 40.5000 6 51.7500 68.2500 7 72.0000 96.0000 K = 3 1 2 3 4 5 1 2.00000 2.00000 2.00000 2.00000 2.00000 2 3.00000 3.66667 4.33333 5.00000 6.33333 3 4.00000 5.33333 6.66667 8.00000 10.6667 4 5.00000 7.66667 10.3333 13.0000 20.3333 5 6.00000 10.0000 14.0000 18.0000 30.0000 6 7.00000 13.0000 19.0000 25.0000 47.0000 7 8.00000 16.0000 24.0000 32.0000 64.0000 6 7 1 2.00000 2.00000 2 7.66667 9.00000 3 13.3333 16.0000 4 27.6667 35.0000 5 42.0000 54.0000 6 69.0000 91.0000 7 96.0000 128.000 TEST0365 R8BLOCK_PRINT prints an R8BLOCK. The 3D array: K = 1 1 2 3 1 1.00000 1.00000 1.00000 2 2.00000 4.00000 8.00000 3 3.00000 9.00000 27.0000 4 4.00000 16.0000 64.0000 K = 2 1 2 3 1 2.00000 2.00000 2.00000 2 4.00000 8.00000 16.0000 3 6.00000 18.0000 54.0000 4 8.00000 32.0000 128.000 TEST037 For an R8COL; R8COL_FIND seeks a column matching given data. R8COL_FIND returns ICOL = 3 TEST038 For an R8COL; R8COL_SORT_HEAP_A does an ascending heap sort R8COL_INSERT inserts new columns. The unsorted matrix: Col 1 2 3 4 Row 1: 2.00000 4.00000 1.00000 3.00000 2: 6.00000 8.00000 5.00000 7.00000 3: 10.0000 12.0000 9.00000 11.0000 The sorted matrix: Col 1 2 3 4 Row 1: 1.00000 2.00000 3.00000 4.00000 2: 5.00000 6.00000 7.00000 8.00000 3: 9.00000 10.0000 11.0000 12.0000 New column: 1: 3.0000000 2: 7.0000000 3: 11.000000 The data was already in column 3 New column: 1: 3.0000000 2: 4.0000000 3: 18.000000 The updated matrix: Col 1 2 3 4 5 Row 1: 1.00000 2.00000 3.00000 3.00000 4.00000 2: 5.00000 6.00000 4.00000 7.00000 8.00000 3: 9.00000 10.0000 18.0000 11.0000 12.0000 TEST0383 For an R8COL; R8COL_PART_QUICK_A partitions the matrix. The matrix: Col 1 2 3 4 5 Row 1: 2.00000 8.00000 6.00000 0.00000 10.0000 2: 4.00000 8.00000 2.00000 2.00000 6.00000 Col 6 7 8 Row 1: 10.0000 0.00000 5.00000 2: 0.00000 6.00000 8.00000 L = 2 R = 4 The partitioned matrix: Col 1 2 3 4 5 Row 1: 0.00000 0.00000 2.00000 10.0000 10.0000 2: 6.00000 2.00000 4.00000 6.00000 0.00000 Col 6 7 8 Row 1: 6.00000 5.00000 8.00000 2: 2.00000 8.00000 8.00000 TEST0385 R8COL_SORT_HEAP_INDEX_A computes an index vector which ascending sorts an R8COL. The unsorted R8COL (transposed): Row 1 2 3 Col 1: 2.00000 6.00000 10.0000 2: 4.00000 8.00000 12.0000 3: 1.00000 5.00000 9.00000 4: 3.00000 7.00000 11.0000 5: 2.00000 6.00000 0.00000 6: 3.00000 4.00000 18.0000 7: 0.00000 0.00000 0.00000 8: 0.00000 6.00000 10.0000 9: 2.00000 6.00000 10.0000 10: 3.00000 7.00000 11.0000 11: 2.00000 0.00000 10.0000 12: 2.00000 6.00000 10.0000 13: 1.00000 5.00000 9.00000 14: 1.00000 5.00000 9.10000 15: 1.00000 5.10000 9.00000 The implicitly sorted R8COL (transposed) 7: 0.0 0.0 0.0 8: 0.0 6.0 10.0 13: 1.0 5.0 9.0 3: 1.0 5.0 9.0 14: 1.0 5.0 9.1 15: 1.0 5.1 9.0 11: 2.0 0.0 10.0 5: 2.0 6.0 0.0 12: 2.0 6.0 10.0 9: 2.0 6.0 10.0 1: 2.0 6.0 10.0 6: 3.0 4.0 18.0 10: 3.0 7.0 11.0 4: 3.0 7.0 11.0 2: 4.0 8.0 12.0 TEST039 For an R8COL; R8COL_SORT_QUICK_A does a quicksort. The unsorted matrix: Col 1 2 3 4 5 Row 1: 2.18418 5.61695 2.57578 6.33966 4.01306 2: 9.56318 4.15307 1.09957 0.617272 7.54673 3: 8.29509 0.661187 0.438290 4.49539 7.97287 Col 6 7 8 9 10 Row 1: 0.183837E-01 0.945448 8.40847 2.60303 3.51629 2: 8.97504 0.136169 1.23104 9.12484 8.22887 3: 3.50752 8.59097 0.751236E-01 1.13664 2.67132 The sorted matrix: Col 1 2 3 4 5 Row 1: 0.183837E-01 0.945448 2.18418 2.57578 2.60303 2: 8.97504 0.136169 9.56318 1.09957 9.12484 3: 3.50752 8.59097 8.29509 0.438290 1.13664 Col 6 7 8 9 10 Row 1: 3.51629 4.01306 5.61695 6.33966 8.40847 2: 8.22887 7.54673 4.15307 0.617272 1.23104 3: 2.67132 7.97287 0.661187 4.49539 0.751236E-01 TEST0393 R8COL_SORTED_TOL_UNIQUE finds tolerably unique columns in a sorted R8COL. The unsorted R8COL (transposed): Row 1 2 3 Col 1: 1.90000 0.00000 10.0000 2: 2.00000 6.00000 10.0000 3: 4.00000 8.00000 12.0000 4: 1.00000 5.00000 9.00000 5: 3.00000 7.00000 11.0000 6: 2.00000 6.00000 0.00000 7: 2.00000 0.00000 10.1000 8: 2.00000 0.100000 10.0000 9: 3.00000 4.00000 18.0000 10: 1.90000 8.00000 10.0000 11: 0.00000 0.00000 0.00000 12: 0.00000 6.00000 10.0000 13: 2.10000 0.00000 10.0000 14: 2.00000 6.00000 10.0000 15: 3.00000 7.00000 11.0000 16: 2.00000 0.00000 10.0000 17: 2.00000 0.00000 10.0000 18: 2.00000 6.00000 10.0000 19: 1.00000 5.00000 9.00000 20: 2.00000 0.00000 10.1000 21: 1.00000 5.00000 9.10000 22: 1.00000 5.10000 9.00000 The sorted R8COL (transposed): Row 1 2 3 Col 1: 0.00000 0.00000 0.00000 2: 0.00000 6.00000 10.0000 3: 1.00000 5.00000 9.00000 4: 1.00000 5.00000 9.00000 5: 1.00000 5.00000 9.10000 6: 1.00000 5.10000 9.00000 7: 1.90000 0.00000 10.0000 8: 1.90000 8.00000 10.0000 9: 2.00000 0.00000 10.0000 10: 2.00000 0.00000 10.0000 11: 2.00000 0.00000 10.1000 12: 2.00000 0.00000 10.1000 13: 2.00000 0.100000 10.0000 14: 2.00000 6.00000 0.00000 15: 2.00000 6.00000 10.0000 16: 2.00000 6.00000 10.0000 17: 2.00000 6.00000 10.0000 18: 2.10000 0.00000 10.0000 19: 3.00000 4.00000 18.0000 20: 3.00000 7.00000 11.0000 21: 3.00000 7.00000 11.0000 22: 4.00000 8.00000 12.0000 Using tolerance = 0.250000 Number of tolerably unique columns is 10 The sorted tolerably unique R8COL (transposed): Row 1 2 3 Col 1: 0.00000 0.00000 0.00000 2: 0.00000 6.00000 10.0000 3: 1.00000 5.00000 9.00000 4: 1.90000 0.00000 10.0000 5: 1.90000 8.00000 10.0000 6: 2.00000 6.00000 0.00000 7: 2.00000 6.00000 10.0000 8: 3.00000 4.00000 18.0000 9: 3.00000 7.00000 11.0000 10: 4.00000 8.00000 12.0000 TEST0395 R8COL_SORTED_TOL_UNIQUE_COUNT counts tolerably unique columns in a sorted R8COL. The unsorted R8COL (transposed): Row 1 2 3 Col 1: 1.90000 0.00000 10.0000 2: 2.00000 6.00000 10.0000 3: 4.00000 8.00000 12.0000 4: 1.00000 5.00000 9.00000 5: 3.00000 7.00000 11.0000 6: 2.00000 6.00000 0.00000 7: 2.00000 0.00000 10.1000 8: 2.00000 0.100000 10.0000 9: 3.00000 4.00000 18.0000 10: 1.90000 8.00000 10.0000 11: 0.00000 0.00000 0.00000 12: 0.00000 6.00000 10.0000 13: 2.10000 0.00000 10.0000 14: 2.00000 6.00000 10.0000 15: 3.00000 7.00000 11.0000 16: 2.00000 0.00000 10.0000 17: 2.00000 0.00000 10.0000 18: 2.00000 6.00000 10.0000 19: 1.00000 5.00000 9.00000 20: 2.00000 0.00000 10.1000 21: 1.00000 5.00000 9.10000 22: 1.00000 5.10000 9.00000 The sorted R8COL (transposed): Row 1 2 3 Col 1: 0.00000 0.00000 0.00000 2: 0.00000 6.00000 10.0000 3: 1.00000 5.00000 9.00000 4: 1.00000 5.00000 9.00000 5: 1.00000 5.00000 9.10000 6: 1.00000 5.10000 9.00000 7: 1.90000 0.00000 10.0000 8: 1.90000 8.00000 10.0000 9: 2.00000 0.00000 10.0000 10: 2.00000 0.00000 10.0000 11: 2.00000 0.00000 10.1000 12: 2.00000 0.00000 10.1000 13: 2.00000 0.100000 10.0000 14: 2.00000 6.00000 0.00000 15: 2.00000 6.00000 10.0000 16: 2.00000 6.00000 10.0000 17: 2.00000 6.00000 10.0000 18: 2.10000 0.00000 10.0000 19: 3.00000 4.00000 18.0000 20: 3.00000 7.00000 11.0000 21: 3.00000 7.00000 11.0000 22: 4.00000 8.00000 12.0000 Using tolerance = 0.250000 Number of tolerably unique columns is 10 TEST0397 R8COL_SORTED_TOL_UNDEX produces index vectors which create a sorted list of the tolerably unique columns of a sorted R8COL, and a map from the original R8COL to the (implicit) R8COL of sorted tolerably unique elements. The unsorted R8COL (transposed): Row 1 2 3 Col 1: 1.90000 0.00000 10.0000 2: 2.00000 6.00000 10.0000 3: 4.00000 8.00000 12.0000 4: 1.00000 5.00000 9.00000 5: 3.00000 7.00000 11.0000 6: 2.00000 6.00000 0.00000 7: 2.00000 0.00000 10.1000 8: 2.00000 0.100000 10.0000 9: 3.00000 4.00000 18.0000 10: 1.90000 8.00000 10.0000 11: 0.00000 0.00000 0.00000 12: 0.00000 6.00000 10.0000 13: 2.10000 0.00000 10.0000 14: 2.00000 6.00000 10.0000 15: 3.00000 7.00000 11.0000 16: 2.00000 0.00000 10.0000 17: 2.00000 0.00000 10.0000 18: 2.00000 6.00000 10.0000 19: 1.00000 5.00000 9.00000 20: 2.00000 0.00000 10.1000 21: 1.00000 5.00000 9.10000 22: 1.00000 5.10000 9.00000 The sorted R8COL (transposed): Row 1 2 3 Col 1: 0.00000 0.00000 0.00000 2: 0.00000 6.00000 10.0000 3: 1.00000 5.00000 9.00000 4: 1.00000 5.00000 9.00000 5: 1.00000 5.00000 9.10000 6: 1.00000 5.10000 9.00000 7: 1.90000 0.00000 10.0000 8: 1.90000 8.00000 10.0000 9: 2.00000 0.00000 10.0000 10: 2.00000 0.00000 10.0000 11: 2.00000 0.00000 10.1000 12: 2.00000 0.00000 10.1000 13: 2.00000 0.100000 10.0000 14: 2.00000 6.00000 0.00000 15: 2.00000 6.00000 10.0000 16: 2.00000 6.00000 10.0000 17: 2.00000 6.00000 10.0000 18: 2.10000 0.00000 10.0000 19: 3.00000 4.00000 18.0000 20: 3.00000 7.00000 11.0000 21: 3.00000 7.00000 11.0000 22: 4.00000 8.00000 12.0000 Tolerance for equality = 0.250000 Number of tolerably unique columns is 10 XDNU points to the representative for each item. UNDX selects the representatives. I XDNU UNDX 1 1 1 2 2 2 3 3 3 4 3 7 5 3 8 6 3 14 7 4 15 8 5 19 9 4 20 10 4 22 11 4 12 4 13 4 14 6 15 7 16 7 17 7 18 4 19 8 20 9 21 9 22 10 The tolerably unique R8COL (transposed): Row 1 2 3 Col 1: 0.00000 0.00000 0.00000 2: 0.00000 6.00000 10.0000 3: 1.00000 5.00000 9.00000 4: 1.90000 0.00000 10.0000 5: 1.90000 8.00000 10.0000 6: 2.00000 6.00000 0.00000 7: 2.00000 6.00000 10.0000 8: 3.00000 4.00000 18.0000 9: 3.00000 7.00000 11.0000 10: 4.00000 8.00000 12.0000 TEST049 For a positive definite symmetric matrix, R8MAT_CHOLESKY_FACTOR computes the lower triangular Cholesky factor. R8MAT_CHORESKY_FACTOR computes the upper triangular Cholesky factor. R8MAT_CHOLESKY_SOLVE solves a linear system using the Cholesky factorization. Matrix to be factored: Col 1 2 3 4 5 Row 1: 2.00000 -1.00000 0.00000 0.00000 0.00000 2: -1.00000 2.00000 -1.00000 0.00000 0.00000 3: 0.00000 -1.00000 2.00000 -1.00000 0.00000 4: 0.00000 0.00000 -1.00000 2.00000 -1.00000 5: 0.00000 0.00000 0.00000 -1.00000 2.00000 Cholesky factor L: Col 1 2 3 4 5 Row 1: 1.41421 0.00000 0.00000 0.00000 0.00000 2: -0.707107 1.22474 0.00000 0.00000 0.00000 3: 0.00000 -0.816497 1.15470 0.00000 0.00000 4: 0.00000 0.00000 -0.866025 1.11803 0.00000 5: 0.00000 0.00000 0.00000 -0.894427 1.09545 Product L * L': Col 1 2 3 4 5 Row 1: 2.00000 -1.00000 0.00000 0.00000 0.00000 2: -1.00000 2.00000 -1.00000 0.00000 0.00000 3: 0.00000 -1.00000 2.00000 -1.00000 0.00000 4: 0.00000 0.00000 -1.00000 2.00000 -1.00000 5: 0.00000 0.00000 0.00000 -1.00000 2.00000 Cholesky factor R: Col 1 2 3 4 5 Row 1: 1.09545 -0.894427 0.00000 0.00000 0.00000 2: 0.00000 1.11803 -0.866025 0.00000 0.00000 3: 0.00000 0.00000 1.15470 -0.816497 0.00000 4: 0.00000 0.00000 0.00000 1.22474 -0.707107 5: 0.00000 0.00000 0.00000 0.00000 1.41421 Product R * R': Col 1 2 3 4 5 Row 1: 2.00000 -1.00000 0.00000 0.00000 0.00000 2: -1.00000 2.00000 -1.00000 0.00000 0.00000 3: 0.00000 -1.00000 2.00000 -1.00000 0.00000 4: 0.00000 0.00000 -1.00000 2.00000 -1.00000 5: 0.00000 0.00000 0.00000 -1.00000 2.00000 Right hand side: 1: 0.0000000 2: 0.0000000 3: 0.0000000 4: 0.0000000 5: 6.0000000 Computed solution: 1: 1.0000000 2: 2.0000000 3: 3.0000000 4: 4.0000000 5: 5.0000000 TEST0555 For a matrix in general storage, R8MAT_FSS factors and solves multiple linear system. Matrix order N = 10 Solutions: Col 1 2 3 Row 1: 1.00000 1.00000 1.00000 2: 1.00000 2.00000 2.00000 3: 1.00000 3.00000 3.00000 4: 1.00000 4.00000 1.00000 5: 1.00000 5.00000 2.00000 6: 1.00000 6.00000 3.00000 7: 1.00000 7.00000 1.00000 8: 1.00000 8.00000 2.00000 9: 1.00000 9.00000 3.00000 10: 1.00000 10.0000 1.00000 TEST1143 R8VEC_BRACKET5 finds a pair of entries in a sorted R8VEC which bracket a value. Sorted array: 1: 1.0000000 2: 2.0000000 3: 3.0000000 4: 4.0000000 5: 5.0000000 6: 5.0000000 7: 7.0000000 8: 8.0000000 9: 9.0000000 10: 10.000000 LEFT RIGHT X(LEFT) XVAL X(RIGHT) -1 -10.0000 (Not bracketed!) 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 12.0000 (Not bracketed!) TEST1145 R8VEC_CHEBYSPACE computes N Chebyshev points in [R1,R2]. N = 5 R1 = -1.00000 R2 = 1.00000 Chebyshev points: 1: -1.0000000 2: -0.70710678 3: 0.0000000 4: 0.70710678 5: 1.0000000 N = 7 R1 = 0.00000 R2 = 10.0000 Chebyshev points: 1: 0.0000000 2: 0.66987298 3: 2.5000000 4: 5.0000000 5: 7.5000000 6: 9.3301270 7: 10.000000 TEST1147 R8VEC_CONVOLUTION computes the convolution of two vectors. The factor X: 1: 1.0000000 2: 2.0000000 3: 3.0000000 4: 4.0000000 The factor Y: 1: -1.0000000 2: 5.0000000 3: 3.0000000 The convolution z = x star y: 1: -1.0000000 2: 3.0000000 3: 10.000000 4: 17.000000 5: 29.000000 6: 12.000000 Correct answer: 1: -1.0000000 2: 3.0000000 3: 10.000000 4: 17.000000 5: 29.000000 6: 12.000000 TEST115 R8VEC_CONVOLUTION_CIRC computes the circular convolution of two vectors. The factor X: 1: 1.0000000 2: 2.0000000 3: 3.0000000 4: 4.0000000 The factor Y: 1: 1.0000000 2: 2.0000000 3: 4.0000000 4: 8.0000000 The circular convolution z = x CC y: 1: 37.000000 2: 44.000000 3: 43.000000 4: 26.000000 Correct answer: 1: 37.000000 2: 44.000000 3: 43.000000 4: 26.000000 TEST1251 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.21841830 2: 0.95631758 3: 0.82950923 4: 0.56169544 5: 0.41530708 6: 0.66118735E-01 7: 0.25757779 8: 0.10995679 9: 0.43828998E-01 10: 0.63396571 11: 0.61727229E-01 12: 0.44953896 13: 0.40130628 14: 0.75467349 15: 0.79728695 16: 0.18383712E-02 17: 0.89750406 18: 0.35075234 19: 0.94544750E-01 20: 0.13616892E-01 I INDX R(INDX(I)) 1 16 0.183837E-02 2 20 0.136169E-01 3 9 0.438290E-01 4 11 0.617272E-01 5 6 0.661187E-01 6 19 0.945448E-01 7 8 0.109957 8 1 0.218418 9 7 0.257578 10 18 0.350752 11 13 0.401306 12 5 0.415307 13 12 0.449539 14 4 0.561695 15 10 0.633966 16 14 0.754673 17 15 0.797287 18 3 0.829509 19 17 0.897504 20 2 0.956318 R_LO 0.840847 R_HI 0.859097 Empty range in R. Array 1: 0.12310392 2: 0.75123641E-02 3: 0.26030300 4: 0.91248371 5: 0.11366405 6: 0.35162866 7: 0.82288732 8: 0.26713227 9: 0.69206650 10: 0.56166247 11: 0.86121579 12: 0.45379378 13: 0.91197703 14: 0.59791688 15: 0.18895469 16: 0.76149206 17: 0.39698848 18: 0.18531412 19: 0.57436586 20: 0.36702667 I INDX R(INDX(I)) 1 2 0.751236E-02 2 5 0.113664 3 1 0.123104 4 18 0.185314 5 15 0.188955 6 3 0.260303 7 8 0.267132 8 6 0.351629 9 20 0.367027 10 17 0.396988 11 12 0.453794 12 10 0.561662 13 19 0.574366 14 14 0.597917 15 9 0.692066 16 16 0.761492 17 7 0.822887 18 11 0.861216 19 13 0.911977 20 4 0.912484 R_LO 0.361529 9 20 0.367027 10 17 0.396988 11 12 0.453794 12 10 0.561662 13 19 0.574366 14 14 0.597917 R_HI 0.617205 Array 1: 0.21293000 2: 0.71447121 3: 0.11770687 4: 0.29932915 5: 0.82500295 6: 0.82466007 7: 0.61861771E-01 8: 0.71078052 9: 0.88283334E-01 10: 0.77799401 11: 0.74530307 12: 0.30867492 13: 0.89937309 14: 0.76353672 15: 0.76173065 16: 0.40696964 17: 0.93874945 18: 0.56208829 19: 0.17820022E-01 20: 0.50110323 I INDX R(INDX(I)) 1 19 0.178200E-01 2 7 0.618618E-01 3 9 0.882833E-01 4 3 0.117707 5 1 0.212930 6 4 0.299329 7 12 0.308675 8 16 0.406970 9 20 0.501103 10 18 0.562088 11 8 0.710781 12 2 0.714471 13 11 0.745303 14 15 0.761731 15 14 0.763537 16 10 0.777994 17 6 0.824660 18 5 0.825003 19 13 0.899373 20 17 0.938749 R_LO 0.419093E-01 2 7 0.618618E-01 3 9 0.882833E-01 4 3 0.117707 5 1 0.212930 6 4 0.299329 7 12 0.308675 R_HI 0.368851 Array 1: 0.27172360 2: 0.85857256 3: 0.29036559E-01 4: 0.17442279E-01 5: 0.15238379 6: 0.11431867 7: 0.35390726 8: 0.11930783 9: 0.20665276 10: 0.21292396 11: 0.61294755 12: 0.80951907 13: 0.58708963 14: 0.21549164 15: 0.76805636 16: 0.72329672 17: 0.44801899 18: 0.85517612 19: 0.94501750 20: 0.90905692 I INDX R(INDX(I)) 1 4 0.174423E-01 2 3 0.290366E-01 3 6 0.114319 4 8 0.119308 5 5 0.152384 6 9 0.206653 7 10 0.212924 8 14 0.215492 9 1 0.271724 10 7 0.353907 11 17 0.448019 12 13 0.587090 13 11 0.612948 14 16 0.723297 15 15 0.768056 16 12 0.809519 17 18 0.855176 18 2 0.858573 19 20 0.909057 20 19 0.945017 R_LO 0.301946E-01 3 6 0.114319 4 8 0.119308 5 5 0.152384 6 9 0.206653 7 10 0.212924 8 14 0.215492 9 1 0.271724 10 7 0.353907 11 17 0.448019 R_HI 0.519726 Array 1: 0.48106695 2: 0.29231288 3: 0.90263984 4: 0.66784151 5: 0.41227804 6: 0.15694849 7: 0.83328163 8: 0.96440416 9: 0.74078991 10: 0.45609886 11: 0.65356142 12: 0.40682695 13: 0.54053860 14: 0.83228094 15: 0.14575576 16: 0.71712832 17: 0.77565076 18: 0.36226162 19: 0.53111085 20: 0.37997675 I INDX R(INDX(I)) 1 15 0.145756 2 6 0.156948 3 2 0.292313 4 18 0.362262 5 20 0.379977 6 12 0.406827 7 5 0.412278 8 10 0.456099 9 1 0.481067 10 19 0.531111 11 13 0.540539 12 11 0.653561 13 4 0.667842 14 16 0.717128 15 9 0.740790 16 17 0.775651 17 14 0.832281 18 7 0.833282 19 3 0.902640 20 8 0.964404 R_LO 0.269285 3 2 0.292313 4 18 0.362262 5 20 0.379977 6 12 0.406827 7 5 0.412278 8 10 0.456099 9 1 0.481067 10 19 0.531111 11 13 0.540539 12 11 0.653561 13 4 0.667842 14 16 0.717128 15 9 0.740790 16 17 0.775651 17 14 0.832281 18 7 0.833282 R_HI 0.877418 TEST1252 R8VEC_INDEXED_HEAP_D creates a descending heap from an indexed R8VEC. The data vector: 1: 101.00000 2: 102.00000 3: 103.00000 4: 104.00000 5: 105.00000 6: 106.00000 7: 107.00000 8: 108.00000 9: 109.00000 10: 110.00000 11: 111.00000 12: 112.00000 13: 113.00000 14: 114.00000 15: 115.00000 16: 116.00000 17: 117.00000 18: 118.00000 19: 119.00000 20: 120.00000 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.000 2 111.000 3 117.000 4 105.000 5 107.000 6 113.000 7 115.000 8 103.000 9 119.000 10 109.000 The data vector (should NOT change): 1: 101.00000 2: 102.00000 3: 103.00000 4: 104.00000 5: 105.00000 6: 106.00000 7: 107.00000 8: 108.00000 9: 109.00000 10: 110.00000 11: 111.00000 12: 112.00000 13: 113.00000 14: 114.00000 15: 115.00000 16: 116.00000 17: 117.00000 18: 118.00000 19: 119.00000 20: 120.00000 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.000 2 111.000 3 117.000 4 105.000 5 109.000 6 113.000 7 115.000 8 103.000 9 101.000 10 107.000 TEST1255 For an indexed R8VEC, R8VEC_INDEXED_HEAP_D_INSERT inserts a value into the heap. R8VEC_INDEXED_HEAP_D_EXTRACT extracts the maximum value; R8VEC_INDEXED_HEAP_D_MAX reports the maximum value. These 3 operations are enough to model a priority queue. The data vector: 1: 1.0000000 2: 2.0000000 3: 3.0000000 4: 4.0000000 5: 5.0000000 6: 6.0000000 7: 7.0000000 8: 8.0000000 9: 9.0000000 10: 10.000000 11: 11.000000 12: 12.000000 13: 13.000000 14: 14.000000 15: 15.000000 16: 16.000000 17: 17.000000 18: 18.000000 19: 19.000000 20: 20.000000 The index vector: 1: 9 2: 2 3: 8 4: 14 5: 5 A(INDX): 1 9.00000 2 2.00000 3 8.00000 4 14.0000 5 5.00000 The index vector after heaping: 1: 14 2: 9 3: 8 4: 2 5: 5 A(INDX) after heaping: 1 14.0000 2 9.00000 3 8.00000 4 2.00000 5 5.00000 Inserting value 7.00000 Current maximum is 14.0000 Inserting value 15.0000 Current maximum is 15.0000 Inserting value 1.00000 Current maximum is 15.0000 Inserting value 19.0000 Current maximum is 19.0000 Inserting value 20.0000 Current maximum is 20.0000 The data vector after insertions: 1: 1.0000000 2: 2.0000000 3: 3.0000000 4: 4.0000000 5: 5.0000000 6: 6.0000000 7: 7.0000000 8: 8.0000000 9: 9.0000000 10: 10.000000 11: 11.000000 12: 12.000000 13: 13.000000 14: 14.000000 15: 15.000000 16: 16.000000 17: 17.000000 18: 18.000000 19: 19.000000 20: 20.000000 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.0000 2 19.0000 3 14.0000 4 9.00000 5 15.0000 6 7.00000 7 8.00000 8 1.00000 9 2.00000 10 5.00000 Now extract the maximum several times. Extracting maximum element A( 20) = 20.0000 Extracting maximum element A( 19) = 19.0000 Extracting maximum element A( 15) = 15.0000 Extracting maximum element A( 14) = 14.0000 Extracting maximum element A( 9) = 9.00000 The data vector after extractions: 1: 1.0000000 2: 2.0000000 3: 3.0000000 4: 4.0000000 5: 5.0000000 6: 6.0000000 7: 7.0000000 8: 8.0000000 9: 9.0000000 10: 10.000000 11: 11.000000 12: 12.000000 13: 13.000000 14: 14.000000 15: 15.000000 16: 16.000000 17: 17.000000 18: 18.000000 19: 19.000000 20: 20.000000 The index vector after extractions: 1: 8 2: 5 3: 7 4: 2 5: 1 A(INDX) after extractions: 1 8.00000 2 5.00000 3 7.00000 4 2.00000 5 1.00000 TEST1256 R8VEC_LEGENDRE computes N Legendre points in [R1,R2]. N = 5 R1 = -1.00000 R2 = 1.00000 Legendre points: 1: -0.90617985 2: -0.53846931 3: 0.0000000 4: 0.53846931 5: 0.90617985 N = 7 R1 = 0.00000 R2 = 10.0000 Legendre points: 1: 0.25446044 2: 1.2923441 3: 2.9707742 4: 5.0000000 5: 7.0292258 6: 8.7076559 7: 9.7455396 TEST1258 For a R8VEC: R8VEC_LINSPACE: evenly spaced points between A and B; R8VEC_MIDSPACE: evenly spaced midpoints between A and B r8vec_linspace ( 5, 10, 20 ) 1: 10.000000 2: 12.500000 3: 15.000000 4: 17.500000 5: 20.000000 r8vec_midspace ( 5, 10, 20 ) 1: 11.000000 2: 13.000000 3: 15.000000 4: 17.000000 5: 19.000000 TEST1465 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.43828998E-01 2: 0.66118735E-01 3: 0.10995679 4: 0.21841830 5: 0.25757779 6: 0.41530708 7: 0.56169544 8: 0.63396571 9: 0.82950923 10: 0.95631758 R_LO 0.617272E-01 2 0.661187E-01 3 0.109957 4 0.218418 5 0.257578 6 0.415307 R_HI 0.449539 Sorted array R: 1: 0.18383712E-02 2: 0.13616892E-01 3: 0.94544750E-01 4: 0.35075234 5: 0.40130628 6: 0.75467349 7: 0.79728695 8: 0.84084745 9: 0.85909686 10: 0.89750406 R_LO 0.751236E-02 2 0.136169E-01 3 0.945448E-01 R_HI 0.123104 Sorted array R: 1: 0.11366405 2: 0.26030300 3: 0.26713227 4: 0.35162866 5: 0.45379378 6: 0.56166247 7: 0.69206650 8: 0.82288732 9: 0.86121579 10: 0.91248371 R_LO 0.597917 7 0.692066 8 0.822887 9 0.861216 R_HI 0.911977 Sorted array R: 1: 0.18531412 2: 0.18895469 3: 0.21293000 4: 0.36152870 5: 0.36702667 6: 0.39698848 7: 0.57436586 8: 0.61720483 9: 0.71447121 10: 0.76149206 R_LO 0.117707 1 0.185314 2 0.188955 3 0.212930 R_HI 0.299329 Sorted array R: 1: 0.61861771E-01 2: 0.88283334E-01 3: 0.30867492 4: 0.71078052 5: 0.74530307 6: 0.76353672 7: 0.77799401 8: 0.82466007 9: 0.82500295 10: 0.89937309 R_LO 0.406970 4 0.710781 5 0.745303 R_HI 0.761731 TEST1504 R8VEC_TRANSPOSE_PRINT prints an R8VEC "tranposed", that is, placing multiple entries on a line. The vector X: 0.218418 0.956318 0.829509 0.561695 0.415307 0.661187E-01 0.257578 0.109957 0.438290E-01 0.633966 0.617272E-01 0.449539 TEST1515 R8VEC_UNIFORM_01 returns a random R8VEC with entries in [0,1]. Input SEED = 123456789 Random vector: 1: 0.21841830 2: 0.95631758 3: 0.82950923 4: 0.56169544 5: 0.41530708 6: 0.66118735E-01 7: 0.25757779 8: 0.10995679 9: 0.43828998E-01 10: 0.63396571 Input SEED = 29242052 Random vector: 1: 0.85909686 2: 0.84084745 3: 0.12310392 4: 0.75123641E-02 5: 0.26030300 6: 0.91248371 7: 0.11366405 8: 0.35162866 9: 0.82288732 10: 0.26713227 Input SEED = 397959036 Random vector: 1: 0.57436586 2: 0.36702667 3: 0.61720483 4: 0.36152870 5: 0.21293000 6: 0.71447121 7: 0.11770687 8: 0.29932915 9: 0.82500295 10: 0.82466007 TEST157 For a pair of R8VEC's: R8VEC2_SUM_MAX_INDEX: index of the sum vector with maximum value. The pair of vectors: 1: 2.18418 0.308636 2: 9.56318 2.24769 3: 8.29509 2.00653 4: 5.61695 3.77337 5: 4.15307 3.98643 6: 0.661187 0.919186E-02 7: 2.57578 4.48752 8: 1.09957 1.75376 9: 0.438290 0.472724 10: 6.33966 0.680845E-01 Index of maximum in A+B: 2 TEST158 R8VECS_PRINT prints a packed R8VEC. Packed R8VEC: 1 11.0000 12.0000 13.0000 2 21.0000 22.0000 3 31.0000 32.0000 33.0000 34.0000 35.0000 36.0000 37.0000 4 41.0000 42.0000 5 51.0000 R8LIB_PRB Normal end of execution. 21 October 2012 10:55:10.077 AM