[SciPy-User] raising a matrix to float power

josef.pktd@gmai... josef.pktd@gmai...
Sat Jul 10 18:45:36 CDT 2010


On Sat, Jul 10, 2010 at 7:39 PM, Sturla Molden <sturla@molden.no> wrote:
> Alexey Brazhe skrev:
>> Hi,
>> I failed to find a way to raise a matrix to a non-integer power in
>> numpy/scipy
>>
>> In Octave/Matlab, one would write M^0.5 to get the result
>> whereas in numpy
>> >>> maxtrix(M, 0.5)
>> raises the "TypeError: exponent must be an integer"
>>
>> Is there a way to do matrix exponentiation to non-integer powers in
>> numpy or scipy?
>>
>> Hope the answer is positive :)
> Sure, M**0.5 is cho_factor(M). For other non-integers I am not sure what
> matrix exponentiation could possibly mean.
>
> Are you sure you don't mean array exponentiation?

scipy linalg  has several matrix functions 'expm', 'expm2', 'expm3',
'sqrtm', 'logm'

'sqrtm'   solves  dot(B,B) = A  not dot(B.T,B) = A

Besides cholesky, I use eigenvector decomposition to get the powers
and other functions.

Josef

>
> Sturla
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>


More information about the SciPy-User mailing list