aboutsummaryrefslogtreecommitdiffstats
path: root/math/vector_operation.hpp
blob: 481fdef60d2a26b5b484046f3f06f13e14c2e92c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#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)
{
  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;
}


#endif