I'm not getting complete permutations. if I try to get all of the permutations of the numbers from 1 to 14, using a simple script, it terminates early. I've tried this on fc5 native and fc6 as a vmware guest and get the same result. it appears to stop cleanly, just early.
Have I built the code wrongly or something? I took that standard _0.912 tarball. I cannot even work out how to debug this. The reproduceability on different platforms makes me think it's an overflow problem, but I don't see anything obvious in that loop value. I see no symptoms of memory leakage.
this program:
---cut here---
import probstat
values = [i+1 for i in range (14)]
gen = probstat.Permutation (values)
loop = 1
for i in gen:
if loop %1000000 == 0: print loop
loop += 1
-- cut here --
stops after it has printed 1278000000. loop is 1278945281, i is:
[1, 4, 11, 2, 8, 7, 13, 14, 12, 5, 9, 6, 10, 3]
loop should be around 87 billion, not 1.27 billion
Logged In: YES
user_id=574600
Originator: YES
diving into gdb, the issue seems to arise between probstat and the underlying gsl code. The function permute_smart_item (which is in the version of probstat, but not the current one) returns an index out of range error (I get a break at line 107 of python/permutation.c), which the python interface does not seem to propagate through. I don't spk C very well, but the code looks correct, so I cannot see why it's not propagating. Neither do I understand why the gsl code runs out of indices. But I thought it useful to put out what I found.
No doubt I'll find that I'm just doing something really stupid.