OpendTect-6_4  6.4
extremefinder.h
Go to the documentation of this file.
1 #ifndef extremefinder_h
2 #define extremefinder_h
3 
4 /*+
5 ________________________________________________________________________
6 
7  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
8  Author: Kristofer Tingdahl
9  Date: 4-11-2002
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 
14 -*/
15 
16 #include "algomod.h"
17 #include "task.h"
18 #include "ranges.h"
19 #include "mathfunc.h"
20 
21 
29 {
30 public:
32  bool max, int itermax, float tol,
33  const Interval<float>& startinterval,
34  const Interval<float>* limitinterval);
50  virtual ~ExtremeFinder1D();
51 
52  void reStart( const Interval<float>& startinterval,
53  const Interval<float>* limitinterval);
63  float extremePos() const;
65  float extremeVal() const;
68  int nrIter() const;
71  int nextStep();
80 protected:
81 
82  float ax_,bx_,cx_;
83  float e_, d_;
84  float a_, b_;
85  float u_, w_, v_, x_;
86  float fw_, fv_, fx_;
87 
89  int iter_;
90  const float tol_;
92  const bool max_;
93  const int itermax_;
94 };
95 
96 
102 {
103 public:
105  const FloatMathFunction&,
106  bool max, int itermax, float tol,
107  const Interval<float>& startinterval,
108  const Interval<float>* limitinterval);
124  virtual ~BisectionExtremeFinder1D();
125 
126  void reStart( const Interval<float>& startinterval,
127  const Interval<float>* limitinterval);
137  float extremePos() const;
139  float extremeVal() const;
142  int nrIter() const;
145  int nextStep();
154 protected:
156  int iter;
157  const float tol;
158  const bool max;
159  const int itermax;
160 
163  float stopfuncval;
165 
166  bool isok;
168 };
169 
170 
178 {
179 
180 public:
181 
183  bool max, int itermax );
189  virtual ~ExtremeFinderND();
190 
191  template<class IDXABL>
192  void setStartPos( const IDXABL& sp )
193  {
194  for ( int idx=0; idx<n_; idx++ )
195  p_[idx] = sp[idx];
196  }
197 
198  int nextStep();
199  /*<!\retval 0 Finished
200  \retval 1 More to do
201  \retval -1 Error (no extreme found or
202  itermax reached The extreme value)
203  */
204 
205  int nrIter() const;
208  float extremeVal() const { return fret_; }
210  const float* extremePos() const { return p_; }
213  template<class IDXABL>
214  void extremePos( IDXABL& sp ) const
215  {
216  for ( int idx=0; idx<n_; idx++ )
217  sp[idx] = p_[idx];
218  }
221 private:
222 
223  float linExtreme(float*);
224 
225  float* p_;
227  float ftol_;
228  int n_;
229  int iter_;
230  float fret_;
231 
232  float* pt_;
233 
234  const bool max_;
235  const int itermax_;
237 };
238 
239 
240 #endif
#define mExpClass(module)
Definition: commondefs.h:160
Interval< float > * limits_
Definition: extremefinder.h:155
int iter_
Definition: extremefinder.h:89
float b_
Definition: extremefinder.h:84
const float * extremePos() const
Definition: extremefinder.h:210
const bool max_
Definition: extremefinder.h:234
const bool max_
Definition: extremefinder.h:92
const FloatMathFunction & func_
Definition: extremefinder.h:91
float fx_
Definition: extremefinder.h:86
Mathematical function.
Definition: mathfunc.h:61
float stopfuncval
Definition: extremefinder.h:163
float x_
Definition: extremefinder.h:85
Finds the nearest local extreme position in ND&#39;s. Implementation of Powell&#39;s Quadratically Convergent...
Definition: extremefinder.h:177
int n_
Definition: extremefinder.h:228
Interval< float > * limits_
Definition: extremefinder.h:88
bool isok
Definition: extremefinder.h:166
float centerfuncval
Definition: extremefinder.h:164
The generalization of something (e.g. a computation) where the steps must be done in sequence...
Definition: task.h:124
const bool max
Definition: extremefinder.h:158
Interval< float > current
Definition: extremefinder.h:161
const FloatMathFunctionND & func_
Definition: extremefinder.h:236
const FloatMathFunction & func
Definition: extremefinder.h:167
Bisection Extreme Finder.
Definition: extremefinder.h:101
float ftol_
Definition: extremefinder.h:227
float cx_
Definition: extremefinder.h:82
int iter_
Definition: extremefinder.h:229
float * p_
Definition: extremefinder.h:225
float * pt_
Definition: extremefinder.h:232
const float tol_
Definition: extremefinder.h:90
const int itermax_
Definition: extremefinder.h:235
float fret_
Definition: extremefinder.h:230
const int itermax_
Definition: extremefinder.h:93
float e_
Definition: extremefinder.h:83
void setStartPos(const IDXABL &sp)
Definition: extremefinder.h:192
Finds extreme values in FloatMathFunctions.
Definition: extremefinder.h:28
float startfuncval
Definition: extremefinder.h:162
void extremePos(IDXABL &sp) const
Sets the sp variable to the extreme position.
Definition: extremefinder.h:214
float extremeVal() const
Definition: extremefinder.h:208
int iter
Definition: extremefinder.h:156
const float tol
Definition: extremefinder.h:157
const int itermax
Definition: extremefinder.h:159
ObjectSet< float > xi_
Definition: extremefinder.h:226

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