From 28fcd862c8831dd4e29f744d162f9181a6e14ac8 Mon Sep 17 00:00:00 2001 From: astrojhgu Date: Thu, 14 Oct 2010 17:32:33 +0000 Subject: git-svn-id: file:///home/svn/opt_utilities@137 ed2142bd-67ad-457f-ba7c-d818d4011675 --- math/vector_operation.hpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'math') diff --git a/math/vector_operation.hpp b/math/vector_operation.hpp index 3f5532c..a856847 100644 --- a/math/vector_operation.hpp +++ b/math/vector_operation.hpp @@ -15,6 +15,25 @@ namespace opt_utilities } return result; } + + template + T contract(const T& x1,const T& x2,...) + { + return x1*x2; + } + + template + typename element_type_trait::element_type + contract(const pT& v1,const pT& v2,const typename element_type_trait::element_type&) + { + typename element_type_trait::element_type result(0); + for(int i=0;i