The other reason it might not compile of course is that a sum of two vectors would be a vector, correct? Not a scalar, which is what your code is trying to do. sum1 also needs to be a Vector.