Automatic Type Changes and Overloading
The types of all floating-point variables are changed to a user-defined data type
type compad_type
double precision :: val = 0.D0
double precision :: drv=0.D0
end type compad_type
automatically by the compiler. Keeping the internal representation of the compiler (IR) consistent
(semantically correct) requires handling of a number of special cases, including and not being limited
to the
- initialization of floating-point variables and use of DATA in the same context;
- need to leave type of named floating-point constants unchanged.
Once the IR has been modified correctly overloading is resolved by the compiler and the appropriate
custom implementations of the intrinsic operators and functions, such as, for example,
! x*y
elemental function ct_multiply_ct(x,y) result(res)
type(compad_type), intent(in) :: x
type(compad_type), intent(in) :: y
type(compad_type) :: res
res%val = x%val * y%val
res%drv = x%drv * y%val + x%val * y%drv
end function ct_multiply_ct
are linked to get a tangent-linear object code.
Example
The following computational graph illustrates the computation of the second column of the Jacobian of
x0=x0*sin(x0*x1)
y1=sin(x0)
y0=x0*x1
at point (2.0,3.0). The local partial derivatives are attached to the edges in the linearized computational graph.
Topic revision: r3 - 2009-04-30 - 06:07:38 - Main.uwe