Hello,

2011/2/2 Frédéric Chapoton <[email protected]>:
> Here is a little more detail, a reduced example, coming from the
> problem above.
>
> sage: kiki
> {B[[1, 0, 1, 1, 0, 1, 0, 1, 0, 0]] + B[[1, 0, 1, 1, 1, 0, 0, 1, 0, 0]]
> + B[[1, 0, 1, 1, 0, 1, 1, 0, 0, 0]] + B[[1, 0, 1, 1, 1, 0, 1, 0, 0,
> 0]] + B[[1, 0, 1, 1, 1, 1, 0, 0, 0, 0]], B[[1, 0, 1, 1, 0, 1, 0, 1, 0,
> 0]] + B[[1, 0, 1, 1, 0, 1, 1, 0, 0, 0]] + B[[1, 0, 1, 1, 1, 0, 0, 1,
> 0, 0]] + B[[1, 0, 1, 1, 1, 0, 1, 0, 0, 0]] + B[[1, 0, 1, 1, 1, 1, 0,
> 0, 0, 0]]}
> sage: kiki.cardinality()
> 2
> sage: kiki[0]==kiki[1]
> True
> sage: kiki[0]-kiki[1]
> 0
>
> so these 2 linear combinations differ only by their order.

My guess is that it is an issue with the hashing of the elements of
"kiki" -- perhaps the hash is based on an ordering?  What types of
objects are they?  Here's a way to reproduce similar behavior:

class Foo(object):
    def __init__(self, value):
        self.value = value
    def __eq__(self, other):
        return isinstance(other, Foo) and self.value == other.value
    def __hash__(self):
        import random
        return random.randint(0,10000)
    def __repr__(self):
        return repr(self.value)


sage: a = Foo(1)
sage: b = Foo(1)
sage: a == b
True
sage: Set([a,b])
{1, 1}
sage: mySet = Set([a,b])
sage: Set([len([v for v in mySet if v==u]) for u in mySet])
{2}

--Mike

-- 
You received this message because you are subscribed to the Google Groups 
"sage-combinat-devel" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-combinat-devel?hl=en.

Reply via email to