/usr/share/doc/ruby-gsl/examples/random/hdsobol.rb is in ruby-gsl 2.1.0.3+dfsg1-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | #!/usr/bin/env ruby
require("gsl")
include GSL
dim = 2
q = QRng.alloc(QRng::HDSOBOL, dim)
#q = QRng.alloc("sobol", dim)
#q = QRng.alloc("niederreiter_2", dim)
#q = QRng.alloc(QRng::NIEDERREITER_2, dim)
p q.name
v = Vector.alloc(dim)
IO.popen("graph -T X -C --title-font-size 0.04 -L 'Distribution of first 1024 points from the quasi-random HDSobol sequence' -m -1 -S 2", "w") do |io|
for i in 0..1024 do
# v = q.get() # by creating a alloc vector
q.get(v) # by using an existing vector (efficient)
io.printf("%e %e\n", v[0], v[1])
end
end
|