[PYTHON MATRIX-SIG] IEEE exceptions, casting, matrix multiplies, and default types

James Hugunin jjh@mama-bear.lcs.mit.edu
Fri, 3 Nov 95 10:37:02 -0500


I'd like to generalize this discussion a little bit.  I've noticed four  
areas where the easiest solution would be to add a user-settable global  
variable to indicate a "desired" mode, yet I agree with Guido that as a  
general rule this is an extremely bad idea.

1) 1/0. returns Inf or raises exception

[Note: Matrix_i creates a matrix of ints, Matrix_d creates one of doubles]
2) Matrix_i(1,2,3) * Matrix_d(1.,2.,3.) == Matrix_d(1.,4.,6.) or raises exception

3) a * b is element-wise or is linear algebra style multiply

4) add([1,2,3], [4,5,6]) == Matrix_?(5,7,9) where the question is what the  
? should be.

I'm busy this morning getting the 0.11 release of the matrixobject  
together, so I don't have time for much more comment, I just wanted to point  
out that this is a very general question (in particular when thinking about  
matrices), and if we're really lucky there might be a nice general purpose  
answer.

-Jim

=================
MATRIX-SIG  - SIG on Matrix Math for Python

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