#18158: `__getitem__` for libGap_Element
-------------------------------------+-------------------------------------
       Reporter:  vdelecroix         |        Owner:
           Type:  defect             |       Status:  needs_review
       Priority:  major              |    Milestone:  sage-7.2
      Component:  interfaces         |   Resolution:
       Keywords:                     |    Merged in:
        Authors:  Vincent Delecroix  |    Reviewers:
Report Upstream:  N/A                |  Work issues:
         Branch:                     |       Commit:
  u/vdelecroix/18158                 |  c27056e7be55c28870ff781ff431b0fe58d927d5
   Dependencies:                     |     Stopgaps:
-------------------------------------+-------------------------------------
Changes (by vdelecroix):

 * milestone:  sage-6.6 => sage-7.2


Old description:

> Some objects in GAP are not list but does support indexation
> {{{
> gap> S := SymmetricGroup(5);;
> gap> irr := Irr(S)[3];;
> gap> irr[1];
> 5
> }}}
> We provide in this ticket a generic `__getitem__` on `GapElement`.

New description:

 Some objects in GAP are not PList but does support indexation
 {{{
 gap> S := SymmetricGroup(5);;
 gap> irr := Irr(S)[3];;
 gap> irr[1];
 5
 }}}
 or
 {{{
 gap> gens := GeneratorsOfGroup(SL(2,GF(5)));;
 gap> m := gens[1];;
 gap> m[1];
 [ Z(5), 0*Z(5) ]
 gap> m[2];
 [ 0*Z(5), Z(5)^3 ]
 }}}

 We change the way gap lists are detected and hence more objects are now
 wrapped as `GapElement_List`.

--

Comment:

 Replying to [comment:8 vbraun]:
 > Getitem without length is IMHO useless. The GAP function `IsList` just
 calls `IS_LIST` internally, so we should perhaps use that instead of
 `IS_PLIST` to decide when to wrap it in a `GapElement_List`

 Indeed it is much more robust and general. That way libgap vectors and
 matrices are also considered as lists
 {{{
 sage: M = libgap.eval('SL(2,GF(5))').GeneratorsOfGroup()[1]
 sage: M
 [ [ Z(5)^2, Z(5)^0 ], [ Z(5)^2, 0*Z(5) ] ]
 sage: M[0]
 [ Z(5)^2, Z(5)^0 ]
 }}}

--
Ticket URL: <http://trac.sagemath.org/ticket/18158#comment:10>
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 https://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to