Skip to content

Commit a05b246

Browse files
committed
Refactor pair_with method in DivisorsElement class for improved logic and clarity
1 parent d5bd3ae commit a05b246

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

darmonpoints/divisors.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ def __setitem__(self, P, val):
251251
self._ptdict[P] = val
252252

253253
def pair_with(self, D):
254+
assert D.degree() == 0
254255
rat = self.rational_function(as_map=True)
255256
return prod((rat(P) ** n for P, n in D), self.parent().base_ring()(1)).log(0)
256257

@@ -259,9 +260,12 @@ def rational_function(self, as_map=False, z=None):
259260
return lambda z: prod(((1 - z / P) ** n for P, n in self), z.parent()(1))
260261
else:
261262
if z is None:
262-
K = self.parent()._field
263+
K = self.parent().base()
264+
if hasattr(K, 'base_field'):
265+
K = K.base_field()
263266
z = K["z"].gen()
264-
return prod(((1 - z / P) ** n for P, n in self), z.parent()(1))
267+
# return prod(((1 - z / P) ** n for P, n in self), z.parent()(1))
268+
return prod(((z - P) ** n for P, n in self), z.parent()(1))
265269

266270
def as_list_of_differences(self):
267271
if self.degree() != 0:

0 commit comments

Comments
 (0)