/// <summary> /// Find first miss count achievable with at least probability p /// </summary> private static double getMissCount(double p, double[] missProbabilities) { var distribution = new PoissonBinomial(missProbabilities); Func <double, double> cdfMinusProb = missCount => distribution.Cdf(missCount) - p; return(Brent.FindRootExpand(cdfMinusProb, -100, 1000)); }
/// <summary> /// Find first miss count achievable with at least probability p /// </summary> private static double getMissCount(double p, double[] missProbabilities) { if (missProbabilities.Sum() == 0) { return(0); } var distribution = new PoissonBinomial(missProbabilities); double cdfMinusProb(double missCount) => distribution.Cdf(missCount) - p; return(Brent.FindRootExpand(cdfMinusProb, -100, 1000)); }