Wednesday, May 6, 2009

wxpython with python 2.6 crashes in Windows Vista

Solution found in: http://www.python-forum.org/pythonforum/viewtopic.php?f=4&t=11331#p54621

To fix this, do the following:

* Make a copy of python.exe
* Use that copy(!) to run 'update_manifest.py' that wxPython installed in you python folder

The problem is that by default a wrong DLL version is loaded, this causes crashes in the wxWidget C++ code. In Python 2.5 and earlier the presence of the python.exe.manifest (installed by wxPython) was enough to fix this, but Python 2.6 is compiled with internal manifests, so external manifest don't work. The script will update the internal manifest so the right DLL is loaded.

You need to use a copy of python.exe to execute the script, because otherwise the program is in use and cannot be updated. After updating the manifest the program should no longer crash on mouse-events (worked for me).

Friday, May 1, 2009

MATLAB: Multiplying with a Matrix Inverse

M-Lint has detected a call to inv in a multiplication operation.
The inverse of a matrix is primarily of theoretical value, and rarely finds any use in practical computations. Never use it to solve a linear system Ax=b with x=inv(A)*b, because it is slow and inaccurate.

Suggested Action
Instead of multiplying the matrix by its inverse, use matrix right division (/) or matrix left division (\). That is:
Replace inv(A)*b with A\b
Replace b*inv(A) with b/A
Frequently, an application needs to solve a series of related linear systems Ax=b, where A does not change, but b does. In this case, use lu, chol, or qr instead of inv, depending on the matrix type.