Contents:
GSL::Combination.alloc(n, k)
GSL::Combination.calloc
if you want to create a
combination which is initialized to the lexicographically first combination. GSL::Combination.calloc(n, k)
GSL::Combination#init_first
GSL::Combination#init_last
GSL::Combination#get(i)
GSL::Combination#[i]
GSL::Combination#n
n
parameter of the combination self.GSL::Combination#k
k
parameter of the combination self.GSL::Combination#data
GSL::Combination#valid
k
elements should contain numbers from range 0 .. n-1,
each number at most once. The numbers have to be in increasing order.GSL::Combination#valid?
GSL::Combination#next
GSL::SUCCESS
. If no further combinations are
available it returns GSL::FAILURE
and leaves self unmodified.
Starting with the first combination and repeatedly applying this function will
iterate through all possible combinations of a given order.GSL::Combination#prev
GSL::SUCCESS
.
If no previous combination is available it returns GSL::FAILURE
and leaves self unmodified.GSL::Combination#fwrite(filename)
GSL::Combination#fwrite(io)
GSL::Combination#fread(filename)
GSL::Combination#fread(io)
GSL::Combination#fprintf(filename, format = "%u")
GSL::Combination#fprintf(io, format = "%u")
GSL::Combination#fscanf(filename)
GSL::Combination#fscanf(io)
#!/usr/bin/env ruby require("rbgsl") printf("All subsets of {0,1,2,3} by size:\n") ; for i in 0...4 do c = GSL::Combination.calloc(4, i); begin printf("{"); c.fprintf(STDOUT, " %u"); printf(" }\n"); end while c.next == GSL::SUCCESS end