[email protected] (William Gould, Stata) writes:
> In the case of the code Brendan Halpin <[email protected]> reported,
> execution time was .0228 seconds after improvement. That was with 100x100
> matrices and I wonder how large the matrices were that Brendan was using. In
> any case, 20 times faster reduces the run time to 0.00114, a savings of .02166
> seconds. That absolute number, while not large, is big enough to catch my
> interest, which is why I've been timing indidvidual statements this morning.
Thanks for the response. It's enlightening, even in some of the
incidentals. My actual algorithm uses even more of those
inefficient nested for-loops, but the real problem is that the end
use is to calculate pairwise proximity data, so it gets called
_N*(_N-1)/2 times.
However, I take your point -- within limits time is not that
important, and coding time is often more important than execution
time. I've been playing with Mata for a week and have firstly been
able to express this algorithm very concisely, and secondly
implemented three or four other proximity measures that I might not
have attempted in C. Plus I'm recalling things I didn't know I knew
about matrix algebra!
Brendan
--
Brendan Halpin, Department of Sociology, University of Limerick, Ireland
Tel: w +353-61-213147 f +353-61-202569 h +353-61-338562; Room F2-025 x 3147
mailto:[email protected] http://www.ul.ie/sociology/brendan.halpin.html
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/