%% SOBOL_TEST06 tests I4_SOBOL. % % Discussion: % % In this test, we get a few samples at high dimensions. % % Licensing: % % This code is distributed under the GNU LGPL license. % % Modified: % % 05 July 2006 % % Author: % % John Burkardt % clear test_num = 3; dim_num_test = [ 100, 500, 1000 ]; fprintf ( 1, '\n' ); fprintf ( 1, 'SOBOL_TEST06\n' ); fprintf ( 1, ' I4_SOBOL computes the next element of a Sobol sequence.\n' ); fprintf ( 1, '\n' ); fprintf ( 1, ' In this test, we get a few samples at high dimension.\n' ); fprintf ( 1, ' We only print the first and last 2 entries of each\n' ); fprintf ( 1, ' sample.\n' ); fprintf ( 1, '\n' ); for test = 1 : test_num dim_num = dim_num_test(test); fprintf ( 1, '\n' ); fprintf ( 1, ' Using dimension DIM_NUM = %d\n', dim_num ); seed = 0; fprintf ( 1, '\n' ); fprintf ( 1, ' Seed Seed I4_SOBOL\n' ); fprintf ( 1, ' In Out (First 2, Last 2)\n' ); fprintf ( 1, '\n' ); for i = 0 : 10 [ r, seed_out ] = i4_sobol ( dim_num, seed ); fprintf ( 1, '%6d %6d ', seed, seed_out ); for j = 1 : 2 fprintf ( 1, '%10f ', r(j) ); end for j = dim_num-1 : dim_num fprintf ( 1, '%10f ', r(j) ); end fprintf ( 1, '\n' ); seed = seed_out; end seed = 100000; for i = 11 : 15 [ r, seed_out ] = i4_sobol ( dim_num, seed ); fprintf ( 1, '%6d %6d ', seed, seed_out ); for j = 1 : 2 fprintf ( 1, '%10f ', r(j) ); end for j = dim_num-1 : dim_num fprintf ( 1, '%10f ', r(j) ); end fprintf ( 1, '\n' ); seed = seed_out; end end