Changeset 718 for trunk/yat/random/random.h
 Timestamp:
 Dec 26, 2006, 10:56:26 AM (16 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/yat/random/random.h
r706 r718 98 98 /// generator can return. 99 99 /// 100 inline u_long max(void) const { return gsl_rng_max(rng_); }100 u_long max(void) const; 101 101 102 102 /// … … 104 104 /// generator can return. 105 105 /// 106 inline u_long min(void) const { return gsl_rng_min(rng_); }106 u_long min(void) const; 107 107 108 108 /// 109 109 /// @brief Returns the name of the random number generator 110 110 /// 111 inline std::string name(void) const { return gsl_rng_name(rng_); }111 std::string name(void) const; 112 112 113 113 /// 114 114 /// @return const pointer to underlying GSL random generator. 115 115 /// 116 inline const gsl_rng* rng(void) const { return rng_; }116 const gsl_rng* rng(void) const; 117 117 118 118 /// … … 125 125 /// @see seed_from_devurandom 126 126 /// 127 inline void seed(u_long s) const { gsl_rng_set(rng_,s); }127 void seed(u_long s) const; 128 128 129 129 /// … … 168 168 /// @return const pointer to underlying GSL random generator. 169 169 /// 170 inline const gsl_rng* rng(void) const { return rng_; } 171 170 const gsl_rng* rng(void) const; 172 171 173 172 private: … … 209 208 /// @see seed_from_devurandom, RNG::seed_from_devurandom, RNG::seed 210 209 /// 211 inline void seed(u_long s) const { rng_>seed(s); }210 void seed(u_long s) const; 212 211 213 212 /// … … 256 255 /// @return A random number. 257 256 /// 258 inline u_long 259 operator()(void) const { return gsl_ran_discrete(rng_>rng(), gen_); } 257 u_long operator()(void) const; 260 258 261 259 private: … … 281 279 /// @brief Default constructor. 282 280 /// 283 DiscreteUniform(void) : range_(rng_>max()) {}281 DiscreteUniform(void); 284 282 285 283 /// … … 296 294 /// functionality will not return). 297 295 /// 298 DiscreteUniform(const u_long n) : range_(n) 299 { if ( range_>rng_>max() ) range_=rng_>max(); } 296 DiscreteUniform(const u_long n); 300 297 301 298 /// … … 304 301 /// likely. n is set in constructor. 305 302 /// 306 inline u_long 307 operator()(void) const { return gsl_rng_uniform_int(rng_>rng(), range_); } 303 u_long operator()(void) const; 308 304 309 305 /// … … 312 308 /// likely. 313 309 /// 314 inline u_long operator()(const u_long n) const 315 { return gsl_rng_uniform_int(rng_>rng(), n); } 310 u_long operator()(const u_long n) const; 316 311 317 312 private: … … 347 342 /// @return A Poisson distributed number. 348 343 /// 349 inline u_long 350 operator()(void) const { return gsl_ran_poisson(rng_>rng(), m_); } 351 352 /// 353 /// @return A Poisson distributed number with expectation value \a 354 /// m 344 u_long operator()(void) const; 345 346 /// 347 /// @return A Poisson distributed number with expectation value 348 /// \a m 355 349 /// 356 350 /// @note this operator ignores parameters set in Constructor 357 351 /// 358 inline u_long 359 operator()(const double m) const { return gsl_ran_poisson(rng_>rng(), m); } 352 u_long operator()(const double m) const; 360 353 361 354 private: … … 393 386 /// @see seed_from_devurandom, RNG::seed_from_devurandom, RNG::seed 394 387 /// 395 inline void seed(u_long s) const { rng_>seed(s); }388 void seed(u_long s) const; 396 389 397 390 /// … … 414 407 }; 415 408 409 // ContinuousUniform is declared before ContinuousGeneral to avoid 410 // forward declaration 416 411 /// 417 412 /// @brief Uniform distribution … … 427 422 { 428 423 public: 429 inline double operator()(void) const { return gsl_rng_uniform(rng_>rng());}424 double operator()(void) const; 430 425 }; 431 426 … … 451 446 /// @return A random number. 452 447 /// 453 inline double operator()(void) const 454 { return hist_.observation_value(discrete_())+(u_()0.5)*hist_.spacing(); } 448 double operator()(void) const; 455 449 456 450 private: … … 476 470 /// @param m is the expectation value of the distribution. 477 471 /// 478 inlineExponential(const double m=1);472 Exponential(const double m=1); 479 473 480 474 /// 481 475 /// @return A random number from exponential distribution. 482 476 /// 483 inline double 484 operator()(void) const { return gsl_ran_exponential(rng_>rng(), m_); } 477 double operator()(void) const; 485 478 486 479 /// … … 490 483 /// @note This operator ignores parameters given in constructor. 491 484 /// 492 inline double operator()(const double m) const 493 { return gsl_ran_exponential(rng_>rng(), m); } 485 double operator()(const double m) const; 494 486 495 487 private: … … 524 516 /// @return A random Gaussian number 525 517 /// 526 inline double 527 operator()(void) const { return gsl_ran_gaussian(rng_>rng(), s_)+m_; } 518 double operator()(void) const; 528 519 529 520 /// … … 533 524 /// @note this operator ignores parameters given in Constructor 534 525 /// 535 inline double 536 operator()(const double s) const { return gsl_ran_gaussian(rng_>rng(), s); } 526 double operator()(const double s) const; 537 527 538 528 /// … … 542 532 /// @note this operator ignores parameters given in Constructor 543 533 /// 544 inline double operator()(const double s, const double m) const 545 { return gsl_ran_gaussian(rng_>rng(), s)+m; } 534 double operator()(const double s, const double m) const; 546 535 547 536 private:
Note: See TracChangeset
for help on using the changeset viewer.