Wed Oct 8 09:15:48 2025 walker_sample_test(): python version: 3.10.12 numpy version: 1.26.4 Test walker_sample() normalize_test(): normalize() normalizes entries 1 through N of a vector of length N+2. Initial X: 0: 0.0654836 1: 0.162889 2: 0.734499 3: 0.908588 4: 0.423584 5: 0.52204 6: 0.252118 Initial L1 norm of X(1:5) = 2.7516 Normalized X: 0: 0.0654836 1: 0.059198 2: 0.266935 3: 0.330203 4: 0.153941 5: 0.189722 6: 0.252118 Final L1 norm of X(1:5) = 1 r8vec_indicator0_test(): r8vec_indicator0() returns an indicator matrix. The indicator0 vector: [0. 1. 2. 3. 4. 5. 6. 7. 8. 9.] random_permutation_test(): random_permutation() randomly permutes entries 1 through N of a vector X[0:N+1]. Initial X: 0: 0 1: 1 2: 2 3: 3 4: 4 5: 5 6: 6 Permuted X: 0: 0 1: 5 2: 2 3: 1 4: 3 5: 4 6: 6 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): 0: 0 1: 0.0625 2: 0.25 3: 0.375 4: 0.25 5: 0.0625 6: 0 I A[I] Y[i] (ignore first and last entries) 0 0 0 1 3 0.3125 2 2 1 3 4 0.5 4 2 0.75 5 3 0.3125 6 6 2 walker_sampler_test(): walker_sampler() creates Walker sample vectors Y and A for efficient sampling of a discrete probability vector. Test the Walker sampler with a Zipf-type probability. Zipf probabilities for N = 10 and parameter P = 2 I X[I] 1 0.645258 2 0.161314 3 0.0716953 4 0.0403286 5 0.0258103 6 0.0179238 7 0.0131685 8 0.0100822 9 0.00796615 10 0.00645258 Randomly permuted X: I X[I] 1 0.161314 2 0.645258 3 0.0179238 4 0.0403286 5 0.0100822 6 0.0131685 7 0.00645258 8 0.0258103 9 0.00796615 10 0.0716953 Built the sampler i Y[i] A[i]: 0 0 0 1 1 1 2 0.669902 1 3 0.179238 2 4 0.403286 2 5 0.100822 2 6 0.131685 2 7 0.0645258 2 8 0.258103 2 9 0.0796615 2 10 0.716953 1 11 2 11 100000 samples: prob #samples: 0.161314 16295 0.645258 64360 0.0179238 1700 0.0403286 4091 0.0100822 1006 0.0131685 1279 0.00645258 594 0.0258103 2613 0.00796615 783 0.0716953 7279 sumvar = 1.51487, (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): 0: 0 1: 0.30103 2: 0.176091 3: 0.124939 4: 0.09691 5: 0.0791812 6: 0.0669468 7: 0.0579919 8: 0.0511525 9: 0.0457575 10: 0 I A[I] Y[i] (ignore first and last entries) 0 0 0 1 1 1 2 1 0.8966 3 2 0.727 4 2 0.8722 5 2 0.7126 6 3 0.6025 7 1 0.5219 8 1 0.4604 9 1 0.4118 10 10 2 The verification sum = 1.38778e-16 It should be very close to zero. 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 N in a Zipf distribution with parameter P. X for N = 5, P = 1.0 0: 0 1: 0.437956 2: 0.218978 3: 0.145985 4: 0.109489 5: 0.0875912 6: 0 X for N = 5, P = 2.0 0: 0 1: 0.683242 2: 0.17081 3: 0.0759157 4: 0.0427026 5: 0.0273297 6: 0 X for N = 10, P = 2.0 0: 0 1: 0.645258 2: 0.161314 3: 0.0716953 4: 0.0403286 5: 0.0258103 6: 0.0179238 7: 0.0131685 8: 0.0100822 9: 0.00796615 10: 0.00645258 11: 0 walker_sample_test(): Normal end of execution. Wed Oct 8 09:15:49 2025