Reducing Table Run Time

*To*: mathgroup at christensen.cybernetics.net*Subject*: [mg1706] Reducing Table Run Time*From*: jt12799 at glibm3.cen.uiuc.edu (Jehan Tsai)*Date*: Wed, 19 Jul 1995 00:13:23 -0400*Organization*: University of Illinois at Urbana

I've got a question about the following bit of code: k=628300;f=10; eq1=UnitStep[x+.005]-UnitStep[x-.005]; eq2=Exp[-I k x^2/(2 f)]; g1=Compile[{x},Evaluate[eq1*eq2]]; f1=Table[g1[index],{index,-.2,.2,N}]; Whenever i run this for a value of N necessary to generate a table of 2000+ values, the line to generate table f1 seems to take up a good 80-90% of the running time, which I understand is due to the evaluation of the function. My question involves whether or not there is a way to reduce the running time, or is this something we have to live with? For 2048 samples, I clocked it at approximately 44s, with most of it taken up by the table. Thanks in advance. J.T. Tsai