vSMC
vSMC: Scalable Monte Carlo
|
Weight set class. More...
#include <vsmc/core/weight_set.hpp>
Public Types | |
typedef std::size_t | size_type |
Public Member Functions | |
WeightSet (size_type N) | |
WeightSet (const WeightSet &)=default | |
WeightSet (WeightSet &&)=default | |
virtual | ~WeightSet () |
template<typename InputIter > | |
void | add_log_weight (InputIter first) |
Set normalized weight, unnormalized logarithm weight and ESS by adding to the unnormalized logarithm weights with (possible unormalized) logarithm incremental weights through an input iterator. More... | |
template<typename RandomIter > | |
void | add_log_weight (RandomIter first, int stride) |
Set normalized weight, unnormalized logarithm weight and ESS by adding to the unnormalized logarithm weights with (possible unormalized) logarithm incremental weights through a ranodm access iterator with (possible non-uniform) stride. More... | |
template<typename InputIter > | |
double | cess (InputIter first, bool use_log) const |
Compute CESS given (log) incremental weights. More... | |
template<typename RandomIter > | |
double | cess (RandomIter first, int stride, bool use_log) const |
Compute CESS given (log) incremental weights. More... | |
template<typename URNG > | |
size_type | draw (URNG &eng) const |
Draw a sample according to the weights. More... | |
double | ess () const |
ESS of the particle collection based on the current weights. More... | |
template<typename InputIter > | |
double | ess (InputIter first, bool use_log) const |
Compute ESS given (log) incremental weights. More... | |
template<typename RandomIter > | |
double | ess (RandomIter first, int stride, bool use_log) const |
Compute ESS given (log) incremental weights. More... | |
double | log_weight (size_type id) const |
Get the unnormalized logarithm weight of the id'th particle. More... | |
const double * | log_weight_data () const |
Read only access to the raw data of logarithm weight. More... | |
template<typename InputIter > | |
void | mul_weight (InputIter first) |
Set normalized weight, unnormalized logarithm weight and ESS by multiply the normalized weight with (possible unnormalized) incremental weights through an input iterator. More... | |
template<typename RandomIter > | |
void | mul_weight (RandomIter first, int stride) |
Set normalized weight, unnormalized logarithm weight and ESS by multiply the normalized weight with (possible unnormalized) incremental weights through a random access iterator with (possible non-uniform) stride. More... | |
WeightSet & | operator= (const WeightSet &)=default |
WeightSet & | operator= (WeightSet &&)=default |
template<typename OutputIter > | |
void | read_log_weight (OutputIter first) const |
Read unnormalized logarithm weights through an output iterator. More... | |
template<typename RandomIter > | |
void | read_log_weight (RandomIter first, int stride) const |
Read unnormalized logarithm weights through a random access iterator with (possible non-uniform stride) More... | |
virtual void | read_resample_weight (double *first) const |
Read normalized weights through an output iterator for the purpose of resampling. More... | |
template<typename OutputIter > | |
void | read_weight (OutputIter first) const |
Read normalized weights through an output iterator. More... | |
template<typename RandomIter > | |
void | read_weight (RandomIter first, int stride) const |
Read normalized weights through a random access iterator with (possible non-uniform stride) More... | |
virtual size_type | resample_size () const |
Size of the weight set for the purpose of resampling. More... | |
virtual const double * | resample_weight_data () const |
Read only access to the resampling weights. More... | |
void | set_equal_weight () |
Set normalized weight, unnormalized logarithm weight and ESS such that each particle has a equal weight. More... | |
template<typename InputIter > | |
void | set_log_weight (InputIter first) |
Set normalized weight, unnormalized logarithm weight and ESS by changing the (possible unnormalized) logarithm weights directly through an input iterator. More... | |
template<typename RandomIter > | |
void | set_log_weight (RandomIter first, int stride) |
Set normalized weight, unnormalized logarithm weight and ESS by changing the (possible unnormalized) logarithm weights directly through a random access iterator with (possible non-uniform) stride. More... | |
template<typename InputIter > | |
void | set_weight (InputIter first) |
Set normalized weight, unnormalized logarithm weight and ESS by changing the (possible unnormalized) weights directly through an input iterator. More... | |
template<typename RandomIter > | |
void | set_weight (RandomIter first, int stride) |
Set normalized weight, unnormalized logarithm weight and ESS by changing the (possible unnormalized) weights directly through a random access iterator with (possible non-uniform) stride. More... | |
size_type | size () const |
double | weight (size_type id) const |
Get the normalized weight of the id'th particle. More... | |
const double * | weight_data () const |
Read only access to the raw data of weight. More... | |
Protected Member Functions | |
virtual double | compute_cess (const double *first, bool use_log) const |
Compute CESS given (logarithm) unormalized incremental weights. More... | |
virtual double | compute_ess (const double *first, bool use_log) const |
Compute ESS given (logarithm) unormalzied incremental weights. More... | |
virtual void | log_weight2weight () |
Compute unormalized logarithm weights from normalized weights. More... | |
double * | mutable_log_weight_data () |
double * | mutable_weight_data () |
virtual void | normalize_log_weight () |
Normalize logarithm weights such that the maximum is zero. More... | |
virtual void | normalize_weight () |
Normalize weights such that the summation is one. More... | |
void | set_ess (double e) |
virtual void | weight2log_weight () |
Compute unormalized weights from normalized logarithm weights. More... | |
Weight set class.
Definition at line 43 of file weight_set.hpp.
typedef std::size_t vsmc::WeightSet::size_type |
Definition at line 47 of file weight_set.hpp.
|
inlineexplicit |
Definition at line 49 of file weight_set.hpp.
|
default |
|
default |
|
inlinevirtual |
Definition at line 94 of file weight_set.hpp.
|
inline |
Set normalized weight, unnormalized logarithm weight and ESS by adding to the unnormalized logarithm weights with (possible unormalized) logarithm incremental weights through an input iterator.
Definition at line 295 of file weight_set.hpp.
|
inline |
Set normalized weight, unnormalized logarithm weight and ESS by adding to the unnormalized logarithm weights with (possible unormalized) logarithm incremental weights through a ranodm access iterator with (possible non-uniform) stride.
Definition at line 308 of file weight_set.hpp.
|
inline |
Compute CESS given (log) incremental weights.
Definition at line 131 of file weight_set.hpp.
|
inline |
Compute CESS given (log) incremental weights.
Definition at line 147 of file weight_set.hpp.
|
inlineprotectedvirtual |
Compute CESS given (logarithm) unormalized incremental weights.
Definition at line 395 of file weight_set.hpp.
|
inlineprotectedvirtual |
Compute ESS given (logarithm) unormalzied incremental weights.
Definition at line 369 of file weight_set.hpp.
|
inline |
Draw a sample according to the weights.
Definition at line 318 of file weight_set.hpp.
|
inline |
ESS of the particle collection based on the current weights.
Definition at line 99 of file weight_set.hpp.
|
inline |
Compute ESS given (log) incremental weights.
Definition at line 103 of file weight_set.hpp.
|
inline |
Compute ESS given (log) incremental weights.
Definition at line 119 of file weight_set.hpp.
|
inline |
Get the unnormalized logarithm weight of the id'th particle.
Definition at line 199 of file weight_set.hpp.
|
inlineprotectedvirtual |
Compute unormalized logarithm weights from normalized weights.
Definition at line 339 of file weight_set.hpp.
|
inline |
Read only access to the raw data of logarithm weight.
Definition at line 328 of file weight_set.hpp.
|
inline |
Set normalized weight, unnormalized logarithm weight and ESS by multiply the normalized weight with (possible unnormalized) incremental weights through an input iterator.
Definition at line 242 of file weight_set.hpp.
|
inline |
Set normalized weight, unnormalized logarithm weight and ESS by multiply the normalized weight with (possible unnormalized) incremental weights through a random access iterator with (possible non-uniform) stride.
Definition at line 255 of file weight_set.hpp.
|
inlineprotected |
Definition at line 336 of file weight_set.hpp.
|
inlineprotected |
Definition at line 334 of file weight_set.hpp.
|
inlineprotectedvirtual |
Normalize logarithm weights such that the maximum is zero.
Definition at line 347 of file weight_set.hpp.
|
inlineprotectedvirtual |
Normalize weights such that the summation is one.
Definition at line 360 of file weight_set.hpp.
|
inline |
Read unnormalized logarithm weights through an output iterator.
Definition at line 182 of file weight_set.hpp.
|
inline |
Read unnormalized logarithm weights through a random access iterator with (possible non-uniform stride)
Definition at line 188 of file weight_set.hpp.
|
inlinevirtual |
Read normalized weights through an output iterator for the purpose of resampling.
Definition at line 162 of file weight_set.hpp.
|
inline |
Read normalized weights through an output iterator.
Definition at line 167 of file weight_set.hpp.
|
inline |
Read normalized weights through a random access iterator with (possible non-uniform stride)
Definition at line 173 of file weight_set.hpp.
|
inlinevirtual |
Size of the weight set for the purpose of resampling.
Definition at line 158 of file weight_set.hpp.
|
inlinevirtual |
Read only access to the resampling weights.
Definition at line 322 of file weight_set.hpp.
|
inline |
Set normalized weight, unnormalized logarithm weight and ESS such that each particle has a equal weight.
Definition at line 203 of file weight_set.hpp.
|
inlineprotected |
Definition at line 332 of file weight_set.hpp.
|
inline |
Set normalized weight, unnormalized logarithm weight and ESS by changing the (possible unnormalized) logarithm weights directly through an input iterator.
Definition at line 267 of file weight_set.hpp.
|
inline |
Set normalized weight, unnormalized logarithm weight and ESS by changing the (possible unnormalized) logarithm weights directly through a random access iterator with (possible non-uniform) stride.
Definition at line 283 of file weight_set.hpp.
|
inline |
Set normalized weight, unnormalized logarithm weight and ESS by changing the (possible unnormalized) weights directly through an input iterator.
Definition at line 214 of file weight_set.hpp.
|
inline |
Set normalized weight, unnormalized logarithm weight and ESS by changing the (possible unnormalized) weights directly through a random access iterator with (possible non-uniform) stride.
Definition at line 230 of file weight_set.hpp.
|
inline |
Definition at line 96 of file weight_set.hpp.
|
inline |
Get the normalized weight of the id'th particle.
Definition at line 196 of file weight_set.hpp.
|
inlineprotectedvirtual |
Compute unormalized weights from normalized logarithm weights.
Definition at line 343 of file weight_set.hpp.
|
inline |
Read only access to the raw data of weight.
Definition at line 325 of file weight_set.hpp.