OpendTect-6_4  6.4
gaussianprobdenfunc.h
Go to the documentation of this file.
1 #ifndef gaussianprobdenfunc_h
2 #define gaussianprobdenfunc_h
3 
4 /*
5 ________________________________________________________________________
6 
7  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
8  Author: Bert
9  Date: Jan 2010
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 
14 */
15 
16 #include "algomod.h"
17 #include "probdenfunc.h"
18 #include "samplingdata.h"
19 #include "arrayndimpl.h"
20 #include "bufstringset.h"
21 template <class T> class Array2DMatrix;
22 namespace Stats { class NormalRandGen; }
23 
24 
25 inline float cMaxGaussianCC() { return 0.99999f; }
26 inline const char* sGaussianCCRangeErrMsg()
27 { return "Correlation coefficients should be in range <-1,1>.\n"
28  "Maximum correlation is 0.99999."; }
29 
30 #define mDefGaussianProbDenFuncFns(nm) \
31  ~nm##ProbDenFunc(); \
32  nm##ProbDenFunc& operator =(const nm##ProbDenFunc&); \
33  virtual nm##ProbDenFunc* clone() const \
34  { return new nm##ProbDenFunc(*this); } \
35  virtual void copyFrom(const ProbDenFunc&); \
36  static const char* typeStr() { return #nm; } \
37  virtual const char* getTypeStr() const { return typeStr(); } \
38  virtual void fillPar(IOPar&) const; \
39  virtual bool usePar(const IOPar&); \
40  virtual bool isEq(const ProbDenFunc&) const;
41 
42 
43 
47 {
48 public:
49 
50  Gaussian1DProbDenFunc( float exp=0, float stdev=1 )
51  : rgen_(0), exp_(exp), std_(stdev) {}
53  : rgen_(0) { *this = oth; }
54 
56 
57  float exp_;
58  float std_;
59 
60 protected:
61 
62  mutable Stats::NormalRandGen* rgen_;
63 
64  virtual float gtAvgPos() const { return exp_; }
65  virtual float gtVal(float) const;
66  virtual void drwRandPos(float&) const;
67 
68 };
69 
70 
74 {
75 public:
76 
78  : rgen0_(0), rgen1_(0)
79  , exp0_(0), exp1_(0)
80  , std0_(1), std1_(1), cc_(0) {}
82  : rgen0_(0), rgen1_(0) { *this = oth; }
83 
85 
86  virtual float averagePos( int dim ) const
87  { return dim ? exp1_ : exp0_; }
88 
89  float exp0_, exp1_;
90  float std0_, std1_;
91  float cc_;
92 
93 protected:
94 
97 
98  virtual float gtVal(float,float) const;
99  virtual void drwRandPos(float&,float&) const;
100 
101 };
102 
103 
107 {
108 public:
109 
110  GaussianNDProbDenFunc(int nrdims=3);
112  { *this = oth; }
114 
115  virtual int nrDims() const { return vars_.size(); }
116  virtual const char* dimName(int) const;
117  virtual void setDimName(int,const char*);
118  virtual float averagePos(int) const;
119 
120  void prepareRandDrawing() const;
121  virtual void drawRandomPos(TypeSet<float>&) const;
122  virtual float value(const TypeSet<float>&) const;
124 
126  {
127  public:
128 
129  VarDef( const char* nm, float e=0, float s=1 )
130  : name_(nm), exp_(e), std_(s) {}
131  bool operator ==( const VarDef& vd ) const
132  { return name_ == vd.name_; }
133 
135  float exp_;
136  float std_;
137  };
138 
140  {
141  public:
142  Corr( int i0=0, int i1=0, float cc=1 )
143  : idx0_(i0), idx1_(i1), cc_(cc) {}
144  bool operator ==( const Corr& oth ) const
145  { return (idx0_ == oth.idx0_ && idx1_ == oth.idx1_)
146  || (idx0_ == oth.idx1_ && idx1_ == oth.idx0_); }
147 
148  int idx0_, idx1_;
149  float cc_;
150 
151  };
152 
155 
156  const char* firstUncorrelated() const;
157 
158 protected:
159 
160 
164 
165 };
166 
167 
168 #endif
#define mExpClass(module)
Definition: commondefs.h:160
TypeSet< VarDef > vars_
Definition: gaussianprobdenfunc.h:153
Definition: statrand.h:77
Probability Density Function for one dimensional datasets.
Definition: probdenfunc.h:81
Gaussian1DProbDenFunc(float exp=0, float stdev=1)
Definition: gaussianprobdenfunc.h:50
bool operator==(const ArrayNDInfo &a1, const ArrayNDInfo &a2)
Definition: arrayndinfo.h:53
Base class for Probability Density Functions.
Definition: probdenfunc.h:31
const char * sGaussianCCRangeErrMsg()
Definition: gaussianprobdenfunc.h:26
Two dimensional Gaussian PDF.
Definition: gaussianprobdenfunc.h:73
ObjectSet< Stats::NormalRandGen > rgens_
Definition: gaussianprobdenfunc.h:162
Matrix class based on Array2D. Initialized to 0.
Definition: array2dmatrix.h:32
float cc_
Definition: gaussianprobdenfunc.h:149
int idx1_
Definition: gaussianprobdenfunc.h:148
float std1_
Definition: gaussianprobdenfunc.h:90
Set of pointers to objects.
Definition: commontypes.h:32
int idx0_
Definition: gaussianprobdenfunc.h:148
#define mDefGaussianProbDenFuncFns(nm)
Definition: gaussianprobdenfunc.h:30
ObjectSet< TypeSet< int > > corrs4vars_
Definition: gaussianprobdenfunc.h:161
One dimensional Gaussian PDF.
Definition: gaussianprobdenfunc.h:46
float exp1_
Definition: gaussianprobdenfunc.h:89
Multi-dimensional pure Gaussian PDF.
Definition: gaussianprobdenfunc.h:106
Gaussian1DProbDenFunc(const Gaussian1DProbDenFunc &oth)
Definition: gaussianprobdenfunc.h:52
TypeSet< Corr > corrs_
Definition: gaussianprobdenfunc.h:154
Array2DMatrix< float > * cholesky_
Definition: gaussianprobdenfunc.h:163
Probability Density Function for two dimensional datasets.
Definition: probdenfunc.h:126
float std_
Definition: gaussianprobdenfunc.h:136
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size...
Definition: bufstring.h:40
GaussianNDProbDenFunc(const GaussianNDProbDenFunc &oth)
Definition: gaussianprobdenfunc.h:111
Definition: gaussianprobdenfunc.h:125
VarDef(const char *nm, float e=0, float s=1)
Definition: gaussianprobdenfunc.h:129
float exp_
Definition: gaussianprobdenfunc.h:135
Statistics.
Definition: array2dinterpol.h:28
Definition: gaussianprobdenfunc.h:139
Stats::NormalRandGen * rgen1_
Definition: gaussianprobdenfunc.h:96
float cc_
Definition: gaussianprobdenfunc.h:91
Corr(int i0=0, int i1=0, float cc=1)
Definition: gaussianprobdenfunc.h:142
Gaussian2DProbDenFunc()
Definition: gaussianprobdenfunc.h:77
float cMaxGaussianCC()
Definition: gaussianprobdenfunc.h:25
BufferString name_
Definition: gaussianprobdenfunc.h:134
Gaussian2DProbDenFunc(const Gaussian2DProbDenFunc &oth)
Definition: gaussianprobdenfunc.h:81
Stats::NormalRandGen * rgen0_
Definition: gaussianprobdenfunc.h:95

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B. V. 2019