#8588: list(SL(2,2)) is inconsistent with SL(2,2).list()
---------------------------------------------------+------------------------
       Reporter:  nthiery                          |         Owner:  AlexGhitza
           Type:  defect                           |        Status:  new       
       Priority:  major                            |     Milestone:            
      Component:  algebra                          |    Resolution:            
       Keywords:  Special linear group, TestSuite  |   Work issues:            
Report Upstream:  N/A                              |     Reviewers:            
        Authors:                                   |     Merged in:            
   Dependencies:                                   |      Stopgaps:            
---------------------------------------------------+------------------------

Comment (by nbruin):

 Are you sure this is a wise fix? This way, even starting to iterate on the
 elements of a matrix group involves constructing all its elements. The
 iterator method on matrix groups previously was the one inherited from
 `sage.combinat.backtrack.TransitiveIdeal.__iter__`, which seems a little
 more conservative.

 In principle, people can write `iter(SL(next_prime(10^5),2)).next()` to
 get an example of a determinant 1 matrix. This doesn't need to be
 expensive (with the current code it is, though. It seems the
 `semigroup_generators` method is horribly inefficient). With the present
 patch it's guaranteed to be very expensive.

 Iterators and lists have different use cases, so why should G.list() and
 list(G) give the same result? I think structures should be allowed to
 choose different enumeration methods depending on the application.
 G.list() knows it returns a list of all elements, so it can concentrate on
 speed and not worry about storage. list(G), which is just [g for g in G]
 asks G to produce an iterator over its elements, which can choose an
 enumeration method that saves memory and/or ensures that it's fast even
 when only a couple of elements are consumed.

 It seems to me the correct fix is to amend `TestSuite` to not enforce that
 iter(G.list()) and iter(G) produce the elements in the same order.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/8588#comment:3>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to