The following table lists the reduction operations that are recognized by f77 and f90.
Table 10-3 Recognized Reduction Operations
Mathematical Operations |
Fortran Statement Templates |
---|---|
Sum of the elements | s = s + v(i) |
Product of the elements | s = s * v(i) |
Dot product of two vectors | s = s + v(i) * u(i) |
Minimum of the elements | s = amin( s, v(i)) |
Maximum of the elements | s = amax( s, v(i)) |
OR of the elements |
do i = 1, n b = b .or. v(i) end do |
AND of nonpositive elements |
b = .true. do i = 1, n if (v(i) .le. 0) b=b .and. v(i) end do |
Count nonzero elements |
k = 0 do i = 1, n if ( v(i) .ne. 0 ) k = k + 1 end do |
All forms of the MIN and MAX function are recognized.