Skip to content

Commit

Permalink
[3.12] Small speed-up for the convolve() recipe. (pythonGH-106371) (p…
Browse files Browse the repository at this point in the history
  • Loading branch information
miss-islington authored Jul 3, 2023
1 parent ddff473 commit 67127ca
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Doc/library/itertools.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1085,8 +1085,8 @@ The following recipes have a more mathematical flavor:
kernel = tuple(kernel)[::-1]
n = len(kernel)
padded_signal = chain(repeat(0, n-1), signal, repeat(0, n-1))
for window in sliding_window(padded_signal, n):
yield math.sumprod(kernel, window)
windowed_signal = sliding_window(padded_signal, n)
return map(math.sumprod, repeat(kernel), windowed_signal)

def polynomial_from_roots(roots):
"""Compute a polynomial's coefficients from its roots.
Expand Down

0 comments on commit 67127ca

Please sign in to comment.