Cython version of R-W