random¶
Bindings for numeric::random namespace
- class pyrosetta.rosetta.numeric.random.RandomGenerator¶
Bases:
pybind11_object
Random number generator system
- assign(self: pyrosetta.rosetta.numeric.random.RandomGenerator, : pyrosetta.rosetta.numeric.random.RandomGenerator) pyrosetta.rosetta.numeric.random.RandomGenerator ¶
C++: numeric::random::RandomGenerator::operator=(const class numeric::random::RandomGenerator &) –> class numeric::random::RandomGenerator &
- gaussian(self: pyrosetta.rosetta.numeric.random.RandomGenerator) float ¶
Get Gaussian distribution random number
C++: numeric::random::RandomGenerator::gaussian() –> double
- get_seed(self: pyrosetta.rosetta.numeric.random.RandomGenerator) int ¶
Return the seed used by this RNG.
C++: numeric::random::RandomGenerator::get_seed() const –> int
- initialized(self: pyrosetta.rosetta.numeric.random.RandomGenerator) bool ¶
Return whether the RandomGenerator has been initialized (by a call to set_seed)
C++: numeric::random::RandomGenerator::initialized() const –> bool
- max(self: pyrosetta.rosetta.numeric.random.RandomGenerator) float ¶
C++: numeric::random::RandomGenerator::max() const –> double
- min(self: pyrosetta.rosetta.numeric.random.RandomGenerator) float ¶
C++: numeric::random::RandomGenerator::min() const –> double
- random_range(self: pyrosetta.rosetta.numeric.random.RandomGenerator, low: int, high: int) int ¶
Returns a random int in the range specified by the arguments
C++: numeric::random::RandomGenerator::random_range(int, int) –> int
- random_range2(self: pyrosetta.rosetta.numeric.random.RandomGenerator, low: int, high: int) int ¶
- Returns a random int in the range specified by the arguments
If low == high, it will return the given integer to simplify code using this.
s
- JAB - Editing random_range produced huge integration test changes, so this is the result.
If you have a better name, please change this.
C++: numeric::random::RandomGenerator::random_range2(int, int) –> int
- restoreState(self: pyrosetta.rosetta.numeric.random.RandomGenerator, in: pyrosetta.rosetta.std.istream) None ¶
C++: numeric::random::RandomGenerator::restoreState(std::istream &) –> void
- saveState(self: pyrosetta.rosetta.numeric.random.RandomGenerator, out: pyrosetta.rosetta.std.ostream) None ¶
C++: numeric::random::RandomGenerator::saveState(std::ostream &) –> void
- set_seed(*args, **kwargs)¶
Overloaded function.
set_seed(self: pyrosetta.rosetta.numeric.random.RandomGenerator, generator_type: str, seed: int) -> None
- Set the seed and the generator type synchronously.
Currently the two supported generator types are “standard” and “mt19937” with the latter being the recommended form.
C++: numeric::random::RandomGenerator::set_seed(const std::string &, int) –> void
set_seed(self: pyrosetta.rosetta.numeric.random.RandomGenerator, seed: int) -> None
Return the seed used by this RNG.
C++: numeric::random::RandomGenerator::set_seed(int) –> void
- uniform(self: pyrosetta.rosetta.numeric.random.RandomGenerator) float ¶
Return from range [0, 1] (?) uniform random number
The implementation of random_range leads me to believe this is actually [0, 1), like most other random number generators. -IWD
C++: numeric::random::RandomGenerator::uniform() –> double
- class pyrosetta.rosetta.numeric.random.WeightedSampler¶
Bases:
pybind11_object
- add_weight(self: pyrosetta.rosetta.numeric.random.WeightedSampler, weight: float) None ¶
add a single weight to the end
C++: numeric::random::WeightedSampler::add_weight(double) –> void
- assign(self: pyrosetta.rosetta.numeric.random.WeightedSampler, : pyrosetta.rosetta.numeric.random.WeightedSampler) pyrosetta.rosetta.numeric.random.WeightedSampler ¶
Copy operator
C++: numeric::random::WeightedSampler::operator=(const class numeric::random::WeightedSampler &) –> class numeric::random::WeightedSampler &
- clear(self: pyrosetta.rosetta.numeric.random.WeightedSampler) None ¶
clear weights
C++: numeric::random::WeightedSampler::clear() –> void
- random_sample(*args, **kwargs)¶
Overloaded function.
random_sample(self: pyrosetta.rosetta.numeric.random.WeightedSampler) -> int
get a random sample using the default random generator
C++: numeric::random::WeightedSampler::random_sample() const –> unsigned long
random_sample(self: pyrosetta.rosetta.numeric.random.WeightedSampler, : pyrosetta.rosetta.numeric.random.RandomGenerator) -> int
get a random sample by passing a random generator
C++: numeric::random::WeightedSampler::random_sample(class numeric::random::RandomGenerator &) const –> unsigned long
random_sample(self: pyrosetta.rosetta.numeric.random.WeightedSampler, randnum: float) -> int
get a random sample by passing a random number from 0 to 1
C++: numeric::random::WeightedSampler::random_sample(double) const –> unsigned long
- resize(*args, **kwargs)¶
Overloaded function.
resize(self: pyrosetta.rosetta.numeric.random.WeightedSampler, num_weights: int) -> None
resize(self: pyrosetta.rosetta.numeric.random.WeightedSampler, num_weights: int, default_weight: float) -> None
resize weights
C++: numeric::random::WeightedSampler::resize(unsigned long, double) –> void
- set_weight(self: pyrosetta.rosetta.numeric.random.WeightedSampler, weight_num: int, weight: float) None ¶
set a single weight
C++: numeric::random::WeightedSampler::set_weight(unsigned long, double) –> void
- size(self: pyrosetta.rosetta.numeric.random.WeightedSampler) int ¶
get number of weights
C++: numeric::random::WeightedSampler::size() const –> unsigned long
- update_cumulative_distribution(self: pyrosetta.rosetta.numeric.random.WeightedSampler) bool ¶
- Update the internal cumulative distribution results
Returns false if there’s an issue with updating the distribution (e.g. empty or all zero weights)
C++: numeric::random::WeightedSampler::update_cumulative_distribution() const –> bool
- weights(*args, **kwargs)¶
Overloaded function.
weights(self: pyrosetta.rosetta.numeric.random.WeightedSampler) -> pyrosetta.rosetta.utility.vector1_double
get weights
C++: numeric::random::WeightedSampler::weights() const –> const class utility::vector1<double, class std::allocator<double> > &
weights(self: pyrosetta.rosetta.numeric.random.WeightedSampler, weights: pyrosetta.rosetta.utility.vector1_double) -> None
set weights
C++: numeric::random::WeightedSampler::weights(const class utility::vector1<double, class std::allocator<double> > &) –> void
- pyrosetta.rosetta.numeric.random.gaussian() float ¶
C++: numeric::random::gaussian() –> double
- pyrosetta.rosetta.numeric.random.gaussian_random_xform(angsd: float, movsd: float) pyrosetta.rosetta.numeric.xyzTransform_double_t ¶
C++: numeric::random::gaussian_random_xform(const double &, const double &) –> class numeric::xyzTransform<double>
- pyrosetta.rosetta.numeric.random.ini_func1(x: int) int ¶
C++: numeric::random::ini_func1(unsigned int) –> unsigned int
- pyrosetta.rosetta.numeric.random.ini_func2(x: int) int ¶
C++: numeric::random::ini_func2(unsigned int) –> unsigned int
- class pyrosetta.rosetta.numeric.random.mt19937_RG¶
Bases:
uniform_RG
- assign(self: pyrosetta.rosetta.numeric.random.mt19937_RG, : pyrosetta.rosetta.numeric.random.mt19937_RG) pyrosetta.rosetta.numeric.random.mt19937_RG ¶
C++: numeric::random::mt19937_RG::operator=(const class numeric::random::mt19937_RG &) –> class numeric::random::mt19937_RG &
- getRandom(self: pyrosetta.rosetta.numeric.random.mt19937_RG) float ¶
C++: numeric::random::mt19937_RG::getRandom() –> double
- getSeed(self: pyrosetta.rosetta.numeric.random.mt19937_RG) int ¶
C++: numeric::random::mt19937_RG::getSeed() –> int
- restoreState(self: pyrosetta.rosetta.numeric.random.mt19937_RG, in: pyrosetta.rosetta.std.istream) None ¶
Deserializes generator state from stream losslessly.
C++: numeric::random::mt19937_RG::restoreState(std::istream &) –> void
- saveState(self: pyrosetta.rosetta.numeric.random.mt19937_RG, out: pyrosetta.rosetta.std.ostream) None ¶
Serializes generator state to stream losslessly.
C++: numeric::random::mt19937_RG::saveState(std::ostream &) –> void
- setSeed(*args, **kwargs)¶
Overloaded function.
setSeed(self: pyrosetta.rosetta.numeric.random.mt19937_RG, iseed: int) -> None
Set seed and state
C++: numeric::random::mt19937_RG::setSeed(const int) –> void
setSeed(self: pyrosetta.rosetta.numeric.random.mt19937_RG, : str) -> None
Set seed and state
C++: numeric::random::mt19937_RG::setSeed(const std::string &) –> void
- pyrosetta.rosetta.numeric.random.random_normal() pyrosetta.rosetta.numeric.xyzVector_double_t ¶
A random vector chosens uniformly from the surface of a unit sphere centered on the origin.
C++: numeric::random::random_normal() –> class numeric::xyzVector<double>
- pyrosetta.rosetta.numeric.random.random_range(low: int, high: int) int ¶
- Return a number uniformly drawn from the inclusive range between low
and high. Threadsafe since each thread uses its own random generator.
C++: numeric::random::random_range(int, int) –> int
- pyrosetta.rosetta.numeric.random.random_rotation() pyrosetta.rosetta.numeric.xyzMatrix_double_t ¶
C++: numeric::random::random_rotation() –> class numeric::xyzMatrix<double>
- pyrosetta.rosetta.numeric.random.random_unit_quaternion() pyrosetta.rosetta.numeric.Quaternion_double_t ¶
C++: numeric::random::random_unit_quaternion() –> class numeric::Quaternion<double>
- pyrosetta.rosetta.numeric.random.random_vector() pyrosetta.rosetta.numeric.xyzVector_double_t ¶
A random vector chosen with spherical symmetry around the origin.
Actual distribution is a 3D gaussian with unit variance centered at the origin.
C++: numeric::random::random_vector() –> class numeric::xyzVector<double>
- pyrosetta.rosetta.numeric.random.random_vector_spherical() pyrosetta.rosetta.numeric.xyzVector_double_t ¶
A random vector chosen with spherical symmetry around the origin.
Actual distribution is a 3D gaussian with unit variance centered at the origin.
C++: numeric::random::random_vector_spherical() –> class numeric::xyzVector<double>
- pyrosetta.rosetta.numeric.random.random_vector_unit_cube() pyrosetta.rosetta.numeric.xyzVector_double_t ¶
A random vector chosen uniformly from within the volume of a unit cube with opposite verticies at (0,0,0) and (1,1,1)
C++: numeric::random::random_vector_unit_cube() –> class numeric::xyzVector<double>
- pyrosetta.rosetta.numeric.random.random_xform() pyrosetta.rosetta.numeric.xyzTransform_double_t ¶
C++: numeric::random::random_xform() –> class numeric::xyzTransform<double>
- pyrosetta.rosetta.numeric.random.reservoir_sample_accept_prob(n_wanted: int, n_seen: int) float ¶
- 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).
C++: numeric::random::reservoir_sample_accept_prob(unsigned long, unsigned long) –> double
- pyrosetta.rosetta.numeric.random.rg() numeric::random::RandomGenerator ¶
Return the one-per-thread “singleton” random generator.
C++: numeric::random::rg() –> class numeric::random::RandomGenerator &
- pyrosetta.rosetta.numeric.random.sformat_idxof(i: int) int ¶
C++: numeric::random::sformat_idxof(int) –> int
- class pyrosetta.rosetta.numeric.random.standard_RG¶
Bases:
uniform_RG
Generator based on rand() < clib > function.
- assign(self: pyrosetta.rosetta.numeric.random.standard_RG, : pyrosetta.rosetta.numeric.random.standard_RG) pyrosetta.rosetta.numeric.random.standard_RG ¶
C++: numeric::random::standard_RG::operator=(const class numeric::random::standard_RG &) –> class numeric::random::standard_RG &
- getRandom(self: pyrosetta.rosetta.numeric.random.standard_RG) float ¶
C++: numeric::random::standard_RG::getRandom() –> double
- getSeed(self: pyrosetta.rosetta.numeric.random.standard_RG) int ¶
C++: numeric::random::standard_RG::getSeed() –> int
- restoreState(self: pyrosetta.rosetta.numeric.random.standard_RG, : pyrosetta.rosetta.std.istream) None ¶
C++: numeric::random::standard_RG::restoreState(std::istream &) –> void
- saveState(self: pyrosetta.rosetta.numeric.random.standard_RG, : pyrosetta.rosetta.std.ostream) None ¶
C++: numeric::random::standard_RG::saveState(std::ostream &) –> void
- setSeed(*args, **kwargs)¶
Overloaded function.
setSeed(self: pyrosetta.rosetta.numeric.random.standard_RG, seed: int) -> None
C++: numeric::random::standard_RG::setSeed(const int) –> void
setSeed(self: pyrosetta.rosetta.numeric.random.standard_RG, : str) -> None
C++: numeric::random::standard_RG::setSeed(const std::string &) –> void
- pyrosetta.rosetta.numeric.random.uniform() float ¶
C++: numeric::random::uniform() –> double
- class pyrosetta.rosetta.numeric.random.uniform_RG¶
Bases:
pybind11_object
Uniform random number generator
- assign(self: pyrosetta.rosetta.numeric.random.uniform_RG, : pyrosetta.rosetta.numeric.random.uniform_RG) pyrosetta.rosetta.numeric.random.uniform_RG ¶
C++: numeric::random::uniform_RG::operator=(const class numeric::random::uniform_RG &) –> class numeric::random::uniform_RG &
- getRandom(self: pyrosetta.rosetta.numeric.random.uniform_RG) float ¶
C++: numeric::random::uniform_RG::getRandom() –> double
- getSeed(self: pyrosetta.rosetta.numeric.random.uniform_RG) int ¶
C++: numeric::random::uniform_RG::getSeed() –> int
- restoreState(self: pyrosetta.rosetta.numeric.random.uniform_RG, in: pyrosetta.rosetta.std.istream) None ¶
C++: numeric::random::uniform_RG::restoreState(std::istream &) –> void
- saveState(self: pyrosetta.rosetta.numeric.random.uniform_RG, out: pyrosetta.rosetta.std.ostream) None ¶
C++: numeric::random::uniform_RG::saveState(std::ostream &) –> void
- setSeed(*args, **kwargs)¶
Overloaded function.
setSeed(self: pyrosetta.rosetta.numeric.random.uniform_RG, seed: int) -> None
C++: numeric::random::uniform_RG::setSeed(const int) –> void
setSeed(self: pyrosetta.rosetta.numeric.random.uniform_RG, seed: str) -> None
C++: numeric::random::uniform_RG::setSeed(const std::string &) –> void
- pyrosetta.rosetta.numeric.random.uniform_vector_sphere(*args, **kwargs)¶
Overloaded function.
uniform_vector_sphere() -> pyrosetta.rosetta.numeric.xyzVector_double_t
uniform_vector_sphere(radius: float) -> pyrosetta.rosetta.numeric.xyzVector_double_t
A random vector chosen uniformly from the ball (volume enclosed within a sphere) of the given radius around the origin.
C++: numeric::random::uniform_vector_sphere(double) –> class numeric::xyzVector<double>