# [SciPy-User] raising a matrix to float power

Alexey Brazhe brazhe@gmail....
Sun Jul 11 12:54:01 CDT 2010

```Thank you for explanation. I must admit, I know very little linear algebra
:(

On Sun, Jul 11, 2010 at 9:41 PM, Charles R Harris <charlesr.harris@gmail.com
> wrote:

>
>
> On Sun, Jul 11, 2010 at 11:31 AM, Alexey Brazhe <brazhe@gmail.com> wrote:
>
>> Seems to be, but not for any matrix:
>>
>> #-----------------
>>
>> def mpower(M, p):
>>     "Matrix exponentiation"
>>     e,EV = linalg.eigh(M)
>>     return dot(EV.T,
>>                dot(diag((e)**p), EV))
>>
>> m = array([[1.0,2.0], [3.0,4.0]])
>>
>> then dot(m.T,m) does equal mpower(mpower(dot(m.T,m), 0.5), 2.0)
>>
>> But mpower(mpower(m,0.5),2) doesn't equal m!
>>
>>
> For this algorithm the matrix needs to be Hermitean, which is the case for
> W^T W. More generally, the matrix needs to be normal, i.e., commute with
> it's transpose. A matrix can be diagonalized iff it is normal.
>
> <snip>
>
> Chuck
>
>
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20100711/6bf7ce3f/attachment.html
```