Fractal Speedup Question
mathimagics at yahoo.co.uk
Thu Jan 19 15:32:39 CET 2006
Jorgen Hochwald writes:
> The thoughts are to have some kind of fixpoint
> (for example) eight bit before the point and the
> the point.
> Now all normalisation-steps (required for the
> numbers) are not needed.
> Question: can this speed up the calculations and how
can I use
> fixpoint numbers with GMP ?
I can't see any advantage in adopting a "fixed-point"
approach here all. To begin with, there is no
significant overhead attached to "normalisation" in a
floating-point multiplication, which is effectively
just an integer multiplication plus an addition of
To emulate that using integers you would have to
re-invent the mpf method of automatic precision
limitation, since integer multiplications (with mpz)
is done with dynamically extended precision.
With a typical Mandelbrot-set iteration, you are
repeatedly squaring, so you would have to continually
do manual result truncation to prevent the values
growing exponentially in size.
The mpf data type maintains a fixed maximum precision
by design, and a multiplication only returns as many
significant digits as you ask for.
In fact, even if you did decide to implement a
fixed-point emulation, you will probably find mpf is a
better medium than mpz because its multiplication is
already optimised to produce a restricted precision
Regarding the basic Mandelbrot iteration, there is not
really much you can do to optimise it.
There are ways to test x^2 + y^2 < N (inside/outside
test) without doing the squarings in many cases - but
this is of no benefit for the Mandelbrot iteration as
you need these values for the next iteration anyway.
More information about the gmp-discuss