31 December 2010 3:33:38.267 PM HAMMERSLEY_PRB FORTRAN90 version Test the HAMMERSLEY library. TEST01 I4_TO_HAMMERSLEY_SEQUENCE computes N elements of a Hammersley sequence on a single call. All arguments are specified explicitly. In this example, we compute the first 10 elements of a "classical" Hammersley sequence, and then the "last" 10 elements. DIM_NUM = 4 N = 10 STEP = 1 SEED = 0 0 0 0 LEAP = 1 1 1 1 BASE = -1000 2 3 5 STEP Hammersley 1 0.200000E-02 0.500000 0.333333 0.200000 2 0.300000E-02 0.250000 0.666667 0.400000 3 0.400000E-02 0.750000 0.111111 0.600000 4 0.500000E-02 0.125000 0.444444 0.800000 5 0.600000E-02 0.625000 0.777778 0.400000E-01 6 0.700000E-02 0.375000 0.222222 0.240000 7 0.800000E-02 0.875000 0.555556 0.440000 8 0.900000E-02 0.625000E-01 0.888889 0.640000 9 0.100000E-01 0.562500 0.370370E-01 0.840000 10 0.110000E-01 0.312500 0.370370 0.800000E-01 We can jump ahead in the sequence by changing STEP: STEP = 991 STEP Hammersley 991 0.992000 0.983398 0.409236 0.355520 992 0.993000 0.302734E-01 0.742570 0.555520 993 0.994000 0.530273 0.187014 0.755520 994 0.995000 0.280273 0.520348 0.955520 995 0.996000 0.780273 0.853681 0.195520 996 0.997000 0.155273 0.298125 0.395520 997 0.998000 0.655273 0.631459 0.595520 998 0.999000 0.405273 0.964792 0.795520 999 1.00000 0.905273 0.141747E-01 0.995520 1000 0.100000E-02 0.927734E-01 0.347508 0.512000E-02 TEST02 I4_TO_HAMMERSLEY_SEQUENCE computes N elements of a Hammersley sequence on a single call. All arguments are specified explicitly. We are free to choose the values of BASE. Any negative value indicates a sequence of J/(-BASE) in that coordinate. In this example, that is the only kind of base we use. DIM_NUM = 4 N = 12 STEP = 0 SEED = 0 0 0 0 LEAP = 1 1 1 1 BASE = -10 -100 -1000 -10000 STEP Hammersley 0 0.100000 0.100000E-01 0.100000E-02 0.100000E-03 1 0.200000 0.200000E-01 0.200000E-02 0.200000E-03 2 0.300000 0.300000E-01 0.300000E-02 0.300000E-03 3 0.400000 0.400000E-01 0.400000E-02 0.400000E-03 4 0.500000 0.500000E-01 0.500000E-02 0.500000E-03 5 0.600000 0.600000E-01 0.600000E-02 0.600000E-03 6 0.700000 0.700000E-01 0.700000E-02 0.700000E-03 7 0.800000 0.800000E-01 0.800000E-02 0.800000E-03 8 0.900000 0.900000E-01 0.900000E-02 0.900000E-03 9 1.00000 0.100000 0.100000E-01 0.100000E-02 10 0.100000 0.110000 0.110000E-01 0.110000E-02 11 0.200000 0.120000 0.120000E-01 0.120000E-02 TEST03 I4_TO_HAMMERSLEY_SEQUENCE computes N elements of a Hammersley sequence on a single call. All arguments are specified explicitly. The SEED vector allows us to define the zeroth element of the coordinate subsequence. That is, if we ask for the STEP=0 entry of the subsequence, we will get the SEED(I)th entry of the full sequence. In this example, we use a fixed base for simplicity. DIM_NUM = 4 N = 12 STEP = 0 SEED = 10 20 30 40 LEAP = 1 1 1 1 BASE = -100 -100 -100 -100 STEP Hammersley 0 0.110000 0.210000 0.310000 0.410000 1 0.120000 0.220000 0.320000 0.420000 2 0.130000 0.230000 0.330000 0.430000 3 0.140000 0.240000 0.340000 0.440000 4 0.150000 0.250000 0.350000 0.450000 5 0.160000 0.260000 0.360000 0.460000 6 0.170000 0.270000 0.370000 0.470000 7 0.180000 0.280000 0.380000 0.480000 8 0.190000 0.290000 0.390000 0.490000 9 0.200000 0.300000 0.400000 0.500000 10 0.210000 0.310000 0.410000 0.510000 11 0.220000 0.320000 0.420000 0.520000 TEST04 I4_TO_HAMMERSLEY_SEQUENCE computes N elements of a Hammersley sequence on a single call. All arguments are specified explicitly. The LEAP vector allows us to define the distance (in the original sequence) between successive subsequence elements. A LEAP of 1 means that, once we start sampling the sequence, we are taking every element. A LEAP of 2 takes every other sequence element, and so on. In this example, we use a fixed base for simplicity. DIM_NUM = 4 N = 12 STEP = 0 SEED = 0 0 0 0 LEAP = 1 2 4 8 BASE = -100 -100 -100 -100 STEP Hammersley 0 0.100000E-01 0.100000E-01 0.100000E-01 0.100000E-01 1 0.200000E-01 0.300000E-01 0.500000E-01 0.900000E-01 2 0.300000E-01 0.500000E-01 0.900000E-01 0.170000 3 0.400000E-01 0.700000E-01 0.130000 0.250000 4 0.500000E-01 0.900000E-01 0.170000 0.330000 5 0.600000E-01 0.110000 0.210000 0.410000 6 0.700000E-01 0.130000 0.250000 0.490000 7 0.800000E-01 0.150000 0.290000 0.570000 8 0.900000E-01 0.170000 0.330000 0.650000 9 0.100000 0.190000 0.370000 0.730000 10 0.110000 0.210000 0.410000 0.810000 11 0.120000 0.230000 0.450000 0.890000 TEST05 I4_TO_HAMMERSLEY_SEQUENCE computes N elements of a Hammersley sequence on a single call. All arguments are specified explicitly. Any entry of the Hammersley sequence can be computed immediately, without having to compute the previous entries. This is also true of the entries of the leaped Hammersley subsequences we generate. The value of a component of the Hammersley sequence is computed directly from its index. But there should not be much difficulty handling indices that go as high as a million or a billion. In this example, we look at high index entries, attained by large values of STEP, or SEED or LEAP. In this example, we use the default bases. BIG VALUES OF STEP: DIM_NUM = 4 N = 5 STEP = 100 SEED = 0 0 0 0 LEAP = 1 1 1 1 BASE = -104 2 3 5 STEP Hammersley 100 0.971153846 0.148437500 0.411522634 0.032000000 101 0.980769231 0.648437500 0.744855967 0.232000000 102 0.990384615 0.398437500 0.189300412 0.432000000 103 1.000000000 0.898437500 0.522633745 0.632000000 104 0.009615385 0.085937500 0.855967078 0.832000000 DIM_NUM = 4 N = 5 STEP = 10000 SEED = 0 0 0 0 LEAP = 1 1 1 1 BASE = -10004 2 3 5 STEP Hammersley 10000 0.999700120 0.034729004 0.386120002 0.000512000 10001 0.999800080 0.534729004 0.719453335 0.200512000 10002 0.999900040 0.284729004 0.163897780 0.400512000 10003 1.000000000 0.784729004 0.497231113 0.600512000 10004 0.000099960 0.159729004 0.830564446 0.800512000 DIM_NUM = 4 N = 5 STEP = 1000000 SEED = 0 0 0 0 LEAP = 1 1 1 1 BASE = -1000004 2 3 5 STEP Hammersley 1000000 0.999997000 0.008833885 0.361066108 0.000057344 1000001 0.999998000 0.508833885 0.694399441 0.200057344 1000002 0.999999000 0.258833885 0.138843885 0.400057344 1000003 1.000000000 0.758833885 0.472177219 0.600057344 1000004 0.000001000 0.133833885 0.805510552 0.800057344 DIM_NUM = 4 N = 5 STEP = 100000000 SEED = 0 0 0 0 LEAP = 1 1 1 1 BASE = -100000004 2 3 5 STEP Hammersley 100000000 0.999999970 0.002070405 0.437356115 0.000000623 100000001 0.999999980 0.502070405 0.770689448 0.200000623 100000002 0.999999990 0.252070405 0.215133893 0.400000623 100000003 1.000000000 0.752070405 0.548467226 0.600000623 100000004 0.000000010 0.127070405 0.881800560 0.800000623 BIG VALUES OF SEED: DIM_NUM = 4 N = 5 STEP = 0 SEED = 100 10000 1000000 100000000 LEAP = 1 1 1 1 BASE = -104 2 3 5 STEP Hammersley 0 0.971154 0.347290E-01 0.361066 0.622592E-06 1 0.980769 0.534729 0.694399 0.200001 2 0.990385 0.284729 0.138844 0.400001 3 1.00000 0.784729 0.472177 0.600001 4 0.961538E-02 0.159729 0.805511 0.800001 BIG VALUES OF LEAP: DIM_NUM = 4 N = 5 STEP = 0 SEED = 0 0 0 0 LEAP = 100 10000 1000000 100000000 BASE = -500 2 3 5 STEP Hammersley 0 0.200000E-02 0.00000 0.00000 0.00000 1 0.202000 0.347290E-01 0.361066 0.622592E-06 2 0.402000 0.173645E-01 0.685350 0.124518E-05 3 0.602000 0.495300E-01 0.120355 0.184812E-05 4 0.802000 0.868225E-02 0.481219 0.247071E-05 TEST06 HAMMERSLEY_SEQUENCE computes N elements of a Hammersley sequence on a single call. All arguments are specified externally, by calling various setup routines. In this example, we compute the first 10 elements of a "classical" Hammersley sequence, and then the "last" 10 elements. DIM_NUM = 4 N = 10 STEP = 1 SEED = 0 0 0 0 LEAP = 1 1 1 1 BASE = -1000 2 3 5 STEP Hammersley 1 0.200000E-02 0.500000 0.333333 0.200000 2 0.300000E-02 0.250000 0.666667 0.400000 3 0.400000E-02 0.750000 0.111111 0.600000 4 0.500000E-02 0.125000 0.444444 0.800000 5 0.600000E-02 0.625000 0.777778 0.400000E-01 6 0.700000E-02 0.375000 0.222222 0.240000 7 0.800000E-02 0.875000 0.555556 0.440000 8 0.900000E-02 0.625000E-01 0.888889 0.640000 9 0.100000E-01 0.562500 0.370370E-01 0.840000 10 0.110000E-01 0.312500 0.370370 0.800000E-01 We can jump ahead in the sequence by changing STEP: STEP = 991 STEP Hammersley 991 0.992000 0.983398 0.409236 0.355520 992 0.993000 0.302734E-01 0.742570 0.555520 993 0.994000 0.530273 0.187014 0.755520 994 0.995000 0.280273 0.520348 0.955520 995 0.996000 0.780273 0.853681 0.195520 996 0.997000 0.155273 0.298125 0.395520 997 0.998000 0.655273 0.631459 0.595520 998 0.999000 0.405273 0.964792 0.795520 999 1.00000 0.905273 0.141747E-01 0.995520 1000 0.100000E-02 0.927734E-01 0.347508 0.512000E-02 TEST07 HALHAM_WRITE writes a Halton or Hammersley dataset to a file DIM_NUM = 4 N = 10 STEP = 0 SEED = 1 0 0 0 LEAP = 1 1 1 1 BASE = -10 2 3 5 STEP Hammersley 0 0.200000 0.00000 0.00000 0.00000 1 0.300000 0.500000 0.333333 0.200000 2 0.400000 0.250000 0.666667 0.400000 3 0.500000 0.750000 0.111111 0.600000 4 0.600000 0.125000 0.444444 0.800000 5 0.700000 0.625000 0.777778 0.400000E-01 6 0.800000 0.375000 0.222222 0.240000 7 0.900000 0.875000 0.555556 0.440000 8 1.00000 0.625000E-01 0.888889 0.640000 9 0.100000 0.562500 0.370370E-01 0.840000 The data was written to "hammersley_04_00010.txt". TEST08 I4_TO_HAMMERSLEY_SEQUENCE computes N elements of a Hammersley sequence on a single call. All arguments are specified explicitly. In this example, we demonstrate that any coordinate of the generalized Hammersley sequence that is generated as a fractional sequence J/|BASE(I)| will "wrap around". DIM_NUM = 4 N = 20 STEP = 1 SEED = 0 0 0 0 LEAP = 1 1 1 1 BASE = -10 2 3 5 STEP Hammersley 1 0.200000 0.500000 0.333333 0.200000 2 0.300000 0.250000 0.666667 0.400000 3 0.400000 0.750000 0.111111 0.600000 4 0.500000 0.125000 0.444444 0.800000 5 0.600000 0.625000 0.777778 0.400000E-01 6 0.700000 0.375000 0.222222 0.240000 7 0.800000 0.875000 0.555556 0.440000 8 0.900000 0.625000E-01 0.888889 0.640000 9 1.00000 0.562500 0.370370E-01 0.840000 10 0.100000 0.312500 0.370370 0.800000E-01 11 0.200000 0.812500 0.703704 0.280000 12 0.300000 0.187500 0.148148 0.480000 13 0.400000 0.687500 0.481481 0.680000 14 0.500000 0.437500 0.814815 0.880000 15 0.600000 0.937500 0.259259 0.120000 16 0.700000 0.312500E-01 0.592593 0.320000 17 0.800000 0.531250 0.925926 0.520000 18 0.900000 0.281250 0.740741E-01 0.720000 19 1.00000 0.781250 0.407407 0.920000 20 0.100000 0.156250 0.740741 0.160000 HAMMERSLEY_PRB Normal end of execution. 31 December 2010 3:33:38.269 PM