[Numpy-discussion] numarray cov function

John Hunter jdhunter at ace.bsd.uchicago.edu
Sun Aug 13 16:02:13 EDT 2006


I was surprised to see that numarray.mlab.cov is returning a rank-0
complex number when given two 1D arrays as inputs rather than the
standard 2x2 covariance array I am used to seeing.  Is this a feature
or a bug?  


In [2]: import numarray.mlab as nam

In [3]: x = nam.rand(10)

In [4]: y = nam.rand(10)  

In [5]: nam.cov(x, y)
Out[5]: array((0.014697855954587828+0j))

In [6]: import numpy.oldnumeric.mlab as npm

In [7]: x = npm.rand(10)

In [8]: y = npm.rand(10)

In [9]: npm.cov(x, y)
Out[9]: 
array([[ 0.13243082,  0.0520454 ],
       [ 0.0520454 ,  0.07435816]])

In [10]: import numarray

In [11]: numarray.__version__
Out[11]: '1.3.3'

In [12]: import numpy

In [13]: numpy.__version__
Out[13]: '1.0b2.dev2999'




More information about the NumPy-Discussion mailing list