From fde965574000e459fa1d234157a663d76f547a9b Mon Sep 17 00:00:00 2001
From: Michael Haupt <michael.haupt@oracle.com>
Date: Fri, 7 Nov 2014 10:42:58 +0100
Subject: [PATCH] adjust specialisation visibility in qgamma

---
 .../truffle/r/nodes/builtin/stats/Qgamma.java | 32 +++++++++----------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/stats/Qgamma.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/stats/Qgamma.java
index 9a282b539f..7ed0511533 100644
--- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/stats/Qgamma.java
+++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/stats/Qgamma.java
@@ -40,13 +40,13 @@ public abstract class Qgamma extends RBuiltinNode {
     // This is derived from distn.c.
 
     @Specialization
-    public double qgamma(double p, double shape, double scale, byte lowerTail, byte logP) {
+    protected double qgamma(double p, double shape, double scale, byte lowerTail, byte logP) {
         controlVisibility();
         return qgamma(p, shape, scale, lowerTail == RRuntime.LOGICAL_TRUE, logP == RRuntime.LOGICAL_TRUE);
     }
 
     @Specialization
-    public RDoubleVector qgamma(RDoubleVector p, double shape, double scale, byte lowerTail, byte logP) {
+    protected RDoubleVector qgamma(RDoubleVector p, double shape, double scale, byte lowerTail, byte logP) {
         controlVisibility();
         // TODO if need be, support iteration over multiple vectors (not just p)
         // TODO support NA
@@ -644,9 +644,9 @@ public abstract class Qgamma extends RBuiltinNode {
         /*
          * PR# 2214 : From: Morten Welinder <terra@diku.dk>, Fri, 25 Oct 2002 16:50 -------- To:
          * R-bugs@biostat.ku.dk Subject: qgamma precision
-         *
+         * 
          * With a final Newton step, double accuracy, e.g. for (p= 7e-4; nu= 0.9)
-         *
+         * 
          * Improved (MM): - only if rel.Err > EPS_N (= 1e-15); - also for lower_tail = FALSE or
          * log_p = TRUE - optionally *iterate* Newton
          */
@@ -707,7 +707,7 @@ public abstract class Qgamma extends RBuiltinNode {
     /*
      * Continued fraction for calculation of 1/i + x/(i+d) + x^2/(i+2*d) + x^3/(i+3*d) + ... =
      * sum_{k=0}^Inf x^k/(i+k*d)
-     *
+     * 
      * auxilary in log1pmx() and lgamma1p()
      */
     private static double logcf(double x, double i, double d, double eps /* ~ relative tolerance */) {
@@ -804,7 +804,7 @@ public abstract class Qgamma extends RBuiltinNode {
          * Abramowitz & Stegun 6.1.33 : for |x| < 2, <==> log(gamma(1+x)) = -(log(1+x) - x) -
          * gamma*x + x^2 * \sum_{n=0}^\infty c_n (-x)^n where c_n := (Zeta(n+2) - 1)/(n+2) =
          * coeffs[n]
-         *
+         * 
          * Here, another convergence acceleration trick is used to compute lgam(x) := sum_{n=0..Inf}
          * c_n (-x)^n
          */
@@ -1030,17 +1030,17 @@ public abstract class Qgamma extends RBuiltinNode {
 
     /*
      * Compute the following ratio with higher accuracy that would be had from doing it directly.
-     *
+     * 
      * dnorm (x, 0, 1, FALSE) ---------------------------------- pnorm (x, 0, 1, lower_tail, FALSE)
-     *
+     * 
      * Abramowitz & Stegun 26.2.12
      */
     private static double dpnorm(double x, boolean lowerTail, double lp) {
         /*
          * So as not to repeat a pnorm call, we expect
-         *
+         * 
          * lp == pnorm (x, 0, 1, lower_tail, TRUE)
-         *
+         * 
          * but use it only in the non-critical case where either x is small or p==exp(lp) is close
          * to 1.
          */
@@ -1504,24 +1504,24 @@ public abstract class Qgamma extends RBuiltinNode {
             /*
              * else |x| > sqrt(32) = 5.657 : the next two case differentiations were really for
              * lower=T, log=F Particularly *not* for log_p !
-             *
+             * 
              * Cody had (-37.5193 < x && x < 8.2924) ; R originally had y < 50
-             *
+             * 
              * Note that we do want symmetry(0), lower/upper -> hence use y
              */
         } else if ((logp && y < 1e170) /* avoid underflow below */
                         /*
                          * ^^^^^ MM FIXME: can speedup for log_p and much larger |x| ! Then, make
                          * use of Abramowitz & Stegun, 26.2.13, something like
-                         * 
+                         *
                          * xsq = x*x;
-                         * 
+                         *
                          * if(xsq * DBL_EPSILON < 1.) del = (1. - (1. - 5./(xsq+6.)) / (xsq+4.)) /
                          * (xsq+2.); else del = 0.;cum = -.5*xsq - M_LN_SQRT_2PI - log(x) +
                          * log1p(-del);ccum = log1p(-exp(*cum)); /.* ~ log(1) = 0 *./
-                         * 
+                         *
                          * swap_tail;
-                         * 
+                         *
                          * [Yes, but xsq might be infinite.]
                          */
                         || (lower && -37.5193 < x && x < 8.2924) || (upper && -8.2924 < x && x < 37.5193)) {
-- 
GitLab