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

Function build_bounds

crates/openquant/src/cla.rs:443–453  ·  view source on GitHub ↗
(n: usize, bounds: &WeightBounds)

Source from the content-addressed store, hash-verified

441}
442
443fn build_bounds(n: usize, bounds: &WeightBounds) -> Result<Vec<(f64, f64)>, ClaError> {
444 match bounds {
445 WeightBounds::Tuple(lo, hi) => Ok(vec![(*lo, *hi); n]),
446 WeightBounds::Lists(low, high) => {
447 if low.len() != n || high.len() != n {
448 return Err(ClaError::DimensionMismatch);
449 }
450 Ok(low.iter().copied().zip(high.iter().copied()).collect())
451 }
452 }
453}
454
455fn check_bounds_feasible(bounds: &[(f64, f64)]) -> Result<(), ClaError> {
456 let lower: f64 = bounds.iter().map(|b| b.0).sum();

Callers 2

allocateMethod · 0.70
_initialiseMethod · 0.70

Calls 1

lenMethod · 0.80

Tested by

no test coverage detected