#include "include.h"
#include "myexcept.h"
#include "extreal.h"
#include <vector>
Include dependency graph for newran.h:
This graph shows which files directly or indirectly include this file:
Go to the source code of this file.
Data Structures | |
class | AddedRandom |
class | AddedSelectedRandom |
class | AsymGen |
class | AsymGenX |
class | Binomial |
class | Cauchy |
class | ChiSq |
class | Constant |
class | DiscreteGen |
class | DividedRandom |
class | Exponential |
class | Gamma |
class | MixedRandom |
class | MultipliedRandom |
class | NegatedRandom |
class | NegativeBinomial |
class | Normal |
class | OredRandom |
class | OredVectRandom |
class | Pareto |
class | Poisson |
class | PosGen |
class | PosGenX |
class | Random |
class | RandomCombination |
class | RandomPermutation |
class | ReciprocalRandom |
class | RepeatedRandom |
class | ReverseShiftedRandom |
class | ScaledRandom |
class | SelectedRandom |
class | ShiftedRandom |
class | SubtractedRandom |
class | SumRandom |
class | SymGen |
class | SymGenX |
class | Uniform |
Defines | |
#define | NEWRAN_LIB 0 |
Typedefs | |
typedef Real(* | PDF )(Real) |
Functions | |
Real | ln_gamma (Real) |
|
|
|
|
|
Definition at line 609 of file newran.cpp. References Real. Referenced by Binomial1::Binomial1(), Binomial2::Binomial2(), NegativeBinomial::Density(), Binomial1::Density(), Poisson1::Density(), Gamma1::Gamma1(), Gamma2::Gamma2(), NegativeBinomial::NegativeBinomial(), TestBinomial(), TestNegativeBinomial(), and TestPoisson().
00610 { 00611 // log gamma function adapted from numerical recipes in C 00612 00613 if (xx<1.0) // Use reflection formula 00614 { 00615 double piz = 3.14159265359 * (1.0-xx); 00616 return log(piz/sin(piz))-ln_gamma(2.0-xx); 00617 } 00618 else 00619 { 00620 static double cof[6]={76.18009173,-86.50532033,24.01409822, 00621 -1.231739516,0.120858003e-2,-0.536382e-5}; 00622 00623 double x=xx-1.0; double tmp=x+5.5; 00624 tmp -= (x+0.5)*log(tmp); double ser=1.0; 00625 for (int j=0;j<=5;j++) { x += 1.0; ser += cof[j]/x; } 00626 return -tmp+log(2.50662827465*ser); 00627 } 00628 } |