[PYTHON MATRIX-SIG] Array comparisons, and determinants

Konrad Hinsen hinsen@ibs.ibs.fr
Fri, 25 Oct 96 12:01:44 +0100


> Inequalities are often generalised to work for vectors and matrices.  For
> example, x>=0 where x is a vector means x[i]>=0 for every i.

With such a definition, you could have an x for which both x > 0 and
x <=0 0 are false. But the __cmp__ function has to decide cleanly
between equal, greater, and less - there is nothing in between.

> However, (and this is where I may be missing something obvious, or
> something that is there already and I haven't understood), has anyone
> considered adopting the Matlab convention: the result of A>=0 for any
> array would be a boolean array of the same shape as A, and this could be
> reduced to give the behaviour corresponding to x>=0 above if that is what
> is wanted.

This is what the functions equal(), greater() etc. do. For the comparison
operators this doesn't work, since they have to return a single integer
(otherwise things like 'and' and 'or' wouldn't work the way they do now).

> There are much faster ways of calculating a determinant than taking the
> product of its eigenvalues, for example by doing a single LR decomposition

True, and if you submit a working replacement we will all be very happy.
I might do it if I find the time, but time is one of the things I am
a bit short of right now; the French government imposes a limit of
24h a day ;-)

Konrad.
-- 
-------------------------------------------------------------------------------
Konrad Hinsen                          | E-Mail: hinsen@ibs.ibs.fr
Laboratoire de Dynamique Moleculaire   | Tel.: +33-76.88.99.28
Institut de Biologie Structurale       | Fax:  +33-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
=================