Given an mxn matrix, and an element's indices, how can I use pure python (no numpy or any matrix packages) to obtain both diagonals that contain that element?
For example:
1 2 3 4
5 6 7 8
9 10 11 12
0 1 0 1
Given element (1, 2), I could get the main diagonal: [2, 7, 12], and [4, 7, 10, 0]. I've seen this post, but I don't care to wrap around the matrix. Also, that solution is very difficult for me to understand, so I'm having trouble re-writing it to fit my needs.