next up previous
Next: Limitations Up: Implementation Previous: Implementation

Supported F90 intrinsics

The module was designed in such a way that any function or subroutine in standard F90 that can be applied to a real number can also accept a TYPE (func) variable and give the expected result. For example, a statement

f = SIN(y),
where f and y are of TYPE (func), amounts to three statements, when drvtv=2, (the FORTRAN 90 array notation is used)

f%value = SIN(y%value)
f%x = COS(y%value) * y%x
f%xx = -SIN(y%value) * y%x $\otimes$ y%x + COS(y%value) * y%xx.

The product of two arrays, y%x $\otimes$ y%x, in the last expression is the tensor product. It produces a higher order tensor (the Hessian), which is stored in a rank-1 array as in Eq. 1. As operations involving intrinsic types can not be redefined, we should use a function (tensor) or define a new operator (.tensor.), as we chose in deriv_class, to compute this special product.

In order to localize all references to the exact representation of TYPE (func), we introduce several functions under the generic names value, FD, SD, and val_assign, FD_assign, SD_assign. They provide the value, the first and the second derivatives, and assign them to the components of a TYPE (func) variable. They are not meant to be used outside the module so they are declared as PRIVATE. Extensive use of pointers keep them very simple and it should be a relatively easy task for a compiler with inlining capabilities to integrate them in a code without the overhead of a function call. We anticipate that no loss in efficiency is introduced by this practice while it adds considerably to the maintainability of the code. The only binding to the internal representation of TYPE (func), remains the assumption that the derivatives are stored in rank-1 arrays; all pointers are declared as such. Unless type aliasing is introduced in FORTRAN, this limitation can not be waived. We could have declared the derivatives as new user-defined types to solve it but by this we would make the code more complex and, possibly, less efficient.

Care was taken that all meaningful for numerical calculations intrinsic functions and every built-in operator of FORTRAN 90 are overloaded appropriately. Fully supported are all expressions involving the following routines: ABS, ATAN, CEILING, COS, COSH, DIGITS, DIM, DOT_PRODUCT, EPSILON, EXP, EXPONENT, FLOOR, FRACTION, HUGE, KIND, LOG, LOG10, MATMUL, MAXEXPONENT, MINEXPONENT, MOD, MODULO, NEAREST, PRECISION, RADIX, RANGE, RRSPACING, SCALE, SET_EXPONENT, SIGN, SIN, SINH, SPACING, TAN, TANH, TINY.

Certain others are not fully overloaded; details on them are presented in the following paragraph.


next up previous
Next: Limitations Up: Implementation Previous: Implementation
Stavros Farantos
1999-12-11