Created
July 5, 2017 04:58
-
-
Save sbugrov/e121fccb3f6f4adf9625c487f58ea035 to your computer and use it in GitHub Desktop.
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
vector <float> operator+(const vector <float>& m1, const vector <float>& m2){ | |
/* Returns the elementwise sum of two vectors. | |
Inputs: | |
m1: a vector | |
m2: a vector | |
Output: a vector, sum of the vectors m1 and m2. | |
*/ | |
const unsigned long VECTOR_SIZE = m1.size(); | |
vector <float> sum (VECTOR_SIZE); | |
for (unsigned i = 0; i != VECTOR_SIZE; ++i){ | |
sum[i] = m1[i] + m2[i]; | |
}; | |
return sum; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment