#include <newran.h>
Inheritance diagram for PosGen:


Public Member Functions | |
| char * | Name () |
| PosGen () | |
| virtual | ~PosGen () |
| Real | Next () |
| ExtReal | Mean () const |
| ExtReal | Variance () const |
Protected Member Functions | |
| void | Build (bool) |
Protected Attributes | |
| Real | xi |
| Real * | sx |
| Real * | sfx |
| bool | NotReady |
Private Member Functions | |
| void | operator= (const PosGen &) |
|
|
Definition at line 184 of file newran.cpp. References NotReady, and tron.
|
|
|
Definition at line 192 of file newran.cpp. References NotReady, sfx, sx, and tron.
|
|
|
Definition at line 206 of file newran.cpp. References Random::Density(), ErrorNoSpace(), NotReady, Real, sfx, sx, tron, and xi. Referenced by SymGen::Next(), Next(), and Normal::Normal().
00207 {
00208 #ifdef MONITOR
00209 tron << "building PosGen arrays\n";
00210 #endif
00211 int i;
00212 NotReady=false;
00213 sx=new Real[60]; sfx=new Real[60];
00214 if (!sx || !sfx) ErrorNoSpace();
00215 Real sxi=0.0; Real inc = sym ? 0.01 : 0.02;
00216 for (i=0; i<60; i++)
00217 {
00218 sx[i]=sxi; Real f1=Density(sxi); sfx[i]=f1;
00219 if (f1<=0.0) goto L20;
00220 sxi+=inc/f1;
00221 }
00222 Throw(Runtime_error("Newran: area too large"));
00223 L20:
00224 if (i<50) Throw(Runtime_error("Newran: area too small"));
00225 xi = sym ? 2*i : i;
00226 return;
00227 }
|
|
|
Reimplemented from Random. Reimplemented in ChiSq1, Gamma1, Normal, Cauchy, and Exponential. Definition at line 109 of file newran.h. References Missing.
|
|
|
Reimplemented from Random. Reimplemented in SymGen, Normal, Cauchy, Exponential, PosGenX, and SymGenX. Definition at line 905 of file newran.cpp.
00905 { return "PosGen"; }
|
|
|
Reimplemented from Random. Reimplemented in ChiSq1, Gamma1, and SymGen. Definition at line 229 of file newran.cpp. References Build(), Random::Density(), Random::Next(), NotReady, Real, sfx, sx, and xi. Referenced by Gamma1::Next().
00230 {
00231 Real ak,y; int ir;
00232 if (NotReady) Build(false);
00233 do
00234 {
00235 Real r1=Random::Next();
00236 ir = (int)(r1*xi); Real sxi=sx[ir];
00237 ak=sxi+(sx[ir+1]-sxi)*Random::Next();
00238 y=sfx[ir]*Random::Next();
00239 }
00240 while ( y>=sfx[ir+1] && y>=Density(ak) );
00241 return ak;
00242 }
|
|
|
Definition at line 97 of file newran.h.
00097 {} // private so can't access
|
|
|
Reimplemented from Random. Reimplemented in ChiSq1, Gamma1, Normal, Cauchy, and Exponential. Definition at line 110 of file newran.h. References Missing.
|
|
|
Definition at line 101 of file newran.h. Referenced by Build(), SymGen::Next(), Next(), Normal::Normal(), PosGen(), Normal::~Normal(), and ~PosGen(). |
|
|
Definition at line 100 of file newran.h. Referenced by Build(), SymGen::Next(), Next(), Normal::Normal(), and ~PosGen(). |
|
|
Definition at line 100 of file newran.h. Referenced by Build(), SymGen::Next(), Next(), Normal::Normal(), and ~PosGen(). |
|
|
Definition at line 100 of file newran.h. Referenced by Build(), SymGen::Next(), Next(), and Normal::Normal(). |
1.3.3