#16836: __neg__ fails in CartesianProduct of CombinatorialFreeModule
-------------------------+-------------------------------------------------
       Reporter:         |        Owner:
  cnassau                |       Status:  needs_work
           Type:         |    Milestone:  sage-6.4
  defect                 |   Resolution:
       Priority:  major  |    Merged in:
      Component:         |    Reviewers:
  categories             |  Work issues:
       Keywords:         |       Commit:
        Authors:         |  27861148fe1ec16070603023e9a9fb643f9d6698
  Christian Nassau       |     Stopgaps:
Report Upstream:  N/A    |
         Branch:         |
  u/cnassau/16836.2      |
   Dependencies:         |
-------------------------+-------------------------------------------------

Comment (by cnassau):

 Replying to [comment:5 vdelecroix]:
 > Could you change
 > {{{
 > sage: F = CombinatorialFreeModule(ZZ, ['a','b'])
 > sage: FF = cartesian_product((F,F))
 > sage: -FF.an_element() # random - only test that negative can be taken
 > }}}
 > to something explicit like
 > {{{
 > sage: F = CombinatorialFreeModule(ZZ, ['a','b'])
 > sage: a,b = F.gens()
 > sage: c = cartesian_product([a,b-2*a]) + cartesian_product([a,a])
 > sage: c
 > 2*B[(0, 'a')] - B[(1, 'a')] + B[(1, 'b')]
 > sage: FF = cartesian_product((F,F))
 > sage: c.parent() == FF
 > True
 > sage: -c
 > -2*B[(0, 'a')] + B[(1, 'a')] - B[(1, 'b')]
 > }}}

 I have followed these suggestions; the doctest is now more explicit.

 > IMHO, the following fails but should work
 > {{{
 > sage: FF([a,b])
 > Traceback (most recent call last)
 > ...
 >
 > TypeError: do not know how to make x (= [B['a'], B['b']])
 > an element of self (=Free module generated by {'a', 'b'} over Integer
 Ring
 > (+) Free module generated by {'a', 'b'} over Integer Ring)
 > }}}

 I agree that this looks like a reasonable expectation, but I'm afraid that
 this might be a bit contentious since it would involve changes in the
 combinatorial heartland. I'd prefer to keep such matters out of this
 ticket which is essentially just a simple bugfix.

 Thanks for taking the time to look into this ticket!

 Cheers,
 Christian

--
Ticket URL: <http://trac.sagemath.org/ticket/16836#comment:7>
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.

Reply via email to