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 | uniform_RG |
Uniform random number generator. More... | |
class | standard_RG |
Generator based on rand() < clib > function. 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 THREAD_LOCAL RandomGeneratorOP | random_generator (nullptr) |
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=numeric::random::rg()) |
template<class T > | |
void | random_permutation (utility::vector0< T > &vect, RandomGenerator &rg=numeric::random::rg()) |
template<class T > | |
void | random_permutation (std::vector< T > &vect, RandomGenerator &rg=numeric::random::rg()) |
template<typename RandomAccessIterator > | |
void | random_permutation (RandomAccessIterator first, RandomAccessIterator last, RandomGenerator &rg=numeric::random::rg()) |
randomly shuffle elements of a sequence More... | |
xyzVector< Real > | uniform_vector_sphere (numeric::Real radius=1) |
A random vector chosen uniformly from the ball (volume enclosed within a sphere) of the given radius around the origin. More... | |
xyzVector< Real > | random_vector_spherical () |
A random vector chosen with spherical symmetry around the origin. More... | |
xyzVector< Real > | random_vector_unit_cube () |
A random vector chosen uniformly from within the volume of a unit cube with opposite verticies at (0,0,0) and (1,1,1) More... | |
xyzVector< Real > | random_vector () |
A random vector chosen with spherical symmetry around the origin. More... | |
xyzVector< Real > | random_normal () |
A random vector chosens uniformly from the surface of a unit sphere centered on the origin. More... | |
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 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 n_wanted, RandomGenerator &rg=numeric::random::rg()) |
std::ostream & | operator<< (std::ostream &out, WeightedSampler const &sampler) |
typedef utility::pointer::shared_ptr< RandomGenerator > numeric::random::RandomGeneratorOP |
typedef platform::Size numeric::random::Size |
typedef utility::pointer::shared_ptr< uniform_RG const > numeric::random::uniform_RG_COP |
typedef utility::pointer::shared_ptr< uniform_RG > numeric::random::uniform_RG_OP |
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.
References test_terpenes::lower, and test_terpenes::upper.
Referenced by pick_random_index_from_cdf().
uniform_RG_OP numeric::random::createRG | ( | string const & | type | ) |
uniform_RG factory
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 |
References a, compute_difference::b, kmeans_adaptive_kernel_density_bb_dependent_rotlib::c, DSFMT_HIGH_CONST, DSFMT_LOW_MASK, DSFMT_MSK1, DSFMT_MSK2, DSFMT_SL1, DSFMT_SL2, DSFMT_SR1, DSFMT_SR2, lshift128(), create_a3b_hbs::r, 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.
References numeric::random::RandomGenerator::gaussian(), and rg().
Referenced by CycBBMover::apply(), LigChiMover::apply(), DuboisChiMover::apply(), BBMover::apply(), SymRBMover::apply(), SimpleBBMover::apply(), MyTransMover::apply(), MyRotMover::apply(), MembraneMinMover::apply(), capri_t033_trim_dock_test(), HubDenovo::cen_fold(), doit(), protocols::abinitio::JumpSpecificAbrelax::fold(), gaussian_random_xform(), main(), make_bonded_rna_move(), random_vector_spherical(), CCParam::randomize(), and test_deriv().
numeric::xyzTransform< numeric::Real > numeric::random::gaussian_random_xform | ( | Real const & | angsd, |
Real const & | movsd | ||
) |
References gaussian(), and numeric::rotation_matrix_degrees().
This function represents a function used in the initialization by init_by_array
x | 32-bit integer |
References x.
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 |
References x.
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 |
References shift.
Referenced by do_recursion().
std::ostream & numeric::random::operator<< | ( | std::ostream & | out, |
WeightedSampler const & | sampler | ||
) |
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.
References binary_search_cdf(), RG, and numeric::random::RandomGenerator::uniform().
|
static |
numeric::xyzVector< numeric::Real > numeric::random::random_normal | ( | ) |
A random vector chosens uniformly from the surface of a unit sphere centered on the origin.
References numeric::xyzVector< T >::is_zero(), numeric::xyzVector< T >::normalized_or_zero(), and random_vector_spherical().
void numeric::random::random_permutation | ( | RandomAccessIterator | first, |
RandomAccessIterator | last, | ||
RandomGenerator & | rg = numeric::random::rg() |
||
) |
randomly shuffle elements of a sequence
References create_a3b_hbs::first, create_a3b_hbs::i, rg(), and numeric::random::RandomGenerator::uniform().
void numeric::random::random_permutation | ( | std::vector< T > & | vect, |
RandomGenerator & | rg = numeric::random::rg() |
||
) |
References create_a3b_hbs::ii, rg(), erraser_analysis::temp, and numeric::random::RandomGenerator::uniform().
void numeric::random::random_permutation | ( | utility::vector0< T > & | vect, |
RandomGenerator & | rg = numeric::random::rg() |
||
) |
References create_a3b_hbs::ii, rg(), erraser_analysis::temp, and numeric::random::RandomGenerator::uniform().
void numeric::random::random_permutation | ( | utility::vector1< T > & | vect, |
RandomGenerator & | rg = numeric::random::rg() |
||
) |
References create_a3b_hbs::ii, rg(), erraser_analysis::temp, and numeric::random::RandomGenerator::uniform().
Referenced by LoopHashRelax_Sampler::apply(), design_test(), determine_residues_to_rebuild(), distribute_jobs(), dna_stats(), PerturbStruct::do_mutate(), CrystDesign::do_reversion(), CrystDesign::greedy_revert_unsats(), ligand_dock_main_jd1(), main(), run_pep_prep(), RunPepSpec(), and trim_dock_rebuild_relax_test().
|
inline |
@detail generate uniformly distributed vector on the unit sphere
References numeric::random::RandomGenerator::gaussian(), RG, and vec().
int numeric::random::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.
References numeric::random::RandomGenerator::random_range(), and rg().
Referenced by numeric::random::ReservoirSampler< T >::add_value(), HemeBindingMover::apply(), MPFindInterfaceTestMover::apply(), MembraneMinMover::apply(), StepwiseTorsionMover::apply(), choose_centroids(), create_and_score_fragments(), generate_sequence_binary_alphabet(), get_change_in_distance(), FragMonteCarlo::initialize_frag_assignment(), main(), ClosureMover::naive_apply(), BreadthMover::omega_apply(), BreadthMover::rama_apply(), random_alignment_move(), FragmentAssemblyMover::run(), run(), FragMonteCarlo::run(), run_parallel_docking(), and BreadthMover::uniform_apply().
numeric::xyzMatrix< numeric::Real > numeric::random::random_rotation | ( | ) |
References numeric::xyzMatrix< T >::cols(), enumerate_junctions::q, and random_unit_quaternion().
Referenced by random_xform(), and rb_entropy_test().
|
inline |
gamma-distribution-like random angle generation, rot_mag makes exactly the same sense as in gaussian_move
@detail 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
References numeric::random::RandomGenerator::gaussian(), mat, RG, numeric::rotation_axis(), numeric::x_rotation_matrix_degrees(), numeric::y_rotation_matrix_degrees(), and numeric::z_rotation_matrix_degrees().
|
inline |
produce a random translation in xyz space
References numeric::random::RandomGenerator::gaussian(), and RG.
Referenced by rb_entropy_test().
numeric::Quaternion< numeric::Real > numeric::random::random_unit_quaternion | ( | ) |
References numeric::constants::d::pi_2, and uniform().
Referenced by random_rotation().
numeric::xyzVector< numeric::Real > numeric::random::random_vector | ( | ) |
A random vector chosen with spherical symmetry around the origin.
Actual distribution is a 3D gaussian with unit variance centered at the origin.
References random_vector_spherical().
numeric::xyzVector< numeric::Real > numeric::random::random_vector_spherical | ( | ) |
A random vector chosen with spherical symmetry around the origin.
Actual distribution is a 3D gaussian with unit variance centered at the origin.
References gaussian().
Referenced by random_normal(), random_vector(), and random_xform().
numeric::xyzVector< numeric::Real > numeric::random::random_vector_unit_cube | ( | ) |
numeric::xyzTransform< numeric::Real > numeric::random::random_xform | ( | ) |
References random_rotation(), and random_vector_spherical().
utility::vector1< T > numeric::random::reservoir_sample | ( | utility::vector1< T > const & | vec, |
numeric::Size | n_wanted, | ||
RandomGenerator & | rg = numeric::random::rg() |
||
) |
|
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).
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.
Referenced by align_backbone_by_chunk(), ChiMover::apply(), TorsionVectorMover::apply(), LoopHashRelax_Sampler::apply(), DockGlycansProtocol::apply(), CenRotSidechainMover::apply(), CenRotCanonicalMover::apply(), backrub_protocol(), create_random_angle_from_range(), create_random_angle_from_range_list(), create_random_nucleoside_torsion(), create_random_suite_torsion(), create_random_torsions(), design_test(), determine_residues_to_rebuild(), devel_main(), distribute_jobs(), dna_stats(), PerturbStruct::do_mutate(), CrystDesign::do_reversion(), doit(), double_helix_test(), erraser_monte_carlo(), PerformanceBenchmark::execute(), fit_helix_in_map(), gaussian(), gaussian_angle_move(), gen_pep_bb_frag(), gen_pep_bb_frag_old(), gen_pep_bb_rama(), gen_pep_bb_sequential(), generate_sequence_binary_alphabet(), CenRotSidechainMover::get_random_rotamer(), CrystDesign::greedy_revert_unsats(), helix_ST(), basic::random::init_random_generators(), initialize_free_and_fixed(), initialize_peptide(), protocols::abinitio::JumpSpecificAbrelax::insert_template_frags(), apps::pilot::KicSandbox::KicSandbox(), lariat_modeling(), ligand_dock_main_jd1(), main(), make_1mer_frags(), make_random_perturbation(), MC_run(), mutate_random_residue(), my_main(), nucleoside_sampling(), one_chain_MC_sampling(), one_chain_ST_MC(), perturb_and_rescore(), UniformPerturber::perturb_chain(), myspace::Scheduler::pick_hashing_res(), pick_random_solution(), ChallengeMover::pick_random_template(), populate_database_with_dummy_data(), protocols_main(), random_angle(), random_delta(), random_element(), random_permutation(), random_range(), numeric::random::WeightedSampler::random_sample(), randomly_open_pose_loop(), rb_entropy_test(), ChallengeMover::realign(), repack_cluster(), reservoir_sample(), myMC::roll(), core::pack::annealer::FixbbSimAnnealer::run(), myspace::Scheduler::run_combine(), myspace::Scheduler::run_NM(), run_parallel_docking(), run_pep_prep(), RunPepSpec(), basic::database::safely_read_from_database(), sample_near_current_torsion(), sample_near_nucleoside_torsion(), sample_near_suite_torsion(), set_pep_csts(), ConstraintToolMover::show_cstset(), simple_loop_modeling_test(), simple_opte_test(), SomeThing::SomeThing(), test(), myspace::test_bbgauss(), trim_dock_rebuild_relax_test(), uniform(), update_torsion_set(), OutputManager::write_header(), write_new_respair_to_database(), and write_scores_and_hbond_geoms_to_database().
|
inlinestatic |
This function simulate a 32-bit array index overlapped to 64-bit array of LITTLE ENDIAN in BIG ENDIAN machine.
References create_a3b_hbs::i.
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.
References rg(), and numeric::random::RandomGenerator::uniform().
Referenced by numeric::random::ReservoirSampler< T >::add_value(), HemeBindingMover::apply(), CycBBMover::apply(), MoveThenFixHMin::apply(), MoveThenFixH::apply(), LigChiMover::apply(), BBMover::apply(), SymRBMover::apply(), SimpleBBMover::apply(), ChiMover::apply(), MyTransMover::apply(), MyRotMover::apply(), FloatScRotMover::apply(), TorsionVectorMover::apply(), DockGlycansProtocol::apply(), FloatScRandomChi::apply(), StepwiseTorsionMover::apply(), ConcertedTorsionMover::apply(), ConstraintConfig::apply_bb_csts(), backrub_protocol(), capri_t033_trim_dock_test(), HubDenovo::cen_fold(), numeric::random::WeightedReservoirSampler< T >::consider_sample(), create_random_pose(), MatchSet::cross(), diversify_sam_loop_test(), dock(), doit(), doit_refine(), dostuff(), fa_refine_and_design(), gaussian-sampling::final_accept(), gen_pep_bb_frag(), gen_pep_bb_frag_old(), gen_pep_bb_rama(), gen_pep_bb_sequential(), helix_ST(), idealize_tf_pose(), gaussian-sampling::initial_accept(), initialize_peptide(), protocols::abinitio::JumpSpecificAbrelax::insert_template_frags(), main(), make_1mer_frags(), make_bonded_rna_move(), make_helix(), make_rand_ss(), make_rand_ss_h(), make_rand_ss_hs(), MC_run(), Mutate1Randomizer::mutate(), mutate_random_residue(), my_main(), nucleoside_sampling(), BreadthMover::omega_apply(), one_chain_ST_MC(), UniformPerturber::perturb_chain(), ConstraintConfig::pick_sequence(), process_ss_str(), rand_rot(), Bola::random_close_phipsi_from_rama(), Bola::random_move(), numeric::random::RandomGenerator::random_range(), numeric::random::WeightedSampler::random_sample(), random_torsions(), random_unit_quaternion(), random_unit_vector(), random_vector_unit_cube(), CCParam::randomize(), randomly_open_pose_loop(), randomly_shift_and_tilt_pose(), randomly_shift_and_tilt_poses(), randvec(), rb_entropy_test(), report(), myMC::roll(), FragmentAssemblyMover::run(), core::pack::annealer::FixbbSimAnnealer::run(), FragMonteCarlo::run(), HubDenovo::run(), myspace::Scheduler::run_combine(), run_parallel_docking(), run_pep_prep(), RunPepSpec(), basic::database::safely_read_from_database(), numeric::random::DistributionSampler< T >::sample(), sample_near_current_torsion(), sample_near_nucleoside_torsion(), sample_near_suite_torsion(), select_string(), set_pep_csts(), MPDomainAssembly::set_random_torsion(), setup_loops_from_mapping(), simple_loop_modeling_test(), simulate_ERMS(), test(), test_MAT_VEC(), test_Random(), BreadthMover::uniform_apply(), uniform_vector_sphere(), SamplingManager::update(), update_torsion_set(), and wriggle_test().
numeric::xyzVector< numeric::Real > numeric::random::uniform_vector_sphere | ( | numeric::Real | radius | ) |
A random vector chosen uniformly from the ball (volume enclosed within a sphere) of the given radius around the origin.
References numeric::distance(), oop_conformations::phi, numeric::constants::ld::pi, basic::options::OptionKeys::cluster::radius, docking::U, uniform(), numeric::xyzVector< T >::x(), numeric::xyzVector< T >::y(), and numeric::xyzVector< T >::z().