Fractal Speedup Question

Jürgen Hochwald jh at cfjh.de
Tue Jan 17 19:21:24 CET 2006


Hi

I'am using the GMP for a fractal programm (under Linux) to calculate deepzoom 
fractal animations. For all numeric calculations the mpf datatype is used.
Checking the used range of the numbers shows, that all numbers are in the 
range |z| < 16. The thougts are to have some kind of fixpoint numbers with 
(for example) eight bit before the point and the rest after the point. Now 
all normaisazion-steps (required for the floating point numbers) are not 
needed.
Question: can this speed up the calculations and how can I use fixpoint 
numbers with GMP ?

The core calculation code is the following (where x and y is the current 
point): Is here something to speed up ?


  mpf_set(a,x);
  mpf_set(b,y);
  mpf_mul(a2,a,a);
  mpf_mul(b2,b,b);
  for (Iter=0;Iter<MaxIter;Iter++) {
    mpf_sub(c,a2,b2);   mpf_add(c,c,x);    mpf_mul(b,a,b);
    //mpf_mul_ui(b,b,2);
    mpf_add(b,b,b);    mpf_add(b,b,y);    mpf_set(a,c);

    mpf_mul(a2,a,a);    mpf_mul(b2,b,b);    mpf_add(c,a2,b2);
    if (mpf_cmp_ui(c,4)>0) {
      Inside=0;
      break;
    }
    if (Aborted) {
      Calculation=FALSE;
      return -1;
    }
  }

Jürgen
www.wetterstation-porta.info
-- 
Mailformattierung siehe hier: www.wetterstation-porta.info/kontakt.html


More information about the gmp-discuss mailing list