vSMC  v3.0.0
Scalable Monte Carlo
Public Types | Public Member Functions | List of all members
vsmc::ResampleIndex< IntType > Class Template Reference

Record and trace resampling index. More...

#include <vsmc/resample/index.hpp>

Public Types

using index_type = IntType
 

Public Member Functions

 ResampleIndex ()
 
void clear ()
 Release memory. More...
 
index_type index (std::size_t id) const
 
index_type index (std::size_t id, std::size_t iter_back) const
 
index_type index (std::size_t id, std::size_t iter_back, std::size_t iter) const
 Get the index given the particle ID and iteration number. More...
 
Vector< index_typeindex_matrix (MatrixLayout layout) const
 
Vector< index_typeindex_matrix (MatrixLayout layout, std::size_t iter_back) const
 
Vector< index_typeindex_matrix (MatrixLayout layout, std::size_t iter_back, std::size_t iter) const
 Get the resampling index matrix. More...
 
std::size_t index_matrix_ncol () const
 
std::size_t index_matrix_ncol (std::size_t iter_back) const
 
std::size_t index_matrix_ncol (std::size_t iter_back, std::size_t iter) const
 
std::size_t index_matrix_nrow () const
 
std::size_t index_matrix_nrow (std::size_t iter_back) const
 
void insert (std::size_t N)
 Insert at last iteration an identity resampling index. More...
 
template<typename InputIter >
void insert (std::size_t N, InputIter first)
 Insert at last iteration an identity resampling index. More...
 
template<typename InputIter >
void insert (std::size_t N, std::size_t iter, InputIter first)
 Insert at a given iteration a resampling index. More...
 
std::size_t iter_size () const
 Number of iterations recorded. More...
 
void push_back (std::size_t N)
 Append an identity resampling index. More...
 
template<typename InputIter >
void push_back (std::size_t N, InputIter first)
 Append a resampling index. More...
 
template<typename RandomIter >
RandomIter read_index_matrix (MatrixLayout layout, RandomIter first) const
 
template<typename RandomIter >
RandomIter read_index_matrix (MatrixLayout layout, RandomIter first, std::size_t iter_back) const
 
template<typename RandomIter >
RandomIter read_index_matrix (MatrixLayout layout, RandomIter first, std::size_t iter_back, std::size_t iter) const
 Read the resampling index matrix into an random access iterator. More...
 
void reset ()
 Reset history. More...
 
std::size_t size () const
 The sample size of the last iteration. More...
 
std::size_t size (std::size_t iter) const
 The sample size of a given iteration. More...
 

Detailed Description

template<typename IntType = std::size_t>
class vsmc::ResampleIndex< IntType >

Record and trace resampling index.

Definition at line 47 of file index.hpp.

Member Typedef Documentation

template<typename IntType = std::size_t>
using vsmc::ResampleIndex< IntType >::index_type = IntType

Definition at line 50 of file index.hpp.

Constructor & Destructor Documentation

template<typename IntType = std::size_t>
vsmc::ResampleIndex< IntType >::ResampleIndex ( )
inline

Definition at line 52 of file index.hpp.

Member Function Documentation

template<typename IntType = std::size_t>
void vsmc::ResampleIndex< IntType >::clear ( )
inline

Release memory.

Definition at line 77 of file index.hpp.

template<typename IntType = std::size_t>
index_type vsmc::ResampleIndex< IntType >::index ( std::size_t  id) const
inline

Definition at line 132 of file index.hpp.

template<typename IntType = std::size_t>
index_type vsmc::ResampleIndex< IntType >::index ( std::size_t  id,
std::size_t  iter_back 
) const
inline

Definition at line 137 of file index.hpp.

template<typename IntType = std::size_t>
index_type vsmc::ResampleIndex< IntType >::index ( std::size_t  id,
std::size_t  iter_back,
std::size_t  iter 
) const
inline

Get the index given the particle ID and iteration number.

Definition at line 143 of file index.hpp.

template<typename IntType = std::size_t>
Vector<index_type> vsmc::ResampleIndex< IntType >::index_matrix ( MatrixLayout  layout) const
inline

Definition at line 187 of file index.hpp.

template<typename IntType = std::size_t>
Vector<index_type> vsmc::ResampleIndex< IntType >::index_matrix ( MatrixLayout  layout,
std::size_t  iter_back 
) const
inline

Definition at line 192 of file index.hpp.

