From 84a78c8a9b4295d1cb593e4a197283d54287aebf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Wed, 23 May 2018 09:59:41 +0200 Subject: [PATCH] [probability] Add comment for future improvement in Binomial law computation --- apps/probability/law/binomial_law.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/apps/probability/law/binomial_law.cpp b/apps/probability/law/binomial_law.cpp index 49ff0fabe..0daeddeb5 100644 --- a/apps/probability/law/binomial_law.cpp +++ b/apps/probability/law/binomial_law.cpp @@ -70,6 +70,13 @@ float BinomialLaw::yMax() { bool BinomialLaw::authorizedValueAtIndex(float x, int index) const { if (index == 0) { + /* As the cumulative probability are computed by looping over all discrete + * abscissa within the interesting range, the complexity of the cumulative + * probability is linear with the size of the range. Here we cap the maximal + * size of the range to 10000. If one day we want to increase or get rid of + * this cap, we should implement the explicite formula of the cumulative + * probability (which depends on an incomplete beta function) to make the + * comlexity O(1). */ if (x != (int)x || x < 0.0f || x > 9999.0f) { return false; }