#18585: Comparison of sparse polynomials
-------------------------------------+-------------------------------------
       Reporter:  bruno              |        Owner:
           Type:  defect             |       Status:  needs_review
       Priority:  major              |    Milestone:  sage-6.8
      Component:  commutative        |   Resolution:
  algebra                            |    Merged in:
       Keywords:  polynomials        |    Reviewers:
        Authors:  Bruno Grenet       |  Work issues:
Report Upstream:  N/A                |       Commit:
         Branch:                     |  7c72ce25d8b5a0709abbed60c7526ba63ebde8b5
  u/bruno/compare_sparse_polynomials |     Stopgaps:
   Dependencies:                     |
-------------------------------------+-------------------------------------

Comment (by vdelecroix):

 Hello,

 1. You can replace
 {{{
 keys1 = list(reversed(sorted(d1.keys())))
 }}}
   with
 {{{
 keys1 = d1.keys()
 keys1.reverse()
 }}}

 2. Instead of looking at the length, you can do
 {{{
 if not keys1 and not keys2: return 0
 if not keys1: return -1
 if not keys2: return 1
 }}}

 3. Why the first key is treated differently?

 Vincent

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

Reply via email to