template<typename IntType = std::size_t>
Vector<index_type> vsmc::ResampleIndex< IntType >::index_matrix ( MatrixLayout  layout,
std::size_t  iter_back,
std::size_t  iter 
) const
inline

Get the resampling index matrix.

Definition at line 199 of file index.hpp.

template<typename IntType = std::size_t>
std::size_t vsmc::ResampleIndex< IntType >::index_matrix_ncol ( ) const
inline

Definition at line 169 of file index.hpp.

template<typename IntType = std::size_t>
std::size_t vsmc::ResampleIndex< IntType >::index_matrix_ncol ( std::size_t  iter_back) const
inline

Definition at line 174 of file index.hpp.

template<typename IntType = std::size_t>
std::size_t vsmc::ResampleIndex< IntType >::index_matrix_ncol ( std::size_t  iter_back,
std::size_t  iter 
) const
inline

Definition at line 179 of file index.hpp.

template<typename IntType = std::size_t>
std::size_t vsmc::ResampleIndex< IntType >::index_matrix_nrow ( ) const
inline

Definition at line 157 of file index.hpp.

template<typename IntType = std::size_t>
std::size_t vsmc::ResampleIndex< IntType >::index_matrix_nrow ( std::size_t  iter_back) const
inline

Definition at line 162 of file index.hpp.

template<typename IntType = std::size_t>
void vsmc::ResampleIndex< IntType >::insert ( std::size_t  N)
inline

Insert at last iteration an identity resampling index.

Definition at line 103 of file index.hpp.

template<typename IntType = std::size_t>
template<typename InputIter >
void vsmc::ResampleIndex< IntType >::insert ( std::size_t  N,
InputIter  first 
)
inline

Insert at last iteration an identity resampling index.

Definition at line 114 of file index.hpp.

template<typename IntType = std::size_t>
template<typename InputIter >
void vsmc::ResampleIndex< IntType >::insert ( std::size_t  N,
std::size_t  iter,
InputIter  first 
)
inline

Insert at a given iteration a resampling index.

Definition at line 124 of file index.hpp.

template<typename IntType = std::size_t>
std::size_t vsmc::ResampleIndex< IntType >::iter_size ( ) const
inline

Number of iterations recorded.

Definition at line 55 of file index.hpp.

template<typename IntType = std::size_t>
void vsmc::ResampleIndex< IntType >::push_back ( std::size_t  N)
inline

Append an identity resampling index.

Definition at line 80 of file index.hpp.

template<typename IntType = std::size_t>
template<typename InputIter >
void vsmc::ResampleIndex< IntType >::push_back ( std::size_t  N,
InputIter  first 
)
inline

Append a resampling index.

Definition at line 92 of file index.hpp.

template<typename IntType = std::size_t>
template<typename RandomIter >
RandomIter vsmc::ResampleIndex< IntType >::read_index_matrix ( MatrixLayout  layout,
RandomIter  first 
) const
inline

Definition at line 212 of file index.hpp.

template<typename IntType = std::size_t>
template<typename RandomIter >
RandomIter vsmc::ResampleIndex< IntType >::read_index_matrix ( MatrixLayout  layout,
RandomIter  first,
std::size_t  iter_back 
) const
inline

Definition at line 218 of file index.hpp.

template<typename IntType = std::size_t>
template<typename RandomIter >
RandomIter vsmc::ResampleIndex< IntType >::read_index_matrix ( MatrixLayout  layout,
RandomIter  first,
std::size_t  iter_back,
std::size_t  iter 
) const
inline

Read the resampling index matrix into an random access iterator.

The matrix, say \(M\) is assume to be \(N\) by \(R\), where \(R\) is the number of iterations between iter and iter_back, inclusive; and \(N\) is the sample size at iteration iter_back. The output is equivalent to set the \(M_{i,j}\) to index(i, j, iter_back). Note that, column major will be more efficient.

Definition at line 234 of file index.hpp.

template<typename IntType = std::size_t>
void vsmc::ResampleIndex< IntType >::reset ( )
inline

Reset history.

Definition at line 74 of file index.hpp.

template<typename IntType = std::size_t>
std::size_t vsmc::ResampleIndex< IntType >::size ( ) const
inline

The sample size of the last iteration.

Definition at line 58 of file index.hpp.

template<typename IntType = std::size_t>
std::size_t vsmc::ResampleIndex< IntType >::size ( std::size_t  iter) const
inline

The sample size of a given iteration.

Definition at line 66 of file index.hpp.