Opened 10 years ago

Closed 10 years ago

#10911 closed defect (fixed)

inverse() method for permutation group elements

Reported by: rbeezer Owned by: joyner
Priority: minor Milestone: sage-4.7
Component: group theory Keywords:
Cc: kcrisman Merged in: sage-4.7.alpha3
Authors: Rob Beezer Reviewers: Robert Bradshaw
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by rbeezer)

Patch aims to resolve the following inconsistency, by providing a .inverse() method for permutation group elements.

sage: S = SymmetricGroup(4)
sage: s = S("(1,2,3)")
sage: type(s)
<type
'sage.groups.perm_gps.permgroup_element.PermutationGroupElement'>
sage: s^-1
(1,3,2)
sage: s.inverse()
(1,3,2)

sage: A = AlternatingGroup(4)
sage: a = A("(1,2,3)")
sage: type(a)
<type
'sage.groups.perm_gps.permgroup_element.PermutationGroupElement'>
sage: a^-1
(1,3,2)
sage: a.inverse()
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<snip>
AttributeError:
'sage.groups.perm_gps.permgroup_element.PermutationGroupElement' object has no attribute 'inverse' 

Some discussion at http://groups.google.com/group/sage-devel/browse_thread/thread/683315261a6c6def

Apply trac_10911-inverses-permutation-group-v2.patch

Attachments (2)

trac_10911-inverses-permutation-group.patch (1.5 KB) - added by rbeezer 10 years ago.
trac_10911-inverses-permutation-group-v2.patch (1.5 KB) - added by rbeezer 10 years ago.

Download all attachments as: .zip

Change History (9)

Changed 10 years ago by rbeezer

comment:1 Changed 10 years ago by rbeezer

  • Authors set to Rob Beezer
  • Status changed from new to needs_review

comment:2 Changed 10 years ago by kcrisman

  • Cc kcrisman added

comment:3 follow-up: Changed 10 years ago by robertwb

  • Status changed from needs_review to needs_work

Calling self.__invert__() is slow, use ~self instead. Other than that, looks good.

comment:4 in reply to: ↑ 3 Changed 10 years ago by rbeezer

  • Description modified (diff)
  • Status changed from needs_work to needs_review

Replying to robertwb:

Calling self.__invert__() is slow, use ~self instead.

Thanks, Robert. v2 patch has the suggested change.

Rob

comment:5 Changed 10 years ago by robertwb

  • Status changed from needs_review to positive_review

Looks good to me.

comment:6 Changed 10 years ago by jdemeyer

  • Reviewers set to Robert Bradshaw

comment:7 Changed 10 years ago by jdemeyer

  • Merged in set to sage-4.7.alpha3
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.