[MATRIX-SIG] LinearAlgebra
Konrad Hinsen
hinsen@ibs.ibs.fr
Fri, 20 Feb 1998 17:48:54 +0100
Some you may have noticed that the routines in LinearAlgebra.py
are not the most efficient ones. I wrote most of it with small
systems in mind, leaving optimization for later. As usual, "later"
didn't arrive for a while...
One of the worst offenders are singular_value_decomposition and
generalized_inverse. Using these on big matrices can quickly eat up
all memory and more.
The good news is that I have better versions, and they work. The bad
news is that the new singular_value_decomposition is not fully
compatible with the old one (generalized_inverse is). I'd like to
know if the incompatibility is a problem for anyone or not; all
my applications turned out to be unaffected.
Here's what happens: The result of a singular value decomposition
consists of two orthonormal matrices and one diagonal matrix. The
diagonal matrix is returned as a vector of the diagonal elements. For
an NxM input matrix, one of the orthonormal matrices has size NxN and
the other MxM; both represent complete bases for their respective
vector spaces. However, for all applications I can think of, the
matrices need to be of size NxK and MxK only, where K = min(N, M),
because the singular vectors corresponding to singular values that are
exactly zero are not relevant. When M and N are very different, the
memory saving is important. So the optimization is to calculate and
return only the essential singular vectors instead of a complete
basis.
Does anyone have an application that would break with such a change?
One could always introduce a second singular value function with a
different name, of course, but it would probably create a bit of
confusion for new users.
--
-------------------------------------------------------------------------------
Konrad Hinsen | E-Mail: hinsen@ibs.ibs.fr
Laboratoire de Dynamique Moleculaire | Tel.: +33-4.76.88.99.28
Institut de Biologie Structurale | Fax: +33-4.76.88.54.94
41, av. des Martyrs | Deutsch/Esperanto/English/
38027 Grenoble Cedex 1, France | Nederlands/Francais
-------------------------------------------------------------------------------
_______________
MATRIX-SIG - SIG on Matrix Math for Python
send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
_______________