R/alg1.R

Defines functions alg1

Documented in alg1

#' Algorithm 1 ("brute_force") for H+ Estimate
#'
#' Estimates H+ for two sets (vectors) A and B, or 
#' a dissimilarity matrix D and a label vector L.
#' Approximation is calculated using p+1 percentiles,
#' with an accuracy bound of 1/p.
#'
#' @param qA (vector, px1)
#' @param qB (vector, px1)
#' @return Estimated H+, un-standardized (numeric vector)
#' @keywords internal
alg1 <- function(qA,qB,p){
  inty <- sapply(qA, function(x) sum(x>qB))
  return(inty)
}

Try the fasthplus package in your browser

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

fasthplus documentation built on Feb. 7, 2022, 5:16 p.m.