1 #ifndef VIENNACL_LINALG_INNER_PROD_HPP_
2 #define VIENNACL_LINALG_INNER_PROD_HPP_
41 #ifdef VIENNACL_WITH_EIGEN
45 template<
typename VectorT1,
typename VectorT2>
47 typename VectorT1::RealScalar>::type
55 #ifdef VIENNACL_WITH_MTL4
59 template<
typename VectorT1,
typename VectorT2>
61 typename VectorT1::value_type>::type
62 inner_prod(VectorT1
const & v1, VectorT2
const & v2)
65 return mtl::dot(v1, v2);
69 #ifdef VIENNACL_WITH_UBLAS
73 template<
typename VectorT1,
typename VectorT2>
75 typename VectorT1::value_type>::type
76 inner_prod(VectorT1
const & v1, VectorT2
const & v2)
86 template<
typename VectorT1,
typename VectorT2>
88 typename VectorT1::value_type>::type
91 assert(v1.size() == v2.size() && bool(
"Vector sizes mismatch"));
93 typename VectorT1::value_type result = 0;
94 for (
typename VectorT1::size_type i=0; i<v1.size(); ++i)
95 result += v1[i] * v2[i];
103 template<
typename NumericT>
116 template<
typename LHS,
typename RHS,
typename OP,
typename NumericT>
130 template<
typename NumericT,
typename LHS,
typename RHS,
typename OP>
144 template<
typename LHS1,
typename RHS1,
typename OP1,
145 typename LHS2,
typename RHS2,
typename OP2>
160 template<
typename NumericT>
Simple enable-if variant that uses the SFINAE pattern.
Dispatch facility for distinguishing between ublas, STL and ViennaCL types.
This file provides the forward declarations for the main types used within ViennaCL.
viennacl::enable_if< viennacl::is_stl< typename viennacl::traits::tag_of< VectorT1 >::type >::value, typename VectorT1::value_type >::type inner_prod(VectorT1 const &v1, VectorT2 const &v2)
viennacl::vector_expression< const vector_base< NumericT >, const vector_tuple< NumericT >, viennacl::op_inner_prod > inner_prod(vector_base< NumericT > const &x, vector_tuple< NumericT > const &y_tuple)
A proxy for scalar expressions (e.g. from inner vector products)
An expression template class that represents a binary operation that yields a vector.
viennacl::vector< float > v1
Tuple class holding pointers to multiple vectors. Mainly used as a temporary object returned from vie...
viennacl::vector< int > v2
A tag class representing inner products of two vectors.
A collection of compile time type deductions.
Simple enable-if variant that uses the SFINAE pattern.