From: <mme...@us...> - 2008-04-29 13:35:52
|
Revision: 5096 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5096&view=rev Author: mmetz_bn Date: 2008-04-29 06:35:47 -0700 (Tue, 29 Apr 2008) Log Message: ----------- fixed bug in mlab.sqrtm; numpy.linalg.eig behaves different than Numeric did Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/lib/matplotlib/mlab.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2008-04-29 13:21:48 UTC (rev 5095) +++ trunk/matplotlib/CHANGELOG 2008-04-29 13:35:47 UTC (rev 5096) @@ -1,3 +1,5 @@ +2008-04-29 Fix bug in mlab.sqrtm - MM + 2008-04-28 Fix bug in SVG text with Mozilla-based viewers (the symbol tag is not supported) - MGD Modified: trunk/matplotlib/lib/matplotlib/mlab.py =================================================================== --- trunk/matplotlib/lib/matplotlib/mlab.py 2008-04-29 13:21:48 UTC (rev 5095) +++ trunk/matplotlib/lib/matplotlib/mlab.py 2008-04-29 13:35:47 UTC (rev 5096) @@ -1901,7 +1901,7 @@ def sqrtm(x): """ Returns the square root of a square matrix. - This means that s=sqrtm(x) implies s*s = x. + This means that s=sqrtm(x) implies dot(s,s) = x. Note that s and x are matrices. """ return mfuncC(npy.sqrt, x) @@ -1914,9 +1914,10 @@ """ x = npy.asarray(x) - (v, u) = npy.linalg.eig(x) - uT = u.transpose() + (v,uT) = npy.linalg.eig(x) V = npy.diag(f(v+0j)) + # todo: warning: this is not exactly what matlab does + # MATLAB "B/A is roughly the same as B*inv(A)" y = npy.dot(uT, npy.dot(V, npy.linalg.inv(uT))) return approx_real(y) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |