Speed When Accessing List Elements Sucks
- To: mathgroup at yoda.physics.unc.edu
- Subject: Speed When Accessing List Elements Sucks
- From: "Michael S. Turok" <turok at cs.columbia.edu>
- Date: Wed, 5 May 1993 02:47:51 -0400
Hi, I have a list and I am trying to calculate the difference between adjacent elements of the list: diff[[n]] = list[[n+1]] - list[[n]] But it is taking forever!! The list is about 100 elements long, and I want to loop this about 50 times. So, I am trying to create a diff matrix that is 50x100. But, after 30 min. CPU time, only about 20 elements of the first row had been filled in!!!! I tracked down the problem to the calculation of these differences, and the real problem seems to be accessing of the elements themselves. Can anyone please, please, please, help me, before I have to dump this into C? Thanks, Michael