[PYTHON MATRIX-SIG] Some notes on the matrix class

Hinsen Konrad hinsenk@ere.umontreal.ca
Thu, 2 Nov 1995 10:10:08 -0500

   random numbers so is slow.  If somebody with a good random number generator  
   in C would like to add this to matrixmodule.c as a new instantiation method  
   in C, I'd use it.

There is no shortage of random number generators in C, although I can't
find one right now on my disk...

   (I also added a concat method noticing that I was missing this other  
   functionality of lists).

Good. I was just about to ask for it...

   There has been a small amount of talk about the possibilty of having  
   "boolean types" in addition to number, sequence, and mapping types that  

I don't see the advantage in a language like Python. In a type-checked
compiled language, a boolean type makes sense, but in Python integers
are just as good and even more useful since you can use the results
of logical operations in arithmetic expressions.

On the other hand, I agree it would be nice (*very* nice) to be able
to define comparison operators that return matrix objects...

   You raise another interesting issue here that I've completely ignored in  
   the matrix object so far.  Numeric exceptions are not handled at all; in  
   return, matrix math executes at the speed of compiled code.  However, it  

I must say that I am not entirely happy with the fact tht Python uses
exceptions for floating point operations at all. In terms of speed and
versatility, I prefer to have IEEE-style operations that simply return
NaN or one of the infinities as the result of an "impossible"
operation. Of course there should be functions to check for these
special results. Such a strategy would be easily generalizable to
matrices, and on systems with IEEE implementations in hardware
(practically all computers on the market now) it would not cause
any speed penalty.

   rummaging around in Grammer and compile.c, Guido also mentioned that he'd be  
   willing to let a**b <--> pow(a, b) into the syntax.  This also seems like  
   an easy hack for someone with the right know-how, and would be a nice bonus  
   for numerical code.

I'd love that. And once we are discussing syntax, I'd also love to have
a concise input notation for complex numbers...

Konrad Hinsen                     | E-Mail: hinsenk@ere.umontreal.ca
Departement de chimie             | Tel.: +1-514-343-6111 ext. 3953
Universite de Montreal            | Fax:  +1-514-343-7586
C.P. 6128, succ. Centre-Ville     | Deutsch/Esperanto/English/Nederlands/
Montreal (QC) H3C 3J7             | Francais (phase experimentale)

MATRIX-SIG  - SIG on Matrix Math for Python

send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org