Sha256: 0d748c07b6d1fcdf90fc045ead04f6658536799be864af626b41b8038a2bfc43

Contents?: true

Size: 382 Bytes

Versions: 6

Compression:

Stored size: 382 Bytes

Contents

#!/usr/bin/env ruby
require("gsl")

N = 10
pp = GSL::Permutation.alloc(N)
GSL::Rng::env_setup()
r = GSL::Rng.alloc("gsl_rng_default")

puts("initial permutation:")
pp.init
pp.fprintf(STDOUT, " %u")
printf("\n")

puts(" random permutation:");
r.shuffle(pp)
pp.fprintf(STDOUT, " %u")
printf("\n");

puts("inverse permutation:");
q = pp.inverse
q.fprintf(STDOUT, " %u")
printf ("\n");

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
gsl-2.1.0.3 examples/permutation/ex1.rb
gsl-2.1.0.2 examples/permutation/ex1.rb
gsl-2.1.0.1 examples/permutation/ex1.rb
gsl-2.1.0 examples/permutation/ex1.rb
gsl-1.16.0.6 examples/permutation/ex1.rb
rb-gsl-1.16.0.5 examples/permutation/ex1.rb