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_type = std::function< void(std::size_t, std::size_t, 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 sp_type = SingleParticle< T >
 
using value_type = T
 
using weight_type = WeightType< T >
 

Public Member Functions

 Particle (size_type N)
 
sp_type begin ()
 Get a SingleParticle<T> object for the first particle. More...
 
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)
 
sp_type end ()
 Get a SingleParticle<T> object for the first particle. More...
 
bool resample (const resample_type &op, double threshold)
 Performing resampling if ESS/N < threshold. More...
 
rng_typerng (size_type id)
 Get an (parallel) RNG stream for a given particle. More...
 
const rng_typerng (size_type id) const
 Get an (parallel) RNG stream for a given particle. More...
 
rng_typerng ()
 Get the (sequential) RNG used stream for resampling. More...
 
const rng_typerng () const
 Get the (sequential) RNG used stream for resampling. 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...
 
sp_type sp (size_type id)
 Get a SingleParticle<T> object. 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_type = std::function<void( std::size_t, std::size_t, rng_type &, const double *, size_type *)>

Definition at line 57 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 55 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 >::sp_type = SingleParticle<T>

Definition at line 58 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>
sp_type vsmc::Particle< T >::begin ( )
inline

Get a SingleParticle<T> object for the first particle.

Definition at line 158 of file particle.hpp.

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>
sp_type vsmc::Particle< T >::end ( )
inline

Get a SingleParticle<T> object for the first particle.

Definition at line 161 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 170 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>
const rng_type& vsmc::Particle< T >::rng ( size_type  id) const
inline

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

Definition at line 146 of file particle.hpp.

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

Get the (sequential) RNG used stream for resampling.

Definition at line 149 of file particle.hpp.

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

Get the (sequential) RNG used stream for resampling.

Definition at line 152 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>
sp_type vsmc::Particle< T >::sp ( size_type  id)
inline

Get a SingleParticle<T> object.

Definition at line 155 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.