This file is indexed.

/usr/include/JAGS/distribution/RScalarDist.h is in jags 4.3.0-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#ifndef R_SCALAR_DIST_H_
#define R_SCALAR_DIST_H_

#include <distribution/ScalarDist.h>

namespace jags {

struct RNG;

/**
 * @short Scalar Distribution using R math library infrastructure.
 *
 * A subclass of RScalarDist has to implement the d,p,q, and r virtual
 * member functions. These are based on the d-p-q-r functions provided
 * by libRmath.
 *
 * The JAGS versions of most (but not all) scalar distributions extend
 * the distribution families in libRmath by allowing the distribution
 * to be bounded.
 */
class RScalarDist : public ScalarDist
{
    const bool _discrete;
    double calPlower(double, std::vector<double const *> const &) const;
    double calPupper(double, std::vector<double const *> const &) const;
public:
    /**
     * Constructor
     *
     * @param name BUGS language name of distribution
     *
     * @param npar Number of parameters, excluding upper and lower bound
     *
     * @param support Support of distribution
     *
     * @param discrete Boolean flag indicating whether the distribution is
     *        discrete valued.
     */
    RScalarDist(std::string const &name, unsigned int npar, Support support,
		bool discrete=false);
    double logDensity(double x, PDFType type,
		      std::vector<double const *> const &parameters,
		      double const *lower, double const *upper) const;
    double randomSample(std::vector<double const *> const &parameters,
			double const *lower, double const *upper,
			RNG *rng) const;
    /**
     * Returns the median. Note that this function can be overloaded
     * by a subclass if necessary.
     */
    double typicalValue(std::vector<double const *> const &parameters,
			double const *lower, double const *upper) const;
    /**
     * Density function, ignoring bounds
     * @param x value at which to evaluate the density
     * @param type Type of density calculation required.
     * @param parameters Array of parameters
     * @param give_log Indicates whether to return log density. 
     */
    virtual double d(double x, PDFType type,
		     std::vector<double const *> const &parameters, 
		     bool give_log) const = 0;
    /**
     * Distribution function, ignoring bounds
     * @param x quantile at which to evaluate the distribution function
     * @param parameters Array of parameters
     * @param lower If true, return value is P[X <= x]. Otherwise
     * P[X > x]
     * @param give_log Indicates whether to return log probabability
     */
    virtual double p(double x, std::vector<double const *> const &parameters, 
		     bool lower, bool give_log) const = 0;
    /**
     * Quantile function, ignoring bounds
     * @param p probability for which to evaluate quantile
     * @param parameters Array of parameters
     * @param log_p Indicates whether p is given as log(p). 
     */
    virtual double q(double p, std::vector<double const *> const &parameters, 
		     bool lower, bool log_p) const = 0;
    /**
     * Random number generation, ignoring bounds
     * @param parameters Array of parameters
     */
    virtual double 
	r(std::vector<double const *> const &parameters, RNG *rng) const = 0;
    /**
     * All RScalarDist distributions can be bounded
     */
    bool canBound() const;
    /**
     * RScalarDist distributions are defined to have support on the integers
     * or on the real line by the constructor
     */
    bool isDiscreteValued(std::vector<bool> const &mask) const;
    /**
     * Alternative function for determining whether the distribution is
     * discrete-valued.
     */
    bool discrete() const;
};

    /**
     * Convenience function that calculates x * log(0) as the limit of
     * x * log(p) as p tends to zero.  This is required for calculation
     * of some density functions.
     *
     * @param x coefficient of log(0)
     * @param give_log logical flag. If true then the limit of x*log(p)
     * is returned, otherwise the limit of p^x.
     */
    double xlog0(double x, bool give_log);

}

#endif /* SCALAR_DIST_RMATH_H_ */