Skip to content

Commit dad0799

Browse files
jiahaostevengj
authored andcommitted
README: links to referenced papers (#25)
Also adds language annotations to code blocks to get syntax highlighting
1 parent 1f1200b commit dad0799

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

README.md

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,13 @@ This is an independent implementation, originally by Steven G. Johnson, of the
2424
algorithm for generation of Sobol sequences in up to 21201 dimensions
2525
described in:
2626

27-
* P. Bratley and B. L. Fox, Algorithm 659, *ACM Trans. Math. Soft.*
28-
**14** (1), pp. 88-100 (1988).
29-
* S. Joe and F. Y. Kuo, *ACM Trans. Math. Soft* **29** (1), 49-57 (2003).
27+
* P. Bratley and B. L. Fox, [Algorithm 659: Implementing Sobol's quasirandom sequence generator][bratley88],
28+
*ACM Trans. Math. Soft.* **14** (1), pp. 88-100 (1988), [doi:10.1145/42288.214372][bratley88].
29+
* S. Joe and F. Y. Kuo, [Remark on algorithm 659: Implementing Sobol's quasirandom sequence generator][joe03],
30+
*ACM Trans. Math. Soft* **29** (1), 49-57 (2003), [doi:10.1145/641876.641879][joe03].
31+
32+
[bratley88]: https://dl.acm.org/citation.cfm?id=214372
33+
[joe03]: https://dl.acm.org/citation.cfm?id=641879
3034

3135
Originally implemented in C in 2007 as
3236
[part of](https://github.com/stevengj/nlopt/blob/master/util/sobolseq.c) the
@@ -58,24 +62,24 @@ In practical applications, however, this point is rarely reached.
5862

5963
To initialize a Sobol sequence `s` in `N` dimensions (`0 < N < 21201`), use
6064
the `SobolSeq` constructor:
61-
```
65+
```julia
6266
using Sobol
6367
s = SobolSeq(N)
6468
```
6569
Then
66-
```
70+
```julia
6771
x = next!(s)
6872
```
6973
returns the next point (a `Vector{Float64}`) in the sequence; each point
7074
lies in the hypercube [0,1]<sup>N</sup>. You can also compute the next
7175
point in-place with
72-
```
76+
```julia
7377
next!(s, x)
7478
```
7579
where `x` should be a `Vector` of length `N` of some floating-point type (e.g. `Float64`, `Float32`, or `BigFloat`).
7680

7781
You can also use a `SobolSeq` as an iterator in Julia:
78-
```
82+
```julia
7983
for x in SobolSeq(N)
8084
...
8185
end
@@ -85,7 +89,7 @@ call `break` (or similar) in the loop body at some point of your choosing.
8589

8690
We also provide a different `SobolSeq` constructor to provide
8791
an `N`-dimensional Sobol sequence rescaled to an arbitrary hypercube:
88-
```
92+
```julia
8993
s = SobolSeq(lb, ub)
9094
```
9195
where `lb` and `ub` are arrays (or other iterables) of length `N`, giving
@@ -95,15 +99,15 @@ the lower and upper bounds of the hypercube, respectively. For example,
9599
If you know in advance the number `n` of points that you plan to
96100
generate, some authors suggest that better uniformity can be attained
97101
by first skipping the initial portion of the LDS (and in particular,
98-
the first power of two smaller than `n`; see Joe and Kuo, 2003). This
102+
the first power of two smaller than `n`; see [Joe and Kuo, 2003][joe03]). This
99103
facility is provided by:
100-
```
104+
```julia
101105
skip(s, n)
102106
```
103107

104108
Skipping exactly `n` elements is also possible:
105109

106-
```
110+
```julia
107111
skip(s, n, exact=true)
108112
```
109113

@@ -113,7 +117,7 @@ Here is a simple example, generating 1024 points in two dimensions and
113117
plotting them with the [PyPlot](https://github.com/stevengj/PyPlot.jl)
114118
package. Note the highly uniform, nonrandom distribution of points in
115119
the [0,1]×[0,1] unit square!
116-
```
120+
```julia
117121
using Sobol
118122
using PyPlot
119123
s = SobolSeq(2)

0 commit comments

Comments
 (0)