Skip to main content

StdDevValue

Trait StdDevValue 

Source
pub trait StdDevValue: Copy + 'static {
    type Moment: Copy + 'static;

    const ZERO: Self::Moment;

    // Required methods
    fn moment(self) -> Self::Moment;
    fn plus(left: Self::Moment, right: Self::Moment) -> Self::Moment;
    fn minus(left: Self::Moment, right: Self::Moment) -> Self::Moment;
    fn times(left: Self::Moment, right: Self::Moment) -> Self::Moment;
    fn deviation(
        count: i32,
        sum_of_items: Self::Moment,
        sum_of_squares: Self::Moment,
    ) -> f64;
    fn to_f64(self) -> f64;
}
Expand description

A value whose standard deviation the aggregations compute (int, long, float, double).

Required Associated Constants§

Source

const ZERO: Self::Moment

The sum of no values.

Required Associated Types§

Source

type Moment: Copy + 'static

The type of the sums of the values and of their squares: i64 for i32 and i64 (upstream widens int to long), the type itself for f32 and f64.

Required Methods§

Source

fn moment(self) -> Self::Moment

The value as a moment.

Source

fn plus(left: Self::Moment, right: Self::Moment) -> Self::Moment

left + right, wrapping on overflow for the integers (C#’s unchecked arithmetic).

Source

fn minus(left: Self::Moment, right: Self::Moment) -> Self::Moment

left - right, wrapping on overflow for the integers.

Source

fn times(left: Self::Moment, right: Self::Moment) -> Self::Moment

left * right, wrapping on overflow for the integers.

Source

fn deviation( count: i32, sum_of_items: Self::Moment, sum_of_squares: Self::Moment, ) -> f64

The sample standard deviation of count values (at least two) whose sum is sum_of_items and the sum of whose squares is sum_of_squares.

Source

fn to_f64(self) -> f64

The value as the result (the implicit conversion of upstream’s fallbackValue).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl StdDevValue for f32

Source§

fn deviation(count: i32, sum_of_items: f32, sum_of_squares: f32) -> f64

The variance in float, as upstream computes it, and its square root in double.

Source§

const ZERO: f32 = 0.0

Source§

type Moment = f32

Source§

fn moment(self) -> f32

Source§

fn plus(left: f32, right: f32) -> f32

Source§

fn minus(left: f32, right: f32) -> f32

Source§

fn times(left: f32, right: f32) -> f32

Source§

fn to_f64(self) -> f64

Source§

impl StdDevValue for f64

Source§

const ZERO: f64 = 0.0

Source§

type Moment = f64

Source§

fn moment(self) -> f64

Source§

fn plus(left: f64, right: f64) -> f64

Source§

fn minus(left: f64, right: f64) -> f64

Source§

fn times(left: f64, right: f64) -> f64

Source§

fn deviation(count: i32, sum_of_items: f64, sum_of_squares: f64) -> f64

Source§

fn to_f64(self) -> f64

Source§

impl StdDevValue for i32

Source§

const ZERO: i64 = 0

Source§

type Moment = i64

Source§

fn moment(self) -> i64

Source§

fn plus(left: i64, right: i64) -> i64

Source§

fn minus(left: i64, right: i64) -> i64

Source§

fn times(left: i64, right: i64) -> i64

Source§

fn deviation(count: i32, sum_of_items: i64, sum_of_squares: i64) -> f64

Source§

fn to_f64(self) -> f64

Source§

impl StdDevValue for i64

Source§

const ZERO: i64 = 0

Source§

type Moment = i64

Source§

fn moment(self) -> i64

Source§

fn plus(left: i64, right: i64) -> i64

Source§

fn minus(left: i64, right: i64) -> i64

Source§

fn times(left: i64, right: i64) -> i64

Source§

fn deviation(count: i32, sum_of_items: i64, sum_of_squares: i64) -> f64

Source§

fn to_f64(self) -> f64

Implementors§