diff --git a/ChangeLog.md b/ChangeLog.md index 2b56e80aec..d6f5033d51 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -50,6 +50,10 @@ - *DEC* - Adding missing headers in some files of DEC. (Roland Denis, [#1349](https://github.com/DGtal-team/DGtal/pull/1349)) + +- *Math* + - Fix possible division by zero in the MultiStatistics class. + (Kacper Pluta, [#1358](https://github.com/DGtal-team/DGtal/pull/1358)) - *Image* - Fix bug in ImageLinearCellEmbedder. diff --git a/src/DGtal/math/MultiStatistics.ih b/src/DGtal/math/MultiStatistics.ih index fb8843f342..59ee104029 100644 --- a/src/DGtal/math/MultiStatistics.ih +++ b/src/DGtal/math/MultiStatistics.ih @@ -250,8 +250,11 @@ DGtal::MultiStatistics::terminate() myExp[ k ] /= mySamples[ k ]; myExp2[ k ] /= mySamples[ k ]; myVar[ k ] = myExp2[ k ] - myExp[ k ] * myExp[ k ]; - myUnbiasedVar[ k ] = mySamples[ k ] * myVar[ k ] - / ( mySamples[ k ] - 1 ); + if ( mySamples[ k ] > 1 ) + myUnbiasedVar[ k ] = mySamples[ k ] * myVar[ k ] / ( mySamples[ k ] - 1 ); + else + myUnbiasedVar[ k ] = 0; + } myIsTerminate = true; } diff --git a/src/DGtal/topology/doc/moduleCubicalComplex.dox b/src/DGtal/topology/doc/moduleCubicalComplex.dox index fa658c9b72..773af73ceb 100644 --- a/src/DGtal/topology/doc/moduleCubicalComplex.dox +++ b/src/DGtal/topology/doc/moduleCubicalComplex.dox @@ -25,7 +25,7 @@ href="https://gforge.liris.cnrs.fr/projects/imagene">ImaGene. The following programs are related to this documentation: -cubical-complex-collapse.cpp, cubical-complex-illustrations.cpp, +cubical-complex-collapse.cpp, cubical-complex-illustrations.cpp, testCubicalComplex.cpp, cubicalComplexThinning.cpp. @section dgtal_ccomplex_sec1 Introduction to cubical complexes