Ticket #4419 (closed defect: fixed)

Opened 5 years ago

Last modified 4 years ago

[with patch, positive review] conversion of Permutations to GAP not implemented

Reported by: mhansen Owned by: mhansen
Priority: minor Milestone: sage-3.2.1
Component: combinatorics Keywords:
Cc: sage-combinat Work issues:
Report Upstream: Reviewers:
Authors: Merged in:
Dependencies: Stopgaps:

Description

The following fails

sage: p = gap(Permutation('(1,2,3)'))
sage: q = gap(Permutation([()]))
sage: gap.Group([p, q])

because

sage: gap(Permutation((1,2,3)))
[ 2 3 1 ]

Attachments

trac_4419.patch Download (1.1 KB) - added by mhansen 5 years ago.

Change History

Changed 5 years ago by mhansen

comment:1 Changed 5 years ago by wdj

I don't see how this fixes the original problem. I get this:

sage: p = gap(Permutation('(1,2,3)'))                                                                                              
sage: q = gap(Permutation('()'))                                                                                       
---------------------------------------------------------------------------                                            
ValueError                                Traceback (most recent call last)
<snip>


ValueError: invalid literal for int() with base 10: ''

and this:

sage: q = gap(Permutation(()))
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<snip>

TypeError: not enough arguments for format string

It seems to me you want Permutation to work like PermutationGroupElement? does here:

sage: p = gap(PermutationGroupElement('(1,2,3)'))
sage: q = gap(PermutationGroupElement('()'))
sage: gap.Group([p, q])
Group( [ (1,2,3), () ] )
sage: gap.Group([p]) == gap.Group([p, q])
True

Is that correct?

comment:2 Changed 5 years ago by mhansen

  • Status changed from new to assigned

Actually, the original issue was this:

sage: p = gap(Permutation('(1,2,3)'))
sage: q = gap(Permutation([()]))
sage: gap.Group([p, q])
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)

Those things that you encountered are "bugs" in the constructor of Permutation. I always construct Permutations from their list notation.

comment:3 Changed 5 years ago by saliola

  • Summary changed from [with patch, needs review] conversion of Permutations to GAP not implemented to [with patch, positive review] conversion of Permutations to GAP not implemented

This patch should get a positive review because it fixes the conversion to gap problem:

sage: p = Permutation('(1,2,3)')
sage: q = Permutation([()])
sage: gap.Group([p,q])
Group( [ (1,2,3), () ] )

The other issues noticed by wdj are problems with the Permutations constructor function, and I will open a new ticket for them.

comment:4 Changed 5 years ago by saliola

The new ticket is here: #4569

comment:5 Changed 5 years ago by mabshoff

  • Status changed from assigned to closed
  • Resolution set to fixed

Merged in Sage 3.2.1.alpha0

comment:6 Changed 4 years ago by nthiery

  • Cc sage-combinat added
Note: See TracTickets for help on using tickets.