[SciPy-user] Matrix sign function
Nils Wagner
nwagner at mecha.uni-stuttgart.de
Wed Sep 24 07:40:19 EDT 2003
Pearu Peterson schrieb:
>
> On Wed, 24 Sep 2003, Nils Wagner wrote:
>
> > It would be nice to have the matrix sign function in scipy.
>
> Try the following:
>
> signm=lambda a:linalg.funm(a,lambda v:sign(v)+0j)
>
> This assumes that `a` has real eigenvalues. Otherwise one most use some
> other sign function that is properly defined for complex values, the
> current sign is acctually
> v |-> sign(real(v))
>
> Pearu
>
To account for complex values, a generalized sign matrix can be defined
as follows
sign(v) = \left\{ \begin{array}{c} 1 \Re v > 0 \\ 0 \Re v = 0 \\ -1 \Re
v < 0 \end{array}\right.
Details are given in the reference (previous e-mail). Anyway, I think
scipy should have a generalized
sign function as well.
A suitable test case is the following matrix
array([[ 29.2, -24.2, 69.5, 49.8, 7. ],
[ -9.2, 5.2, -18. , -16.8, -2. ],
[-10. , 6. , -20. , -18. , -2. ],
[ -9.6, 9.6, -25.5, -15.4, -2. ],
[ 9.8, -4.8, 18. , 18.2, 2. ]])
Any suggestion for the implementation of a generalized matrix sign
function ?
BTW, Davies and Higham have published an interesting paper on matrix
functions. They have improved Matlab's function funm.
Davies, P.~I., Higham, N.~J.
A Schur-Parlett algorithm for computing matrix functions,
SIAM Journal Matrix Analysis and Applications, Vol. 25 No.2 pp. 464-485
Nils
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.net
> http://www.scipy.net/mailman/listinfo/scipy-user
More information about the SciPy-User
mailing list