9 May 2025 9:47:37.114 PM walker_sample_test(): FORTRAN90 version. Test walker_sample(). I4_CHOOSE_TEST I4_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 I4_UNIFORM_AB_TEST I4_UNIFORM_AB computes pseudorandom values in an interval [A,B]. The lower endpoint A = -100 The upper endpoint B = 200 1 149 2 -100 3 -68 4 -45 5 148 6 157 7 15 8 193 9 109 10 14 11 151 12 96 13 13 14 -10 15 -37 16 61 17 102 18 191 19 -73 20 188 normalize_test(): normalize() normalizes entries 1 through N of a vector of length N+2. Initial X: 1: 0.64907676-309 2: 0.61912143 3: 0.43561811 4: 0.68918563 5: 0.76627943 6: 0.17237070 7: 0.67914189 Initial L1 norm of X(1:N) = 2.68258 Normalized X: 1: 0.64907676-309 2: 0.23079368 3: 0.16238803 4: 0.25691194 5: 0.28565067 6: 0.64255681E-01 7: 0.67914189 Final L1 norm of X(1:N) = 1.00000 NORMALIZE_TEST Normal end of execution. r8vec_print_test(): R8VEC_PRINT prints an R8VEC. The R8VEC: 1: 123.45600 2: 0.50000000E-05 3: -1000000.0 4: 3.1415927 RANDOM_PERMUTATION_TEST RANDOM_PERMUTATION randomly permutes entries 1 through N of a vector X[0:N+1]. Initial X: 1: 0.0000000 2: 1.0000000 3: 2.0000000 4: 3.0000000 5: 4.0000000 6: 5.0000000 7: 6.0000000 Permuted X: 1: 0.0000000 2: 3.0000000 3: 5.0000000 4: 4.0000000 5: 2.0000000 6: 1.0000000 7: 6.0000000 RANDOM_PERMUTATION_TEST Normal end of execution. WALKER_BUILD_TEST WALKER_BUILD builds the Walker sampler data vectors Y and A, given a probability vector X. Binomial PDF (ignore first and last entries): 1: 0.11385280-312 2: 0.62500000E-01 3: 0.25000000 4: 0.37500000 5: 0.25000000 6: 0.62500000E-01 7: 6.0000000 I A[I] Y[i] (ignore first and last entries) 0 0 0.00000 1 3 0.312500 2 2 1.00000 3 4 0.500000 4 2 0.750000 5 3 0.312500 6 6 2.00000 WALKER_BUILD_TEST Normal end of execution. WALKER_SAMPLER_TEST: WALKER_SAMPLER creates Walker sample vectors Y and A for efficiently sampling a discrete probability vector. Test the Walker sampler with a Zipf-type probability. Zipf probabilities for N = 10 and parameter P = 2.00000 I X(I) 1 0.645258 2 0.161314 3 0.716953E-01 4 0.403286E-01 5 0.258103E-01 6 0.179238E-01 7 0.131685E-01 8 0.100822E-01 9 0.796615E-02 10 0.645258E-02 Randomly permuted X: I X(I) 1 0.131685E-01 2 0.161314 3 0.796615E-02 4 0.403286E-01 5 0.179238E-01 6 0.645258E-02 7 0.645258 8 0.716953E-01 9 0.258103E-01 10 0.100822E-01 Built the sampler i Y(i) A(i): 1 0.131685 7 2 1.00000 2 3 0.796615E-01 7 4 0.403286 7 5 0.179238 7 6 0.645258E-01 7 7 0.386855 2 8 0.716953 7 9 0.258103 7 10 0.100822 7 100000 samples: prob #samples: 0.131685E-01 1315 0.161314 16212 0.796615E-02 781 0.403286E-01 4107 0.179238E-01 1797 0.645258E-02 689 0.645258 64483 0.716953E-01 7131 0.258103E-01 2515 0.100822E-01 970 sumvar = 0.842431 (should be about 1) WALKER_VERIFY_TEST WALKER_VERIFY verifies the Walker sampler data vectors Y and A,for a given probability vector X. Benford PDF (ignore first and last entries): 1: 0.0000000 2: 0.30103000 3: 0.17609126 4: 0.12493874 5: 0.96910013E-01 6: 0.79181246E-01 7: 0.66946790E-01 8: 0.57991947E-01 9: 0.51152522E-01 10: 0.45757491E-01 11: 0.0000000 I A(I) Y(i) (ignore first and last entries) 0 0 0.00000 1 1 1.00000 2 1 0.896612 3 2 0.726970 4 2 0.872190 5 2 0.712631 6 3 0.602521 7 1 0.521928 8 1 0.460373 9 1 0.411817 10 10 2.00000 The verification sum = 0.138778E-15 It should be very close to zero. WALKER_VERIFY_TEST Normal end of execution. ZIPF_PROBABILITY_TEST ZIPF_PROBABILITY sets up a probablity vector X of N+2 elements containing in X[1:N] the probabilities of outcomes 1 through Nin a Zipf distribution with parameter P. X for N = 5, P = 1.0 1: 0.0000000 2: 0.43795620 3: 0.21897810 4: 0.14598540 5: 0.10948905 6: 0.87591241E-01 7: 0.0000000 X for N = 5, P = 2.0 1: 0.0000000 2: 0.68324160 3: 0.17081040 4: 0.75915734E-01 5: 0.42702600E-01 6: 0.27329664E-01 7: 0.0000000 X for N = 10, P = 2.0 1: 0.0000000 2: 0.64525798 3: 0.16131450 4: 0.71695331E-01 5: 0.40328624E-01 6: 0.25810319E-01 7: 0.17923833E-01 8: 0.13168530E-01 9: 0.10082156E-01 10: 0.79661479E-02 11: 0.64525798E-02 12: 0.0000000 ZIPF_PROBABILITY_TEST Normal end of execution. walker_sample_test(): Normal end of execution. 9 May 2025 9:47:37.118 PM