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

Function test_lambda_for_zero_matrices

crates/openquant/tests/cla.rs:178–190  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

176
177#[test]
178fn test_lambda_for_zero_matrices() {
179 let prices = load_asset_prices();
180 let mut cla = CLA::new(WeightBounds::Tuple(0.0, 1.0), "mean");
181 cla.allocate(Some(AssetPricesInput::Prices(&prices)), None, None, None, Some("min_volatility"))
182 .unwrap();
183 let mut cov = covariance(&prices.data);
184 for v in cov.iter_mut() {
185 *v = 0.0;
186 }
187 let (x, y) = cla._compute_lambda(&cov, &cov, &cla.expected_returns, None, &[1], &[0]);
188 assert_eq!(x, 0.0);
189 assert_eq!(y, 0);
190}
191
192#[test]
193fn test_w_for_no_bounded_weights() {

Callers

nothing calls this directly

Calls 4

load_asset_pricesFunction · 0.85
_compute_lambdaMethod · 0.80
covarianceFunction · 0.70
allocateMethod · 0.45

Tested by

no test coverage detected