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

Record and trace resample index. More...

#include <vsmc/resample/index.hpp>

Public Types

using index_type = IntType
 
using size_type = std::size_t
 

Public Member Functions

 ResampleIndex (size_type N)
 
void clear ()
 Release memory. More...
 
index_type index (size_type id, std::size_t iter) const
 Get the index given the particle ID and iteration number, starting with zero. More...
 
template<MatrixLayout Layout>
Vector< index_typeindex_matrix () const
 
void insert ()
 
template<typename InputIter >
void insert (InputIter first)
 
template<typename InputIter >
void insert (std::size_t iter, InputIter first)
 
std::size_t iter_size () const
 Number of iterations recorded. More...
 
void push_back ()
 
template<typename InputIter >
void push_back (InputIter first)
 
template<MatrixLayout Layout, typename OutputIter >
void read_index_matrix (OutputIter first) const
 
void reset ()
 Reset history. More...
 
size_type size () const
 

Detailed Description

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

Record and trace resample 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 51 of file index.hpp.

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

Definition at line 50 of file index.hpp.

Constructor & Destructor Documentation

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

Definition at line 53 of file index.hpp.

Member Function Documentation

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

Release memory.

Definition at line 68 of file index.hpp.

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

Get the index given the particle ID and iteration number, starting with zero.

The index is traced back using the history. The cost is O(iter_size() - iter)

Definition at line 121 of file index.hpp.

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

Definition at line 137 of file index.hpp.

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

Definition at line 89 of file index.hpp.

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

Definition at line 98 of file index.hpp.

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

Definition at line 107 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 62 of file index.hpp.

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

Definition at line 70 of file index.hpp.

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

Definition at line 83 of file index.hpp.

template<typename IntType = std::size_t>
template<MatrixLayout Layout, typename OutputIter >
void vsmc::ResampleIndex< IntType >::read_index_matrix ( OutputIter  first) const
inline

Definition at line 144 of file index.hpp.

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

Reset history.

Definition at line 65 of file index.hpp.

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

Definition at line 59 of file index.hpp.