I'm currently writing a programme in which two arrays are defined and then undergo singular value decomposition followed by some other processes to simulate some physics. The arrays should be of dimension D² x D². I initially tried:
Ma, Mb = ( np.zeros([ pow(D, 2), pow(D,2)]) for i in range(2))
followed by
Ma = np . zeros ([ pow(D,2), pow(D,2)])
Mb = np . zeros ([ pow(D,2), pow(D,2)])
and finally
Ma , Mb = [np . zeros ([ pow(D,2), pow(D,2)])]*2
I've found that defining the arrays in different ways affects my final answer, with only the final way giving me the answer I expect. The first two options give me nonsensical answers. Are these different methods actually equivalent or am I missing something?
Edit:
The code that follows is:
for i in D_array:
for j in D_array:
for k in D_array:
for l in D_array:
Ma[k + D * j][i + D * l] = T[i][j][k][l]
Mb[k + D * l][i + D * j] = T[i][j][k][l]
where T and D_array were previously defined. After this Ma and Mb undergo SVD,