| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=real64), | intent(in) | :: | x(:) | |||
| real(kind=real64), | intent(in) | :: | y(:) |
function dot(x, y) result(prod) real(real64), intent(in) :: x(:) real(real64), intent(in) :: y(:) real(real64) :: prod ! 配列のサイズが異なる場合はエラーとして停止 if (size(x) /= size(y)) then write (*, '(A)') "Error: dot - array sizes do not match." error stop 1 end if #ifdef _MKL prod = ddot(int(size(x), int32), x, 1, y, 1) #else ! 手動ループやOpenMPよりも、dot_product組込み関数が推奨される prod = dot_product(x, y) #endif end function dot