#20028: sorting of number field elements
-------------------------------------+-------------------------------------
       Reporter:  cremona            |        Owner:
           Type:  defect             |       Status:  new
       Priority:  major              |    Milestone:  sage-7.1
      Component:  number fields      |   Resolution:
       Keywords:  sort number field  |    Merged in:
  elements                           |    Reviewers:
        Authors:                     |  Work issues:
Report Upstream:  N/A                |       Commit:
         Branch:  u/cremona/20028    |  f9f6b99b09fc6c5183d2fe7a82e4f27e957f059c
   Dependencies:                     |     Stopgaps:
-------------------------------------+-------------------------------------

Comment (by gjorgenson):

 Replying to [comment:19 cremona]:

 > Sure, rem_indices is not used.  But also: the line P=self(P) is executed
 man ytimes (once for each j) and in the next line should it not be if
 p++points[j]?  Otherwise j is not used.  I am also worried about the
 effect of popping points[i] while in the i-loop, but perhaps that's OK
 given that the i loop goes backwards.  A comment to explain what this
 block of code is doing would help, since I suspect that someone might come
 up with a slicker solution.  (If we only wanted to remove duplicates and
 did not care about the order then something like points=list(set(points))
 would work.)

 That code doesn't try to remove duplicates (the list of points returned by
 rational_points in line 2998 is assumed to contain no duplicates already),
 but is trying to weed out periodic points of the map {{{self}}} that have
 periods smaller than n so that only those with minimal period n are
 returned. This is done by iterating each point in the list by {{{self}}}
 (in the j-loop) n-1 times and checking whether any of those iterates is
 the same point as the 0th iterate (points[i]). j is not used for indexing
 but is needed to keep track of how many times to iterate each point before
 it can be concluded that the point has minimal period n.

 The problems associated with popping elements from the list are avoided
 since the i-loop moves backwards. I'm not sure of a way to do this more
 efficiently, but it would definitely be good to at least add some more
 documentation to the code. Would that be appropriate to do in this ticket,
 or would it be cleaner to leave it to a separate ticket?

--
Ticket URL: <http://trac.sagemath.org/ticket/20028#comment:23>
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