Learn R Programming

ldmppr (version 1.1.0)

toroidal_dist_matrix_optimized: Optimized function to compute toroidal distance matrix over a rectangular domain

Description

Optimized function to compute toroidal distance matrix over a rectangular domain

Usage

toroidal_dist_matrix_optimized(location_matrix, x_bound, y_bound)

Value

a matrix of toroidal distances.

Arguments

location_matrix

a 2 column matrix of (x,y) coordinates.

x_bound

the upper bound for the x dimension.

y_bound

the upper bound for the y dimension.

Examples

Run this code
# Generate a matrix of locations
location_matrix <- matrix(c(1, 2, 3, 4, 5, 6), ncol = 2)
x_bound <- 10
y_bound <- 10

# Compute the toroidal distance matrix
toroidal_dist_matrix_optimized(location_matrix, x_bound, y_bound)

Run the code above in your browser using DataLab