corrected one bug in Add to insert the value in last bin since upper bound is +inf
This commit is contained in:
parent
cf1a476116
commit
2f871fc16e
|
@ -370,15 +370,12 @@ void Histogram<ScalarType>::Add(ScalarType v, ScalarType increment)
|
|||
int pos=BinIndex(v);
|
||||
if(v<minElem) minElem=v;
|
||||
if(v>maxElem) maxElem=v;
|
||||
if(pos>=0 && pos<=n)
|
||||
{
|
||||
|
||||
assert((pos>=0)&&(pos<=n+1));
|
||||
H[pos]+=increment;
|
||||
cnt+=increment;
|
||||
avg+=v*increment;
|
||||
rms += (v*v)*increment;
|
||||
}
|
||||
}
|
||||
|
||||
template <class ScalarType>
|
||||
ScalarType Histogram<ScalarType>::BinCount(ScalarType v)
|
||||
|
|
Loading…
Reference in New Issue