Vector: added norm_squared() because sometimes you can safe the sqrt operation

This commit is contained in:
Matthias Grob
2017-12-04 15:34:13 +01:00
parent 41ad2bdea5
commit 5130da206a
+5
View File
@@ -71,6 +71,11 @@ public:
return Type(sqrt(a.dot(a)));
}
Type norm_squared() const {
const Vector &a(*this);
return Type(a.dot(a));
}
inline Type length() const {
return norm();
}