[Numpy-discussion] expm

Kevin Jacobs <jacobs@bioinformed.com> bioinformed at gmail.com
Fri Jul 20 14:45:43 EDT 2007

On 7/20/07, Nils Wagner <nwagner at iam.uni-stuttgart.de> wrote:
> Your sqrtm_eig(x) function won't work if x is defective.
> See test_defective.py for details.

I am aware, though at least on my system, the SVD-based method is by far the
fastest and robust (and can be made more robust by the addition of a
relative condition number threshold).  The eig version was included mainly
for comparison.

Have you considered the algorithms proposed by
> Nick Higham for various matrix functions ?
> http://www.maths.manchester.ac.uk/~higham/pap-mf.html

Yep.  He is one of my heros.  The downside is that direct Python
implementations of many of his algorithms will almost always be
significantly slower than using algorithms that leave the heavy-lifting to
LAPACK.  This is certainly the case for the current sqrtm and expm code.
Even in the Python domain, there is significant room to optimize the current
sqrtm implementation, since one of the key inner loops can be trivially
vectorized.  I'll certainly give that a shot and add it to my next round of
benchmarks.  However, I'm not sure that I want to commit to going to the
next level by developing and maintaining a C implementation of sqrtm.  While
it has the potential to achieve near-optimal performance for that method, we
may be reaching the point of diminishing returns for my needs.  I certainly
won't complain if someone else is willing to do so.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20070720/4f4614e5/attachment.html>

More information about the NumPy-Discussion mailing list