aboutsummaryrefslogtreecommitdiffstats
path: root/math/vector_operation.hpp
blob: 3f5532c938c8ce4293a3306c14db8faef475a14d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#ifndef VECTOR_OPERATION_HPP
#define VECTOR_OPERATION_HPP
#include <core/opt_traits.hpp>
namespace opt_utilities
{

  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