aboutsummaryrefslogtreecommitdiffstats
path: root/math/vector_operation.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'math/vector_operation.hpp')
-rw-r--r--math/vector_operation.hpp26
1 files changed, 14 insertions, 12 deletions
diff --git a/math/vector_operation.hpp b/math/vector_operation.hpp
index 481fdef..3f5532c 100644
--- a/math/vector_operation.hpp
+++ b/math/vector_operation.hpp
@@ -1,18 +1,20 @@
#ifndef VECTOR_OPERATION_HPP
#define VECTOR_OPERATION_HPP
#include <core/opt_traits.hpp>
-
-template <typename pT>
-typename element_type_trait<pT>::element_type
-inner_product(const pT& v1,const pT& v2)
+namespace opt_utilities
{
- typename element_type_trait<pT>::element_type result;
- for(int i=0;i<get_size(v1);++i)
- {
- result+=get_element(v1,i)*get_element(v2,i);
- }
- return result;
-}
-
+ template <typename pT>
+ typename element_type_trait<pT>::element_type
+ inner_product(const pT& v1,const pT& v2)
+ {
+ typename element_type_trait<pT>::element_type result(0);
+ for(int i=0;i<get_size(v1);++i)
+ {
+ result+=get_element(v1,i)*get_element(v2,i);
+ }
+ return result;
+ }
+
+}
#endif