Improve documentation

This commit is contained in:
Vinzent Steinberg 2017-05-05 16:04:51 +02:00
parent c75ffc01f1
commit afd46067a9

View File

@ -9,10 +9,11 @@ extern crate conv;
use conv::ApproxFrom; use conv::ApproxFrom;
/// Represent an average value of a sequence of numbers. /// Represent the arithmetic mean and the variance of a sequence of numbers.
/// ///
/// The average is calculated iteratively, so the sequence of numbers can be an /// Everything is calculated iteratively using constant memory, so the sequence
/// iterator. /// of numbers can be an iterator. The used algorithms try to avoid numerical
/// instabilities.
/// ///
/// ``` /// ```
/// use average::Average; /// use average::Average;
@ -61,7 +62,7 @@ impl Average {
/// Calculate the unbiased sample variance of the sequence. /// Calculate the unbiased sample variance of the sequence.
/// ///
/// This assumes that sequence consists of samples of a larger population. /// This assumes that the sequence consists of samples of a larger population.
pub fn sample_variance(&self) -> f64 { pub fn sample_variance(&self) -> f64 {
if self.n < 2 { if self.n < 2 {
return 0.; return 0.;
@ -71,7 +72,7 @@ impl Average {
/// Calculate the population variance of the sequence. /// Calculate the population variance of the sequence.
/// ///
/// This assumes that sequence consists of the entire population. /// This assumes that the sequence consists of the entire population.
pub fn population_variance(&self) -> f64 { pub fn population_variance(&self) -> f64 {
if self.n < 2 { if self.n < 2 {
return 0.; return 0.;