hilbert-modular-group 0.1.1__tar.gz → 0.1.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of hilbert-modular-group might be problematic. Click here for more details.

Files changed (35) hide show
  1. {hilbert_modular_group-0.1.1 → hilbert_modular_group-0.1.2}/Dockerfile +1 -1
  2. {hilbert_modular_group-0.1.1 → hilbert_modular_group-0.1.2}/Makefile +6 -6
  3. {hilbert_modular_group-0.1.1 → hilbert_modular_group-0.1.2}/PKG-INFO +2 -2
  4. {hilbert_modular_group-0.1.1 → hilbert_modular_group-0.1.2}/README.md +1 -1
  5. {hilbert_modular_group-0.1.1 → hilbert_modular_group-0.1.2}/entrypoint.sh +1 -1
  6. {hilbert_modular_group-0.1.1 → hilbert_modular_group-0.1.2}/hilbert_modular_group.egg-info/PKG-INFO +2 -2
  7. {hilbert_modular_group-0.1.1 → hilbert_modular_group-0.1.2}/src/hilbert_modgroup/hilbert_modular_group_class.py +47 -47
  8. {hilbert_modular_group-0.1.1 → hilbert_modular_group-0.1.2}/src/hilbert_modgroup/pullback.py +70 -53
  9. {hilbert_modular_group-0.1.1 → hilbert_modular_group-0.1.2}/src/hilbert_modgroup/pullback_cython.pyx +0 -6
  10. {hilbert_modular_group-0.1.1 → hilbert_modular_group-0.1.2}/src/hilbert_modgroup/upper_half_plane.pyx +2 -2
  11. hilbert_modular_group-0.1.2/src/hilbert_modgroup/version.py +16 -0
  12. {hilbert_modular_group-0.1.1 → hilbert_modular_group-0.1.2}/tox.ini +8 -2
  13. hilbert_modular_group-0.1.1/src/hilbert_modgroup/version.py +0 -5
  14. {hilbert_modular_group-0.1.1 → hilbert_modular_group-0.1.2}/.github/workflows/docker-image.yml +0 -0
  15. {hilbert_modular_group-0.1.1 → hilbert_modular_group-0.1.2}/.gitignore +0 -0
  16. {hilbert_modular_group-0.1.1 → hilbert_modular_group-0.1.2}/.relint.yaml +0 -0
  17. {hilbert_modular_group-0.1.1 → hilbert_modular_group-0.1.2}/CHANGELOG.md +0 -0
  18. {hilbert_modular_group-0.1.1 → hilbert_modular_group-0.1.2}/LICENSE +0 -0
  19. {hilbert_modular_group-0.1.1 → hilbert_modular_group-0.1.2}/MANIFEST.in +0 -0
  20. {hilbert_modular_group-0.1.1 → hilbert_modular_group-0.1.2}/examples/ExamplesK1.ipynb +0 -0
  21. {hilbert_modular_group-0.1.1 → hilbert_modular_group-0.1.2}/examples/ExamplesK2.ipynb +0 -0
  22. {hilbert_modular_group-0.1.1 → hilbert_modular_group-0.1.2}/examples/ExamplesK3.ipynb +0 -0
  23. {hilbert_modular_group-0.1.1 → hilbert_modular_group-0.1.2}/examples/ExamplesK4.ipynb +0 -0
  24. {hilbert_modular_group-0.1.1 → hilbert_modular_group-0.1.2}/examples/plot.py +0 -0
  25. {hilbert_modular_group-0.1.1 → hilbert_modular_group-0.1.2}/hilbert_modular_group.egg-info/SOURCES.txt +0 -0
  26. {hilbert_modular_group-0.1.1 → hilbert_modular_group-0.1.2}/hilbert_modular_group.egg-info/dependency_links.txt +0 -0
  27. {hilbert_modular_group-0.1.1 → hilbert_modular_group-0.1.2}/hilbert_modular_group.egg-info/top_level.txt +0 -0
  28. {hilbert_modular_group-0.1.1 → hilbert_modular_group-0.1.2}/pyproject.toml +0 -0
  29. {hilbert_modular_group-0.1.1 → hilbert_modular_group-0.1.2}/setup.cfg +0 -0
  30. {hilbert_modular_group-0.1.1 → hilbert_modular_group-0.1.2}/setup.py +0 -0
  31. {hilbert_modular_group-0.1.1 → hilbert_modular_group-0.1.2}/src/hilbert_modgroup/__init__.py +0 -0
  32. {hilbert_modular_group-0.1.1 → hilbert_modular_group-0.1.2}/src/hilbert_modgroup/all.py +0 -0
  33. {hilbert_modular_group-0.1.1 → hilbert_modular_group-0.1.2}/src/hilbert_modgroup/hilbert_modular_group_element.pyx +0 -0
  34. {hilbert_modular_group-0.1.1 → hilbert_modular_group-0.1.2}/src/hilbert_modgroup/upper_half_plane.pxd +0 -0
  35. {hilbert_modular_group-0.1.1 → hilbert_modular_group-0.1.2}/src/hilbert_modgroup/utils.py +0 -0
@@ -1,7 +1,7 @@
1
1
  ARG REMOTE_SRC=1
2
2
  ARG GIT_BRANCH=develop
3
3
 
4
- FROM sagemath/sagemath:9.7 as base
4
+ FROM --platform=linux/amd64 sagemath/sagemath:10.3 as base
5
5
  RUN sudo apt-get update
6
6
  RUN sudo apt-get -y install git
7
7
 
@@ -46,7 +46,7 @@ examples:
46
46
 
47
47
  tox:
48
48
  sage -pip install tox meson
49
- sage --python -m tox src -c tox.ini -e $(TOX_ARGS)
49
+ sage --python -m tox -c tox.ini -e $(TOX_ARGS)
50
50
 
