This is the mail archive of the gsl-discuss@sources.redhat.com mailing list for the GSL project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: faster log factorials


On Sat, 10 May 2003, Brian Gough wrote:

] James Theiler writes:
]  >   1. I used a perl script to rebuild the precomputed fact_table[] and
]  >      doub_fact_table[].  Should this perl script be part of GSL?  (Mark,
]  >      you'll be relieved to know it's not part of the build script!)
]
] It should be a 1-liner in gp-pari or Emacs Calc and could go
] in the comments.
]

Right, computing logs is not exactly rocket science; the hard part
(the perl part) was to get all the braces and commas right, and the
indenting neat and even.  I guess I agree that posterity will not miss
much if it does not have access to that code.

The ubiquitous use of factorials in multinomial expressions, in
special functions, and in random distributions, puts a premium on
their fast evaluation.  A still-open question:  If we provide
pre-computed values, how many should we provide?  For the straight (no
logarithm) values, there is a natural cutoff at 170 since 170! (or is
it 171!?) is the largest value that is a valid IEEE double precison
number.  But for the logs, we can assume the higher the cutoff the
more often we'll be able to provide a fast precomputed value.  We
could easily provide thousands, and I think most computers nowadays
would not begrudge the memory.  But there may be other issues that I
am not considering.

jt

---------------------------------------------
James Theiler                     jt@lanl.gov
MS-B244, NIS-2, LANL        tel: 505/665-5682
Los Alamos, NM 87545        fax: 505/665-4414
----- Space and Remote Sensing Sciences -----




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]