[Numpy-discussion] vector to tensor matrix speed up
Ferenc.Pintye at eu.decoma.com
Ferenc.Pintye at eu.decoma.com
Thu Jul 20 08:36:12 EDT 2006
Hi users,
i have some problem in Numpy with indexing speed for array to tensor
matrix transport.
With 200000 cycles it's 9sec ! (without sort(eigvals() - functions)
Many thanks
f.
# stress values/matrix in array form for 200000 points
out = zeros((200000,11),Float32)
#
#.....out = filling matrix ...etc...
#
# stress tensor matrix
eig = zeros((3,3),Float32)
#
#output for eigvalues
eigwert = array([0,0,0])
#
for j in arange(0,200000):
eig[0,0] = out[j,1]
eig[1,1] = out[j,2]
eig[2,2] = out[j,3]
#
eig[0,1] = out[j,4]
eig[0,2] = out[j,6]
eig[1,0] = out[j,4]
eig[1,2] = out[j,5]
eig[2,0] = out[j,6]
eig[2,1] = out[j,5]
#
eigwert = sort(eigvals(eig))
out[j,7] = eigwert[2]
out[j,8] = eigwert[1]
out[j,9] = eigwert[0]
out[j,10] = abs(eigwert[0]-eigwert[2])
#
More information about the NumPy-Discussion
mailing list