Re: Optimizing for fast floating-point numerical code
- From: ventimig@xxxxxxx (David A. Ventimiglia)
- Date: Mon, 24 Aug 2009 15:43:17 -0400
Alberto Riva <alb@xxxxxxxxxxxxxx> writes:
David A. Ventimiglia wrote:
"Thomas M. Hermann" <tmh.public@xxxxxxxxx> writes:
Another thing you should be careful of when making the comparison of
your lisp code with Fortran is that the difference in the
implementations of RANDOM can be significant since you are calling it
inside your loop. On one hand, it is valid to evaluate this difference
because implementing your own random number generation function would
be pretty annoying. On the other hand, if generating random numbers is
a critical part of your algorithm, it may be worth your time to
research how it is accomplished in the respective languages and
implement a version that better meets your requirements.
This point is interesting to me. Evidently, it'd be unsurprising for an
intrinsic function like `random' in a given Lisp implementation to be
suboptimal, perhaps very much so.
I don't think Thomas meant that the built-in RANDOM is suboptimal in
terms of speed, I think he meant that it's probably going to be
different from the one in your Fortran implementation. There's no such
thing as really random numbers, they're called pseudo-random for a
reason, and they may be "pseudo" in different ways (ie, have different
statistical properties). In other words, you may get slightly
different results, even if the rest of your algorithm is exactly the
same.
Alberto
Hi Alberto,
Maybe I'm wrong, but I inferred that Thomas did indeed mean that the
built-in RANDOM may be suboptimal in terms of speed, given the
significance he attributes to its use inside a loop, and given his
conjecture that re-implementing it may be a way to meet my requirements,
which are execution speed. But again, maybe I mis-interpreted.
On the other hand, I would be very worried if the distributions occupied
by random numbers generated by Lisp and Fortran don't converge in their
statistical properties (like first couple of moments). Does that
actually happen?
Best,
David
--
________________________________________
David A. Ventimiglia
Graduate Student
Michigan State University
.
- Follow-Ups:
- Re: Optimizing for fast floating-point numerical code
- From: Thomas M. Hermann
- Re: Optimizing for fast floating-point numerical code
- From: Richard Fateman
- Re: Optimizing for fast floating-point numerical code
- From: George Neuner
- Re: Optimizing for fast floating-point numerical code
- References:
- Optimizing for fast floating-point numerical code
- From: David A. Ventimiglia
- Re: Optimizing for fast floating-point numerical code
- From: Thomas M. Hermann
- Re: Optimizing for fast floating-point numerical code
- From: David A. Ventimiglia
- Re: Optimizing for fast floating-point numerical code
- From: Alberto Riva
- Optimizing for fast floating-point numerical code
- Prev by Date: Re: Draw a circle in OpenGL
- Next by Date: Re: Better mehod to generate a sequence of range?
- Previous by thread: Re: Optimizing for fast floating-point numerical code
- Next by thread: Re: Optimizing for fast floating-point numerical code
- Index(es):
Relevant Pages
|