[Numpy-discussion] Matrix square root

Bernard Frankpitt frankpit at erols.com
Sat Sep 6 07:28:02 EDT 2003

Andrew Nesbit wrote:

>Konrad Hinsen <hinsen at cnrs-orleans.fr> writes:
>>On Thursday 04 September 2003 16:42, Andrew Nesbit wrote:
>>>I need a function equivalent to Matlab's sqrtm, i.e., a square root
>>>for matrices
>>I'd use an eigenvalue decomposition, then take the square root of the 
>>eigenvalues, and then apply the diagonlization matrix in reverse. If you 
>>convert to eigenvalues to complex before taking the square root, this will 
>>work for non-positive-definite matrices, yielding a complex result
>Thankyou for the advice.  This gives me a good starting point.
The only problem with this approach is that you have to find all the 
eigenvalues and eigenvectors to get the spectral decomposition.  For 
large, poorly conditioned matrices this can be a source of significant 
errors, and a lot of work. An alternative, and often faster and more 
accurate approach is to use a series expansion for the square root. 
Evaluating the series expansion only requires multiplication.


More information about the NumPy-Discussion mailing list