I would like to change diagonal elements from a 2d matrix. These are both main and non-main diagonals.
numpy.diagonal() In NumPy 1.10, it will return a read/write view, Writing to the returned array will alter your original array.
numpy.fill_diagonal(), numpy.diag_indices() Only works with main-diagonal elements
Here is my use case: I want to recreate a matrix of the following form, which is very trivial using diagonal notation given that I have all the x, y, z as arrays.