LandSciTech / pfocal

Fast parallel convolution in R.
https://landscitech.github.io/pfocal/
Other
2 stars 1 forks source link

chebyshev distance throws an error #17

Closed VLucet closed 3 years ago

VLucet commented 3 years ago
> chebyshev_distance_kernel(2,2)
     [,1]
[1,]    2
Warning message:
In .q_kernel_to_kernel(.chebyshev_distance_quarter_kernel(vertical_radius,  :
  qk should be a matrix. If it is not, but it is numeric, this assumes that it is a matrix with 1 row
VLucet commented 3 years ago

The issue is that the helper .chebyshev_distance_quarter_kernel returns a value. This is due to these lines in .minkowski_distance_quarter_kernel:

    return(max(
      .horizontal_distance_quarter_kernel(vertical_radius, horizontal_radius),
      .vertical_distance_quarter_kernel(vertical_radius, horizontal_radius)
    ))

The max function returns a single value, while the expected behavior should be pairwise maximum, can be achieved with pmax.