[Tutor] Unity matrix

Stuart Murdock s.e.murdock at soton.ac.uk
Tue Sep 28 20:31:31 CEST 2004

Hi python dudes,

Does anyone know if there is a builtin to numarray (or an add on ) to 
give me a unity matrix. It would look better than
trying to add ones along the diagonal of a zeros.

I want something like

A = unity((2))

to produce the same as

A = array([[1 0],[0,1]])




Stuart Murdock Ph.D,
Research Fellow,
Dept. of Chemistry / E-Science,
University of Southampton,
Highfield, Southampton,
SO17 1BJ, United Kingdom

More information about the Tutor mailing list