MCKL
Monte Carlo Kernel Library
Classes | Typedefs | Enumerations | Functions
Resampling

Resampling. More...

Classes

class  mckl::ResampleAlgorithm< U01SeqType, Residual >
 Resampling algorithm. More...
 
class  mckl::ResampleEval< T >
 SMCSampler<T>::eval_type subtype. More...
 
class  mckl::ResampleIndex< IntType >
 Record and trace resampling index. More...
 
class  mckl::U01SequenceSorted
 Sorted of standard uniform numbers. More...
 
class  mckl::U01SequenceStratified
 Stratified standard uniform numbers. More...
 
class  mckl::U01SequenceSystematic
 Systematic standard uniform numbers. More...
 

Typedefs

using mckl::ResampleMultinomial = ResampleAlgorithm< U01SequenceSorted, false >
 Multinomial resampling. More...
 
using mckl::ResampleResidual = ResampleAlgorithm< U01SequenceSorted, true >
 Residual resampling. More...
 
using mckl::ResampleResidualStratified = ResampleAlgorithm< U01SequenceStratified, true >
 Residual stratified resampling. More...
 
using mckl::ResampleResidualSystematic = ResampleAlgorithm< U01SequenceSystematic, true >
 Residual systematic resampling. More...
 
using mckl::ResampleStratified = ResampleAlgorithm< U01SequenceStratified, false >
 Stratified resampling. More...
 
using mckl::ResampleSystematic = ResampleAlgorithm< U01SequenceSystematic, false >
 Systematic resampling. More...
 

Enumerations

enum  mckl::ResampleScheme {
  mckl::ResampleScheme::Multinomial,
  mckl::ResampleScheme::Stratified,
  mckl::ResampleScheme::Systematic,
  mckl::ResampleScheme::Residual,
  mckl::ResampleScheme::ResidualStratified,
  mckl::ResampleScheme::ResidualSystematic
}
 Resampling schemes. More...
 

Functions

template<typename InputIter , typename OutputIter >
OutputIter mckl::resample_trans_rep_index (std::size_t N, std::size_t M, InputIter replication, OutputIter index)
 Transform replication numbers into parent indices. More...
 
template<typename InputIter , typename OutputIterR , typename OutputIterI >
std::size_t mckl::resample_trans_residual (std::size_t N, std::size_t M, InputIter weight, OutputIterR resid, OutputIterI integ)
 Transform normalized weights to normalized residual and integrals,. More...
 
template<typename InputIter , typename OutputIter , typename U01SeqType >
OutputIter mckl::resample_trans_u01_rep (std::size_t N, std::size_t M, InputIter weight, U01SeqType &&u01seq, OutputIter replication)
 Transform uniform [0, 1) sequence into replication numbers. More...
 
template<typename RealType , typename RNGType >
void mckl::u01_rand_sorted (RNGType &rng, std::size_t N, RealType *r)
 Generate sorted standard uniform numbers with \(O(N)\) cost. More...
 
template<typename RealType , typename RNGType >
void mckl::u01_rand_stratified (RNGType &rng, std::size_t N, RealType *r)
 Generate stratified standard uniform numbers. More...
 
template<typename RealType , typename RNGType >
void mckl::u01_rand_systematic (RNGType &rng, std::size_t N, RealType *r)
 Generate systematic standard uniform numbers. More...
 
template<typename RealType >
void mckl::u01_trans_sorted (std::size_t N, const RealType *u01, RealType *r)
 Tranform a sequence of standard uniform random numbers to sorted sequence. More...
 
template<typename RealType >
void mckl::u01_trans_stratified (std::size_t N, const RealType *u01, RealType *r)
 Transform a sequence of standard uniform random numbers to a stratified sequence. More...
 
template<typename RealType >
void mckl::u01_trans_systematic (std::size_t N, const RealType *u01, RealType *r)
 Transform a single standard uniform random number to a systematic sequence. More...
 

Detailed Description

Resampling.

Typedef Documentation

◆ ResampleMultinomial

Multinomial resampling.

Definition at line 571 of file resample.hpp.

◆ ResampleResidual

Residual resampling.

Definition at line 583 of file resample.hpp.

◆ ResampleResidualStratified

