Basic HTML version of Foils prepared 26 September 1996

Foil 22 Typical Use of Array and Intrinsic Operations

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


REAL u(0:nx,0:ny), A(100,100) , fact , avg
u= fact * (u -avg) Scales and translates all elements of u
avg = .25*( CSHIFT(u,1,1) + CSHIFT(u,-1,1) + CSHIFT(u,1,2) + CSHIFT(u,-1,2)
calculates of average of 4 array elements surrounding each point. Note third argument in CSHIFT is label for axis (1=x 2=y)
SQRT( A(1:100) ) calculates a new array containing 100 square roots
SUM(A) is a reduction operator sumimg all elements of array A as a scalar
SIZE(A,1) is an Array Query Intrinsic giving size of A in the first dimension and is particularly useful for "assumed-shape" arrays passed into subroutines



© 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