Add functors for distributions, and templated newton-raphson function in C++.
fix bug in assigning ftime and event vectors