Skip to content

Instantly share code, notes, and snippets.

@sbugrov
Last active July 5, 2017 04:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sbugrov/2e97912647c825a9771aced30333d053 to your computer and use it in GitHub Desktop.
Save sbugrov/2e97912647c825a9771aced30333d053 to your computer and use it in GitHub Desktop.
vector <float> operator-(const vector <float>& m1, const vector <float>& m2){
/* Returns the difference between two vectors.
Inputs:
m1: vector
m2: vector
Output: vector, m1 - m2, difference between two vectors m1 and m2.
*/
const unsigned long VECTOR_SIZE = m1.size();
vector <float> difference (VECTOR_SIZE);
for (unsigned i = 0; i != VECTOR_SIZE; ++i){
difference[i] = m1[i] - m2[i];
};
return difference;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment