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

Function assert_weights_basic

crates/openquant/tests/cla.rs:32–38  ·  view source on GitHub ↗
(weights: &[f64], expect_nonnegative: bool)

Source from the content-addressed store, hash-verified

30}
31
32fn assert_weights_basic(weights: &[f64], expect_nonnegative: bool) {
33 let sum: f64 = weights.iter().sum();
34 assert!((sum - 1.0).abs() < 1e-6);
35 if expect_nonnegative {
36 assert!(weights.iter().all(|w| *w >= 0.0));
37 }
38}
39
40#[test]
41fn test_cla_with_mean_returns() {

Calls

no outgoing calls

Tested by

no test coverage detected