diff --git a/vec.h b/vec.h index d9d1562..74fd24b 100644 --- a/vec.h +++ b/vec.h @@ -363,6 +363,14 @@ public: return sum; }; + //! compute the sum of squares the vector elements + inline const T sumsqr() const { + T sum(v[0]); + for(register int i=1; i