Subsets_of_k broken?

Questions and problems about using polymake go here.
User avatar
hampe
Developer
Posts: 48
Joined: 29 Apr 2011, 10:42

Subsets_of_k broken?

Postby hampe » 13 Jan 2012, 14:37

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...

User avatar
joswig
Main Author
Posts: 282
Joined: 24 Dec 2010, 11:10

Re: Subsets_of_k broken?

Postby joswig » 13 Jan 2012, 14:58

Which compiler, which Perl version, and which operating system are you using?

User avatar
hampe
Developer
Posts: 48
Joined: 29 Apr 2011, 10:42

Re: Subsets_of_k broken?

Postby hampe » 13 Jan 2012, 15:57

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

User avatar
gawrilow
Main Author
Posts: 423
Joined: 25 Dec 2010, 17:40

Re: Subsets_of_k broken?

Postby gawrilow » 13 Jan 2012, 19:12

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.


Return to “Helpdesk”