I want to create efficiently matrices of the following shape, i.e. absolute difference between the row and the column number. E.g. for 5 I should get:
0 1 2 3 4
1 0 1 2 3
2 1 0 1 2
3 2 1 0 1
4 3 2 1 0
Is there a fast / elegant way to do this in Python?