Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/sage/schemes/elliptic_curves/ell_curve_isogeny.py
Original file line number Diff line number Diff line change
Expand Up @@ -2244,11 +2244,10 @@ def __init_kernel_polynomial_velu(self):
else:
invX = x

psi = poly_ring.one()
for xQ in self.__kernel_mod_sign.keys():
psi *= x - invX(xQ)
from sage.misc.misc_c import prod
psi = prod([x - invX(xQ) for xQ in self.__kernel_mod_sign.keys()]) # building the list is not redundant; this is slightly faster
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

really? prod delegates to iterator_prod if the input is a generator. Where does the overhead come from?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually the overhead might be because Python can inline the list comprehension, but not the generator expression.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesnt prod use a binary tree for the product when given a list?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Last time I checked, the difference was that passing an iterator makes it use a different (suboptimal) tree structure since the total length is not a priori known.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at it again, I'm not sure if that is the reason: iterator_prod() does promise that the tree will be balanced... So you might be right, @user202729.


self.__kernel_polynomial = psi
self.__kernel_polynomial = poly_ring(psi)

###################################
# Kohel's Variant of Velu's Formula
Expand Down
Loading