Rosetta
|
Classes | |
class | DistributionSampler |
class | mt19937_RG |
class | RandomGenerator |
Random number generator system. More... | |
class | ReservoirSampler |
Simple container for keeping K random values. More... | |
class | standard_RG |
Generator based on rand() < clib > function. More... | |
class | uniform_RG |
Uniform random number generator. More... | |
class | WeightedReservoirItem |
class | WeightedReservoirSampler |
class | WeightedSampler |
Typedefs | |
typedef platform::Size | Size |
typedef utility::pointer::shared_ptr < RandomGenerator > | RandomGeneratorOP |
typedef utility::pointer::shared_ptr < uniform_RG > | uniform_RG_OP |
typedef utility::pointer::shared_ptr < uniform_RG const > | uniform_RG_COP |
Functions | |
static void | lshift128 (w128_t *out, const w128_t *in, int shift) |
static uint32_t | ini_func1 (uint32_t x) |
static uint32_t | ini_func2 (uint32_t x) |
static int | sformat_idxof (int i) |
static void | do_recursion (w128_t *r, w128_t *a, w128_t *b, w128_t *c, w128_t *lung) |
static RandomGeneratorOP | random_generator (0) |
RandomGenerator & | rg () |
Return the one-per-thread "singleton" random generator. More... | |
double | uniform () |
Generate a random number between 0 and 1. Threadsafe since each thread uses its own random generator. More... | |
double | gaussian () |
Generate a random number pulled from a standard normal – i.e. mean of zero and standard deviation of 1. Threadsafe since each thread uses its own random generator. More... | |
int | random_range (int low, int high) |
Return a number uniformly drawn from the inclusive range between low and high. Threadsafe since each thread uses its own random generator. More... | |
uniform_RG_OP | createRG (string const &type) |
uniform_RG factory More... | |
template<typename T > | |
xyzVector< T > | random_point_on_unit_sphere (RandomGenerator &RG) |
template<typename T > | |
T | random_rotation_angle (T rot_mag, RandomGenerator &RG) |
gamma-distribution-like random angle generation, rot_mag makes exactly the same sense as in gaussian_move More... | |
template<typename T > | |
xyzVector< T > | random_translation (T trans_mag, RandomGenerator &RG) |
produce a random translation in xyz space More... | |
template<typename T > | |
platform::Size | binary_search_cdf (utility::vector1< T > const &cdf, T urn) |
Return the index in the CDF array such that it is smaller than or equal to the uniform-random-number (urn) and that the next entry in the array is larger than urn. The CDF ought to represent the exclusive cumulative sum of the probabilities of some discrete set so that the width for entry i – the gap between entry i and entry i+1 should be the probability of entry i. More... | |
template<typename T > | |
platform::Size | pick_random_index_from_cdf (utility::vector1< T > const &cdf, RandomGenerator &RG) |
Choose an element from an array of positions representing the cumulative distribution function for some target distribution. This uses binary search to quickly find the target index. If any position has the same probability as the preceeding position, then its index won't be returned. More... | |
template<class T > | |
void | random_permutation (utility::vector1< T > &vect, RandomGenerator &rg) |
template<class T > | |
void | random_permutation (utility::vector0< T > &vect, RandomGenerator &rg) |
template<class T > | |
void | random_permutation (std::vector< T > &vect, RandomGenerator &rg) |
template<typename RandomAccessIterator > | |
void | random_permutation (RandomAccessIterator first, RandomAccessIterator last, RandomGenerator &rg) |
randomly shuffle elements of a sequence More... | |
xyzVector< Real > | random_vector_spherical () |
xyzVector< Real > | random_vector_unit_cube () |
xyzVector< Real > | random_vector () |
xyzVector< Real > | random_normal () |
Quaternion< Real > | random_unit_quaternion () |
xyzMatrix< Real > | random_rotation () |
xyzTransform< Real > | random_xform () |
xyzTransform< Real > | gaussian_random_xform (Real const &angsd, Real const &movsd) |
numeric::Real | reservoir_sample_accept_prob (numeric::Size n_wanted, numeric::Size const n_seen) |
Returns the probability that the Nth value in a sequence should be accepted using the reservoir sampling criterion. More... | |
template<typename T > | |
utility::vector1< T > | reservoir_sample (utility::vector1< T > const &vec, numeric::Size const n_wanted, RandomGenerator &rg) |
typedef utility::pointer::shared_ptr< RandomGenerator > numeric::random::RandomGeneratorOP |
Definition at line 30 of file random.fwd.hh.
typedef utility::pointer::shared_ptr< uniform_RG const > numeric::random::uniform_RG_COP |
Definition at line 26 of file uniform.fwd.hh.
typedef utility::pointer::shared_ptr< uniform_RG > numeric::random::uniform_RG_OP |
Definition at line 23 of file uniform.fwd.hh.
platform::Size numeric::random::binary_search_cdf | ( | utility::vector1< T > const & | cdf, |
T | urn | ||
) |
Return the index in the CDF array such that it is smaller than or equal to the uniform-random-number (urn) and that the next entry in the array is larger than urn. The CDF ought to represent the exclusive cumulative sum of the probabilities of some discrete set so that the width for entry i – the gap between entry i and entry i+1 should be the probability of entry i.
Definition at line 103 of file random.functions.hh.
References test.T007_TracerIO::T.
Referenced by pick_random_index_from_cdf().
uniform_RG_OP numeric::random::createRG | ( | string const & | type | ) |
uniform_RG factory
Definition at line 65 of file random.cc.
References utility_exit_with_message.
Referenced by numeric::random::RandomGenerator::set_seed().
|
inlinestatic |
This function represents the recursion formula.
r | output |
a | a 128-bit part of the internal state array |
b | a 128-bit part of the internal state array |
c | a 128-bit part of the internal state array |
lung | a 128-bit part of the internal state array |
Definition at line 281 of file mt19937.hh.
References DSFMT_HIGH_CONST, DSFMT_LOW_MASK, DSFMT_MSK1, DSFMT_MSK2, DSFMT_SL1, DSFMT_SL2, DSFMT_SR1, DSFMT_SR2, lshift128(), W128_T::u, and x().
Referenced by numeric::random::mt19937_RG::gen_rand_all().
double numeric::random::gaussian | ( | ) |
Generate a random number pulled from a standard normal – i.e. mean of zero and standard deviation of 1. Threadsafe since each thread uses its own random generator.
Definition at line 57 of file random.cc.
References numeric::random::RandomGenerator::gaussian(), and rg().
Referenced by gaussian_random_xform(), and random_vector_spherical().
numeric::xyzTransform< numeric::Real > numeric::random::gaussian_random_xform | ( | Real const & | angsd, |
Real const & | movsd | ||
) |
Definition at line 63 of file random_xyz.cc.
References gaussian(), and numeric::rotation_matrix_degrees().
This function represents a function used in the initialization by init_by_array
x | 32-bit integer |
Definition at line 304 of file mt19937.hh.
Referenced by numeric::random::mt19937_RG::init_by_array().
This function represents a function used in the initialization by init_by_array
x | 32-bit integer |
Definition at line 314 of file mt19937.hh.
Referenced by numeric::random::mt19937_RG::init_by_array().
This function simulates SIMD 128-bit left shift by the standard C. The 128-bit integer given in in is shifted by (shift * 8) bits. This function simulates the LITTLE ENDIAN SIMD.
out | the output of this function |
in | the 128-bit data to be shifted |
shift | the shift value |
Definition at line 267 of file mt19937.hh.
References W128_T::u.
Referenced by do_recursion().
platform::Size numeric::random::pick_random_index_from_cdf | ( | utility::vector1< T > const & | cdf, |
RandomGenerator & | RG | ||
) |
Choose an element from an array of positions representing the cumulative distribution function for some target distribution. This uses binary search to quickly find the target index. If any position has the same probability as the preceeding position, then its index won't be returned.
Definition at line 138 of file random.functions.hh.
References binary_search_cdf(), test.T007_TracerIO::T, and numeric::random::RandomGenerator::uniform().
|
static |
Referenced by rg().
numeric::xyzVector< numeric::Real > numeric::random::random_normal | ( | ) |
Definition at line 33 of file random_xyz.cc.
References random_vector_spherical().
void numeric::random::random_permutation | ( | utility::vector1< T > & | vect, |
RandomGenerator & | rg | ||
) |
Definition at line 39 of file random_permutation.hh.
References test.T200_Scoring::ii, test.T007_TracerIO::T, and numeric::random::RandomGenerator::uniform().
Referenced by run_pep_prep().
void numeric::random::random_permutation | ( | utility::vector0< T > & | vect, |
RandomGenerator & | rg | ||
) |
Definition at line 56 of file random_permutation.hh.
References test.T200_Scoring::ii, test.T007_TracerIO::T, and numeric::random::RandomGenerator::uniform().
void numeric::random::random_permutation | ( | std::vector< T > & | vect, |
RandomGenerator & | rg | ||
) |
Definition at line 74 of file random_permutation.hh.
References test.T200_Scoring::ii, test.T007_TracerIO::T, and numeric::random::RandomGenerator::uniform().
void numeric::random::random_permutation | ( | RandomAccessIterator | first, |
RandomAccessIterator | last, | ||
RandomGenerator & | rg | ||
) |
randomly shuffle elements of a sequence
Definition at line 93 of file random_permutation.hh.
References numeric::random::RandomGenerator::uniform().
|
inline |
generate uniformly distributed vector on the unit sphere
Definition at line 44 of file random.functions.hh.
References numeric::random::RandomGenerator::gaussian(), and numeric::xyzVector< typename >::normalized().
Return a number uniformly drawn from the inclusive range between low and high. Threadsafe since each thread uses its own random generator.
Definition at line 58 of file random.cc.
References numeric::random::RandomGenerator::random_range(), and rg().
Referenced by numeric::random::ReservoirSampler< T >::add_value(), CoupledMovesProtocol::apply(), DatabaseIOBenchmark::run(), run(), and FragmentAssemblyMover::run().
numeric::xyzMatrix< numeric::Real > numeric::random::random_rotation | ( | ) |
Definition at line 51 of file random_xyz.cc.
References numeric::xyzMatrix< typename >::cols(), random_unit_quaternion(), numeric::Quaternion< typename >::w(), numeric::Quaternion< typename >::x(), numeric::Quaternion< typename >::y(), and numeric::Quaternion< typename >::z().
Referenced by random_xform().
|
inline |
gamma-distribution-like random angle generation, rot_mag makes exactly the same sense as in gaussian_move
generate axis and angle for axis-angle rotation for random rotation move in R/RT degrees of freedom. rotation axis: uniformly distributed on unit sphere, rotation angle: chosen to mimic the distribution of rotation angles obtained from gaussian distrbuted Euler angles (core/kinematics/Jump.cc), which is a gamma-distribution-like distribution
Definition at line 65 of file random.functions.hh.
References numeric::random::RandomGenerator::gaussian(), numeric::rotation_axis(), test.T007_TracerIO::T, numeric::x_rotation_matrix_degrees(), numeric::y_rotation_matrix_degrees(), and numeric::z_rotation_matrix_degrees().
|
inline |
produce a random translation in xyz space
Definition at line 85 of file random.functions.hh.
References numeric::random::RandomGenerator::gaussian().
numeric::Quaternion< numeric::Real > numeric::random::random_unit_quaternion | ( | ) |
Definition at line 38 of file random_xyz.cc.
References numeric::constants::d::pi_2, and uniform().
Referenced by random_rotation().
numeric::xyzVector< numeric::Real > numeric::random::random_vector | ( | ) |
Definition at line 30 of file random_xyz.cc.
References random_vector_spherical().
numeric::xyzVector< numeric::Real > numeric::random::random_vector_spherical | ( | ) |
Definition at line 23 of file random_xyz.cc.
References gaussian().
Referenced by random_normal(), random_vector(), and random_xform().
numeric::xyzVector< numeric::Real > numeric::random::random_vector_unit_cube | ( | ) |
Definition at line 26 of file random_xyz.cc.
References uniform().
numeric::xyzTransform< numeric::Real > numeric::random::random_xform | ( | ) |
Definition at line 59 of file random_xyz.cc.
References random_rotation(), and random_vector_spherical().
utility::vector1< T > numeric::random::reservoir_sample | ( | utility::vector1< T > const & | vec, |
numeric::Size const | n_wanted, | ||
RandomGenerator & | rg | ||
) |
Definition at line 95 of file reservoir_sample.hh.
References end, numeric::random::RandomGenerator::random_range(), reservoir_sample_accept_prob(), and numeric::random::RandomGenerator::uniform().
|
inline |
Returns the probability that the Nth value in a sequence should be accepted using the reservoir sampling criterion.
If we've seen N values and we want to keep K of them, the probability of the Nth value being accepted is min(K/N,1.0).
Definition at line 83 of file reservoir_sample.hh.
References min().
Referenced by numeric::random::ReservoirSampler< T >::add_value(), and reservoir_sample().
RandomGenerator & numeric::random::rg | ( | ) |
Return the one-per-thread "singleton" random generator.
Definition at line 46 of file random.cc.
References random_generator().
Referenced by PerformanceBenchmark::execute(), gaussian(), gen_pep_bb_sequential(), main(), make_1mer_frags(), mutate_random_residue(), random_range(), randomly_open_pose_loop(), myMC::roll(), run_pep_prep(), RunPepSpec(), basic::database::safely_read_from_database(), set_pep_csts(), and uniform().
This function simulate a 32-bit array index overlapped to 64-bit array of LITTLE ENDIAN in BIG ENDIAN machine.
Definition at line 254 of file mt19937.hh.
Referenced by numeric::random::mt19937_RG::init_by_array(), and numeric::random::mt19937_RG::setSeed().
double numeric::random::uniform | ( | ) |
Generate a random number between 0 and 1. Threadsafe since each thread uses its own random generator.
Definition at line 56 of file random.cc.
References rg(), and numeric::random::RandomGenerator::uniform().
Referenced by numeric::random::ReservoirSampler< T >::add_value(), CoupledMovesProtocol::apply(), numeric::random::WeightedReservoirSampler< T >::consider_sample(), main(), make_1mer_frags(), mutate_random_residue(), numeric::random::RandomGenerator::random_range(), random_unit_quaternion(), random_vector_unit_cube(), randomly_open_pose_loop(), myMC::roll(), FragmentAssemblyMover::run(), run_pep_prep(), basic::database::safely_read_from_database(), numeric::random::DistributionSampler< T >::sample(), and set_pep_csts().