 |
OpendTect
6.6
|
Go to the documentation of this file.
14 #include "generalmod.h"
28 , canbeneg_(canbeneg) {}
30 void add(
int val,T wt=1);
32 bool valid()
const {
return wts_; }
35 void clear() {
delete wts_; wts_ = 0; }
48 const int arridx = !canbeneg_ ? val
49 : (val < 0 ? -1 - 2 * val : 2 * val);
52 if ( !wts_ || wts_->size() <= arridx )
58 OD::memCopy( wts_->arr(), tmp->arr(), tmp->size() *
sizeof(T) );
61 T& curwt = (*wts_)[arridx];
72 if ( !valid() )
return 0;
74 int winner = -1; T maxwt = -1;
75 for (
int idx=0; idx<wts_->size(); idx++ )
77 if ( (*wts_)[idx] > maxwt )
78 { winner = idx; maxwt = (*wts_)[idx]; }
86 if ( winner % 2 ) res = -res;
int result() const
Definition: classify.h:70
Finds out which class is the best from a series of weighted data points.
Definition: classify.h:24
#define mExpClass(module)
Definition: commondefs.h:177
TypeSet< T > * wts_
Definition: classify.h:40
bool valid() const
Definition: classify.h:32
void add(int val, T wt=1)
Definition: classify.h:46
WeightedClassCounter(bool canbeneg=true)
Definition: classify.h:26
void clear()
Definition: classify.h:35
bool canbeneg_
Definition: classify.h:39
Sets of (small) copyable elements.
Definition: commontypes.h:29
Generated at
for the OpendTect
seismic interpretation project.
Copyright (C): dGB Beheer B.V. 1995-2021