tiny additions in vec.h and vecmat3.h

This commit is contained in:
2024-01-18 14:31:00 +01:00
parent e75248eb23
commit 764baa3201
2 changed files with 12 additions and 0 deletions

8
vec.h
View File

@@ -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<nn; i++){ sum += v[i]*v[i];}
return sum;
};
//! compute the product of the vector elements
inline const T prod() const {
T prod(v[0]);