COIN-OR::LEMON - Graph Library

Changeset 12:435bbc8127b3 in lemon-1.2


Ignore:
Timestamp:
12/22/07 08:01:20 (17 years ago)
Author:
Alpar Juttner <alpar@…>
Branch:
default
Children:
13:83c84df7a956, 14:8685efdef52f
Phase:
public
Message:

A better way of generating pareto distr, and swap its parameters.

  • Pareto distribution is now generated as a composition of a Gamma and an exponential one
  • Similarly to gamma() and weibull(), the shape parameter became the first one.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/random.h

    r11 r12  
    799799    /// This function generates a Pareto distribution random number.
    800800    ///
     801    ///\param k shape parameter (<tt>k>0</tt>)
    801802    ///\param x_min location parameter (<tt>x_min>0</tt>)
    802     ///\param k shape parameter (<tt>k>0</tt>)
    803     ///
    804     ///\warning This function used inverse transform sampling, therefore may
    805     ///suffer from numerical unstability.
    806     ///
    807     ///\todo Implement a numerically stable method
    808     double pareto(double x_min,double k)
    809     {
    810       return x_min*pow(1.0-real<double>(),1.0/k);
     803    ///
     804    double pareto(double k,double x_min)
     805    {
     806      return exponential(gamma(k,1.0/x_min));
    811807    } 
    812808     
Note: See TracChangeset for help on using the changeset viewer.