51
51
  docker:
52
52
  docker build --build-arg GIT_BRANCH=$(GIT_BRANCH) --build-arg REMOTE_SRC=$(REMOTE_SRC) -t hilbertmodgroup-$(TAG) .
@@ -55,19 +55,19 @@ docker-rebuild:
55
55
  docker build --build-arg GIT_BRANCH=$(GIT_BRANCH) --build-arg REMOTE_SRC=$(REMOTE_SRC) --no-cache -t hilbertmodgroup-$(TAG) .
56
56
 
57
57
  docker-test: docker
58
- docker run -it -e GIT_BRANCH=$(GIT_BRANCH) --init hilbertmodgroup-$(TAG) test
58
+ docker run --platform linux/amd64 -it -e GIT_BRANCH=$(GIT_BRANCH) --init hilbertmodgroup-$(TAG) test
59
59
 
60
60
  docker-examples: docker
61
- docker run -p $(NBPORT):$(NBPORT) -it -e GIT_BRANCH=$(GIT_BRANCH) -e NBPORT=$(NBPORT) --init hilbertmodgroup-$(TAG) examples $(EXAMPLES_ARGS)
61
+ docker run --platform linux/amd64 -p $(NBPORT):$(NBPORT) -it -e GIT_BRANCH=$(GIT_BRANCH) -e NBPORT=$(NBPORT) --init hilbertmodgroup-$(TAG) examples $(EXAMPLES_ARGS)
62
62
 
63
63
  docker-tox: docker
64
- docker run -it -e GIT_BRANCH=$(GIT_BRANCH) -e TOX_ARGS=$(TOX_ARGS) --init hilbertmodgroup-$(TAG) tox
64
+ docker run --platform linux/amd64 -it -e GIT_BRANCH=$(GIT_BRANCH) -e TOX_ARGS=$(TOX_ARGS) --init hilbertmodgroup-$(TAG) tox
65
65
 
66
66
  docker-shell: docker
67
- docker run -it -e GIT_BRANCH=$(GIT_BRANCH) --init hilbertmodgroup-$(TAG) shell
67
+ docker run --platform linux/amd64 -it -e GIT_BRANCH=$(GIT_BRANCH) --init hilbertmodgroup-$(TAG) shell
68
68
 
69
69
  docker-sage: docker
70
- docker run -it -e GIT_BRANCH=$(GIT_BRANCH) --init hilbertmodgroup-$(TAG) run
70
+ docker run --platform linux/amd64 -it -e GIT_BRANCH=$(GIT_BRANCH) --init hilbertmodgroup-$(TAG) run
71
71
 
72
72
 
73
73
  clean:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hilbert_modular_group
3
- Version: 0.1.1
3
+ Version: 0.1.2
4
4
  Summary: Algorithms for Hilbert modular groups
5
5
  Home-page: https://github.com/fredstro/hilbertmodgroup
6
6
  Author: Fredrik Stromberg
@@ -30,7 +30,7 @@ and is dependent on SageMath.
30
30
 
31
31
  ## Requirements
32
32
  - SageMath v9.6+ (https://www.sagemath.org/)
33
- (Tested on v9.6, v9.7 and v10.0)
33
+ (Tested on v9.6, v9.7, v10.0 and v10.2)
34
34
 
35
35
  ## Installation
36
36
  ### Using sage pip
@@ -6,7 +6,7 @@ and is dependent on SageMath.
6
6
 
7
7
  ## Requirements
8
8
  - SageMath v9.6+ (https://www.sagemath.org/)
9
- (Tested on v9.6, v9.7 and v10.0)
9
+ (Tested on v9.6, v9.7, v10.0 and v10.2)
10
10
 
11
11
  ## Installation
12
12
  ### Using sage pip
@@ -20,7 +20,7 @@ case $1 in
20
20
  tox)
21
21
  echo "Docker container running tox with $TOX_ARGS"
22
22
  sage -pip install tox
23
- sage -python -m tox -c tox.ini src -e $TOX_ARGS
23
+ sage -python -m tox -c tox.ini -e $TOX_ARGS
24
24
  ;;
25
25
  examples)
26
26
  echo "Docker container with Jupyter Notebook interface to run example notebooks."
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hilbert-modular-group
3
- Version: 0.1.1
3
+ Version: 0.1.2
4
4
  Summary: Algorithms for Hilbert modular groups
5
5
  Home-page: https://github.com/fredstro/hilbertmodgroup
6
6
  Author: Fredrik Stromberg
@@ -30,7 +30,7 @@ and is dependent on SageMath.
30
30
 
31
31
  ## Requirements
