#19016: Better hash for Element
-------------------------------------+-------------------------------------
       Reporter:  ncohen             |        Owner:
           Type:  defect             |       Status:  needs_work
       Priority:  critical           |    Milestone:  sage-6.10
      Component:  misc               |   Resolution:
       Keywords:                     |    Merged in:
        Authors:  Nils Bruin,        |    Reviewers:
  Vincent Delecroix                  |  Work issues:
Report Upstream:  N/A                |       Commit:
         Branch:  public/19016-bis   |  d34e7c3dfcda5b31ea4b5f1d112d843ae0d0e549
   Dependencies:                     |     Stopgaps:
-------------------------------------+-------------------------------------
Changes (by jdemeyer):

 * status:  needs_review => needs_work


Comment:

 1. In `src/sage/rings/polynomial/laurent_polynomial.pyx`, the function
 `__hash__` is defined twice in the same class.

 2. This isn't proper doctest syntax:
 {{{
 #!diff
 +    def __hash__(self):
 +        """
 +        TESTS:
 +
 +            It would be nice if the following would produce a list of
 +            15 distinct hashes.
 +
 +            sage: K.<t> = FunctionField(QQ)
 +            sage: len({hash(t^i+t^j) for i in [-2..2] for j in [i..2]})
 +            10
 +        """
 +        return hash(self._x)
 }}}

 3. Could you justify the need to add lots of comparison functions?

 4. Why is this needed?
 {{{
 #!diff
 -        return self.element_class(self, m)
 +        return self.element_class(self, ZZ(m))
 }}}

 5. This looks very suspicious:
 {{{
              [      0       1]
              [-272118       0]

 -            sage: a.matrix() * b
 +            sage: a.matrix() * b.matrix()
              [-272118       0]
              [      0    -462]
 -            sage: a * b.matrix()
 +            sage: a.matrix() * b.matrix()
              [-272118       0]
              [      0    -462]
 }}}

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