Functions to compute a distance kernel.

euclidean_distance_kernel(vertical_radius, horizontal_radius = vertical_radius)

manhattan_distance_kernel(vertical_radius, horizontal_radius = vertical_radius)

minkowski_distance_kernel(
  p,
  vertical_radius,
  horizontal_radius = vertical_radius
)

chebyshev_distance_kernel(vertical_radius, horizontal_radius = vertical_radius)

vertical_distance_kernel(vertical_radius, horizontal_radius = vertical_radius)

horizontal_distance_kernel(
  vertical_radius,
  horizontal_radius = vertical_radius
)

distance_kernel(vertical_radius, horizontal_radius = vertical_radius)

Arguments

vertical_radius

[numeric] The kernel's radius in the vertical dimension.

horizontal_radius

[numeric] The kernel's radius in the horizontal dimension.

p

[numeric] Exponent parameter for the Minkowski distance.

Value

A matrix corresponding to the kernel.

Examples


distance_kernel(vertical_radius = 2, horizontal_radius = 2)
#>          [,1]     [,2] [,3]     [,4]     [,5]
#> [1,] 2.828427 2.236068    2 2.236068 2.828427
#> [2,] 2.236068 1.414214    1 1.414214 2.236068
#> [3,] 2.000000 1.000000    0 1.000000 2.000000
#> [4,] 2.236068 1.414214    1 1.414214 2.236068
#> [5,] 2.828427 2.236068    2 2.236068 2.828427
euclidean_distance_kernel(vertical_radius = 2, horizontal_radius = 2)
#>          [,1]     [,2] [,3]     [,4]     [,5]
#> [1,] 2.828427 2.236068    2 2.236068 2.828427
#> [2,] 2.236068 1.414214    1 1.414214 2.236068
#> [3,] 2.000000 1.000000    0 1.000000 2.000000
#> [4,] 2.236068 1.414214    1 1.414214 2.236068
#> [5,] 2.828427 2.236068    2 2.236068 2.828427
manhattan_distance_kernel(vertical_radius = 2, horizontal_radius = 2)
#>      [,1] [,2] [,3] [,4] [,5]
#> [1,]    4    3    2    3    4
#> [2,]    3    2    1    2    3
#> [3,]    2    1    0    1    2
#> [4,]    3    2    1    2    3
#> [5,]    4    3    2    3    4
minkowski_distance_kernel(vertical_radius = 2, horizontal_radius = 2, p = 1)
#>      [,1] [,2] [,3] [,4] [,5]
#> [1,]    4    3    2    3    4
#> [2,]    3    2    1    2    3
#> [3,]    2    1    0    1    2
#> [4,]    3    2    1    2    3
#> [5,]    4    3    2    3    4
chebyshev_distance_kernel(vertical_radius = 2, horizontal_radius = 2)
#>      [,1] [,2] [,3] [,4] [,5]
#> [1,]    2    2    2    2    2
#> [2,]    2    1    1    1    2
#> [3,]    2    1    0    1    2
#> [4,]    2    1    1    1    2
#> [5,]    2    2    2    2    2
vertical_distance_kernel(vertical_radius = 2, horizontal_radius = 2)
#>      [,1] [,2] [,3] [,4] [,5]
#> [1,]    2    2    2    2    2
#> [2,]    1    1    1    1    1
#> [3,]    0    0    0    0    0
#> [4,]    1    1    1    1    1
#> [5,]    2    2    2    2    2
horizontal_distance_kernel(vertical_radius = 2, horizontal_radius = 2)
#>      [,1] [,2] [,3] [,4] [,5]
#> [1,]    2    1    0    1    2
#> [2,]    2    1    0    1    2
#> [3,]    2    1    0    1    2
#> [4,]    2    1    0    1    2
#> [5,]    2    1    0    1    2