32
32
  - SageMath v9.6+ (https://www.sagemath.org/)
33
- (Tested on v9.6, v9.7 and v10.0)
33
+ (Tested on v9.6, v9.7, v10.0 and v10.2)
34
34
 
35
35
  ## Installation
36
36
  ### Using sage pip
@@ -21,9 +21,9 @@ from sage.groups.matrix_gps.linear import LinearMatrixGroup_generic
21
21
  from sage.modular.cusps_nf import NFCusp
22
22
  from sage.rings.infinity import infinity
23
23
  from sage.rings.number_field.number_field import QuadraticField, CyclotomicField
24
- from sage.all import latex, Integer, Matrix, matrix
24
+ from sage.all import latex, Integer, Matrix, matrix, ZZ
25
25
  from sage.misc.cachefunc import cached_method
26
- from sage.rings.number_field.order import is_NumberFieldOrder
26
+ from sage.rings.number_field.order import Order
27
27
 
28
28
  # from .upper_half_plane import ComplexPlaneOtimesK
29
29
  from hilbert_modgroup.upper_half_plane import ComplexPlaneProductElement__class
@@ -35,7 +35,7 @@ logger = logging.getLogger(__name__)
35
35
  logger.setLevel(10)
36
36
 
37
37
 
38
- def is_HilbertModularGroup(x):
38
+ def is_HilbertModularGroup(x) -> bool:
39
39
  """
40
40
  Return `True` if ``x`` is an instance of a HilbertModularGroup
41
41
 
@@ -61,34 +61,32 @@ def is_HilbertModularGroup(x):
61
61
 
62
62
  def HilbertModularGroup(number_field, projective=True):
63
63
  r"""
64
- Create the Hilbert modular group over the ring of integers in the given number field
64
+ Create the Hilbert modular group over the ring of integers in the given number field
65
65
 
66
66
 
67
- INPUT:
68
-
69
- - ``number_field`` (NumberField) -- a totally real number field or positive integer.
70
- If a positive integer D is specified
71
- then the number field $Q(\sqrt(D))$ is used.
72
- - ``projective`` (bool) - True if you want PSL(2,K) and False for SL(2,K)
67
+ INPUT:
73
68
 
69
+ - ``number_field`` (NumberField) -- a totally real number field or positive integer.
70
+ If a positive integer D is specified
71
+ then the number field $Q(\sqrt(D))$ is used.
72
+ - ``projective`` (bool) - ``True`` if you want PSL(2,K) and ``False`` for SL(2,K)
74
73
 
75
- EXAMPLES::
76
-
77
- sage: from hilbert_modgroup.all import HilbertModularGroup
78
- sage: HilbertModularGroup(5)
79
- Hilbert Modular Group ... x^2 - 5 with a = 2.236067977499790?
80
- sage: HilbertModularGroup(QuadraticField(5))
81
- Hilbert Modular Group ... x^2 - 5 with a = 2.236067977499790?
82
74
 
75
+ EXAMPLES::
83
76
 
84
- TESTS::
77
+ sage: from hilbert_modgroup.all import HilbertModularGroup
78
+ sage: HilbertModularGroup(5)
79
+ Hilbert Modular Group ... x^2 - 5 with a = 2.236067977499790?
80
+ sage: HilbertModularGroup(QuadraticField(5))
81
+ Hilbert Modular Group ... x^2 - 5 with a = 2.236067977499790?
85
82
 
86
- sage: from hilbert_modgroup.all import HilbertModularGroup
87
- sage: HilbertModularGroup(5)
88
- Hilbert Modular Group ... x^2 - 5 with a = 2.236067977499790?
89
- sage: HilbertModularGroup(QuadraticField(5))
90
- Hilbert Modular Group ... x^2 - 5 with a = 2.236067977499790?
83
+ TESTS::
91
84
 
85
+ sage: from hilbert_modgroup.all import HilbertModularGroup
86
+ sage: HilbertModularGroup(5)
87
+ Hilbert Modular Group ... x^2 - 5 with a = 2.236067977499790?
88
+ sage: HilbertModularGroup(QuadraticField(5))
89
+ Hilbert Modular Group ... x^2 - 5 with a = 2.236067977499790?
92
90
 
93
91
  """
94
92
  if isinstance(number_field, (int, Integer)) and number_field > 0:
@@ -120,13 +118,14 @@ class HilbertModularGroup_class(LinearMatrixGroup_generic):
120
118
  r"""
121
119
  Init a Hilbert modular group over the ring of integers in the given number field
122
120
 
123
-
124
121
  INPUT:
122
+
125
123
  - ``base_ring`` - ring
126
124
  - ``sage_name`` - string
127
125
  - ``latex_string`` - string
128
126
 
129
127
  EXAMPLES::
128
+
130
129
  sage: from hilbert_modgroup.hilbert_modular_group_class import *
131
130
  sage: OK=QuadraticField(5).OK()
132
131
  sage: name = f'Hilbert Modular Group PSL(2) over {OK}'
@@ -149,7 +148,8 @@ class HilbertModularGroup_class(LinearMatrixGroup_generic):
149
148
  [ 1 1/2*a + 1/2]
150
149
  [ 0 1]
151
150
  """
152
- if not is_NumberFieldOrder(base_ring) or not base_ring.number_field().is_totally_real():
151
+ if base_ring != ZZ and (not isinstance(base_ring, Order)
152
+ or not base_ring.number_field().is_totally_real()):
153
153
  raise ValueError("Input (={0}) can not be used to create a Hilbert modular group. " +
154
154
  "Need an order of a totally real number field")
155
155
  # Instance data related to elliptic elements
@@ -166,31 +166,30 @@ class HilbertModularGroup_class(LinearMatrixGroup_generic):
166
166
  self._cusp_normalizing_maps_inverse = {}
167
167
  # At the moment we only deal with full level (1)
168
168
  self._level = base_ring.fractional_ideal(1)
169
- super(HilbertModularGroup_class, self).__init__(degree=Integer(2), base_ring=base_ring,
170
- special=True,
171
- sage_name=sage_name,
172
- latex_string=latex_string,
173
- category=Groups().Infinite(),
174
- invariant_form=None)
169
+ super().__init__(degree=Integer(2), base_ring=base_ring,
170
+ special=True,
171
+ sage_name=sage_name,
172
+ latex_string=latex_string,
173
+ category=Groups().Infinite(),
174
+ invariant_form=None)
175
175
 
176
176
  @cached_method
177
177
  def generators(self, algorithm='standard'):
178
178
  r"""
179
- Return a list of generators of self.
179
+ Return a list of generators of ``self``.
180
180
 
181
181
  INPUT:
182
182
 
183
-
184
183
  - ``algorithm`` (string) either 'standard' or 'elementary'.
185
- If 'elementary' is given return a set of generators
186
- consisting of elementary (i.e. upper- and lower-triangular) matrices.
187
- Otherwise return a set of reflections and translations.
188
184
 
185
+ If 'elementary' is given return a set of generators
186
+ consisting of elementary (i.e. upper- and lower-triangular) matrices.
187
+ Otherwise return a set of reflections and translations.
189
188
 
190
189
  EXAMPLES::
191
190
 
192
191
  sage: from hilbert_modgroup.all import HilbertModularGroup
193
- sage: H=HilbertModularGroup(5)
192
+ sage: H = HilbertModularGroup(5)
194
193
  sage: H.generators()
195
194
  [
196
195
  [ 0 -1] [ 1 1/2*a + 1/2] [1 a]
@@ -207,15 +206,15 @@ class HilbertModularGroup_class(LinearMatrixGroup_generic):
207
206
  """
208
207
  if algorithm == 'standard':
209
208
  gens = [self.S()]
210
- for x in self.base_ring().basis():
211
- gens.append(self.T(x))
209
+ gens.extend(self.T(x) for x in self.base_ring().basis())
212
210
  elif algorithm == 'elementary':
213
211
  gens = []
214
212
  for x in self.base_ring().basis():
215
213
  gens.append(self.T(x))
216
214
  gens.append(self.L(x))
217
215
  else:
218
- raise ValueError("Unknown algorithm '{0}'. Expected one of 'standard' or 'elementary'")
216
+ raise ValueError(f"Unknown algorithm '{algorithm}'. "
217
+ f"Expected one of 'standard' or 'elementary'")
219
218
  return gens
220
219
 
221
220
  @cached_method
@@ -247,7 +246,7 @@ class HilbertModularGroup_class(LinearMatrixGroup_generic):
247
246
  EXAMPLES::
248
247
 
249
248
  sage: from hilbert_modgroup.all import HilbertModularGroup
250
- sage: H=HilbertModularGroup(5)
249
+ sage: H = HilbertModularGroup(5)
251
250
  sage: H.T()
252
251
  [1 1]
253
252
  [0 1]
@@ -269,6 +268,7 @@ class HilbertModularGroup_class(LinearMatrixGroup_generic):
269
268
  INPUT:
270
269
 
271
270
  - ``a`` -- integer in number field
271
+
272
272
  EXAMPLES::
273
273
 
274
274
  sage: from hilbert_modgroup.all import HilbertModularGroup
@@ -441,7 +441,6 @@ class HilbertModularGroup_class(LinearMatrixGroup_generic):
441
441
  """
442
442
  A set of cusp representatives of self.
443
443
 
444
-
445
444
  EXAMPLES::
446
445
 
447
446
  sage: from hilbert_modgroup.all import HilbertModularGroup
@@ -552,6 +551,7 @@ class HilbertModularGroup_class(LinearMatrixGroup_generic):
552
551
  Return a representative cusp and optionally a corresponding map.
553
552
 
554
553
  INPUT:
554
+
555
555
  - ``cusp`` -- cusp
556
556
  - ``return_map`` -- bool (default: False)
557
557
  Set to True to also return the map giving the equivalence.
@@ -704,7 +704,7 @@ class HilbertModularGroup_class(LinearMatrixGroup_generic):
704
704
  EXAMPLES::
705
705
 
706
706
  sage: from hilbert_modgroup.all import HilbertModularGroup
707
- sage: H=HilbertModularGroup(5)
707
+ sage: H = HilbertModularGroup(5)
708
708
  sage: H.traces_of_elliptic_elements()
709
709
  [-1, 0, -1/2*a - 1/2, 1/2*a - 1/2, 1, -1/2*a + 1/2, 1/2*a + 1/2]
710
710
 
@@ -715,7 +715,7 @@ class HilbertModularGroup_class(LinearMatrixGroup_generic):
715
715
  sage: var('x')
716
716
  x
717
717
  sage: K = NumberField(x^3-36*x-1, names='a')
718
- sage: H=HilbertModularGroup(K)
718
+ sage: H = HilbertModularGroup(K)
719
719
  sage: H2.traces_of_elliptic_elements()
720
720
  [-1, 0, 1]
721
721
 
@@ -776,12 +776,12 @@ class HilbertModularGroup_class(LinearMatrixGroup_generic):
776
776
  Returns None if no elliptic element with this trace exists.
777
777
 
778
778
  INPUT:
779
+
779
780
  - `t` number field element
780
781
 
781
782
  OUTPUT:
782
- - integer or None
783
-
784
783
 
784
+ - integer or ``None``
785
785
 
786
786
  EXAMPLES::
787
787
 
@@ -880,7 +880,7 @@ class HilbertModularGroup_class(LinearMatrixGroup_generic):
880
880
  if not isinstance(cusp, NFCusp) or cusp.number_field() != base_nf:
881
881
  raise ValueError(f"Input should be a NF cusp defined over {base_nf}!")
882
882
  ca, cb = (cusp.numerator(), cusp.denominator())
883
- if not (ca, cb) in self._cusp_normalizing_maps:
883
+ if (ca, cb) not in self._cusp_normalizing_maps:
884
884
  # First find the equivalent representative
885
885
  # crep, B = self.cusp_representative(cusp,return_map=True)
886
886
  # crepa,crepb = crep.numerator(),crep.denominator()
@@ -19,14 +19,14 @@ from sage.misc.misc_c import prod
19
19
  from sage.modular.cusps_nf import NFCusp
20
20
  from sage.modules.free_module_element import vector
21
21
  from sage.rings.infinity import Infinity
22
- from sage.rings.number_field.number_field_ideal import is_NumberFieldIdeal
22
+ from sage.rings.number_field.number_field_ideal import NumberFieldIdeal
23
23
  from sage.rings.real_double import RDF
24
24
  from sage.rings.real_mpfr import RealField
25
25
  from sage.structure.sage_object import SageObject
26
26
  from sage.matrix.all import Matrix
27
27
 
28
28
  from hilbert_modgroup.upper_half_plane import \
29
- ComplexPlaneProductElement__class,\
29
+ ComplexPlaneProductElement__class, \
30
30
  UpperHalfPlaneProductElement__class, UpperHalfPlaneProductElement
31
31
 
32
32
  from hilbert_modgroup.utils import upper, lower
@@ -466,7 +466,7 @@ class HilbertPullback(SageObject):
466
466
 
467
467
  """
468
468
  ideala = self._construct_ideal(a)
469
- entries = [[x for x in beta.complex_embeddings(prec)] for beta in ideala.integral_basis()]
469
+ entries = [list(beta.complex_embeddings(prec)) for beta in ideala.integral_basis()]
470
470
  n = self.group().base_ring().degree()
471
471
  return matrix(RealField(prec), n, n, entries).transpose()
472
472
 
@@ -517,7 +517,7 @@ class HilbertPullback(SageObject):
517
517
 
518
518
  """
519
519
  ideala = self._construct_ideal(a)
520
- entries = [[x for x in beta.vector()] for beta in ideala.integral_basis()]
520
+ entries = [list(beta.vector()) for beta in ideala.integral_basis()]
521
521
  n = self.group().base_ring().degree()
522
522
  return matrix(self.number_field(), n, n, entries).transpose()
523
523
 
@@ -789,31 +789,33 @@ class HilbertPullback(SageObject):
789
789
  Try to find a heuristic closest cusp using LLL.
790
790
 
791
791
  INPUT:
792
+
792
793
  - ``z`` -- point in the upper half-plane
793
794
  - ``a`` -- ideal or number field element (default = None)
794
- If None then this is set to the entire ring of integers.
795
+ If None then this is set to the entire ring of integers.
795
796
  - ``as_cusp`` -- boolean (default: False)
796
- If True we return an element of type NFCusp
797
+ If True we return an element of type NFCusp
798
+
797
799
  EXAMPLES::
798
800
 
799
801
  sage: from hilbert_modgroup.all import *
800
802
  sage: H1 = HilbertModularGroup(5)
801
803
  sage: P1 = HilbertPullback(H1)
802
- sage: z=UpperHalfPlaneProductElement([CC(0,1),CC(0,1)])
804
+ sage: z = UpperHalfPlaneProductElement([CC(0,1),CC(0,1)])
803
805
  sage: P1.get_heuristic_closest_cusp(z)
804
806
  (-1, 0)
805
- sage: z=UpperHalfPlaneProductElement([CC(0,0.5),CC(0,1)])
807
+ sage: z = UpperHalfPlaneProductElement([CC(0,0.5),CC(0,1)])
806
808
  sage: P1.get_heuristic_closest_cusp(z)
807
809
  (0, 1)
808
- sage: z=UpperHalfPlaneProductElement([CC(2.2,0.5),CC(1,0.5)])
810
+ sage: z = UpperHalfPlaneProductElement([CC(2.2,0.5),CC(1,0.5)])
809
811
  sage: P1.get_heuristic_closest_cusp(z)
810
812
  (-1/2*a + 3/2, 1)
811
813
  sage: H2 = HilbertModularGroup(10)
812
814
  sage: P2 = HilbertPullback(H2)
813
- sage: z=UpperHalfPlaneProductElement([CC(2,0.5),CC(1,0.2)])
815
+ sage: z = UpperHalfPlaneProductElement([CC(2,0.5),CC(1,0.2)])
814
816
  sage: P2.get_heuristic_closest_cusp(z)
815
817
  (1, 1)
816
- sage: z=UpperHalfPlaneProductElement([23.3400000000000 + 0.0100000000000000*I,\
818
+ sage: z = UpperHalfPlaneProductElement([23.3400000000000 + 0.0100000000000000*I,\
817
819
  0.0200000000000000 + 0.0300000000000000*I])
818
820
  sage: P2.get_heuristic_closest_cusp(z)
819
821
  (3*a - 10, -a - 4)
@@ -856,23 +858,28 @@ class HilbertPullback(SageObject):
856
858
 
857
859
  def _construct_ideal(self, a, b=None):
858
860
  r"""
859
- Construct an ideal of the number field associated with self from a
861
+ Construct an ideal of the number field associated with self from a.
860
862
 
861
863
  EXAMPLES::
862
864
 
863
- sage: from hilbert_modgroup.all import *
864
- sage: P1=HilbertPullback(HilbertModularGroup(5))
865
- sage: P1._construct_ideal(1)
866
- Fractional ideal (1)
867
- sage: P1._construct_ideal(P1.number_field().fractional_ideal(1))
868
- Fractional ideal (1)
869
-
870
-
865
+ sage: from hilbert_modgroup.all import *
866
+ sage: P1 = HilbertPullback(HilbertModularGroup(5))
867
+ sage: P1._construct_ideal(1)
868
+ Fractional ideal (1)
869
+ sage: P1._construct_ideal(P1.number_field().fractional_ideal(1))
870
+ Fractional ideal (1)
871
+ sage: a = P1.number_field().fractional_ideal(1)
872
+ sage: b = P1.number_field().fractional_ideal(2)
873
+ sage: P1._construct_ideal(a, b)
874
+ Fractional ideal (1/2)
871
875
  """
872
876
  if a is None:
873
877
  ideala = self.group().base_ring().fractional_ideal(1)
874
- elif is_NumberFieldIdeal(a):
875
- ideala = a
878
+ elif isinstance(a, NumberFieldIdeal):
879
+ if b:
880
+ ideala = a / b
881
+ else:
882
+ ideala = a
876
883
  elif a in self.group().base_ring() and not b:
877
884
  ideala = self.group().base_ring().fractional_ideal(a)
878
885
  elif a in self.group().base_ring() and b in self.group().base_ring():
@@ -886,18 +893,23 @@ class HilbertPullback(SageObject):
886
893
  Return an instance of NFCusp for the number field of self from input c and optional d
887
894
 
888
895
  INPUT:
896
+
889
897
  - ``c`` -- instance of NFCusp, element or tuple of elements of number field
890
898
  - ``d`` -- element of number field or None (default: None)
899
+
891
900
  EXAMPLES::
892
901
 
893
- sage: from hilbert_modgroup.all import *
894
- sage: P1=HilbertPullback(HilbertModularGroup(5))
895
- sage: P1._construct_cusp(1,0)
896
- Cusp Infinity of Number Field in a with ... polynomial x^2 - 5 with a = 2.236067977499790?
897
- sage: P1._construct_cusp((1,0))
898
- Cusp Infinity of Number Field in a with ... polynomial x^2 - 5 with a = 2.236067977499790?
899
- sage: P1._construct_cusp(0,1)
900
- Cusp [0: 1] of Number Field in a with ... polynomial x^2 - 5 with a = 2.236067977499790?
902
+ sage: from hilbert_modgroup.all import *
903
+ sage: P1=HilbertPullback(HilbertModularGroup(5))
904
+ sage: P1._construct_cusp(1,0)
905
+ Cusp Infinity of Number Field in a with ... polynomial
906
+ x^2 - 5 with a = 2.236067977499790?
907
+ sage: P1._construct_cusp((1,0))
908
+ Cusp Infinity of Number Field in a with ... polynomial
909
+ x^2 - 5 with a = 2.236067977499790?
910
+ sage: P1._construct_cusp(0,1)
911
+ Cusp [0: 1] of Number Field in a with ... polynomial
912
+ x^2 - 5 with a = 2.236067977499790?
901
913
  """
902
914
  if isinstance(c, NFCusp) and c.number_field() == self.number_field():
903
915
  return c
@@ -921,7 +933,7 @@ class HilbertPullback(SageObject):
921
933
  sage: from hilbert_modgroup.upper_half_plane import UpperHalfPlaneProductElement
922
934
  sage: H1 = HilbertModularGroup(5)
923
935
  sage: P1 = HilbertPullback(H1)
924
- sage: z=UpperHalfPlaneProductElement([CC(1,1),CC(1,1)])
936
+ sage: z = UpperHalfPlaneProductElement([CC(1,1),CC(1,1)])
925
937
  sage: P1.X(z)
926
938
  (1.00000000000000, 0.000000000000000)
927
939
  sage: b1,b2 = H1.base_ring().fractional_ideal(1).integral_basis(); b1,b2
@@ -957,7 +969,7 @@ class HilbertPullback(SageObject):
957
969
  sage: from hilbert_modgroup.upper_half_plane import UpperHalfPlaneProductElement
958
970
  sage: H1 = HilbertModularGroup(5)
959
971
  sage: P1 = HilbertPullback(H1)
960
- sage: z=UpperHalfPlaneProductElement([CC(1,1),CC(1,1)])
972
+ sage: z = UpperHalfPlaneProductElement([CC(1,1),CC(1,1)])
961
973
  sage: P1.reduce_by_translations(z,return_map=True)
962
974
  (
963
975
  [ 1 -1]
@@ -965,7 +977,7 @@ class HilbertPullback(SageObject):
965
977
  )
966
978
 
967
979
 
968
- sage: z=UpperHalfPlaneProductElement([CC(3,1),CC(-1,1)])
980
+ sage: z = UpperHalfPlaneProductElement([CC(3,1),CC(-1,1)])
969
981
  sage: P1.reduce_by_translations(z,return_map=True) # abs tol 1e-10
970
982
  (
971
983
  [-0.236067977499790 + 1.00000000000000*I, 0.236067977499790 + 1.00000000000000*I],
@@ -985,12 +997,12 @@ class HilbertPullback(SageObject):
985
997
 
986
998
  sage: H3=HilbertModularGroup(NumberField(x^3-36*x-1, names='a'))
987
999
  sage: P3=HilbertPullback(H3)
988
- sage: z=UpperHalfPlaneProductElement([CC(1,1),CC(1,1)])
1000
+ sage: z = UpperHalfPlaneProductElement([CC(1,1),CC(1,1)])
989
1001
  sage: P3.reduce_by_translations(z,return_map=True)
990
1002
  Traceback (most recent call last):
991
1003
  ...
992
1004
  ValueError: Need an element of type: UpperHalfPlaneProductElement__class of degree 3
993
- sage: z=UpperHalfPlaneProductElement([CC(1,1),CC(1,1),CC(1,1)])
1005
+ sage: z = UpperHalfPlaneProductElement([CC(1,1),CC(1,1),CC(1,1)])
994
1006
  sage: P3.reduce_by_translations(z,return_map=True)
995
1007
  (
996
1008
  [ 1 -1]
@@ -1023,7 +1035,6 @@ class HilbertPullback(SageObject):
1023
1035
 
1024
1036
  EXAMPLES::
1025
1037
 
1026
-
1027
1038
  sage: from hilbert_modgroup.all import *
1028
1039
  sage: from hilbert_modgroup.upper_half_plane import UpperHalfPlaneProductElement
1029
1040
  sage: H1 = HilbertModularGroup(5)
@@ -1068,7 +1079,7 @@ class HilbertPullback(SageObject):
1068
1079
 
1069
1080
  - ``z`` -- point in the upper half-plane
1070
1081
  - ``return_map`` -- boolean (default False)
1071
- Set to ``True`` to return the map which performed the reduction.
1082
+ Set to ``True`` to return the map which performed the reduction.
1072
1083
 
1073
1084
  EXAMPLES::
1074
1085
 
@@ -1109,8 +1120,8 @@ class HilbertPullback(SageObject):
1109
1120
  - ``z`` -- point in the upper half-plane.
1110
1121
  - ``cusp`` -- cusp of the group of self.
1111
1122
  - ``return_map`` -- boolean (default=False)
1112
- Return the map A such that AN^-1z is reduced where N is the
1113
- cusp normalizing map for the cusp.
1123
+ Return the map A such that AN^-1z is reduced where N is the
1124
+ cusp normalizing map for the cusp.
1114
1125
 
1115
1126
  EXAMPLES::
1116
1127
 
@@ -1132,8 +1143,8 @@ class HilbertPullback(SageObject):
1132
1143
  [1.00000000000000*I, 1.00000000000000*I], [ 0 1]
1133
1144
  )
1134
1145
 
1135
- :: Check that if we apply a cusp-normalizing map to a point then the reduction with respect
1136
- :: to that cusp is the same as the reduction of the original point with respect to infinity
1146
+ Check that if we apply a cusp-normalizing map to a point then the reduction with respect
1147
+ to that cusp is the same as the reduction of the original point with respect to infinity ::
1137
1148
 
1138
1149
  sage: c=NFCusp(P1.group().base_ring().number_field(),1,2)
1139
1150
  sage: N=H1.cusp_normalizing_map(c)
@@ -1161,19 +1172,18 @@ class HilbertPullback(SageObject):
1161
1172
  [ 1 a - 1]
1162
1173
  [ 0 1]
1163
1174
  )
1164
- sage: H3=HilbertModularGroup(NumberField(x^3-36*x-1, names='a'))
1165
- sage: P3=HilbertPullback(H3)
1175
+ sage: H3 = HilbertModularGroup(NumberField(x^3-36*x-1, names='a'))
1176
+ sage: P3 = HilbertPullback(H3)
1166
1177
  sage: z=UpperHalfPlaneProductElement([CC(1,1),CC(2,1),CC(10,1)])
1167
- sage: P3.reduce_in_cuspidal_region(z,P3.group().cusps()[0],\
1168
- return_map=True) # abs tol 1e-10
1178
+ sage: cusp = P3.group().cusps()[0]
1179
+ sage: P3.reduce_in_cuspidal_region(z, cusp, # abs tol 1e-10
1180
+ ....: return_map=True)
1169
1181
  (
1170
1182
  [2.98606258583498 + 1.0*I, -1.97222162680976 + 1.0*I, -0.0138409590252291 + 1.0*I],
1171
1183
  <BLANKLINE>
1172
1184
  [ 1 -a - 4]
1173
1185
  [ 0 1]
1174
1186
  )
1175
-
1176
-
1177
1187
  """
1178
1188
  self._check_upper_half_plane_element(z)
1179
1189
  if not cusp:
@@ -1351,7 +1361,7 @@ class HilbertPullback(SageObject):
1351
1361
  if not B:
1352
1362
  return p1
1353
1363
  # Hypercube containing the integral points of the coordinates wrt the integral basis
1354
- vertices = [vector([y for y in B * vector(x)]) for x in p1.vertices()]
1364
+ vertices = [vector(list(B * vector(x))) for x in p1.vertices()]
1355
1365
  # Try to make a polyhedron of the mapped vertices.
1356
1366
  return Polyhedron(vertices, base_ring=RDF)
1357
1367
 
@@ -1380,9 +1390,10 @@ class HilbertPullback(SageObject):
1380
1390
 
1381
1391
  def _matrix_BLambda_row_sum(self, i=None):
1382
1392
  r"""
1383
- Compute r_i(B_{\Lambda}) = sum_j |b_ij| or sum_ij |b_ij|.
1393
+ Compute ``r_i(B_{\Lambda}) = sum_j |b_ij|`` or ``sum_ij |b_ij|``.
1384
1394
 
1385
1395
  INPUT:
1396
+
1386
1397
  -`` i`` -- integer (default: None)
1387
1398
  If i is given then return sum of absolute values in row nr. i,
1388
1399
  otherwise return the sum.
@@ -1429,7 +1440,7 @@ class HilbertPullback(SageObject):
1429
1440
  @cached_method
1430
1441
  def _exp_matrix_BLambda_row_sum(self, i=None):
1431
1442
  r"""
1432
- Compute exp(r_i(B_{\Lambda})) = sum_j |b_ij| or sum_ij |b_ij|.
1443
+ Compute ``exp(r_i(B_{\Lambda})) = sum_j |b_ij|`` or ``sum_ij |b_ij|``.
1433
1444
 
1434
1445
  INPUT:
1435
1446
 
@@ -1599,6 +1610,7 @@ class HilbertPullback(SageObject):
1599
1610
  Return the constant `a_i` used to bound the embeddings of sigma in Algorithm XXX.
1600
1611
 
1601
1612
  INPUT:
1613
+
1602
1614
  - ``z`` -- point in the upper half-plane
1603
1615
  - ``initial_bd_d`` -- an initial bound for the distance to nearest cusp (default None)
1604
1616
  - ``use_initial_bd_d`` -- boolean (default: 'True') Use the initial bound or not.
@@ -1658,6 +1670,7 @@ class HilbertPullback(SageObject):
1658
1670
  Return the vector of all bounds Dzi
1659
1671
 
1660
1672
  INPUT:
1673
+
1661
1674
  - ``z`` -- point in the upper half-plane
1662
1675
  - ``initial_bd_d`` -- an initial bound for the distance to nearest cusp (default None)
1663
1676
  - ``use_initial_bd_d`` -- boolean (default: 'True') Use the initial bound or not.
@@ -1825,9 +1838,11 @@ class HilbertPullback(SageObject):
1825
1838
  prec=16):
1826
1839
  """
1827
1840
  Bound for the embeddings of the numerator of the closest cusp to z.
1841
+
1828
1842
  Reference: Corollary 5
1829
1843
 
1830
- rho_i in [sigma_i x_i - delta*y_i**0.5 , sigma_i x_i - delta*y_i**0.5]
1844
+ ``rho_i in [sigma_i x_i - delta*y_i**0.5 , sigma_i x_i - delta*y_i**0.5]``
1845
+
1831
1846
  INPUT:
1832
1847
 
1833
1848
  - ``z`` -- point in the upper half-plane
@@ -1897,8 +1912,10 @@ class HilbertPullback(SageObject):
1897
1912
  """
1898
1913
  Bound for the coordinates, with respect to the ring of integers,
1899
1914
  of the numerator of the closest cusp to z.
1915
+
1900
1916
  Reference: Lemma XXX
1901
- rho_i in [sigma_i x_i - delta*y_i**0.5 , sigma_i x_i - delta*y_i**0.5]
1917
+
1918
+ ``rho_i in [sigma_i x_i - delta*y_i**0.5 , sigma_i x_i - delta*y_i**0.5]``
1902
1919
 
1903
1920
  INPUT:
1904
1921
 
@@ -2206,13 +2223,13 @@ class HilbertPullback(SageObject):
2206
2223
 
2207
2224
 
2208
2225
  EXAMPLES::
2226
+
2209
2227
  sage: from hilbert_modgroup.all import *
2210
2228
  sage: H1 = HilbertModularGroup(5)
2211
2229
  sage: P1 = HilbertPullback(H1)
2212
2230
  sage: z = UpperHalfPlaneProductElement([CC(0,1),CC(0,1)])
2213
2231
  sage: P1._candidate_closest_cusps(z)
2214
2232
  [(1, 0), (-1, -1), (0, 1), (1, -1)]
2215
-
2216
2233
  """
2217
2234
  cusp_candidates = find_candidate_cusps(self, z, use_lll=use_lll,
2218
2235
  use_norm_bound=use_norm_bound,
@@ -6,15 +6,9 @@ Note: These are the algorithms that needs optimizing to make it all faster.
6
6
  """
7
7
  from sage.all import ceil,floor,cartesian_product
8
8
  from sage.arith.misc import gcd
9
- from sage.modular.cusps_nf import NFCusp
10
- from sage.rings.infinity import Infinity
11
9
  from sage.structure.sage_object cimport SageObject
12
10
  from hilbert_modgroup.upper_half_plane cimport UpperHalfPlaneProductElement__class
13
- # from sage.rings.number_field.number_field_ideal import NumberFieldIdeal
14
11
  from sage.rings.number_field.number_field_element cimport NumberFieldElement
15
- from sage.rings.number_field.number_field_element import is_NumberFieldElement
16
- from sage.matrix.constructor import identity_matrix
17
- from sage.matrix.all import Matrix
18
12
 
19
13
  cpdef integral_coordinates_in_box(bounds):
20
14
  """
@@ -8,7 +8,7 @@ Note: The structure of this class is based on ArithmeticSubgroupElement from sag
8
8
 
9
9
  """
10
10
  import sage
11
- from sage.groups.perm_gps.permgroup_element import is_PermutationGroupElement
11
+ from sage.groups.perm_gps.permgroup_element import PermutationGroupElement
12
12
  from sage.rings.real_mpfr import RealField
13
13
  from sage.structure.element cimport Element
14
14
  from sage.rings.all import Integer, CC
@@ -1625,7 +1625,7 @@ cdef class ComplexPlaneProductElement__class(Element):
1625
1625
 
1626
1626
 
1627
1627
  """
1628
- if not is_PermutationGroupElement(s):
1628
+ if not isinstance(s, PermutationGroupElement):
1629
1629
  raise ValueError("Input must be a permutation group element")
1630
1630
  znew = [0 for i in range(self._degree)]
1631
1631
  for i in range(self._degree):
@@ -0,0 +1,16 @@
1
+ # file generated by setuptools_scm
2
+ # don't change, don't track in version control
3
+ TYPE_CHECKING = False
4
+ if TYPE_CHECKING:
5
+ from typing import Tuple, Union
6
+ VERSION_TUPLE = Tuple[Union[int, str], ...]
7
+ else:
8
+ VERSION_TUPLE = object
9
+
10
+ version: str
11
+ __version__: str
12
+ __version_tuple__: VERSION_TUPLE
13
+ version_tuple: VERSION_TUPLE
14
+
15
+ __version__ = version = '0.1.2'
16
+ __version_tuple__ = version_tuple = (0, 1, 2)
@@ -5,7 +5,7 @@
5
5
  envlist = doctest, coverage, pycodestyle, relint, codespell, flake8
6
6
  skipsdist = true
7
7
  requires =
8
- tox>=3.18
8
+ tox>=4.12
9
9
 
10
10
  [testenv]
11
11
  setenv =
@@ -75,4 +75,10 @@ per-file-ignores =
75
75
  description =
76
76
  check for misspelled words in source code
77
77
  deps = flake8
78
- commands = flake8 {posargs:{toxinidir}/src/}
78
+ commands = flake8 {posargs:{toxinidir}/src/}
79
+
80
+ [testenv:rst]
81
+ description =
82
+ validate Python docstrings markup as reStructuredText
83
+ deps = flake8-rst-docstrings
84
+ commands = flake8 --select=RST {posargs:{toxinidir}/sage/}
@@ -1,5 +0,0 @@
1
- # coding: utf-8
2
- # file generated by setuptools_scm
3
- # don't change, don't track in version control
4
- __version__ = version = '0.1.1'
5
- __version_tuple__ = version_tuple = (0, 1, 1)