This subprogram computes the dot product of vectors vec1 and vec2 of length lgth. vec1 and vec2 do not appear in function iloc since they are used only as input names for this subprogram, and so they don't need to have space reserved for them in the array work.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | Lgth | |||
| real(kind=wp), | intent(in), | dimension(Nparm + 1) | :: | Vec1 | ||
| real(kind=wp), | intent(in), | dimension(Nparm + 1) | :: | Vec2 | ||
| integer, | intent(in) | :: | Nparm |
pure function dotprd(Lgth, Vec1, Vec2, Nparm) result(dd) implicit none integer, intent(in) :: Lgth integer, intent(in) :: Nparm real(wp), dimension(Nparm + 1), intent(in) :: Vec1 real(wp), dimension(Nparm + 1), intent(in) :: Vec2 real(wp) :: dd integer :: j dd = Vec1(1)*Vec2(1) if (Lgth > 1) then do j = 2, Lgth dd = dd + Vec1(j)*Vec2(j) end do end if end function dotprd