Algorithm Choice

2 views
Skip to first unread message

Greg

unread,
May 10, 2007, 8:28:55 PM5/10/07
to Gravit mailing list
I'm trying to understand the difference between the processFrameOT and
processFramePP functions. I thought that the OT version would be
faster, but I'm seeing about 2-3x the speed if I use the PP version.
I've checked with particle counts from 1000-20000.

Am I misunderstanding the two algorithms?

Gerald Kaszuba

unread,
May 13, 2007, 5:01:56 AM5/13/07
to gra...@googlegroups.com
Hi Greg

The OT method is the Barnes-Hut octree method which is a O(n log n) algorithm. The PP method is the particle to particle method which is a O(N^2) algorithm.

When I was developing Gravit the PP method was substantially slower then the OT method. I don't know how you're able to get an opposite result! I shall try it when I get a chance.

What type of computer and video card are you using? Perhaps it has something to do with that.

Gerald
--
Gerald Kaszuba
http://geraldkaszuba.com/

Greg

unread,
Jun 12, 2007, 5:19:34 PM6/12/07
to Gravit mailing list
Hi Gerald,

Thanks.
I'm using a T2500 (Core Duo 2GHz) with an NVidia Go 7600.

Another algorithm question: it looks like both the PP and OT methods
are essentially calculating the gravitational force as something
that's inversely related to the distance, rather than the square of
the distance. (Since the force isn't normalized before being
multiplied by the distance in statements like force*dv[0], there's
some cancellation that results in it going linear, rather than with
the squared distance.)
It still looks cool, I just want to make sure I'm understanding your
approach.

-Greg


On May 13, 2:01 am, "Gerald Kaszuba" <gerald.kasz...@gmail.com> wrote:
> Hi Greg
>

> The OT method is the *Barnes-Hut *octree method which is a O(*n* log *n*)


> algorithm. The PP method is the particle to particle method which is a
> O(N^2) algorithm.
>
> When I was developing Gravit the PP method was substantially slower then the
> OT method. I don't know how you're able to get an opposite result! I shall
> try it when I get a chance.
>
> What type of computer and video card are you using? Perhaps it has something
> to do with that.
>
> Gerald
>

Reply all
Reply to author
Forward
0 new messages