Changeset 34


Ignore:
Timestamp:
Feb 6, 2004, 10:37:15 AM (19 years ago)
Author:
Jari Häkkinen
Message:

Moved inlines to proper place, i.e. .h-file. Fixed asserts.

Location:
trunk/src
Files:
1 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/histogram.cc

    r13 r34  
     1// $Id$
     2
     3#include <cassert>
     4
    15#include "histogram.h"
    26
  • trunk/src/random_singleton.h

    r23 r34  
    5757
    5858  @return If \a n is zero, or left out, a number between [ \a
    59   min, \a max] is returned, otherwise a number between 0 and n-1
     59  min, \a max ] is returned, otherwise a number between 0 and n-1
    6060  is returned.
    6161
     
    144144  }; // random_singleton
    145145 
    146 #include "random_singleton.icc"
     146
     147double random_singleton::get_exponential( const double& mu ) const
     148{
     149  return gsl_ran_exponential( r_, mu );
     150}
     151
     152
     153double random_singleton::get_gaussian( const double& sigma ) const
     154{
     155  return gsl_ran_gaussian( r_, sigma );
     156}
     157
     158
     159inline std::string random_singleton::get_generator_type() const
     160{
     161  return static_cast<std::string>( gsl_rng_name( r_ ) );
     162}
     163
     164
     165size_t random_singleton::get_rnd_discrete()
     166{
     167  return gsl_ran_discrete( r_, gen_ );
     168}
     169
     170
     171int random_singleton::get_seed() const
     172{
     173  return gsl_rng_default_seed;
     174}
     175
     176
     177double random_singleton::get_uniform_double() const
     178{
     179  return gsl_rng_uniform( r_ );
     180}
     181
     182
     183u_long random_singleton::get_uniform_int(const u_long n) const
     184{
     185    return ( n ? gsl_rng_uniform_int(r_,n) : gsl_rng_get( r_ ));
     186}
     187
     188
     189u_long random_singleton::get_uniform_min() const
     190{
     191  return gsl_rng_min( r_ );
     192}
     193
     194
     195u_long random_singleton::get_uniform_max() const
     196{
     197  return gsl_rng_max( r_ );
     198}
     199
     200
     201void random_singleton::set_general_distribution_prob( const size_t& k,
     202                  const double* p )
     203{
     204  gen_ = gsl_ran_discrete_preproc( k, p );
     205}
    147206
    148207} // namespace thep_c++_tools
Note: See TracChangeset for help on using the changeset viewer.