next up previous

4.4 Array-valued Functions     continued...

The elemental intrinsic functions are (most of) those defined with scalar dummy arguments. Such functions may be called with array actual arguments, and return an array result conformable with the actual argument. Each element of the result is what would have been obtained if the function had been called with just the corresponding (scalar) element of the actual argument. Thus an elemental function is automatically (and conceptually in parallel) applied to each element of the actual argument. Any of the usual computational intrinsic functions can be called elementally. For example, in

X may be scalar, in which case COS returns a scalar result, or X may be an array (any dimension), in which case COS returns an array-valued result conformable with X. If the seismic-like example above were modified to
exp(g) + cshift(u,1,2) - cshift(u,-1,2)
then each term in the expression becomes an intrinsic function call that returns a result conformable with g and u. The first term is an elemental call and the other two are transformational. All of the 108 Fortran 90 intrinsic functions may be called elementally except for the 42 listed above as transformational.

Note that whereas elemental function calls may be considered to be a number of independent scalar function calls, a transformational function is considered as in integral self-contained computation, delivering the result ``all together, all at once".