[PYTHON MATRIX-SIG] NumPy 1.0b2: first comments

Konrad Hinsen hinsen@ibs.ibs.fr
Fri, 21 Mar 1997 10:08:22 +0100

Yesterday I did a quick installation and a few tests on the new NumPy.
Here are some first comments.

- The installation instructions are missing in the archive.

- During installation, compileall.py reports syntax error in UserArray,
  although it can later be imported without an error message. I have no
  idea how this can happen...

- Complex arrays are not printed correctly:
     >>> 1+0j
     >>> array([1+0j])
     array([ 1+j ])
  (In case anyone reports that the complex test code in LinearAlgebra.py
   fails: it doesn't; it's just wrong printing of the results.)

  Here's a quick fix. It may not produce totally correct formatting
  (I didn't check thoroughly), but at least it prints correct values.
  Replace the following function in ArrayPrinter.py:

def _formatComplex(x, real_format, imag_format):
	r = _formatFloat(x.real, real_format)
	i = _formatFloat(x.imag, imag_format, 0)
	if imag_format[-1] == 'f':
		zeros = len(i)
		while zeros > 2 and i[zeros-1] == '0': zeros = zeros-1
		i = i[:zeros] + 'j' + (len(i)-zeros)*' '
		i = i + 'j'
	return r + i

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