Home License -- for personal use only. Not for government, academic, research, commercial, or other organizational use. 13-May-2025 19:21:16 walker_sample_test(): MATLAB/Octave version 9.11.0.2358333 (R2021b) Update 7. Test walker_sample() normalize_test(): normalize() normalizes entries 1 through N of a vector of length N+2. Initial X: 1: 0.814724 2: 0.905792 3: 0.126987 4: 0.913376 5: 0.632359 6: 0.0975404 7: 0.278498 Initial L1 norm of X(1:N) = 2.67605 Normalized X: 1: 0.814724 2: 0.33848 3: 0.047453 4: 0.341314 5: 0.236303 6: 0.0364493 7: 0.278498 Final L1 norm of X(1:N) = 1 NORMALIZE_TEST Normal end of execution. r8vec_print_test(): r8vec_print() prints an R8VEC. The R8VEC: 1: 123.456 2: 5e-06 3: -1e+06 4: 3.14159 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 2: 0.0625 3: 0.25 4: 0.375 5: 0.25 6: 0.0625 7: 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_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 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.00796615 2 0.0403286 3 0.00645258 4 0.0131685 5 0.645258 6 0.0100822 7 0.0179238 8 0.161314 9 0.0716953 10 0.0258103 Built the sampler i Y(i) A(i): 1 0.0796615 5 2 0.403286 5 3 0.0645258 5 4 0.131685 5 5 1 5 6 0.100822 5 7 0.179238 8 8 0.509337 5 9 0.716953 8 10 0.258103 5 100000 samples: prob #samples: 0.00796615 806 0.0403286 4062 0.00645258 653 0.0131685 1306 0.645258 64485 0.0100822 984 0.0179238 1837 0.161314 16261 0.0716953 7040 0.0258103 2566 sumvar = 0.568971 (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 2: 0.30103 3: 0.176091 4: 0.124939 5: 0.09691 6: 0.0791812 7: 0.0669468 8: 0.0579919 9: 0.0511525 10: 0.0457575 11: 0 I A(I) Y(i) (ignore first and last entries) 0 0 0 1 1 1 2 1 0.896612 3 2 0.72697 4 2 0.87219 5 2 0.712631 6 3 0.602521 7 1 0.521928 8 1 0.460373 9 1 0.411817 10 10 2 The verification sum = 1.38778e-16 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 2: 0.437956 3: 0.218978 4: 0.145985 5: 0.109489 6: 0.0875912 7: 0 X for N = 5, P = 2.0 1: 0 2: 0.683242 3: 0.17081 4: 0.0759157 5: 0.0427026 6: 0.0273297 7: 0 X for N = 10, P = 2.0 1: 0 2: 0.645258 3: 0.161314 4: 0.0716953 5: 0.0403286 6: 0.0258103 7: 0.0179238 8: 0.0131685 9: 0.0100822 10: 0.00796615 11: 0.00645258 12: 0 ZIPF_PROBABILITY_TEST Normal end of execution. walker_sample_test(): Normal end of execution. 13-May-2025 19:21:16