Impure wrapper function for f_lin_manhattan_core.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(in) | :: | x(:) |
input vector 1 |
||
| real(kind=wp), | intent(in) | :: | y(:) |
input vector 2 |
Manhattan distance
impure function f_lin_manhattan(x, y) result(dist) ! ==== Description !! Impure wrapper function for `f_lin_manhattan_core`. ! ==== Declarations real(wp), intent(in) :: x(:) !! input vector 1 real(wp), intent(in) :: y(:) !! input vector 2 real(wp) :: dist !! Manhattan distance ! ==== Instructions ! ---- handle input ! check if size is valid if (size(x) .le. 1 .or. size(y) .le. 1) then ! write error message and assign NaN value if invalid call s_err_print(fsml_error(4)) dist = f_utl_assign_nan() return endif ! ---- compute Euclidean distance ! call pure function dist = f_lin_manhattan_core(x, y) end function f_lin_manhattan