Basic HTML version of Foils prepared 26 September 1996

Foil 113 Example of PURE Function from Chuck Koelbel

From HPCC Software Technologies Fall 96 -- Overview and HPF Delivered Lectures of CPS615 Basic Simulation Track for Computational Science -- 26 September 96. by Geoffrey C. Fox


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)
END FORALL
This can call the PURE function mandelbrot which is essentially a generalized intrinsic
PURE INTEGER FUNCTION mandelbrot (x,itol)
  • COMPLEX, INTENT(IN) :: x
  • INTEGER, INTENT(IN) :: itol
  • COMPLEX xtmp
  • INTEGER k
    • k=0
    • xtmp = -x
    • DO WHILE( ABS(xtmp) < 2. .AND. k < itol )
    • xtmp = xtmp*xtmp - x
    • k = k + 1
    • END DO
    • mandelbrot = k
END FUNCTION mandelbrot



© 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 Feb 22 1998