C++ porting of Stan Salvador's FastDTW