#16836: __neg__ fails in CartesianProduct of CombinatorialFreeModule
-------------------------+-------------------------------------------------
Reporter: | Owner:
cnassau | Status: needs_review
Type: | Milestone: sage-6.4
defect | Resolution:
Priority: major | Merged in:
Component: | Reviewers:
categories | Work issues:
Keywords: | Commit:
Authors: | 4c7a1c9cd9edfc9ea455918a56917ce873cec2e8
Christian Nassau | Stopgaps:
Report Upstream: N/A |
Branch: |
public/16836 |
Dependencies: |
-------------------------+-------------------------------------------------
Comment (by cnassau):
Replying to [comment:12 vdelecroix]:
> Not sure the old code is appropriate:
> {{{
> sage: NNSemiring = NonNegativeIntegerSemiring()
> sage: C = cartesian_product([ZZ,NNSemiring,RR])
> sage: -C([2,0,.4])
> (-2, 0, -0.400000000000000)
> sage: parent(_)
> The cartesian product of (Integer Ring, Integer Ring,
> Real Field with 53 bits of precision)
> }}}
> The problem is that `NN` is a facade (i.e. its elements are Integer
whose with parent the Integer Ring). But when `NN` is a factor of a
cartesian product it is not considered as being one. I would just remove
completely this `__neg__` for magma elements or adopt my version. That
would avoid many problems!
Getting rid of it sounds like a clean solution. The latest commit now only
implements a `__neg__` if all factors are guaranteed to have inverses.
Cheers,
Christian
--
Ticket URL: <http://trac.sagemath.org/ticket/16836#comment:14>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.