I am using Python and Numpy to do some data analysis.
I have a large 3D matrix (NxNxN), where each cell is again a matrix, this time a 3x3 matrix. Calling the matrix data, it looks like this:
data[N,N,N,3,3]
I need to find the eigenvalues of all the 3x3 matrices, and for that I use Numpy's eigvals routine, but it takes ages to do. Right now I pretty much do this:
for i in range(N):
for j in range(N):
for k in range(N):
a = np.linalg.eigvals(data[i,j,k,:,:])
For N = 256, this takes about an hour. Any ideas on how to make this more efficient?
Many thanks for any suggestions!