Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d1f66d6

Browse files
committed
pyparsing update, setuptools, and scipy mlab fix
svn path=/trunk/matplotlib/; revision=1917
1 parent 64baf87 commit d1f66d6

5 files changed

Lines changed: 325 additions & 37 deletions

File tree

CHANGELOG

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
2005-12-12 Updated pyparsing (mathtext now a bit faster) and minor
2+
fixes to scipy numerix and setuptools
3+
14
2005-12-12 Matplotlib data is now installed as package_data in
25
the matplotlib module. This gets rid of checking the
36
many possibilities in matplotlib._get_data_path() - CM

lib/matplotlib/numerix/mlab/__init__.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,46 @@ def std(m,axis=0):
3838
x = x - mx
3939
return sqrt(add.reduce(x*x,axis)/(n-1.0))
4040

41+
def cov(m,y=None, rowvar=0, bias=0):
42+
"""Estimate the covariance matrix.
43+
44+
If m is a vector, return the variance. For matrices where each row
45+
is an observation, and each column a variable, return the covariance
46+
matrix. Note that in this case diag(cov(m)) is a vector of
47+
variances for each column.
48+
49+
cov(m) is the same as cov(m, m)
50+
51+
Normalization is by (N-1) where N is the number of observations
52+
(unbiased estimate). If bias is 1 then normalization is by N.
53+
54+
If rowvar is zero, then each row is a variable with
55+
observations in the columns.
56+
"""
57+
if y is None:
58+
y = m
59+
else:
60+
y = y
61+
if rowvar:
62+
m = transpose(m)
63+
y = transpose(y)
64+
if (m.shape[0] == 1):
65+
m = transpose(m)
66+
if (y.shape[0] == 1):
67+
y = transpose(y)
68+
N = m.shape[0]
69+
if (y.shape[0] != N):
70+
raise ValueError, "x and y must have the same number of observations."
71+
m = m - mean(m,axis=0)
72+
y = y - mean(y,axis=0)
73+
if bias:
74+
fact = N*1.0
75+
else:
76+
fact = N-1.0
77+
#
78+
val = squeeze(dot(transpose(m),conjugate(y)) / fact)
79+
return val
80+
4181
def bartlett(M):
4282
"""bartlett(M) returns the M-point Bartlett window.
4383
"""

0 commit comments

Comments
 (0)