(C++) Sum of Pairwise Distances Between Cases in Two Aligned Time Series
(C++) Sum of Pairwise Distances Between Cases in Two Aligned Time Series
Computes the lock-step sum of distances between two regular and aligned time series. NA values should be removed before using this function. If the selected distance function is "chi" or "cosine", pairs of zeros should be either removed or replaced with pseudo-zeros (i.e. 0.00001).
distance_ls_cpp(x, y, distance ="euclidean")
Arguments
x: (required, numeric matrix) univariate or multivariate time series.
y: (required, numeric matrix) univariate or multivariate time series with the same number of columns and rows as 'x'.
distance: (optional, character string) distance name from the "names" column of the dataset distances (see distances$name). Default: "euclidean".
Returns
numeric
Examples
#simulate two regular time seriesx <- zoo_simulate( seed =1, irregular =FALSE)y <- zoo_simulate( seed =2, irregular =FALSE)#distance matrixdist_matrix <- distance_ls_cpp( x = x, y = y, distance ="euclidean")
See Also
Other Rcpp_matrix: cost_matrix_diagonal_cpp(), cost_matrix_diagonal_weighted_cpp(), cost_matrix_orthogonal_cpp(), distance_matrix_cpp()