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

Function cluster_variance

crates/openquant/src/hcaa.rs:369–378  ·  view source on GitHub ↗
(cov: &DMatrix<f64>, indices: &[usize])

Source from the content-addressed store, hash-verified

367}
368
369fn cluster_variance(cov: &DMatrix<f64>, indices: &[usize]) -> Result<f64, HcaaError> {
370 let w = inverse_variance_weights(cov, indices)?;
371 let mut v = 0.0;
372 for (ii, &i) in indices.iter().enumerate() {
373 for (jj, &j) in indices.iter().enumerate() {
374 v += w[ii] * cov[(i, j)] * w[jj];
375 }
376 }
377 Ok(v.max(0.0))
378}
379
380fn cluster_sharpe(
381 expected: &[f64],

Callers 2

cluster_sharpeFunction · 0.70
recursive_bisectionFunction · 0.70

Calls 1

inverse_variance_weightsFunction · 0.70

Tested by

no test coverage detected