Just for consistency, leave spaces around `<` and the `==` a few lines above. Also, it's perhaps more idiomatic (and performant) to pass this function a `const std::vector<double>&` instead. Can you give MATLAB a pointer straight to the data in the vector or is there a chance it will try and resize it or something?