#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    |  a8a0714ceb09eef1c5a9e1607b2dce5183d8763d
   Dependencies:                     |     Stopgaps:
-------------------------------------+-------------------------------------

Comment (by cremona):

 Replying to [comment:18 gjorgenson]:
 > Hi!

 Thanks a lot for responding.

 >
 > I think the failure in projective_morphism.py comes from
 projective_homset.py, where a set is now unexpectedly returned instead of
 a list in the points function for fields. The try block that was added in
 projective_homset.py prevents {{{sorted(points)}}} from executing in line
 138 and {{{sorted}}} changes the type of points from a set to a list.
 Changing {{{return points}}} to {{{return list(points)}}} in line 141
 seems to address the problem.

 OK, we'll do that.  (It is odd to me that sorted(X) has the side effect of
 changing a set to a list, but now that we know that we just make it into a
 list regardless of whether we are able to sort it.)

 I'll update the branch on this ticket accordingly.
 >
 > For the code in projective_morphism.py (lines 3003-3011) in the first
 line a list is declared but is never used (I think it is an artifact from
 a previous implementation attempt that wasn't caught). As far as I can
 tell, the rest of the code is working properly. Is there a problem with
 its functionality that I've missed?

 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.)

 It's a nuisance that any fix to this will conflict with our sorting
 changes, but we'll have to live with that.

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