Skip to main content

assert_stochastic

Function assert_stochastic 

Source
pub fn assert_stochastic<F>(
    matrix: &ArrayView2<'_, F>,
    name: &str,
    tolerance: F,
) -> CoreResult<()>
where F: Float + Display + Sum,
Expand description

Assert that a 2-D matrix is (row-)stochastic: each row sums to 1 within tolerance, and all elements are non-negative.