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

Particle class representing the whole particle set. More...

#include <vsmc/core/particle.hpp>

Public Types

using resample_rng_type = ResampleRNGType< T >
 
using resample_type = std::function< void(std::size_t, std::size_t, resample_rng_type &, const double *, size_type *)>
 
using rng_set_type = RNGSetType< T >
 
using rng_type = typename rng_set_type::rng_type
 
using size_type = SizeType< T >
 
using value_type = T
 
using weight_type = WeightType< T >
 

Public Member Functions

 Particle (size_type N)
 
Particle< T > clone (bool new_rng) const
 Clone the particle system except the RNG engines. More...
 
Particle< T > & clone (const Particle< T > &other, bool retain_rng)
 Clone another particle system except the RNG engines. More...
 
Particle< T > & clone (Particle< T > &&other, bool retain_rng)
 
bool resample (const resample_type &op, double threshold)
 Performing resampling if ESS/N < threshold. More...
 
resample_rng_typeresample_rng ()
 Get the (sequential) RNG used stream for resampling. More...
 
rng_typerng (size_type id)
 Get an (parallel) RNG stream for a given particle. More...
 
rng_set_typerng_set ()
 Read and write access to the RNG collection object. More...
 
const rng_set_typerng_set () const
 Read only access to the RNG collection object. More...
 
size_type size () const
 Number of particles. More...
 
value_typevalue ()
 Read and write access to the value collection object. More...
 
const value_typevalue () const
 Read only access to the value collection object. More...
 
weight_typeweight ()
 Read and write access to the weight collection object. More...
 
const weight_typeweight () const
 Read only access to the weight collection object. More...
 

Detailed Description

template<typename T>
class vsmc::Particle< T >

Particle class representing the whole particle set.

Definition at line 48 of file particle.hpp.

Member Typedef Documentation

template<typename T>
using vsmc::Particle< T >::resample_rng_type = ResampleRNGType<T>

Definition at line 55 of file particle.hpp.

template<typename T>
using vsmc::Particle< T >::resample_type = std::function<void(std::size_t, std::size_t, resample_rng_type &, const double *, size_type *)>

Definition at line 58 of file particle.hpp.

template<typename T>
using vsmc::Particle< T >::rng_set_type = RNGSetType<T>

Definition at line 54 of file particle.hpp.

template<typename T>
using vsmc::Particle< T >::rng_type = typename rng_set_type::rng_type

Definition at line 56 of file particle.hpp.

template<typename T>
using vsmc::Particle< T >::size_type = SizeType<T>

Definition at line 51 of file particle.hpp.

template<typename T>
using vsmc::Particle< T >::value_type = T

Definition at line 52 of file particle.hpp.

template<typename T>
using vsmc::Particle< T >::weight_type = WeightType<T>

Definition at line 53 of file particle.hpp.

Constructor & Destructor Documentation

template<typename T>
vsmc::Particle< T >::Particle ( size_type  N)
inlineexplicit

Definition at line 60 of file particle.hpp.

Member Function Documentation

template<typename T>
Particle<T> vsmc::Particle< T >::clone ( bool  new_rng) const
inline

Clone the particle system except the RNG engines.

Parameters
new_rngIf true, the new particle system has new-seeded RNG. Otherwise false, it is exactly the same as the current.

Definition at line 73 of file particle.hpp.

template<typename T>
Particle<T>& vsmc::Particle< T >::clone ( const Particle< T > &  other,
bool  retain_rng 
)
inline

Clone another particle system except the RNG engines.

Parameters
otherThe particle system to be cloned
retain_rngIf true, retain the current system's RNG. Otherwise, it is exactly the same as the new one.

Definition at line 89 of file particle.hpp.

template<typename T>
Particle<T>& vsmc::Particle< T >::clone ( Particle< T > &&  other,
bool  retain_rng 
)
inline

Definition at line 105 of file particle.hpp.

template<typename T>
bool vsmc::Particle< T >::resample ( const resample_type op,
double  threshold 
)
inline

Performing resampling if ESS/N < threshold.

Parameters
opThe resampling operation funcitor
thresholdThe threshold of ESS/N below which resampling will be performed
Returns
true if resampling was performed

Definition at line 155 of file particle.hpp.

template<typename T>
resample_rng_type& vsmc::Particle< T >::resample_rng ( )
inline

Get the (sequential) RNG used stream for resampling.

Definition at line 146 of file particle.hpp.

template<typename T>
rng_type& vsmc::Particle< T >::rng ( size_type  id)
inline

Get an (parallel) RNG stream for a given particle.

Definition at line 143 of file particle.hpp.

template<typename T>
rng_set_type& vsmc::Particle< T >::rng_set ( )
inline

Read and write access to the RNG collection object.

Definition at line 137 of file particle.hpp.

template<typename T>
const rng_set_type& vsmc::Particle< T >::rng_set ( ) const
inline

Read only access to the RNG collection object.

Definition at line 140 of file particle.hpp.

template<typename T>
size_type vsmc::Particle< T >::size ( ) const
inline

Number of particles.

Definition at line 122 of file particle.hpp.

template<typename T>
value_type& vsmc::Particle< T >::value ( )
inline

Read and write access to the value collection object.

Definition at line 125 of file particle.hpp.

template<typename T>
const value_type& vsmc::Particle< T >::value ( ) const
inline

Read only access to the value collection object.

Definition at line 128 of file particle.hpp.

template<typename T>
weight_type& vsmc::Particle< T >::weight ( )
inline

Read and write access to the weight collection object.

Definition at line 131 of file particle.hpp.

template<typename T>
const weight_type& vsmc::Particle< T >::weight ( ) const
inline

Read only access to the weight collection object.

Definition at line 134 of file particle.hpp.