🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.fortran
Article #6563

Re: Fastest code for Gamma function

#6563
From: robertdodier
Date: Tue, 09 May 2000 00:00
39 lines
2580 bytes
Leonard Howell asks about fast algorithms for computing the
gamma density function.

One fast computational strategy is to build a very large interpolation
table (i.e., very small increment between support points) and use
low-order interpolating polynomials. To build the table you can use
your choice of slow algorithms.

This might not help if you need values of the gamma function for
different values of the shape parameter. However, if the number of
values of the shape parameter is small enough (let's say not more
than a thousand) you might still be better off investing CPU in
building an interpolation table for each shape parameter value.

In general, given the vast number of function calls (specified as
10^10) you are justified in spending resources up front to shave
a little bit off each function call.

I don't have a good intuition about interpolating over both the
argument and the shape parameter; it depends, I suppose, on how
much the shape varies for different values of the shape parameter.

Finally, if you are doing some kind of simulation or Monte Carlo
integration, you might consider parallelizing your code, at least
to the extent of launching identical runs on separate CPU's.
Some kinds of simulation and MC integration are very amenable to
parallelization, and you can get a speed-up factor nearly equal to
the number of CPU's available; much better than anything you can
squeeze out of clever numerical analysis.

HTH,
Robert Dodier

PS. Sorry if this post is a duplicate -- the copy I posted earlier
today doesn't seem to have appeared.


Sent via Deja.com http://www.deja.com/
Before you buy.
Technical Details
Message-ID: <8f84h0$bv$1@nnrp1.deja.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <fGNQ4.51301$WF.2761743@bgtnsc04-news.ops.worldnet.att.net>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10d632,8bad7910b3fe0dc6
X-Google-Attributes: gid10d632,public
X-Google-Thread: 104500,8bad7910b3fe0dc6
X-Google-Attributes: gid104500,public
X-Google-Thread: 1094ba,8bad7910b3fe0dc6
X-Google-Attributes: gid1094ba,public
From: robertdodier@my-deja.com
Subject: Re: Fastest code for Gamma function
Date: 2000/05/09
Message-ID: <8f84h0$bv$1@nnrp1.deja.com>
X-Deja-AN: 620960696
References: <fGNQ4.51301$WF.2761743@bgtnsc04-news.ops.worldnet.att.net>
To: leowood@worldnet.att.net
X-Http-User-Agent: Mozilla/4.61 [en] (X11; U; Linux 2.2.12-20 i586)
X-Http-Proxy: 1.0 x31.deja.com:80 (Squid/1.1.22) for client 128.138.85.193
Organization: Maximum entropy
X-Article-Creation-Date: Tue May 09 04:34:40 2000 GMT
X-MyDeja-Info: XMYDJUIDrobertdodier
Reply-To: dodier@colorado.edu
Newsgroups: comp.lang.fortran,computer42.statistik,sci.stat.math