This file is indexed.

/usr/include/root/TUnuranMultiContDist.h is in libroot-math-unuran-dev 5.34.19+dfsg-1.2.

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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
// @(#)root/unuran:$Id$
// Authors: L. Moneta, J. Leydold Wed Feb 28 2007

/**********************************************************************
 *                                                                    *
 * Copyright (c) 2006  LCG ROOT Math Team, CERN/PH-SFT                *
 *                                                                    *
 *                                                                    *
 **********************************************************************/

// Header file for class TUnuranMultiContDist

#ifndef ROOT_Math_TUnuranMultiContDist
#define ROOT_Math_TUnuranMultiContDist

#ifndef ROOT_Math_TUnuranBaseDist
#include "TUnuranBaseDist.h"
#endif

#ifndef ROOT_Math_IFunction
#include "Math/IFunction.h"
#endif



#include <vector>

class TF1; 


//___________________________________________________________________________________________
/** 
   TUnuranMultiContDist class describing multi dimensional continuous distributions. 
   It is used by TUnuran to generate a set of random numbers according to this distribution via 
   TUnuran::Sample(double *).  
   The class can be constructed from a multi-dimensional function (TF1 pointer, which can be actually also a 
   TF2 or a TF3). 
   It provides a method to set the domain of the distribution ( SetDomain ) which will correspond to the range 
   of the generated random numbers. By default the domain is [(-inf,-inf,...)(+inf,+inf,...)], indipendently of the 
   range set in the TF1 class used to construct the distribution. 

   The derivatives of the pdf which are used by some UNURAN methods are estimated numerically in the 
   Derivative() method. Some extra information (like distribution mode) can be set using SetMode.   
   Some methods require instead of the pdf the log of the pdf. 
   This can also be controlled by setting a flag when constructing this class. 

*/ 
/////////////////////////////////////////////////////////////
class TUnuranMultiContDist : public TUnuranBaseDist {

public: 


   /** 
      Constructor from a TF1 object representing the Probability density function. 
      The derivatives of the Pdf are estimated, when required by the UNURAN algorithm, 
      using numerical derivation. 
      If a value of dim 0 is passed , the dimension of the function is taken from TF1::GetNdim(). 
      This works only for 2D and 3D (for TF2 and TF3 objects). 
   */ 
   TUnuranMultiContDist (TF1 * func = 0, unsigned int dim = 0, bool isLogPdf = false);  


   /** 
      Constructor as before but from a generic function object interface for multi-dim functions
   */ 
   TUnuranMultiContDist (const ROOT::Math::IMultiGenFunction & pdf, bool isLogPdf = false); 

   /** 
      Destructor 
   */ 
   virtual ~TUnuranMultiContDist ();


   /** 
      Copy constructor
   */ 
   TUnuranMultiContDist(const TUnuranMultiContDist &); 

   /** 
      Assignment operator
   */ 
   TUnuranMultiContDist & operator = (const TUnuranMultiContDist & rhs); 

   /**
      Clone (required by base class)
    */
   virtual TUnuranMultiContDist * Clone() const { return new TUnuranMultiContDist(*this); } 


   /**
      get number of dimension of the distribution
   */
   unsigned int NDim() const { 
      return fPdf->NDim(); 
   }

   /**
      set the domain of the distribution giving an array of minimum and maximum values
      By default otherwise the domain is undefined, i.e. is [-inf,+inf]
      To remove the domain do a SetDomain(0,0). 
      There is no possibility to have a domain defined in only one coordinate. Use instead inf or DOUBLE_MAX to 
      specify un infinite domain in that coordinate
   */
   void SetDomain(const double *xmin, const double *xmax)  { 
      if (xmin == 0 || xmax == 0) return; 
      fXmin = std::vector<double>(xmin,xmin+NDim()); 
      fXmax = std::vector<double>(xmax,xmax+NDim()); 
   }

   /**
      set the mode of the distribution (coordinates of the distribution maximum values)
   */
   void SetMode(const double * x) { 
      fMode = std::vector<double>(x,x+NDim());
   }

   /**
      get the distribution lower domain values. Return a null pointer if domain is not defined 
   */
   const double * GetLowerDomain() const { 
      if (fXmin.size() == 0 || (  fXmin.size() != fXmax.size() )  ) return 0; 
      return &fXmin[0];
   }
   /**
      get the distribution upper domain values. Return a null pointer if domain is not defined 
   */
   const double * GetUpperDomain() const { 
      if (fXmax.size() == 0 || (  fXmin.size() != fXmax.size() )  ) return 0; 
      return &fXmax[0];
   }


   /**
      get the mode (vector of coordinate positions of the maxima of the distribution)
      If a mode has not defined return a NULL pointer
   */
   const double * GetMode( ) const { 
      if (fMode.size() == 0  ) return 0; 
      return &fMode.front(); 
   }


   /**
      flag to control if given function represent the log of a pdf
   */
   bool IsLogPdf() const {  return fIsLogPdf; }

   /**
      evaluate the probability density function, used by UnuRan 
   */
   double Pdf ( const double * x) const;

   /** 
       evaluate the gradient vector of  the Pdf. Used by UnuRan
   */
   void Gradient( const double * x, double * grad) const;  

   /**
      evaluate the partial derivative for the given coordinate. Used by UnuRan
   */
   double Derivative( const double * x, int icoord) const; 



private: 

   const ROOT::Math::IMultiGenFunction  * fPdf;    //pointer to the pdf

   std::vector<double> fXmin;      //vector with lower x values of the domain
   std::vector<double> fXmax;      //vector with upper x values of the domain 
   std::vector<double> fMode;      //vector representing the x coordinates of the maximum of the pdf 

   bool fIsLogPdf;                 //flag to control if function pointer represent log of pdf
   bool  fOwnFunc;                // flag to indicate if class manages the function pointers


   ClassDef(TUnuranMultiContDist,1)  //Wrapper class for multi dimensional continuous distribution


}; 



#endif /* ROOT_Math_TUnuranMultiContDist */