Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Re: Processing data with lot of math...

by BrowserUk (Patriarch)
on May 12, 2004 at 18:53 UTC ( [id://352864]=note: print w/replies, xml ) Need Help??


in reply to Re: Processing data with lot of math...
in thread Processing data with lot of math...

This method won't work. Take the three points

p( 10, 10, 10 ); p( 14.142, 10, 0 ); p( 10, 14.142, 0 );

Using the origin as the base, all three points have a calculated distance of 17.32 and will sort adjacent to each other, but they are obviously in completely different positions and the distance between each of the three points varies greatly.


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"Think for yourself!" - Abigail

Replies are listed 'Best First'.
Re: Re: Re: Processing data with lot of math...
by ysth (Canon) on May 12, 2004 at 19:39 UTC
    Look again.

    The point is to avoid having both loops go over all the points. The distance from origin is just one way of easily filtering out some (with luck, most) points for the inner loop (since the distance between two points is guaranteed to be greater than or equal to the difference in their distances from a third point).

    The distance between $one and $two is still checked.

      Okay, I see you made a few updates since I read your original and went off to verify my thoughts.

      I guess it depends upon the number and density of the points as to how effective the filtering would be.

      I was picturing something like a buckyball. If the origin was at the centre of the buckyball, then every atom (molecule??) would either be filtered in or filtered out, unless the constraining value was extremly tight.

      Of course, you can move the origin, and then you'd get a greater or lesser ring of potentials, depending upon the relationship between the chosen origin and the position of the atom under test.

      Or with a buckytube, you get rings, ovals, or two long parallel lines of potentials.

      Then again, bucky-anything is probably a fairly rare case:)


      Examine what is said, not who speaks.
      "Efficiency is intelligent laziness." -David Dunham
      "Think for yourself!" - Abigail
        I'm sorry, from your wording, I guessed you had commented after I added the code to demonstrate what I meant. And I added the code because the English "for each point checking distance of the following points only until the distance from origin has increased by your cutoff" didn't make it completely clear that "checking distance" meant the distance between two data points and "increased by your cutoff" meant distance of the two points from the origin differing by the cutoff. And because sorting multiple arrays the same way with slices needed demonstration.

        Dare I ask what a buckyballs or buckytubes are?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://352864]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2024-04-19 15:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found