From fd1b5772af95933673248c6450c3115f994ff70b Mon Sep 17 00:00:00 2001 From: Eric Bechet <eric.bechet@ulg.ac.be> Date: Wed, 16 Dec 2009 17:36:09 +0000 Subject: [PATCH] dot product --- Geo/STensor3.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Geo/STensor3.h b/Geo/STensor3.h index d5bfbc4a1a..63413901ce 100644 --- a/Geo/STensor3.h +++ b/Geo/STensor3.h @@ -266,5 +266,14 @@ inline void tensprod(const SVector3 &a, const SVector3 &b, STensor3 &c) c(i,j)=a(i)*b(j); } +inline double dot(const STensor3 &a, const STensor3 &b) +{ + double prod=0; + for (int i = 0; i < 3; i++) + for (int j = 0; j < 3; j++) + prod+=a(i,j)*b(i,j); + return prod; +} + #endif -- GitLab