I have an array of size 5 x 3 x 3.
I want to fill the diagonal of each 3 x 3 block with a number.
How can I do this efficiently using numpy (A python library).
My starting matrix is this:
[[[0 0 0]
[0 0 0]
[0 0 0]]
[[0 0 0]
[0 0 0]
[0 0 0]]
[[0 0 0]
[0 0 0]
[0 0 0]]
[[0 0 0]
[0 0 0]
[0 0 0]]
[[0 0 0]
[0 0 0]
[0 0 0]]]
and I want something like this:
[[[0.07735655 0 0 ]
[0 0.11476396 0 ]
[0 0 0.09903619]]
[[0.1923885 0 0 ]
[0 0.03063454 0 ]
[0 0 0.06028193]]
[[0.06566275 0 0 ]
[0 0.03151423 0 ]
[0 0 0.04042383]]
[[0.07950743 0 0 ]
[0 0.03250461 0 ]
[0 0 0.0448308 ]]
[[0.10879917 0 0 ]
[0 0.04700161 0 ]
[0 0 0.03924387]]]