R/RcppExports.R

Defines functions Stratified_Resampler SSP_Resampler

Documented in SSP_Resampler Stratified_Resampler

# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

#' SSP resampling
#'
#' @importFrom Rdpack reprompt
#' @description This function implements the SSP resampling algorithm \insertCite{gerber2019negative}{PFoptim}.
#' @usage SSP_Resampler(U,W)
#' @param U A vector of points in (0,1) such that \code{length(U)=length(W)}.
#' @param W A vector of normalized weights.
#' @details 
#' For efficiency reasons, \code{SSP_Resampler} does not perform checks on the supplied arguments.
#' @return A vector of length N with elements in the set \eqn{\{1,...,N\}}, with \code{N=length(U)=length(W)}.
#' @keywords resampling algorithms
#' @export
#' @examples
#' N<-100
#' W<-rbeta(N,0.5,2)
#' W<-W/sum(W)
#' J<-SSP_Resampler(runif(N),W)
#' @references 
#' \insertAllCited{}
SSP_Resampler <- function(points, W) {
    .Call(`_PFoptim_SSP_Resampler`, points, W)
}

#' Stratified resampling
#'
#' @importFrom Rdpack reprompt
#' @description This function implements the stratified resampling algorithm descibed see e.g. in Section 9.6 of \insertCite{chopin2020introduction;textual}{PFoptim}
#' @usage Stratified_Resampler(U,W)
#' @param U A vector of points in (0,1) such that \code{length(U)=length(W)}.
#' @param W A vector of normalized weights.
#' @details 
#' For efficiency reasons, \code{Stratified_Resampler} does not perform checks on the supplied arguments.
#' @return A vector of length N with elements in the set \eqn{\{1,...,N\}}, with \code{N=length(U)=length(W)}.
#' @keywords resampling algorithms
#' @export
#' @examples
#' N<-100
#' W<-rbeta(N,0.5,2)
#' W<-W/sum(W)
#' J<-Stratified_Resampler(runif(N),W)
#' @references 
#' \insertAllCited{}
Stratified_Resampler <- function(points, W) {
    .Call(`_PFoptim_Stratified_Resampler`, points, W)
}
mathieugerber/PFoptim documentation built on July 1, 2022, 2:34 p.m.