[Lemon-commits] Alpar Juttner: Serious buxfixes in Random::gamma...

Lemon HG hg at lemon.cs.elte.hu
Thu Apr 3 14:01:27 CEST 2008


details:   http://lemon.cs.elte.hu/hg/lemon/rev/b6bede534255
changeset: 116:b6bede534255
user:      Alpar Juttner <alpar [at] cs.elte.hu>
date:      Thu Apr 03 13:00:18 2008 +0100
description:
	Serious buxfixes in Random::gamma() and Random::pareto()

diffstat:

1 file changed, 2 insertions(+), 2 deletions(-)
lemon/random.h |    4 ++--

diffs (21 lines):

diff -r 7b44eea654d0 -r b6bede534255 lemon/random.h
--- a/lemon/random.h	Tue Apr 01 16:25:51 2008 +0100
+++ b/lemon/random.h	Thu Apr 03 13:00:18 2008 +0100
@@ -795,7 +795,7 @@
 	    nu=V0*std::exp(-xi);
 	  }
       } while(nu>std::pow(xi,delta-1.0)*std::exp(-xi));
-      return theta*(xi-gamma(int(std::floor(k))));
+      return theta*(xi+gamma(int(std::floor(k))));
     }
     
     /// Weibull distribution
@@ -819,7 +819,7 @@
     ///
     double pareto(double k,double x_min)
     {
-      return exponential(gamma(k,1.0/x_min));
+      return exponential(gamma(k,1.0/x_min))+x_min;
     }  
       
     /// Poisson distribution



More information about the Lemon-commits mailing list