C++ implementation of LDA