c++ implementation of arXiv:1305.1878

Adding c++ implementation.