mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'mockersf/fix-doc-generation' into 'master'
fix doc generation See merge request veloren/veloren!993
This commit is contained in:
commit
c3e1fd8664
common/src/comp/body
biped_large.rsbird_medium.rscritter.rsdragon.rsgolem.rshumanoid.rsquadruped_medium.rsquadruped_small.rs
world/src/sim
@ -55,10 +55,9 @@ impl<'a, SpeciesMeta> core::ops::Index<&'a Species> for AllSpecies<SpeciesMeta>
|
||||
pub const ALL_SPECIES: [Species; 2] = [Species::Ogre, Species::Cyclops];
|
||||
|
||||
impl<'a, SpeciesMeta: 'a> IntoIterator for &'a AllSpecies<SpeciesMeta> {
|
||||
type IntoIter = std::iter::Copied<std::slice::Iter<'static, Self::Item>>;
|
||||
type Item = Species;
|
||||
|
||||
type IntoIter = impl Iterator<Item = Self::Item>;
|
||||
|
||||
fn into_iter(self) -> Self::IntoIter { ALL_SPECIES.iter().copied() }
|
||||
}
|
||||
|
||||
|
@ -82,10 +82,9 @@ pub const ALL_SPECIES: [Species; 8] = [
|
||||
];
|
||||
|
||||
impl<'a, SpeciesMeta: 'a> IntoIterator for &'a AllSpecies<SpeciesMeta> {
|
||||
type IntoIter = std::iter::Copied<std::slice::Iter<'static, Self::Item>>;
|
||||
type Item = Species;
|
||||
|
||||
type IntoIter = impl Iterator<Item = Self::Item>;
|
||||
|
||||
fn into_iter(self) -> Self::IntoIter { ALL_SPECIES.iter().copied() }
|
||||
}
|
||||
|
||||
|
@ -72,10 +72,9 @@ pub const ALL_SPECIES: [Species; 6] = [
|
||||
];
|
||||
|
||||
impl<'a, SpeciesMeta: 'a> IntoIterator for &'a AllSpecies<SpeciesMeta> {
|
||||
type IntoIter = std::iter::Copied<std::slice::Iter<'static, Self::Item>>;
|
||||
type Item = Species;
|
||||
|
||||
type IntoIter = impl Iterator<Item = Self::Item>;
|
||||
|
||||
fn into_iter(self) -> Self::IntoIter { ALL_SPECIES.iter().copied() }
|
||||
}
|
||||
|
||||
|
@ -52,10 +52,9 @@ impl<'a, SpeciesMeta> core::ops::Index<&'a Species> for AllSpecies<SpeciesMeta>
|
||||
pub const ALL_SPECIES: [Species; 1] = [Species::Reddragon];
|
||||
|
||||
impl<'a, SpeciesMeta: 'a> IntoIterator for &'a AllSpecies<SpeciesMeta> {
|
||||
type IntoIter = std::iter::Copied<std::slice::Iter<'static, Self::Item>>;
|
||||
type Item = Species;
|
||||
|
||||
type IntoIter = impl Iterator<Item = Self::Item>;
|
||||
|
||||
fn into_iter(self) -> Self::IntoIter { ALL_SPECIES.iter().copied() }
|
||||
}
|
||||
|
||||
|
@ -52,10 +52,9 @@ impl<'a, SpeciesMeta> core::ops::Index<&'a Species> for AllSpecies<SpeciesMeta>
|
||||
pub const ALL_SPECIES: [Species; 1] = [Species::StoneGolem];
|
||||
|
||||
impl<'a, SpeciesMeta: 'a> IntoIterator for &'a AllSpecies<SpeciesMeta> {
|
||||
type IntoIter = std::iter::Copied<std::slice::Iter<'static, Self::Item>>;
|
||||
type Item = Species;
|
||||
|
||||
type IntoIter = impl Iterator<Item = Self::Item>;
|
||||
|
||||
fn into_iter(self) -> Self::IntoIter { ALL_SPECIES.iter().copied() }
|
||||
}
|
||||
|
||||
|
@ -105,10 +105,9 @@ pub const ALL_RACES: [Race; 6] = [
|
||||
];
|
||||
|
||||
impl<'a, SpeciesMeta: 'a> IntoIterator for &'a AllSpecies<SpeciesMeta> {
|
||||
type IntoIter = std::iter::Copied<std::slice::Iter<'static, Self::Item>>;
|
||||
type Item = Race;
|
||||
|
||||
type IntoIter = impl Iterator<Item = Self::Item>;
|
||||
|
||||
fn into_iter(self) -> Self::IntoIter { ALL_RACES.iter().copied() }
|
||||
}
|
||||
|
||||
|
@ -82,10 +82,9 @@ pub const ALL_SPECIES: [Species; 8] = [
|
||||
];
|
||||
|
||||
impl<'a, SpeciesMeta: 'a> IntoIterator for &'a AllSpecies<SpeciesMeta> {
|
||||
type IntoIter = std::iter::Copied<std::slice::Iter<'static, Self::Item>>;
|
||||
type Item = Species;
|
||||
|
||||
type IntoIter = impl Iterator<Item = Self::Item>;
|
||||
|
||||
fn into_iter(self) -> Self::IntoIter { ALL_SPECIES.iter().copied() }
|
||||
}
|
||||
|
||||
|
@ -102,10 +102,9 @@ pub const ALL_SPECIES: [Species; 13] = [
|
||||
];
|
||||
|
||||
impl<'a, SpeciesMeta: 'a> IntoIterator for &'a AllSpecies<SpeciesMeta> {
|
||||
type IntoIter = std::iter::Copied<std::slice::Iter<'static, Self::Item>>;
|
||||
type Item = Species;
|
||||
|
||||
type IntoIter = impl Iterator<Item = Self::Item>;
|
||||
|
||||
fn into_iter(self) -> Self::IntoIter { ALL_SPECIES.iter().copied() }
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ pub fn map_edge_factor(posi: usize) -> f32 {
|
||||
|
||||
/// Computes the cumulative distribution function of the weighted sum of k
|
||||
/// independent, uniformly distributed random variables between 0 and 1. For
|
||||
/// each variable i, we use weights[i] as the weight to give samples[i] (the
|
||||
/// each variable i, we use `weights[i]` as the weight to give `samples[i]` (the
|
||||
/// weights should all be positive).
|
||||
///
|
||||
/// If the precondition is met, the distribution of the result of calling this
|
||||
@ -37,23 +37,26 @@ pub fn map_edge_factor(posi: usize) -> f32 {
|
||||
///
|
||||
/// NOTE:
|
||||
///
|
||||
/// Per [1], the problem of determing the CDF of
|
||||
/// Per [[1]], the problem of determing the CDF of
|
||||
/// the sum of uniformly distributed random variables over *different* ranges is
|
||||
/// considerably more complicated than it is for the same-range case.
|
||||
/// Fortunately, it also provides a reference to [2], which contains a complete
|
||||
/// derivation of an exact rule for the density function for this case. The CDF
|
||||
/// is just the integral of the cumulative distribution function [3],
|
||||
/// is just the integral of the cumulative distribution function [[3]],
|
||||
/// which we use to convert this into a CDF formula.
|
||||
///
|
||||
/// This allows us to sum weighted, uniform, independent random variables.
|
||||
///
|
||||
/// At some point, we should probably contribute this back to stats-rs.
|
||||
///
|
||||
/// 1. https://www.r-bloggers.com/sums-of-random-variables/,
|
||||
/// 1. [https://www.r-bloggers.com/sums-of-random-variables/][1],
|
||||
/// 2. Sadooghi-Alvandi, S., A. Nematollahi, & R. Habibi, 2009.
|
||||
/// On the Distribution of the Sum of Independent Uniform Random Variables.
|
||||
/// Statistical Papers, 50, 171-175.
|
||||
/// 3. hhttps://en.wikipedia.org/wiki/Cumulative_distribution_function
|
||||
/// 3. [https://en.wikipedia.org/wiki/Cumulative_distribution_function][3]
|
||||
///
|
||||
/// [1]: https://www.r-bloggers.com/sums-of-random-variables/
|
||||
/// [3]: https://en.wikipedia.org/wiki/Cumulative_distribution_function
|
||||
pub fn cdf_irwin_hall<const N: usize>(weights: &[f32; N], samples: [f32; N]) -> f32 {
|
||||
// Let J_k = {(j_1, ... , j_k) : 1 ≤ j_1 < j_2 < ··· < j_k ≤ N }.
|
||||
//
|
||||
|
Loading…
Reference in New Issue
Block a user