Page 1 of 1

Subsets_of_k broken?

Posted: 13 Jan 2012, 14:37
by hampe
Heyho!

After updating to 2.11 I discovered that some of my functions suddenly started producing segfaults. The reason for this seems to be that pm::Subsets_of_k (in PowerSet.h) does not behave as it used to behave. In fact, it seems to be broken: I created a small test function containing the following piece of code:

Code: Select all

Set<int> s = sequence(0,5); Array<Set<int> > ps (pm::Subsets_of_k<Set<int> >(s,2)); pm::cout << ps << endl;
Now if I call this function several times, I get a different output each time. The array contains part of the correct answer (which should be all subsets of cardinality 2 of the set {0,..,4}, but it also contains sets of the form {0 0} or {0 random large number}.

This is probably a bug ;-) - except if the interface itself has changed, which would be very bad for backwards compatibility...

Re: Subsets_of_k broken?

Posted: 13 Jan 2012, 14:58
by joswig
Which compiler, which Perl version, and which operating system are you using?

Re: Subsets_of_k broken?

Posted: 13 Jan 2012, 15:57
by hampe
Ah, sorry, forgot to add that:

I'm on Ubuntu maverick with perl v5.10.1 and compiled polymake with gcc-4.4/g++-4.4

Re: Subsets_of_k broken?

Posted: 13 Jan 2012, 19:12
by gawrilow
There seems indeed to be a bug in it. I'll look into it. But if you replace the explicit constructor with the function call all_subsets_of_k(s,2) your code will work fine.