[PYTHON MATRIX-SIG] Matrix

Konrad Hinsen hinsen@ibs.ibs.fr
Mon, 16 Sep 96 16:24:54 +0100


> Python 1.4b3 (Sep 13 1996) [C]
> Copyright 1991-1996 Stichting Mathematisch Centrum, Amsterdam
> >>> import ni,Numeric
> >>> from Numeric.Matrix import *
> >>> qq=Matrix([[12,21],[323,3434]]) 
> >>> qq
> Matrix  21
>  323 3434
> 
> This looks strange to me. I also tried 

The following line in UserArray.py is responsible for this rubbish:

    def __repr__(self):
	return self.name+str(self.array)[5:] #Hack, will break if repr for array changes

As the comment says, this has broken... As an immediate replacement,
I suggest:

    def __repr__(self):
	return self.name + '\n' + str(self.array)

This will print "Matrix" and the data starting from the next line.
In the long run, someone should think about (and implement) a nicer
way to print matrices to make them look distinct from arrays, e.g.
a border around it or whatever.

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, Ave. 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
=================