Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: taking a long time
Date: Sun, 30 Nov 2008 02:00:18 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 15
Message-ID: <ggss3i$9vo$1@fred.mathworks.com>
References: <ggrqvm$k5l$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1228010418 10232 172.30.248.38 (30 Nov 2008 02:00:18 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 30 Nov 2008 02:00:18 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:503858


"Travis" <sinusoid2@hotmail.com> wrote in message <ggrqvm$k5l$1@fred.mathworks.com>...
> I am using the distance function to find the distance between two sets of lat/longs.  The data sets are 700,700 and 309 points long.  It has been running for over 10 hours.  Is this normal for it to take this long?  Is there a quicker way to do this?
--------
> OK, going on 24+ hours now.  Again, is this normal?  Is there a faster way?
--------
  Travis, you are placing a heavy burden on your computer's computational capacity.  Every distance between a 700,700-element set and a 309-element set amounts to a total of 216,516,300 distances altogether, and each one of these presumably involves a great circle arc distance between pairs of longitude and latitude quantities.  These are spherical trigonometric computations rather than the much simpler Euclidean formulas.  If you are using an ellipsoidal earth, these computations would be even more time-consuming.

  I would suggest you time your computer for computing, say, all the distances between two 100-element sets and then multiply that by a factor of twenty-one thousand or thereabouts to get the timing you might reasonably expect for your problem.  If the 100 by a 100 case takes only five seconds, you could expect to have six hours more to go beyond your present 24 hour wait.

  As for there being a faster method, some of the trigonometric calculations, such as determining the sine and cosine of the longitude and latitude quantities could be pre-computed just once for each set's elements and this would save some time as compared with starting each distance computation from scratch.  However, I would expect that the people at Mathworks have already figured that out for themselves and would be taking such a shortcut, provided it is being done in a single call on the appropriate distance function.

  There is of course another (unlikely?) possibility.  Your computer may not possess enough RAM memory to store the necessary large number of distances and it is doing a switch to virtual disk memory.  That would certainly slow things down.  Mathworks people can tell you whether such a thing might be happening.  I always thought that Matlab would complain if it didn't possess a sufficient amount of contiguous RAM memory to store an allocated array.

Roger Stafford