I stumbled upon this python code (which works) and for me it seems awesome. However, I cannot understand what this code does. To reproduce it, I kind of wrote a test code:
import numpy as np
x = np.random.rand(10, 10, 6)
So, I have 100 symmetric 3x3 matrices, and I only store unique components. Now I want to generate a full 3x3 matrix, and that is where the magic happens.
indices = np.array([[0, 1, 3],
[1, 2, 4],
[3, 4, 5]])
I see it doing this. Since the components of the index 0-5 must be located in the 3x3 matrix in order to have a symmetric matrix.
mat = x[..., indices]
This line has lost me. Thus, he is working on the last measurement of the x array, but it’s completely not clear to me how the permutation and rebuilding are done, but it really returns an array of the form (10, 10, 3, 3). I am amazed and confused!