Opened 8 years ago

Last modified 6 years ago

#17692 needs_work enhancement

The default __invert__ method of an element should avoid coercion — at Version 3

Reported by: Stefan Owned by:
Priority: trivial Milestone: sage-6.5
Component: basic arithmetic Keywords:
Cc: vdelecroix Merged in:
Authors: Vincent Delecroix Reviewers:
Report Upstream: N/A Work issues:
Branch: u/vdelecroix/17692 (Commits, GitHub, GitLab) Commit: e3aa70371159bf5faf231260e8d6e766665f5c04
Dependencies: #17694 Stopgaps:

Status badges

Description (last modified by vdelecroix)

Currently, the __invert__ methods in element.pyx do

    return 1/self

This results in a coercion of the integer 1 into the appropriate parent structure. Better would be to do

    return self.parent().one() / self

Additionally, the __invert__ method in MultiplicativeGroupElement relies on a method is_one() that is not provided by the class itself.

Change History (3)

comment:1 Changed 8 years ago by vdelecroix

  • Cc vdelecroix added
  • Description modified (diff)

cc'ing me (+ formatting in the description)

comment:2 Changed 8 years ago by vdelecroix

  • Authors set to Vincent Delecroix
  • Branch set to u/vdelecroix/17692
  • Commit set to e3aa70371159bf5faf231260e8d6e766665f5c04
  • Dependencies set to #17694
  • Status changed from new to needs_review

New commits:

d3e1ad5trac #17694: upgrade the category of polyhedra
c0a0bbbtrac #17694: one_element->one and zero_element->zero
e3aa703trac #17692: rewrite __invert__ (and delete some)

comment:3 Changed 8 years ago by vdelecroix

  • Description modified (diff)
Note: See TracTickets for help on using tickets.