Unexpected behaviour on mac
When I try to use the nslr project on my mac (High Sierra, version 10.13.6, with clang: Apple LLVM version 9.1.0 and c++14), I get an infinite loop in the while loop starting at line 658 of segmented_regression.hpp. This happens whether I pip install it from this repo or if I clone and compile the c++ myself.
The problem seems to be with the behaviour of the unordered set. Specifically:
if(seen.find(nl.matrix()) != seen.end()) { ... }
is never true, and so the method never returns. Having a look at the members of the set each time through the loop suggests that the set is not growing as one would expect, which seems to be causing the conditional to always return false. However, if I make a copy of the previous state of nl
and compare that with the current state of nl
, like so:
if (old_nl.matrix() == nl.matrix()){
return fit;
}
then I get the behaviour I would expect.