Skip to content

Commit b1e6ccd

Browse files
authored
Merge pull request numpy#27830 from iMurfyD/legendre-polynomial-optimization
ENH: speedup evaluation of numpy.polynomial.legendre.legval.
2 parents 1489be4 + a7e6113 commit b1e6ccd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

numpy/polynomial/legendre.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -905,8 +905,8 @@ def legval(x, c, tensor=True):
905905
for i in range(3, len(c) + 1):
906906
tmp = c0
907907
nd = nd - 1
908-
c0 = c[-i] - (c1*(nd - 1))/nd
909-
c1 = tmp + (c1*x*(2*nd - 1))/nd
908+
c0 = c[-i] - c1*((nd - 1)/nd)
909+
c1 = tmp + c1*x*((2*nd - 1)/nd)
910910
return c0 + c1*x
911911

912912

0 commit comments

Comments
 (0)