next up previous
Next: Complex conjugate Up: A sampling of useful Previous: Inserting diagonal elements

Identity matrix

The identity or unit matrix in numpy is easily constructed:

>>> print(np.identity(4))
[[ 1.  0.  0.  0.]
 [ 0.  1.  0.  0.]
 [ 0.  0.  1.  0.]
 [ 0.  0.  0.  1.]]



Carleton DeTar 2018-02-12