R/compute_outer.R

Defines functions compute_outer

Documented in compute_outer

#' @title
#' Computes distance on all possible combinations
#'
#' @description
#' Computes the distance between all combination of elements in two vector. a is
#' vector of size n, and b is a vector of size m, the result, will be a matrix
#' of size(n,m)
#'
#' @param a first vector (size n)
#' @param b second vector (size m)
#' @param op operator (e.g., '-', '+', '/', ...)
#'
#' @return
#' A n by m matrix that includes abs difference between elements of vector a and b.
#'
#' @keywords internal
#'
compute_outer <- function(a, b , op) {
  return(abs(outer(a, b, op)))
}

Try the CausalGPS package in your browser

Any scripts or data that you put into this service are public.

CausalGPS documentation built on Sept. 30, 2023, 1:06 a.m.