Are you fixing it yourself ? It would be difficult for me to it as I
leave tomorrow morning !

2011/6/7 Nicolas M. Thiery <nicolas.thi...@u-psud.fr>:
>        Hi Vivianne, Christian, and all free module fans,
>
> On Tue, Jun 07, 2011 at 11:44:07AM +0200, Viviane Pons wrote:
>> I just came across a big "zero" problem on my patch and I was
>> wondering where it was coming from.
>> ...
>> Obviously, there is something wrong, and it's breaking my program ...
>
> I agree that this is a bug. Here is a reduction of the problem, using
> that Z3.zero() != 0.0::
>
>    sage: Z3 = IntegerModRing(3)
>    sage: D = { Z3.zero(): 0.0 }
>    sage: sage.combinat.dict_addition.dict_addition([D])
>    {0: 0.000000000000000}
>    sage: D = { 0: 0.0 }
>    sage: sage.combinat.dict_addition.dict_addition([D])
>    {}
>
> Whether an item is deleted should only depend on the value, not the
> key. A quick fix is to use ``a = D.itervalues().next()`` instead of
> ``a = iter(D).next()``; this must have been the original intention.
>
> Now, what about replacing:
>
>    for_removal = [key for key in D if D[key] == zero]
>    for key in for_removal:
>        del D[key]
>
> by:
>
>    D = dict( (key, value) for (key, value) in D if not value.is_zero() )
>
> To everyone: do you agree that this is the semantic we want?
>
> Christian: please benchmark!
>
> Cheers,
>                                Nicolas
> --
> Nicolas M. Thiéry "Isil" <nthi...@users.sf.net>
> http://Nicolas.Thiery.name/
>
> --
> You received this message because you are subscribed to the Google Groups 
> "sage-combinat-devel" group.
> To post to this group, send email to sage-combinat-devel@googlegroups.com.
> To unsubscribe from this group, send email to 
> sage-combinat-devel+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/sage-combinat-devel?hl=en.
>
>

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

Reply via email to