Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Doctest to illustrate that base_ring must be a part of the cache key …
Browse files Browse the repository at this point in the history
…created by the DirichletGroup factory
  • Loading branch information
saraedum committed Apr 9, 2014
1 parent ebe6a39 commit 0521e97
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/sage/modular/dirichlet.py
Original file line number Diff line number Diff line change
Expand Up @@ -1755,6 +1755,33 @@ def create_key(self, modulus, base_ring=None, zeta=None, zeta_order=None, names=
sage: DirichletGroup.create_key(60)
(Cyclotomic Field of order 4 and degree 2, 60, zeta4, 4)
An example to illustrate that ``base_ring`` is a part of the key::
sage: k = DirichletGroup.create_key(2, base_ring=QQ); k
(Rational Field, 2, 1, 1)
sage: l = DirichletGroup.create_key(2, base_ring=CC); l
(Complex Field with 53 bits of precision, 2, 1.00000000000000, 1)
sage: k == l
False
sage: G = DirichletGroup.create_object(None, k); G
Group of Dirichlet characters of modulus 2 over Rational Field
sage: H = DirichletGroup.create_object(None, l); H
Group of Dirichlet characters of modulus 2 over Complex Field with 53 bits of precision
sage: G == H
False
If ``base_ring`` was not be a part of the key, the keys would compare
equal and the caching would be broken::
sage: k = k[1:]; k
(2, 1, 1)
sage: l = l[1:]; l
(2, 1.00000000000000, 1)
sage: k == l
True
sage: DirichletGroup(2, base_ring=QQ) is DirichletGroup(2, base_ring=CC)
False
"""
modulus = rings.Integer(modulus)

Expand Down

0 comments on commit 0521e97

Please sign in to comment.