Basic HTML version of Foils prepared August 7 98

Foil 17 PURE for Mandelbrot Sets

From DoD HPF Training -- 3. Parallel Constructs in HPF DoD Training and Others -- 1995-98. by Chuck Koelbel -- Rice University


1 ! The caller (Explicit interface not shown)
2 FORALL ( i=1:n, j=1:m )
  • k(i,j) = mandelbrot( CMPLX((i-1)*1.0/(n-1), &
    • (j-1)*1.0/(m-1)), 1000 )
3 END FORALL
4 ! The callee
5 PURE INTEGER FUNCTION mandelbrot(x, itol)
6 COMPLEX, INTENT(IN) :: x
7 INTEGER, INTENT(IN) :: itol
8 COMPLEX xtmp
9 INTEGER k
  • k = 0
  • xtmp = -x
  • DO WHILE (ABS(xtmp)<2.0 .AND. k<itol)
    • xtmp = xtmp*xtmp - x
    • k = k + 1
  • END DO
  • mandelbrot = k
10 END FUNCTION mandelbrot

in Table To:


© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Sun Aug 9 1998