R/RcppExports.R

Defines functions rcpp_parallel_nearest_facility_nonself rcpp_parallel_nearest_facility rcpp_parallel_distm_C_min_nonself rcpp_parallel_distm_C_min rcpp_parallel_distm_C dist_spherical_cosine dist_haversine

Documented in dist_haversine dist_spherical_cosine rcpp_parallel_distm_C rcpp_parallel_distm_C_min rcpp_parallel_distm_C_min_nonself rcpp_parallel_nearest_facility rcpp_parallel_nearest_facility_nonself

# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

#' Haversine Distance
#'
#' @param lon_x Longitude for starting point
#' @param lat_x Latitude for starting point
#' @param lon_y Longitude for ending point
#' @param lat_y Latitude for ending point
#'
#' @return Double of distance between points in m
#'
dist_haversine <- function(lon_x, lat_x, lon_y, lat_y) {
    .Call('_kfbmisc_dist_haversine', PACKAGE = 'kfbmisc', lon_x, lat_x, lon_y, lat_y)
}

#' Spherical Distance
#'
#' @param lon_x Longitude for starting point
#' @param lat_x Latitude for starting point
#' @param lon_y Longitude for ending point
#' @param lat_y Latitude for ending point
#'
#' @return Double of distance between points in m
#'
dist_spherical_cosine <- function(lon_x, lat_x, lon_y, lat_y) {
    .Call('_kfbmisc_dist_spherical_cosine', PACKAGE = 'kfbmisc', lon_x, lat_x, lon_y, lat_y)
}

#' Parallel calculates distance between two matrices of lat/long.
#'
#' @param x matrix of coordinates. In the same format as st_coordinates output (X, Y)
#' @param y matrix of coordinates. In the same format as st_coordinates output (X, Y)
#'
#' @return returns matrix of distances in miles
#'
rcpp_parallel_distm_C <- function(x, y) {
    .Call('_kfbmisc_rcpp_parallel_distm_C', PACKAGE = 'kfbmisc', x, y)
}

#' Find closest unit from group y
#'
#' @param x matrix of coordinates. In the same format as st_coordinates output (X, Y)
#' @param y matrix of coordinates. In the same format as st_coordinates output (X, Y)
#'
#' @return Vector. Contains index of closest unit in y
#'
#' @export
rcpp_parallel_distm_C_min <- function(x, y) {
    .Call('_kfbmisc_rcpp_parallel_distm_C_min', PACKAGE = 'kfbmisc', x, y)
}

#' Find nearest neighbor of x (non-self)
#'
#' @param x matrix of coordinates. In the same format as st_coordinates output (X, Y)
#' @param y Same as x.
#'
#' @return Vector. Contains index of closest unit in y
#'
#' @export
rcpp_parallel_distm_C_min_nonself <- function(x, y) {
    .Call('_kfbmisc_rcpp_parallel_distm_C_min_nonself', PACKAGE = 'kfbmisc', x, y)
}

#' Find closest unit from group y and measure distance
#'
#' @param x Matrix of coordinates. In the same format as st_coordinates output (X, Y)
#' @param y Matrix of coordinates. In the same format as st_coordinates output (X, Y)
#'
#' @return Matrix. 2 columns. First column is index of closest unit in y.
#' Second column is distance
#'
#' @export
rcpp_parallel_nearest_facility <- function(x, y) {
    .Call('_kfbmisc_rcpp_parallel_nearest_facility', PACKAGE = 'kfbmisc', x, y)
}

#' Find nearest neighbor of x and measure distance (non-self)
#'
#' @param x matrix of coordinates. In the same format as st_coordinates output (X, Y)
#' @param y Same as x.
#'
#' @return Matrix. 2 columns. First column is index of closest unit in y.
#' Second column is distance
#'
#' @export
rcpp_parallel_nearest_facility_nonself <- function(x, y) {
    .Call('_kfbmisc_rcpp_parallel_nearest_facility_nonself', PACKAGE = 'kfbmisc', x, y)
}
kylebutts/kfbmisc documentation built on April 17, 2025, 5:20 p.m.