Turning off debug isn't as straightforward as
I'd hoped. There are two options.
Option 1: put flags in the makefile that make
it easy to turn off all range checking in
Stan and in Eigen.
Pros: gets rid of computation
Cons: will seg fault instead of report errors
won't help with models in Stan language
If that's all people want, no problem.
It's hard to control through the modeling language
because it would require recompiling the library
libstan.a with different compiler flags.
Option 2: we could more subtly try to control
the range checks in the modeling language and Eigen.
First, do no harm. Wherever possible, we want to avoid
the possibility of seg faults percolating through to
R and crashing it.
The current code is redundant for indexing.
Stan checks std::vector, Eigen vector, row vector
and matrix indexings generated from the modeling language.
Eigen also checks all Eigen vector, row vector and
matrix indexing and raises an indexing exception if
it finds one rather than seg faulting.
If Eigen's literally just doing assert() in the code,
I don't know that that's much better, and we probably
need to add a bunch of range checks on Eigen operations
to be safe.
Nothing in Stan checks that matrices are compatible
sizes before multiplying. I'm not sure if Eigen does
that in the same way it checks indexing.
The doc for EIGEN_NO_DEBUG says it turns
off all asserts at both compile and run time:
http://eigen.tuxfamily.org/dox/TopicPreprocessorDirectives.html
Controlling our own checks one way or the other is no
problem.
- Bob