function that calculates the dot product of two real 3-dimensional vectors and
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(in), | dimension(:) | :: | a | ||
| real(kind=dp), | intent(in), | dimension(:) | :: | b |
function dot(a, b) result(result) real(dp), dimension(:), intent(in) :: a, b real(dp) :: result integer :: i if (size(a) /= size(b)) stop "Error: Vectors must be of the same size." result = 0.0_dp do i = 1, size(a) result = result + a(i) * b(i) end do end function dot