summaryrefslogtreecommitdiff
path: root/numpy/lib/function_base.py
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2015-10-05 14:42:01 -0600
committerCharles Harris <charlesr.harris@gmail.com>2015-10-05 14:42:01 -0600
commit09c958b0100860db9549a17b6d1684f3c9fb8885 (patch)
treefaa3006ed2398099c22e232ffa02e658cf6c5123 /numpy/lib/function_base.py
parentd5bde029dea303093ecd1f1190c5fb5a478fb414 (diff)
parentcd212173210a59ff34aa4edd3308bc520ee3e974 (diff)
downloadnumpy-09c958b0100860db9549a17b6d1684f3c9fb8885.tar.gz
Merge pull request #6411 from larsmans/cov-memory-use
ENH: speed up cov by ~10% for large arrays
Diffstat (limited to 'numpy/lib/function_base.py')
-rw-r--r--numpy/lib/function_base.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py
index e3c2cd193..b09dcad15 100644
--- a/numpy/lib/function_base.py
+++ b/numpy/lib/function_base.py
@@ -2269,7 +2269,7 @@ def cov(m, y=None, rowvar=1, bias=0, ddof=None, fweights=None, aweights=None):
# Determine the normalization
if w is None:
- fact = float(X.shape[1] - ddof)
+ fact = X.shape[1] - ddof
elif ddof == 0:
fact = w_sum
elif aweights is None:
@@ -2287,7 +2287,7 @@ def cov(m, y=None, rowvar=1, bias=0, ddof=None, fweights=None, aweights=None):
else:
X_T = (X*w).T
c = dot(X, X_T.conj())
- c /= fact
+ c *= 1. / np.float64(fact)
return c.squeeze()