my loop is too slow

SC Zhong sai at dft.chem.cuhk.edu.hk
Mon May 10 04:06:02 EDT 1999


I tried to learn and use python a week ago, and wrote
a small application.  When it run the loop:

	for k in range(dimension):
		for i in range(dimension):
			for j in range(dimension):
				for h in range(dimension):
					a[k,i]=a[k,i]+c[k,h]*c[k,j]*\
						f[j,i]*f[i,h]

it took very long time (may be 10 hours in my HP workstation). dimension
is 142 and a,c,f are all complex.  

I do not want to waste the other part of the program which processing text
file and rewrite the whole program in C or Fortran.  Is there ways to speed
the above up?

Thanks a lot.
SC CHUNG





More information about the Python-list mailing list