This is the mail archive of the
gsl-discuss@sources.redhat.com
mailing list for the GSL project.
Re: erroneous claim at sources.redhat.com/gsl/ref/gsl-ref_4.html#SEC3 2
- From: Achim Gädke <Achim dot Gaedke at physik dot tu-darmstadt dot de>
- To: jimmy mcguire <jxmcguire1 at ualr dot edu>,gsl-discuss at sources dot redhat dot com
- Date: Tue, 15 Jul 2003 14:22:26 +0200
- Subject: Re: erroneous claim at sources.redhat.com/gsl/ref/gsl-ref_4.html#SEC3 2
- References: <0AAF93247C75E3408638B965DEE11A700101020B@i2km41-ukdy.nat.bt.com> <3F13CFF6.3010304@physik.tu-darmstadt.de> <3F13EE30.6030800@mail.ualr.edu>
Yes, this is quite true, that I do not really know, what's the optimal way.
1) In order to fix a documentation bug, we should correct the manual.
2) Here we multiply numbers (plain floating point numbers), so the
effort to do the optimum should be not to large: approx. O(2*log_2(n))
is not bad in contrast to O(n).
3) If it is cheap to find a better way or if we deal with matrices (e.g.
in characteristic polynoms), we may want to find out a better way to
split this multiplication. Finding prime factors is quite expensive. For
21 I avoid one multiplication, but what about the costs?
4) I like this problem, because it's simple to explain and becomes
difficult when solving it. :-)
Achim
jimmy mcguire wrote:
Breaking my usual rule against speaking proir to knowing for sure, how
about use the powers of two approach if the destination exponent is a
power of two or if it is prime, otherwise the break the destination
exponent into prime addends and construct multiplicative factors
corresponding to the prime additive exponents. Repeat (recurse) as
necessary.
Achim Gädke wrote:
so, is there anyone outside, knowing similar problems?
I agree, repeated squaring is likely to be the best solution, because
the binary representation can be obtained easily on a computer.
So the manual should state, that this algorithm is efficient and in
most cases the fastest.
Achim
keith.briggs@bt.com wrote: