1 | initial version |
You have to access to the tensor components by directly passing the indices to the operator []
, not via a string (as @tolga 's comment pointed out, string access shall be used outside loops). Moreover, you have to substitute Id =
by Id +=
. So the code should be something like
Id = 0
for i in range(4):
for j in range(4):
for k in range(4):
for l in range(4):
for m in range(4):
for n in range(4):
Id += R_down[i,j,k,l]*dual[i,j,m,n]*R_up[k,l,m,n]