Skip to content

Commit

Permalink
Add a hash function for the class TernaryQF.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gustavo Rama authored and tornaria committed Oct 26, 2023
1 parent 07a2afd commit 65be016
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/sage/quadratic_forms/ternary_qf.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,19 @@ def coefficients(self):
"""
return self._a, self._b, self._c, self._r, self._s, self._t

def __hash__(self):
"""
Returns a hash for self.
EXAMPLES::
sage: Q = TernaryQF([1, 2, 3, 4, 5, 6])
sage: Q.__hash__()
5881802312257552497
"""

return hash(self.coefficients())

def coefficient(self, n):
r"""
Return the `n`-th coefficient of the ternary quadratic form.
Expand Down

0 comments on commit 65be016

Please sign in to comment.