1 #ifndef VIENNACL_LINALG_INNER_PROD_HPP_
2 #define VIENNACL_LINALG_INNER_PROD_HPP_
39 #ifdef VIENNACL_HAVE_EIGEN
43 #if defined(_MSC_VER) && _MSC_VER < 1500 //Visual Studio 2005 needs special treatment
46 Eigen::VectorXf
const & v2)
53 Eigen::VectorXd
const & v2)
59 template<
typename VectorT1,
typename VectorT2 >
60 typename VectorT1::RealScalar
61 inner_prod(VectorT1
const& v1, VectorT2
const& v2,
71 #ifdef VIENNACL_HAVE_MTL4
75 #if defined(_MSC_VER) && _MSC_VER < 1500 //Visual Studio 2005 needs special treatment
76 template <
typename ScalarType>
77 ScalarType
inner_prod(mtl::dense_vector<ScalarType>
const & v1,
78 mtl::dense_vector<ScalarType>
const & v2)
80 return mtl::dot(v1, v2);
83 template<
typename VectorT1,
typename VectorT2 >
84 typename VectorT1::value_type
85 inner_prod(VectorT1
const& v1, VectorT2
const& v2,
90 return mtl::dot(v1, v2);
95 #ifdef VIENNACL_HAVE_UBLAS
99 #if defined(_MSC_VER) && _MSC_VER < 1500 //Visual Studio 2005 needs special treatment
100 template<
typename ScalarType >
102 inner_prod(boost::numeric::ublas::vector<ScalarType>
const & v1,
103 boost::numeric::ublas::vector<ScalarType>
const & v2)
109 template<
typename VectorT1,
typename VectorT2 >
110 typename VectorT1::value_type
111 inner_prod(VectorT1
const& v1, VectorT2
const& v2,
124 template<
typename VectorT1,
typename VectorT2 >
125 typename VectorT1::value_type
130 assert(v1.size() == v2.size());
132 typename VectorT1::value_type result = 0;
133 for (
typename VectorT1::size_type i=0; i<v1.size(); ++i)
134 result += v1[i] * v2[i];
142 template<
typename ScalarType,
unsigned int alignment1,
unsigned int alignment2 >
145 viennacl::op_inner_prod >