No subject

Thomas Schwaller et@appl-math.tu-muenchen.de
Thu, 16 Nov 1995 14:57:24 +0100

```Hi all,

when writing my first matrix algorithms I faced a "problem" of
"inconsistency" concerning matrices and vectors.

Suppose a naive user being used to Matlab, Scilab or octave.
He/she want's to to his/her first matrix computations:
a=Matrix([1,2,3],[2,3,4],[4,5,6])
b=ones(3)
Multiply(a,b)

Traceback (innermost last):
File "<stdin>", line 1, in ?
File "/home/et/Python-1.3/Lib/Matrix.py", line 114, in Multiply
Matrix.error: 1st dimension invalid

Aha he/she thinks, b ia a row vector. So let's transpose it
b=ones(3).transpose()

Traceback (innermost last):
File "<stdin>", line 1, in ?
Matrix.error: 1st dimension invalid

So wat the hell is going on here, (s)he thinks.
So let's try

b=ones(3, 1)
Multiply(a,b)

[[6.0], [9.0], [15.0]]

Ah yes, well let's compute a dot product of b and compare it with something:

if dot(b,b) == 3.0: print 'ok'
else : print 'not ok'

not ok

Hm..
print dot(b,b)

[3.0]

Ah, I see..

if dot(b,b)[0] == 3.0: print 'ok'
else : print 'not ok'

ok

At this point our potential user who heard really hot things about the python
matrix class will probably not use it anymore.

What can we do to change his/her opinion, because WE know it's still
a very hot topic and we all love it, don't we? :-)

###   END OF THE NIGHTMARE TALE
;;;;-))

TOM

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

send messages to: matrix-sig@python.org