tweak: delete higher level match in mixture function

This commit is contained in:
NunoSempere 2023-10-15 00:01:05 +01:00
parent ce119253b7
commit 4983699308
5 changed files with 12 additions and 13 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -41,11 +41,10 @@ let sampleTo low high =
let logstd = (loghigh -. loglow) /. (2.0 -. normal_95_ci_length ) in let logstd = (loghigh -. loglow) /. (2.0 -. normal_95_ci_length ) in
sampleLognormal logmean logstd sampleLognormal logmean logstd
let (|>) x f = f x
let mixture (samplers: (unit -> float) array) (weights: float array): float option = let mixture (samplers: (unit -> float) array) (weights: float array): float option =
match (Array.length samplers == Array.length weights) with if (Array.length samplers == Array.length weights)
| false -> None then None
| true -> else
let normalized_weights = normalizeXs weights in let normalized_weights = normalizeXs weights in
let cumsummed_normalized_weights = cumsumXs normalized_weights in let cumsummed_normalized_weights = cumsumXs normalized_weights in
let p = sampleZeroToOne () in let p = sampleZeroToOne () in