cost_path_diagonal_bandwidth_cpp: (C++) Orthogonal and Diagonal Least Cost Path Restricted by...

View source: R/RcppExports.R

cost_path_diagonal_bandwidth_cppR Documentation

(C++) Orthogonal and Diagonal Least Cost Path Restricted by Sakoe-Chiba band

Description

Computes the least cost matrix from a distance matrix. Considers diagonals during computation of least-costs. In case of ties, diagonals are favored.

Usage

cost_path_diagonal_bandwidth_cpp(dist_matrix, cost_matrix, bandwidth = 1)

Arguments

dist_matrix

(required, numeric matrix). Distance matrix between two time series.

cost_matrix

(required, numeric matrix). Cost matrix generated from dist_matrix.

bandwidth

(required, numeric) Size of the Sakoe-Chiba band at both sides of the diagonal used to constrain the least cost path. Expressed as a fraction of the number of matrix rows and columns. Unrestricted by default. Default: 1

Value

data frame

See Also

Other Rcpp_cost_path: cost_path_cpp(), cost_path_diagonal_cpp(), cost_path_orthogonal_bandwidth_cpp(), cost_path_orthogonal_cpp(), cost_path_slotting_cpp(), cost_path_sum_cpp(), cost_path_trim_cpp()

Examples

#simulate two time series
x <- zoo_simulate(seed = 1)
y <- zoo_simulate(seed = 2)

#distance matrix
dist_matrix <- distance_matrix_cpp(
  x = x,
  y = y,
  distance = "euclidean"
)

#least cost matrix
cost_matrix <- cost_matrix_orthogonal_cpp(
  dist_matrix = dist_matrix
)

#least cost path
cost_path <- cost_path_diagonal_cpp(
  dist_matrix = dist_matrix,
  cost_matrix = cost_matrix
)

cost_path

distantia documentation built on April 4, 2025, 5:42 a.m.