[mq] Fix bug in TWM and use more harmonics in predictions.
[mq] Add C++ implementation of TWM