Skip to content

Commit

Permalink
Refactor pair_with method in DivisorsElement class for improved logic…
Browse files Browse the repository at this point in the history
… and clarity
  • Loading branch information
mmasdeu committed Jan 15, 2025
1 parent d5bd3ae commit a05b246
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions darmonpoints/divisors.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ def __setitem__(self, P, val):
self._ptdict[P] = val

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

Expand All @@ -259,9 +260,12 @@ def rational_function(self, as_map=False, z=None):
return lambda z: prod(((1 - z / P) ** n for P, n in self), z.parent()(1))
else:
if z is None:
K = self.parent()._field
K = self.parent().base()
if hasattr(K, 'base_field'):
K = K.base_field()
z = K["z"].gen()
return prod(((1 - z / P) ** n for P, n in self), z.parent()(1))
# return prod(((1 - z / P) ** n for P, n in self), z.parent()(1))
return prod(((z - P) ** n for P, n in self), z.parent()(1))

def as_list_of_differences(self):
if self.degree() != 0:
Expand Down

0 comments on commit a05b246

Please sign in to comment.