Created
May 9, 2018 04:19
-
-
Save sgarciav/91e149bfd736dd34264a7b91952c749f to your computer and use it in GitHub Desktop.
Common items for C++ that I always forget how to do.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// count character occurances in string | |
std::string s = "the answer; should ;be ;; four"; | |
size_t n = std::count(s.begin(), s.end(), ';'); | |
// Mahalanobis distance | |
double dist = sqrt((x - u).transposeInPlace() * cov_matrix.inverse() * (x - u)); // untested |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment