Function smartnoise_runtime::components::covariance::covariance[][src]

pub fn covariance(
    left: &ArrayView1<'_, Float>,
    right: &ArrayView1<'_, Float>,
    mean_left: Float,
    mean_right: Float,
    delta_degrees_of_freedom: usize
) -> Float

Get covariance between two 1D-arrays.

Arguments

Return

Covariance of the two arrays.

Example

use ndarray::{ArrayD, arr1};
use smartnoise_runtime::components::covariance::covariance;

let left = arr1(&[1.,2.,3.]);
let right = arr1(&[4.,5.,6.]);
let mean_left = 2.;
let mean_right = 5.;
let cov = covariance(&left.view(), &right.view(), mean_left, mean_right, 1);
assert_eq!(cov, 1.);