fix: small doc changes

This commit is contained in:
Volodymyr Orlov
2020-11-06 11:20:43 -08:00
parent ab7f46603c
commit 83048dbe94
2 changed files with 6 additions and 5 deletions
+2 -2
View File
@@ -166,7 +166,7 @@ pub trait BaseVector<T: RealNumber>: Clone + Debug {
/// ``` /// ```
fn unique(&self) -> Vec<T>; fn unique(&self) -> Vec<T>;
/// Compute the arithmetic mean. /// Computes the arithmetic mean.
fn mean(&self) -> T { fn mean(&self) -> T {
let n = self.len(); let n = self.len();
let mut mean = T::zero(); let mut mean = T::zero();
@@ -176,7 +176,7 @@ pub trait BaseVector<T: RealNumber>: Clone + Debug {
} }
mean / T::from_usize(n).unwrap() mean / T::from_usize(n).unwrap()
} }
/// Compute the standard deviation. /// Computes the standard deviation.
fn std(&self) -> T { fn std(&self) -> T {
let n = self.len(); let n = self.len();
+4 -3
View File
@@ -1,13 +1,14 @@
//! # Various Statistical Methods //! # Various Statistical Methods
//! //!
//! //! This module provides reference implementations for various statistical functions.
//! Concrete implementations of the `BaseMatrix` trait are free to override these methods for better performance.
use crate::linalg::BaseMatrix; use crate::linalg::BaseMatrix;
use crate::math::num::RealNumber; use crate::math::num::RealNumber;
/// Defines baseline implementations for various statistical functions /// Defines baseline implementations for various statistical functions
pub trait MatrixStats<T: RealNumber>: BaseMatrix<T> { pub trait MatrixStats<T: RealNumber>: BaseMatrix<T> {
/// Compute the arithmetic mean along the specified axis. /// Computes the arithmetic mean along the specified axis.
fn mean(&self, axis: u8) -> Vec<T> { fn mean(&self, axis: u8) -> Vec<T> {
let (n, m) = match axis { let (n, m) = match axis {
0 => { 0 => {
@@ -34,7 +35,7 @@ pub trait MatrixStats<T: RealNumber>: BaseMatrix<T> {
x x
} }
/// Compute the standard deviation along the specified axis. /// Computes the standard deviation along the specified axis.
fn std(&self, axis: u8) -> Vec<T> { fn std(&self, axis: u8) -> Vec<T> {
let (n, m) = match axis { let (n, m) = match axis {
0 => { 0 => {