--- trunk/src/math/Vector.hpp 2006/05/17 21:51:42 963 +++ trunk/src/math/Vector.hpp 2009/05/20 19:35:05 1349 @@ -313,6 +313,18 @@ namespace oopse { return *this; } + /** + * Returns the sum of all elements of this vector. + * @return the sum of all elements of this vector + */ + inline Real sum() { + Real tmp; + tmp = 0; + for (unsigned int i = 0; i < Dim; i++) + tmp += this->data_[i]; + return tmp; + } + /** * Returns the length of this vector. * @return the length of this vector