MCPcopy Create free account
hub / github.com/Open-Quant/openquant / _get_values_diff

Function _get_values_diff

crates/openquant/src/structural_breaks.rs:121–134  ·  view source on GitHub ↗
(
    test_type: &str,
    series: &[f64],
    index: usize,
    ind: usize,
)

Source from the content-addressed store, hash-verified

119}
120
121pub fn _get_values_diff(
122 test_type: &str,
123 series: &[f64],
124 index: usize,
125 ind: usize,
126) -> StructuralBreakResult<f64> {
127 let left = series.get(index).ok_or(StructuralBreakError::IndexOutOfBounds)?;
128 let right = series.get(ind).ok_or(StructuralBreakError::IndexOutOfBounds)?;
129 match test_type {
130 "one_sided" => Ok(left - right),
131 "two_sided" => Ok((left - right).abs()),
132 _ => Err(StructuralBreakError::InvalidTestType(test_type.to_string())),
133 }
134}
135
136pub fn _get_betas(
137 _x: &[Vec<f64>],

Calls

no outgoing calls

Tested by 1