transpose evuivalent for rot but faster

This commit is contained in:
Martin Diehl 2019-09-13 06:32:05 -07:00
parent 43bb421b8c
commit 49b3cd2145
1 changed files with 2 additions and 2 deletions

View File

@ -137,8 +137,8 @@ for name in filenames:
F = np.array(list(map(float,table.data[column:column+items['tensor']['dim']])),'d').reshape(items['tensor']['shape']) F = np.array(list(map(float,table.data[column:column+items['tensor']['dim']])),'d').reshape(items['tensor']['shape'])
(U,S,Vh) = np.linalg.svd(F) # singular value decomposition (U,S,Vh) = np.linalg.svd(F) # singular value decomposition
R = np.dot(U,Vh) # rotation of polar decomposition R = np.dot(U,Vh) # rotation of polar decomposition
stretch['U'] = np.dot(np.linalg.inv(R),F) # F = RU stretch['U'] = np.dot(R.T,F) # F = RU
stretch['V'] = np.dot(F,np.linalg.inv(R)) # F = VR stretch['V'] = np.dot(F,R.T) # F = VR
for theStretch in stretches: for theStretch in stretches:
stretch[theStretch] = np.where(abs(stretch[theStretch]) < 1e-12, 0, stretch[theStretch]) # kill nasty noisy data stretch[theStretch] = np.where(abs(stretch[theStretch]) < 1e-12, 0, stretch[theStretch]) # kill nasty noisy data