Problem with dist function in IDL [message #55319] |
Sun, 12 August 2007 07:41  |
ATKT
Messages: 1 Registered: August 2007
|
Junior Member |
|
|
Can somebody tell what exactly dist function is doing in IDL
e.g x=dist(2,2)
0.000000 1.00000
1.00000 1.41421
What is the meaning of this ouput
x=dist(4,4)
0.000000 1.00000 2.00000 1.00000
1.00000 1.41421 2.23607 1.41421
2.00000 2.23607 2.82843 2.23607
1.00000 1.41421 2.23607 1.41421
I am unable to understand the out put which is being generated.
|
|
|
Re: Problem with dist function in IDL [message #55651 is a reply to message #55319] |
Tue, 28 August 2007 13:10   |
Michael Galloy
Messages: 1114 Registered: April 2006
|
Senior Member |
|
|
On Aug 28, 12:26 pm, David Fanning <n...@dfanning.com> wrote:
> I was just having a look at the BUTTERWORTH filter code in the IDL
> library, and I notice that the ITTVIS programmer who wrote this
> function uses the double FOR loop method to create the distance
> function, rather than DIST.
>
> What do you suppose he knows that we don't!?
Well, the BUTTERWORTH code has to handle 1, 2, or 3-dimensional
distance arrays, whereas DIST handles only the 2-dimensional case. So
BUTTERWORTH could use DIST for only one of the three cases, so the
developer decided not to use it? In any case, DIST is more efficient
than BUTTERWORTH for the 2-dimensional case.
Mike
--
www.michaelgalloy.com
|
|
|
Re: Problem with dist function in IDL [message #92533 is a reply to message #55651] |
Tue, 05 January 2016 23:02  |
Ken G
Messages: 14 Registered: September 2006
|
Junior Member |
|
|
As an interesting (9 years later) follow-up to this, I noticed that the IDL8.5 Butterworth.pro code uses dist() in the calculation of 1D filters. The code pulls one one row from the 2D dist() result. Totally inefficient. Go ahead and ask for filtering of an 1D array with 100k points and see what happens. :/
Plus they modified the routine significantly but that doesn't appear in the documentation / file header.
|
|
|