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,14 +370,11 @@ void Histogram<ScalarType>::Add(ScalarType v, ScalarType increment)
|
||||||
int pos=BinIndex(v);
|
int pos=BinIndex(v);
|
||||||
if(v<minElem) minElem=v;
|
if(v<minElem) minElem=v;
|
||||||
if(v>maxElem) maxElem=v;
|
if(v>maxElem) maxElem=v;
|
||||||
if(pos>=0 && pos<=n)
|
assert((pos>=0)&&(pos<=n+1));
|
||||||
{
|
H[pos]+=increment;
|
||||||
|
cnt+=increment;
|
||||||
H[pos]+=increment;
|
avg+=v*increment;
|
||||||
cnt+=increment;
|
rms += (v*v)*increment;
|
||||||
avg+=v*increment;
|
|
||||||
rms += (v*v)*increment;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class ScalarType>
|
template <class ScalarType>
|
||||||
|
|
Loading…
Reference in New Issue