/usr/share/doc/ruby-gsl/examples/sort/sort.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 21 22 23 | #!/usr/bin/env ruby
require("gsl")
N = 100000
k = 5
x = GSL::Vector.alloc(N)
GSL::Rng.env_setup()
T = GSL::Rng::DEFAULT
r = GSL::Rng.alloc(T)
for i in 0...N do
x[i] = r.uniform()
end
small = x.sort_smallest(k)
printf("%d smallest values from %d\n", k, N);
for i in 0...k do
printf("%d: %.18f\n", i, small[i]);
end
|