f_lin_manhattan Function

public impure function f_lin_manhattan(x, y) result(dist)

Impure wrapper function for f_lin_manhattan_core.

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: x(:)

input vector 1

real(kind=wp), intent(in) :: y(:)

input vector 2

Return Value real(kind=wp)

Manhattan distance


Calls

proc~~f_lin_manhattan~~CallsGraph proc~f_lin_manhattan f_lin_manhattan proc~f_lin_manhattan_core f_lin_manhattan_core proc~f_lin_manhattan->proc~f_lin_manhattan_core proc~f_utl_assign_nan f_utl_assign_nan proc~f_lin_manhattan->proc~f_utl_assign_nan proc~s_err_print s_err_print proc~f_lin_manhattan->proc~s_err_print

Called by

proc~~f_lin_manhattan~~CalledByGraph proc~f_lin_manhattan f_lin_manhattan interface~fsml_manhattan fsml_manhattan interface~fsml_manhattan->proc~f_lin_manhattan

Source Code

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