Residual stratified resampling.

Definition at line 588 of file resample.hpp.

◆ ResampleResidualSystematic

Residual systematic resampling.

Definition at line 593 of file resample.hpp.

◆ ResampleStratified

Stratified resampling.

Definition at line 575 of file resample.hpp.

◆ ResampleSystematic

Systematic resampling.

Definition at line 579 of file resample.hpp.

Enumeration Type Documentation

◆ ResampleScheme

enum mckl::ResampleScheme
strong

Resampling schemes.

Enumerator
Multinomial 

Multinomial resampling.

Stratified 

Stratified resampling.

Systematic 

Systematic resampling.

Residual 

Residual resampling.

ResidualStratified 

Stratified resampling on residuals.

ResidualSystematic 

Systematic resampling on residuals.

Definition at line 43 of file resample.hpp.

Function Documentation

◆ resample_trans_rep_index()

template<typename InputIter , typename OutputIter >
OutputIter mckl::resample_trans_rep_index ( std::size_t  N,
std::size_t  M,
InputIter  replication,
OutputIter  index 
)
inline

Transform replication numbers into parent indices.

Parameters
NSample size before resampling
MSample size after resampling
replicationN-vector of replication numbers
indexM-vector of parent indices

Definition at line 417 of file resample.hpp.

◆ resample_trans_residual()

template<typename InputIter , typename OutputIterR , typename OutputIterI >
std::size_t mckl::resample_trans_residual ( std::size_t  N,
std::size_t  M,
InputIter  weight,
OutputIterR  resid,
OutputIterI  integ 
)
inline

Transform normalized weights to normalized residual and integrals,.

Parameters
NSample size before resampling
MSample size after resampling
weightN-vector of normalized weights
residN-vector of normalized residuals
integN-vector of integral parts
Returns
The number of remaining elements to be resampled

Definition at line 334 of file resample.hpp.

◆ resample_trans_u01_rep()

template<typename InputIter , typename OutputIter , typename U01SeqType >
OutputIter mckl::resample_trans_u01_rep ( std::size_t  N,
std::size_t  M,
InputIter  weight,
U01SeqType &&  u01seq,
OutputIter  replication 
)
inline

Transform uniform [0, 1) sequence into replication numbers.

Parameters
NSample size before resampling
MSample size after resampling
weightN-vector of normalized weights
u01seqM ordered uniform [0, 1) random numbers
replicationN-vector of replication numbers

Definition at line 375 of file resample.hpp.

◆ u01_rand_sorted()

template<typename RealType , typename RNGType >
void mckl::u01_rand_sorted ( RNGType &  rng,
std::size_t  N,
RealType *  r 
)
inline

Generate sorted standard uniform numbers with \(O(N)\) cost.

Definition at line 217 of file resample.hpp.

◆ u01_rand_stratified()

template<typename RealType , typename RNGType >
void mckl::u01_rand_stratified ( RNGType &  rng,
std::size_t  N,
RealType *  r 
)
inline

Generate stratified standard uniform numbers.

Definition at line 240 of file resample.hpp.

◆ u01_rand_systematic()

template<typename RealType , typename RNGType >
void mckl::u01_rand_systematic ( RNGType &  rng,
std::size_t  N,
RealType *  r 
)
inline

Generate systematic standard uniform numbers.

Definition at line 259 of file resample.hpp.

◆ u01_trans_sorted()

template<typename RealType >
void mckl::u01_trans_sorted ( std::size_t  N,
const RealType *  u01,
RealType *  r 
)
inline

Tranform a sequence of standard uniform random numbers to sorted sequence.

Definition at line 143 of file resample.hpp.

◆ u01_trans_stratified()

template<typename RealType >
void mckl::u01_trans_stratified ( std::size_t  N,
const RealType *  u01,
RealType *  r 
)
inline

Transform a sequence of standard uniform random numbers to a stratified sequence.

Definition at line 167 of file resample.hpp.

◆ u01_trans_systematic()

template<typename RealType >
void mckl::u01_trans_systematic ( std::size_t  N,
const RealType *  u01,
RealType *  r 
)
inline

Transform a single standard uniform random number to a systematic sequence.

Definition at line 192 of file resample.hpp.