MATLAB is standard, numpy equivalent to the post-transpose calculation
>> x = [2,0,-1.4;2.2,0.2,-1.5;2.4,0.1,-1;1.9,0,-1.2]
x =
2.0000 0-1.4000
2.2000 0.2000-1.5000
2.4000 0.1000-1.0000
1.9000 0-1.2000
>> CoV (x)
Ans =
0.0492 0.0142 0.0192
0.0142 0.0092-0.0058
0.0192-0.0058 0.0492
>> xt=x '
XT =
2.0000 2.2000 2.4000 1.9000
0 0.2000 0.1000 0
-1.4000-1.5000-1.0000-1.2000
>> CoV (XT)
Ans =
2.9200 3.1600 2.9500 2.6700
3.1600 3.4300 3.1750 2.8850
2.9500 3.1750 3.0100 2.7050
2.6700 2.8850 2.7050 2.4433
Np.array (x). T
Array ([[2., 2.2, 2.4, 1.9],
[0., 0.2, 0.1, 0.],
[-1.4,-1.5,-1.,-1.2]])
>>> Print (Np.cov (Np.array (x). T))
[[0.04916667 0.01416667 0.01916667]
[0.01416667 0.00916667-0.00583333]
[0.01916667-0.00583333 0.04916667]]
Np.array (x)
Array ([[2., 0.,-1.4],
[2.2, 0.2,-1.5],
[2.4, 0.1,-1.],
[1.9, 0.,-1.2]])
>>> Print (Np.cov (Np.array (x)))
[[2.92 3.16 2.95 2.67]
[3.16 3.43 3.175 2.885]
[2.95 3.175 3.01 2.705]
[2.67 2.885 2.705 2.44333333]]
NumPy and Matlab Calculate the difference of covariance matrices (matlab is standard, numpy equivalent to post-transpose calculation)