Re: CALCULATION TIME
- To: mathgroup at smc.vnet.net
- Subject: [mg21427] Re: CALCULATION TIME
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Fri, 7 Jan 2000 00:20:38 -0500 (EST)
- Organization: Universitaet Leipzig
- References: <851ek8$4b5@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi, whats wrong ? The Do[]-Loops ? You should look into your expression to express the operations with highlevel commands like Dot[], RotateLeft[], ListConvolve[], Fold[] ... I use rather seldom Do[]'s and For[]'s and I have never missed it. Functional operators like Map[], Apply[] are typical faster. You supply not the information to give you more hints. Regards Jens Blimbaum Jerry DLPC wrote: > > I have some code performing (roughly) the following Do Loops: > > Do[......... > Do[x[[m,n+1]] = x[[m,n]] + B* y[[n+m-1]]*e[[n]] > > ----------------------------------------------, > > eps+Sum[y[[n-q]]^2,{q,0,M-1}] > {m,M} ], > > {n,M,Length[y]}] > > where y, e are lists (y is data that contains about 30000 elements), > etc. Running a data set takes about 10.5 secs. I wanted to shorten the > time but couldnt figure out how to write it either in Nest or Compile form > so I went thru it piece meal to see if I could find a culprit and from this > I noticed if I replace the Sum term in the denominator by a number, lets say > 1, and then perform the calculations it only takes about 2.5 seconds! I > did a sample Sum[expr^2] with a similar Do loop separately and it takes no > time at all. > > What is wrong? > > thanks. Jerry Blimbaum NSWC Panama City, Fl