Fast implementation of reverse unfinished beta function in C ++

I am looking for an implementation of an inverse incomplete beta function, possibly already written in C ++ or simple to implement. However, I need it to be FAST! As in, I will run this in the optimizer's inner loop, so it will hopefully take a couple of hundred clock cycles.

There are already several threads here, but in this case, I am ready to drop the greater accuracy for speed. In addition, the domain is somewhat limited, since I only use integer values ​​for a and b.

More information about the problem: I give an integer number of trials n and an integer k <= n of these trials that were successful. I assume that the background distribution for the base probability of a successful test is uniform in [0,1], so given that I have seen a number of trials and successes, my subsequent distribution should be a beta distribution. In the Bayesian model, I essentially try to find the pth percentile of probable underlying probabilities.

Again, I do not need it to be very accurate, just fast. I can cope with an error of up to +/- 1%. However, this cannot be extremely inaccurate for small numbers: my inputs range from almost zero to tens of thousands.

Thanks in advance! If any clarification is necessary, let me know.

+4
source share
1 answer
+4
source

Source: https://habr.com/ru/post/1392254/


All Articles