matrix anti diagonal numpy code example
Example: anti diagonal matrix python
Use np.eye(n)[::-1] which will produce:
array([[ 0., 0., 0., 0., 1.],
[ 0., 0., 0., 1., 0.],
[ 0., 0., 1., 0., 0.],
[ 0., 1., 0., 0., 0.],
[ 1., 0., 0., 0., 0.]])
for n=5