thouis / numpy-trac-migration

numpy Trac to github issues migration
2 stars 3 forks source link

cov fails with complex data (Trac #2137) #5933

Open numpy-gitbot opened 11 years ago

numpy-gitbot commented 11 years ago

Original ticket http://projects.scipy.org/numpy/ticket/2137 on 2012-05-20 by trac user mph, assigned to unknown.

The cov function fails with complex data due to line 1990 in function_base.py

X = array(m, ndmin=2, dtype=float)

For example, with a = np.array(((1, 2, 3),(1j, 2j, 3j)))

np.cov(a) gives

array([[ 1., 0.], [ 0., 0.]])

whereas the correct answer is

array([[ 1., -1.j], [ 1.j, 1.]])