corrected one bug in Add to insert the value in last bin since upper bound is +inf

This commit is contained in:
Nico Pietroni 2014-04-24 16:07:13 +00:00
parent cf1a476116
commit 2f871fc16e
1 changed files with 5 additions and 8 deletions

View File

@ -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)