Rosetta
|
#include <WeightedSampler.hh>
Public Member Functions | |
WeightedSampler () | |
Constructor. More... | |
WeightedSampler (numeric::Size num_weights) | |
Constructor. More... | |
WeightedSampler (utility::vector1< numeric::Real > const &weights) | |
Constructor. More... | |
virtual | ~WeightedSampler () |
Destructor. More... | |
WeightedSampler (WeightedSampler const &) | |
Copy constructor. More... | |
WeightedSampler & | operator= (WeightedSampler const &) |
Copy operator. More... | |
utility::vector1< numeric::Real > const & | weights () const |
get weights More... | |
void | weights (utility::vector1< numeric::Real > const &weights) |
set weights More... | |
void | add_weight (numeric::Real weight) |
add a single weight to the end More... | |
void | set_weight (numeric::Size weight_num, numeric::Real weight) |
set a single weight More... | |
void | clear () |
clear weights More... | |
numeric::Size | size () const |
get number of weights More... | |
void | resize (numeric::Size num_weights, numeric::Real default_weight=0) |
resize weights More... | |
numeric::Size | random_sample () const |
get a random sample using the default random generator More... | |
numeric::Size | random_sample (numeric::random::RandomGenerator &) const |
get a random sample by passing a random generator More... | |
numeric::Size | random_sample (numeric::Real randnum) const |
get a random sample by passing a random number from 0 to 1 More... | |
bool | update_cumulative_distribution () const |
Update the internal cumulative distribution results Returns false if there's an issue with updating the distribution (e.g. empty or all zero weights) More... | |
Private Attributes | |
utility::vector1< numeric::Real > | weights_ |
utility::vector1< numeric::Real > | cumulative_distribution_ |
bool | cumulative_distribution_valid_ |
numeric::random::WeightedSampler::WeightedSampler | ( | ) |
Constructor.
numeric::random::WeightedSampler::WeightedSampler | ( | numeric::Size | num_weights | ) |
Constructor.
numeric::random::WeightedSampler::WeightedSampler | ( | utility::vector1< numeric::Real > const & | weights | ) |
Constructor.
|
virtualdefault |
Destructor.
numeric::random::WeightedSampler::WeightedSampler | ( | WeightedSampler const & | weighted_sampler | ) |
Copy constructor.
|
inline |
add a single weight to the end
References cumulative_distribution_valid_, basic::options::OptionKeys::sc::weight, and weights_.
|
inline |
clear weights
References cumulative_distribution_valid_, and weights_.
Referenced by pyrosetta.bindings.pose.ResidueLabelAccessor::discard().
|
default |
Copy operator.
numeric::Size numeric::random::WeightedSampler::random_sample | ( | ) | const |
get a random sample using the default random generator
References numeric::random::rg(), and numeric::random::uniform().
Referenced by random_sample().
numeric::Size numeric::random::WeightedSampler::random_sample | ( | numeric::random::RandomGenerator & | rg | ) | const |
get a random sample by passing a random generator
References random_sample(), numeric::random::rg(), and numeric::random::RandomGenerator::uniform().
numeric::Size numeric::random::WeightedSampler::random_sample | ( | numeric::Real | randnum | ) | const |
get a random sample by passing a random number from 0 to 1
References cumulative_distribution_, cumulative_distribution_valid_, create_a3b_hbs::i, and update_cumulative_distribution().
|
inline |
resize weights
References weights_.
Referenced by PyMOL-Rosetta-relay-client.SecretInputDialog::__init__().
|
inline |
set a single weight
References cumulative_distribution_valid_, basic::options::OptionKeys::sc::weight, and weights_.
|
inline |
bool numeric::random::WeightedSampler::update_cumulative_distribution | ( | ) | const |
Update the internal cumulative distribution results Returns false if there's an issue with updating the distribution (e.g. empty or all zero weights)
References cumulative_distribution_, cumulative_distribution_valid_, create_a3b_hbs::i, runtime_assert, basic::options::OptionKeys::sc::weight, and weights_.
Referenced by random_sample().
|
inline |
get weights
References weights_.
Referenced by numeric::random::operator<<(), pyrosetta.distributed.tasks.score.ScorePoseTask::score_function(), and weights().
|
inline |
set weights
References cumulative_distribution_valid_, weights(), and weights_.
Referenced by pyrosetta.distributed.tasks.score.ScorePoseTask::score_function().
|
mutableprivate |
Referenced by random_sample(), and update_cumulative_distribution().
|
mutableprivate |
Referenced by add_weight(), clear(), random_sample(), set_weight(), update_cumulative_distribution(), and weights().
|
private |
Referenced by add_weight(), clear(), resize(), set_weight(), size(), update_cumulative_distribution(), and weights().