|
35 | 35 | from sage.geometry.polyhedron.constructor import Polyhedron
|
36 | 36 |
|
37 | 37 |
|
38 |
| -def ZZ_points_of_bounded_height(dim, bound, normalize=False): |
39 |
| - yield [] |
| 38 | +def ZZ_points_of_bounded_height(dim, bound): |
| 39 | + r""" |
| 40 | + Return an iterator of the points in ``self`` of absolute multiplicative |
| 41 | + height of at most ``bound`` in the rational field. |
| 42 | +
|
| 43 | + INPUT: |
| 44 | +
|
| 45 | + - ``dim`` -- a positive integer |
| 46 | +
|
| 47 | + - ``bound`` -- a positive integer |
| 48 | +
|
| 49 | + OUTPUT: |
| 50 | +
|
| 51 | + - an iterator of points of bounded height |
| 52 | +
|
| 53 | + EXAMPLES: |
| 54 | +
|
| 55 | + sage: from sage.schemes.projective.proj_bdd_height import ZZ_points_of_bounded_height |
| 56 | + sage: sorted(list(ZZ_points_of_bounded_height(1, 1))) |
| 57 | + [(-1 : -1), (-1 : 0), (-1 : 1), (0 : -1), (0 : 1), (1 : -1), (1 : 0), (1 : 1)] |
| 58 | + sage: len(list(ZZ_points_of_bounded_height(1, 5))) |
| 59 | + 80 |
| 60 | + sage: sorted(list(ZZ_points_of_bounded_height(1, 2))) |
| 61 | + [(-2 : -1), (-2 : 1), (-1 : -2), (-1 : -1), |
| 62 | + (-1 : 0), (-1 : 1), (-1 : 2), (0 : -1), |
| 63 | + (0 : 1), (1 : -2), (1 : -1), (1 : 0), |
| 64 | + (1 : 1), (1 : 2), (2 : -1), (2 : 1)] |
| 65 | +
|
| 66 | + There are no points of negative height:: |
| 67 | +
|
| 68 | + sage: from sage.schemes.projective.proj_bdd_height import ZZ_points_of_bounded_height |
| 69 | + sage: list(ZZ_points_of_bounded_height(1, -3)) |
| 70 | + [] |
| 71 | + """ |
| 72 | + if bound < 1: |
| 73 | + return iter(set([])) |
| 74 | + |
| 75 | + PN = ProjectiveSpace(ZZ, dim) |
| 76 | + |
| 77 | + for i in range(-bound, bound + 1): |
| 78 | + for j in range(-bound, bound + 1): |
| 79 | + if gcd(i, j) == 1: |
| 80 | + yield PN((i, j)) |
40 | 81 |
|
41 | 82 |
|
42 | 83 | def QQ_points_of_bounded_height(dim, bound, normalize=False):
|
@@ -218,20 +259,14 @@ def points_of_bounded_height(PN, K, dim, bound, prec=53, normalize=False):
|
218 | 259 | (-1 : 0 : 1), (1 : 0 : 1), (1 : 1 : 0), (-1 : 1 : 0), (-1 : -1 : 1),
|
219 | 260 | (-1 : 1 : 1), (1 : -1 : 1), (1 : 1 : 1)]
|
220 | 261 |
|
221 |
| - :: |
222 |
| -
|
223 |
| - sage: P.<z,w> = ProjectiveSpace(ZZ, 1) |
224 |
| - sage: sorted(list(P.points_of_bounded_height(bound=2))) |
225 |
| - [] |
226 |
| -
|
227 | 262 | ::
|
228 | 263 |
|
229 | 264 | sage: R.<x> = QQ[]
|
230 | 265 | sage: K.<a> = NumberField(3*x^2 + 1)
|
231 | 266 | sage: O = K.maximal_order()
|
232 | 267 | sage: P.<z,w> = ProjectiveSpace(O, 1)
|
233 |
| - sage: sorted(list(P.points_of_bounded_height(bound=2))) |
234 |
| - [] |
| 268 | + sage: len(list(P.points_of_bounded_height(bound=2))) |
| 269 | + 44 |
235 | 270 | """
|
236 | 271 | if bound < 1:
|
237 | 272 | return iter([])
|
|
0 commit comments