Bug in TRobustEstimator / ROOTR -> ROOT

Hi,

There is a bug in TRobustEstimator (ROOT 5.34/18, Linux x86_64) causing a crash for certain data sets. I’m attaching a sample data set and a short macro that reproduce the problem.

I tried to pin down the problem. It seems to me that there is some error in the RDraw() method, which partitions the complete data set into multiple sets. The following line should be checked (by the author):

1238 nrand = Int_t(gRandom->Uniform(0, 1) * (fN-jndex))+1;

It’s not clear to me if the range of the indices should be 0…fN-1 or 1…fN. Anyway, it happens that the index in subdat[temp+i] in the following line is equal to the size of fData, which causes a crash (should be <= size-1):

397 dattemp(i,j)=fData[subdat[temp+i]][j];

I’m circumventing the problem now by using the R interface ROOTR, which gives access to all kind of estimators. I suggest to include ROOTR into the production version of ROOT as soon as possible since this increases the power and impact of the ROOT data analysis framework massively!

Cheers,
Dominik

P.S. Sorry for reporting the bug here, I was not able to login into your bug reporting system within reasonable time.
Test.C (358 Bytes)
data.dat (49 KB)