Exemple #1
0
        } //# end of rnorm.censored

        internal static double RUnifLogP1(double[] logPLim, bool lowerTail = true, double u = double.NaN)
        {
            // On suppose logPLim est de longueur 2, et que logPLim[1] > logPLim[0]
            if (double.IsNaN(u))
            {
                u = UniformDistribution.RUnif();
            }
            //# To sample 'size' values uniformly in c(exp(logp.lim[1]), exp(logp.lim[2]))

            double w = logPLim[1] - logPLim[0];

            if (!lowerTail)
            {
                w = Math.Abs(w);
            }

            double logP = Math.Log(u) + ExponentialDistribution.PExp(w, logP: true);
            double x    = ExponentialDistribution.QExp(logP, logP: true);

            x = logPLim.Max() - x;
            return(x);
        }