Statalist The Stata Listserver

[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Mata slow?

From   Brendan Halpin <>
Subject   Re: st: Mata slow?
Date   Mon, 27 Nov 2006 18:32:28 +0000 (William Gould, Stata) writes:

> In the case of the code Brendan Halpin <> 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 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
*   For searches and help try:

© Copyright 1996–2023 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index