summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--numpy/polynomial/chebyshev.py6
-rw-r--r--numpy/polynomial/hermite.py6
-rw-r--r--numpy/polynomial/hermite_e.py6
-rw-r--r--numpy/polynomial/laguerre.py6
-rw-r--r--numpy/polynomial/legendre.py6
-rw-r--r--numpy/polynomial/polynomial.py6
6 files changed, 18 insertions, 18 deletions
diff --git a/numpy/polynomial/chebyshev.py b/numpy/polynomial/chebyshev.py
index ab4c96a54..6fbd5d346 100644
--- a/numpy/polynomial/chebyshev.py
+++ b/numpy/polynomial/chebyshev.py
@@ -541,12 +541,12 @@ def chebfromroots(roots) :
else :
[roots] = pu.as_series([roots], trim=False)
roots.sort()
- n = len(roots)
p = [chebline(-r, 1) for r in roots]
+ n = len(p)
while n > 1:
- m = n//2
+ m, r = divmod(n, 2)
tmp = [chebmul(p[i], p[i+m]) for i in range(m)]
- if n%2:
+ if r:
tmp[0] = chebmul(tmp[0], p[-1])
p = tmp
n = m
diff --git a/numpy/polynomial/hermite.py b/numpy/polynomial/hermite.py
index 32b50a866..229ac26db 100644
--- a/numpy/polynomial/hermite.py
+++ b/numpy/polynomial/hermite.py
@@ -288,12 +288,12 @@ def hermfromroots(roots) :
else :
[roots] = pu.as_series([roots], trim=False)
roots.sort()
- n = len(roots)
p = [hermline(-r, 1) for r in roots]
+ n = len(p)
while n > 1:
- m = n//2
+ m, r = divmod(n, 2)
tmp = [hermmul(p[i], p[i+m]) for i in range(m)]
- if n%2:
+ if r:
tmp[0] = hermmul(tmp[0], p[-1])
p = tmp
n = m
diff --git a/numpy/polynomial/hermite_e.py b/numpy/polynomial/hermite_e.py
index 0511307a4..ba41a4fc0 100644
--- a/numpy/polynomial/hermite_e.py
+++ b/numpy/polynomial/hermite_e.py
@@ -288,12 +288,12 @@ def hermefromroots(roots) :
else :
[roots] = pu.as_series([roots], trim=False)
roots.sort()
- n = len(roots)
p = [hermeline(-r, 1) for r in roots]
+ n = len(p)
while n > 1:
- m = n//2
+ m, r = divmod(n, 2)
tmp = [hermemul(p[i], p[i+m]) for i in range(m)]
- if n%2:
+ if r:
tmp[0] = hermemul(tmp[0], p[-1])
p = tmp
n = m
diff --git a/numpy/polynomial/laguerre.py b/numpy/polynomial/laguerre.py
index 866aab5c4..4401b5414 100644
--- a/numpy/polynomial/laguerre.py
+++ b/numpy/polynomial/laguerre.py
@@ -284,12 +284,12 @@ def lagfromroots(roots) :
else :
[roots] = pu.as_series([roots], trim=False)
roots.sort()
- n = len(roots)
p = [lagline(-r, 1) for r in roots]
+ n = len(p)
while n > 1:
- m = n//2
+ m, r = divmod(n, 2)
tmp = [lagmul(p[i], p[i+m]) for i in range(m)]
- if n%2:
+ if r:
tmp[0] = lagmul(tmp[0], p[-1])
p = tmp
n = m
diff --git a/numpy/polynomial/legendre.py b/numpy/polynomial/legendre.py
index b76e678c2..9470865a8 100644
--- a/numpy/polynomial/legendre.py
+++ b/numpy/polynomial/legendre.py
@@ -315,12 +315,12 @@ def legfromroots(roots) :
else :
[roots] = pu.as_series([roots], trim=False)
roots.sort()
- n = len(roots)
p = [legline(-r, 1) for r in roots]
+ n = len(p)
while n > 1:
- m = n//2
+ m, r = divmod(n, 2)
tmp = [legmul(p[i], p[i+m]) for i in range(m)]
- if n%2:
+ if r:
tmp[0] = legmul(tmp[0], p[-1])
p = tmp
n = m
diff --git a/numpy/polynomial/polynomial.py b/numpy/polynomial/polynomial.py
index c8894c68e..7a5d3dbd5 100644
--- a/numpy/polynomial/polynomial.py
+++ b/numpy/polynomial/polynomial.py
@@ -187,12 +187,12 @@ def polyfromroots(roots) :
else :
[roots] = pu.as_series([roots], trim=False)
roots.sort()
- n = len(roots)
p = [polyline(-r, 1) for r in roots]
+ n = len(p)
while n > 1:
- m = n//2
+ m, r = divmod(n, 2)
tmp = [polymul(p[i], p[i+m]) for i in range(m)]
- if n%2:
+ if r:
tmp[0] = polymul(tmp[0], p[-1])
p = tmp
n = m