File tree 2 files changed +6
-3
lines changed
2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change
1
+ 2008-04-29 Fix bug in mlab.sqrtm - MM
2
+
1
3
2008-04-28 Fix bug in SVG text with Mozilla-based viewers (the symbol
2
4
tag is not supported) - MGD
3
5
Original file line number Diff line number Diff line change @@ -1901,7 +1901,7 @@ def rank(x):
1901
1901
def sqrtm (x ):
1902
1902
"""
1903
1903
Returns the square root of a square matrix.
1904
- This means that s=sqrtm(x) implies s*s = x.
1904
+ This means that s=sqrtm(x) implies dot(s,s) = x.
1905
1905
Note that s and x are matrices.
1906
1906
"""
1907
1907
return mfuncC (npy .sqrt , x )
@@ -1914,9 +1914,10 @@ def mfuncC(f, x):
1914
1914
"""
1915
1915
1916
1916
x = npy .asarray (x )
1917
- (v , u ) = npy .linalg .eig (x )
1918
- uT = u .transpose ()
1917
+ (v ,uT ) = npy .linalg .eig (x )
1919
1918
V = npy .diag (f (v + 0j ))
1919
+ # todo: warning: this is not exactly what matlab does
1920
+ # MATLAB "B/A is roughly the same as B*inv(A)"
1920
1921
y = npy .dot (uT , npy .dot (V , npy .linalg .inv (uT )))
1921
1922
return approx_real (y )
1922
1923
You can’t perform that action at this time.
0 commit comments