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

Function get_sadf

crates/openquant/src/structural_breaks.rs:98–119  ·  view source on GitHub ↗
(
    _series: &[f64],
    _model: &str,
    _add_const: bool,
    _min_length: usize,
    _lags: SadfLags,
)

Source from the content-addressed store, hash-verified

96}
97
98pub fn get_sadf(
99 _series: &[f64],
100 _model: &str,
101 _add_const: bool,
102 _min_length: usize,
103 _lags: SadfLags,
104) -> StructuralBreakResult<Vec<f64>> {
105 let (x, y, indices) = get_y_x(_series, _model, _lags, _add_const)?;
106 if y.len() <= _min_length {
107 return Ok(Vec::new());
108 }
109
110 let mut sadf_values = Vec::with_capacity(y.len().saturating_sub(_min_length));
111 for (pos, _) in indices.iter().enumerate().skip(_min_length) {
112 let x_subset = x[..=pos].to_vec();
113 let y_subset = y[..=pos].to_vec();
114 let value = get_sadf_at_t(&x_subset, &y_subset, _min_length)?;
115 sadf_values.push(value);
116 }
117
118 Ok(sadf_values)
119}
120
121pub fn _get_values_diff(
122 test_type: &str,

Callers 3

bench_sadf_sm_powerFunction · 0.85
test_sadf_testFunction · 0.85
sb_get_sadfFunction · 0.85

Calls 3

get_y_xFunction · 0.85
get_sadf_at_tFunction · 0.85
lenMethod · 0.80

Tested by 1

test_sadf_testFunction · 0.68