vSMC  v3.0.0
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 range_type = ParticleRange< T >
 
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 state_type = T
 
using weight_type = WeightType< T >
 

Public Member Functions

 Particle ()
 
template<typename... Args>
 Particle (size_type N, Args &&...args)
 
sp_type begin ()
 Get a SingleParticle<T> object for the first particle. More...
 
Particle< T > clone () const
 Clone the Particle except the RNG engines. More...
 
sp_type end ()
 Get a SingleParticle<T> object for the first particle. More...
 
range_type range (size_type begin, size_type end)
 Get a ParticleRange<T> object. More...
 
range_type range ()
 Get a ParticleRange<T> object with begin == 0, end == size() More...
 
template<typename InputIter >
void resize_by_index (size_type N, InputIter index)
 Resize by selecting according to user supplied index vector. More...
 
template<typename ResampleType >
void resize_by_resample (size_type N, ResampleType &&op)
 Resize by resampling. More...
 
void resize_by_uniform (size_type N)
 Resize by uniformly selecting from all particles. 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...
 
state_typestate ()
 Read and write access to the state collection object. More...
 
const state_typestate () const
 Read only access to the state 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 83 of file particle.hpp.

Member Typedef Documentation

template<typename T>
using vsmc::Particle< T >::range_type = ParticleRange<T>

Definition at line 92 of file particle.hpp.

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

Definition at line 89 of file particle.hpp.

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

Definition at line 90 of file particle.hpp.

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

Definition at line 86 of file particle.hpp.

template<typename T>
using vsmc::Particle< T >::sp_type = SingleParticle<T>

Definition at line 91 of file particle.hpp.

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

Definition at line 87 of file particle.hpp.

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

Definition at line 88 of file particle.hpp.

Constructor & Destructor Documentation

template<typename T>
vsmc::Particle< T >::Particle ( )
inline

Definition at line 94 of file particle.hpp.

template<typename T>
template<typename... Args>
vsmc::Particle< T >::Particle ( size_type  N,
Args &&...  args 
)
inlineexplicit

Definition at line 100 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 216 of file particle.hpp.

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

Clone the Particle except the RNG engines.

Definition at line 110 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 219 of file particle.hpp.

template<typename T>
range_type vsmc::Particle< T >::range ( size_type  begin,
size_type  end 
)
inline

Get a ParticleRange<T> object.

Definition at line 207 of file particle.hpp.

template<typename T>
range_type vsmc::Particle< T >::range ( )
inline

Get a ParticleRange<T> object with begin == 0, end == size()

Definition at line 213 of file particle.hpp.

template<typename T>
template<typename InputIter >
void vsmc::Particle< T >::resize_by_index ( size_type  N,
InputIter  index 
)
inline

Resize by selecting according to user supplied index vector.

Parameters
NThe new sample size
indexN-vector of parent indices

Definition at line 127 of file particle.hpp.

template<typename T>
template<typename ResampleType >
void vsmc::Particle< T >::resize_by_resample ( size_type  N,
ResampleType &&  op 
)
inline

Resize by resampling.

Parameters
NThe new sample size
opThe resampling function object

The particle system is resampled to a new system with possibly different size. The system will be changed even if N == size().

Definition at line 142 of file particle.hpp.

template<typename T>
void vsmc::Particle< T >::resize_by_uniform ( size_type  N)
inline

Resize by uniformly selecting from all particles.

Parameters
NThe new sample size

This is equivalent to first set the weights to equal, and then perform Multinomial resampling. The particle system will be changed even if N == size().

Definition at line 161 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 186 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 192 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 198 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 201 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 180 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 183 of file particle.hpp.

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

Number of particles.

Definition at line 120 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 204 of file particle.hpp.

template<typename T>
state_type& vsmc::Particle< T >::state ( )
inline

Read and write access to the state collection object.

Definition at line 168 of file particle.hpp.

template<typename T>
const state_type& vsmc::Particle< T >::state ( ) const
inline

Read only access to the state collection object.

Definition at line 171 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 174 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 177 of file particle.hpp.