[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]])

Thanks

Stuart

-- 

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



More information about the Tutor mailing list