From 5130da206a1d02eb2466e8ce23f3c1f1cc0b8414 Mon Sep 17 00:00:00 2001 From: Matthias Grob Date: Mon, 13 Nov 2017 16:23:33 +0100 Subject: [PATCH] Vector: added norm_squared() because sometimes you can safe the sqrt operation --- matrix/Vector.hpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/matrix/Vector.hpp b/matrix/Vector.hpp index 3d19e1dac0..fc937c2a42 100644 --- a/matrix/Vector.hpp +++ b/matrix/Vector.hpp @@ -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(); }