summaryrefslogtreecommitdiff
path: root/numpy/lib/function_base.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/lib/function_base.py')
-rw-r--r--numpy/lib/function_base.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py
index efa51173a..91034ef37 100644
--- a/numpy/lib/function_base.py
+++ b/numpy/lib/function_base.py
@@ -2389,11 +2389,17 @@ def cov(m, y=None, rowvar=True, bias=False, ddof=None, fweights=None,
# Handles complex arrays too
m = np.asarray(m)
+ if m.ndim > 2:
+ raise ValueError("m has more than 2 dimensions")
+
if y is None:
dtype = np.result_type(m, np.float64)
else:
y = np.asarray(y)
+ if y.ndim > 2:
+ raise ValueError("y has more than 2 dimensions")
dtype = np.result_type(m, y, np.float64)
+
X = array(m, ndmin=2, dtype=dtype)
if rowvar == 0 and X.shape[0] != 1:
X = X.T