Read the white paper in the link I posted,
this explains the structure of the approach,
and is more helpful then the raw C++ code.