Changeset 367
 Timestamp:
 Aug 5, 2005, 1:55:16 PM (16 years ago)
 Location:
 trunk
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

trunk/doc/namespaces.doxygen
r304 r367 9 9 /// 10 10 /// @namespace theplu::gslapi 11 /// All GSL wrapper functionality is to be defined within gslapi12 /// namespace.13 ///14 11 /// There are a number of support operators and functions for the 15 12 /// wrapper classes that do not belong to the classes themselves, but … … 17 14 /// 18 15 /// @brief GSL wrapper 16 17 /// 18 /// @namespace theplu::random 19 /// 20 /// @brief Random number distributions 19 21 20 22 /// 
trunk/lib/random/Random.h
r366 r367 41 41 /// 42 42 /// @brief continuous random distributions. 43 /// Base for continuous random distributions. 43 /// 44 /// Abstract base class for continuous random distributions. 44 45 /// 45 46 class RandomContinuous … … 52 53 inline RandomContinuous(void) { rng_=RNG::instance(89); } 53 54 55 /// 56 /// @return A random number 57 /// 54 58 virtual double operator()(void) const = 0; 55 59 … … 62 66 /// @brief Uniform distribution 63 67 /// 64 /// Class for generating a random number from a flatdistribution68 /// Class for generating a random number from a uniform distribution 65 69 /// between zero and unity. 66 70 /// 67 /// Distribution function \f$ f(x) = 1 \f$ for \f$ 0 \le x < 1 \f$ 68 /// Expectation value: 0.5 71 /// Distribution function \f$ f(x) = 1 \f$ for \f$ 0 \le x < 1 \f$ \n 72 /// Expectation value: 0.5 \n 69 73 /// Variance: \f$ \frac{1}{12} \f$ 70 74 /// … … 78 82 79 83 /// 80 /// Class to generate Gaussian random numbers. 84 /// @brief Gaussian distribution 85 /// 86 /// Class for generating a random number from a Gaussian 87 /// distribution between zero and unity. Utilizes the BoxMuller 88 /// algorithm, which needs two calls to random generator. 89 /// 90 /// Distribution function \f$ f(x) = 91 /// \frac{1}{\sqrt{2\pi\sigma^2}}\exp(\frac{(x\mu)^2}{2\sigma^2}) 92 /// \f$ \n 93 /// Expectation value: \f$ \mu \f$ \n 94 /// Variance: \f$ \sigma^2 \f$ 81 95 /// 82 96 class RandomGaussian : public RandomContinuous 83 97 { 84 98 public: 99 /// 100 /// @brief Constructor 101 /// @param s is the standard deviation \f$ \sigma \f$ of distribution 102 /// m is the expectation value \f$ \mu \f$ of the distribution 103 /// 85 104 inline RandomGaussian(const double s=1, const double m=0) 86 105 : m_(m), s_(s) {} 87 106 107 /// 108 /// @return A random Gaussian number 109 /// 88 110 inline double operator()(void) const 89 111 { return gsl_ran_gaussian(rng_>rng(), s_)+m_; } 90 112 113 /// 114 /// @return A random Gaussian number with standard deviation \a s 115 /// and expectation value 0. 116 /// @note this operator ignores parameters given in Constructor 117 /// 91 118 inline double operator()(const double s) const 92 119 { return gsl_ran_gaussian(rng_>rng(), s); } 93 120 121 /// 122 /// @return A random Gaussian number with standard deviation \a s 123 /// and expectation value \a m. 124 /// @note this operator ignores parameters given in Constructor 125 /// 94 126 inline double operator()(const double s, const double m) const 95 127 { return gsl_ran_gaussian(rng_>rng(), s)+m; } … … 101 133 102 134 /// 103 /// @brief exponential 135 /// @brief Exponential distribution 136 /// 137 /// Class for generating a random number from a Exponential 138 /// distribution. 139 /// 140 /// Distribution function \f$ f(x) = \frac{1}{m}\exp(x/a) \f$ for 141 /// \f$ x \f$ \n 142 /// Expectation value: \f$ m \f$ \n 143 /// Variance: \f$ m^2 \f$ 104 144 /// 105 145 class RandomExponential : public RandomContinuous … … 107 147 public: 108 148 /// 109 /// Constructor 149 /// @brief Constructor 150 /// @param m is the expectation value of the distribution. 110 151 /// 111 152 inline RandomExponential(const double m=1) … … 113 154 114 155 /// 115 /// 156 /// @return A random number from exponential distribution 116 157 /// 117 158 inline double operator()(void) const … … 119 160 120 161 /// 121 /// 122 /// 162 /// @return A random number from exponential distribution, with 163 /// expectation value \a m 164 /// @note this operator ignores parameters given in Constructor 165 /// 123 166 inline double operator()(const double m) const 124 167 { return gsl_ran_exponential(rng_>rng(), m); } … … 131 174 /// 132 175 /// @brief discrete random distributions. 133 /// Base for discrete random distributions. 176 /// 177 /// Abstract Base Class for discrete random distributions. Given K 178 /// discrete events with different probabilities \f$ P[k] \f$, 179 /// produce a random value k consistent with its probability. 134 180 /// 135 181 class RandomDiscrete … … 137 183 public: 138 184 /// 139 /// Constructor185 /// @brief Constructor 140 186 /// 141 187 inline RandomDiscrete(void) { rng_=RNG::instance(89); } 142 188 143 189 /// 144 /// Common interface for all Discrete Random Classes190 /// @return A random number. 145 191 /// 146 192 virtual long operator()(void) const = 0; … … 150 196 }; 151 197 198 /// 199 /// @brief Discrete uniform distribution 200 /// 201 /// Discrete uniform distribution also known as the "equally likely 202 /// outcomes" distribution. Each outcome, in this case an integer 203 /// from \f$ [a,b) \f$, have equal probability to occur. 204 /// 205 /// Distribution function \f$ p(k) = \frac{1}{ba} \f$ for \f$ a \le 206 /// k < b \f$ \n 207 /// Expectation value: \f$ \frac{a+b}{2} \f$ \n 208 /// Variance: \f$ \frac{1}{3}((ba)^21) \f$ 209 /// 152 210 153 211 class RandomDiscreteUniform : public RandomDiscrete … … 155 213 public: 156 214 /// 157 /// Constructor. 215 /// @brief Constructor. 216 /// 217 /// @param \a range is number of different integers that can be 218 /// generated \f$ (ba+1) \f$ \a min is the minimal integer that 219 /// can be generated \f$ (a) \f$ 158 220 /// 159 221 inline RandomDiscreteUniform(const u_long range, const long min=0) … … 174 236 /// 175 237 /// @return A random number between \a min and \a range  \a min 238 /// @note this operator ignores parameters given in Constructor 176 239 /// 177 240 inline long operator()(const u_long range, const long min) const … … 186 249 187 250 /// 188 /// @brief Poisson 189 /// 190 class RandomPoisson : public RandomContinuous 191 { 192 public: 193 /// 194 /// Constructor 195 /// 251 /// @brief Poisson Distribution 252 /// 253 /// Having a Poisson process (no memory), number of occurences 254 /// within a given time window is Poisson distributed. This 255 /// distribution is the limit of a Binomial distribution when number 256 /// of attempts is large, and the probability for one attempt to be 257 /// succesful is small (in such a way that the expected number of 258 /// succesful attempts is \f$ m \f$. 259 /// 260 /// Probability function \f$ p(k) = e^{m}\frac{m^k}{k!} \f$ for \f$ 0 \le 261 /// k \f$ \n 262 /// Expectation value: \f$ m \f$ \n 263 /// Variance: \f$ m \f$ 264 /// 265 class RandomPoisson : public RandomDiscrete 266 { 267 public: 268 /// 269 /// @brief Constructor 270 /// 271 /// @param m is expectation value 196 272 inline RandomPoisson(const double m=1) 197 273 : m_(m){} 198 274 199 275 /// 200 /// 276 /// @return a Poisson distributed number. 201 277 /// 202 278 inline double operator()(void) const … … 204 280 205 281 /// 206 /// 207 /// 282 /// @return a Poisson distributed number with expectation value \a 283 /// m 284 /// @note this operator ignores parameters set in Constructor 208 285 inline double operator()(const double m) const 209 286 { return gsl_ran_poisson(rng_>rng(), m); }
Note: See TracChangeset
for help on using the changeset viewer.