twitter / BreakoutDetection

Breakout Detection via Robust E-Statistics
GNU General Public License v2.0
755 stars 181 forks source link

Segfault with constant input and `exact=F` #17

Open vspinu opened 9 years ago

vspinu commented 9 years ago

Tested on two linux machines (rehel and ubuntu) with R3.1.1.

> library(BreakoutDetection)
> breakout(rep.int(20, 1000),  exact = F)

 *** caught segfault ***
address 0xfffffffc039ffa30, cause 'memory not mapped'

Traceback:
 1: .Call("BreakoutDetection_EDM_tail", PACKAGE = "BreakoutDetection",     Z, min_size, alpha, quant)
 2: Analysis(Zcounts, min.size, alpha)
 3: breakout(rep.int(20, 1000), exact = F)

Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace
putnam120 commented 9 years ago

I think what is happening is that the method is trying to transform the data so that it maps to the interval [0,1]. However, since all of the values are the same there will be a division by 0. So R returns NaN, but I don't thin that the C++ code knows how to handle this.