MCKL
Monte Carlo Kernel Library
Public Types | Public Member Functions | List of all members
mckl::ResampleIndex< IntType > Class Template Reference

Record and trace resampling index. More...

#include <mckl/algorithm/resample.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
 
std::size_t num_iter () 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 mckl::ResampleIndex< IntType >

Record and trace resampling index.

Definition at line 598 of file resample.hpp.

Member Typedef Documentation

◆ index_type

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

Definition at line 601 of file resample.hpp.

Constructor & Destructor Documentation

◆ ResampleIndex()

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

Definition at line 603 of file resample.hpp.

Member Function Documentation

◆ clear()

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

Release memory.

Definition at line 630 of file resample.hpp.

◆ index() [1/3]

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

Definition at line 657 of file resample.hpp.

◆ index() [2/3]

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

Definition at line 662 of file resample.hpp.

◆ index() [3/3]

template<typename IntType = std::size_t>
index_type mckl::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 668 of file resample.hpp.

◆ index_matrix() [1/3]

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

Definition at line 717 of file resample.hpp.

◆ index_matrix() [2/3]

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

Definition at line 722 of file resample.hpp.

◆ index_matrix() [3/3]

template<typename IntType = std::size_t>
Vector<index_type> mckl::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 729 of file resample.hpp.

◆ index_matrix_ncol() [1/3]

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

Definition at line 697 of file resample.hpp.

◆ index_matrix_ncol() [2/3]

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

Definition at line 702 of file resample.hpp.

◆ index_matrix_ncol() [3/3]

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

Definition at line 707 of file resample.hpp.

◆ index_matrix_nrow() [1/2]

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

Definition at line 683 of file resample.hpp.

◆ index_matrix_nrow() [2/2]

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

Definition at line 688 of file resample.hpp.

◆ num_iter()

template<typename IntType = std::size_t>
std::size_t mckl::ResampleIndex< IntType >::num_iter ( ) const
inline

Number of iterations recorded.

Definition at line 606 of file resample.hpp.

◆ push_back() [1/2]

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

Append an identity resampling index.

Definition at line 633 of file resample.hpp.

◆ push_back() [2/2]

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

Append a resampling index.

Definition at line 646 of file resample.hpp.

◆ read_index_matrix() [1/3]

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

Definition at line 743 of file resample.hpp.

◆ read_index_matrix() [2/3]

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

Definition at line 749 of file resample.hpp.

◆ read_index_matrix() [3/3]

template<typename IntType = std::size_t>
template<typename RandomIter >
RandomIter mckl::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 765 of file resample.hpp.

◆ reset()

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

Reset history.

Definition at line 627 of file resample.hpp.

◆ size() [1/2]

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

The sample size of the last iteration.

Definition at line 609 of file resample.hpp.

◆ size() [2/2]

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

The sample size of a given iteration.

Definition at line 618 of file resample.hpp.