Answers for "anti diagonal matrix python"

0

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
Posted by: Guest on March-20-2021

Code answers related to "anti diagonal matrix python"

Python Answers by Framework

Browse Popular Code Answers by Language