32 #ifndef SHARK_LINALG_BLAS_KERNELS_CBLAS_DOT_HPP 33 #define SHARK_LINALG_BLAS_KERNELS_CBLAS_DOT_HPP 37 namespace shark {
namespace blas {
namespace bindings {
39 inline void dot(
int N,
40 float const* x,
int strideX,
41 float const* y,
int strideY,
44 result = cblas_sdot(N, x, strideX, y, strideY);
47 inline void dot(
int N,
48 double const* x,
int strideX,
49 double const* y,
int strideY,
52 result = cblas_ddot(N, x, strideX, y, strideY);
55 inline void dot(
int N,
56 std::complex<float>
const* x,
int strideX,
57 std::complex<float>
const* y,
int strideY,
58 std::complex<float>& result
61 reinterpret_cast<cblas_float_complex_type const* >(x), strideX,
62 reinterpret_cast<cblas_float_complex_type const* >(y), strideY,
63 reinterpret_cast<cblas_float_complex_type*>(&result)
67 inline void dot(
int N,
68 std::complex<double>
const* x,
int strideX,
69 std::complex<double>
const* y,
int strideY,
70 std::complex<double>& result
73 reinterpret_cast<cblas_double_complex_type const* >(x), strideX,
74 reinterpret_cast<cblas_double_complex_type const* >(y), strideY,
75 reinterpret_cast<cblas_double_complex_type*>(&result)
82 template <
typename VectorX,
typename VectorY>
84 vector_expression<VectorX>
const& x,
85 vector_expression<VectorY>
const& y,
86 typename VectorX::value_type& result,
93 traits::storage(x), traits::stride(x),
94 traits::storage(y), traits::stride(y),
99 template<
class Storage1,
class Storage2,
class T1,
class T2,
class T3>
100 struct optimized_dot_detail{
101 typedef boost::mpl::false_ type;
104 struct optimized_dot_detail<
105 dense_tag, dense_tag,
106 double, double, double
108 typedef boost::mpl::true_ type;
111 struct optimized_dot_detail<
112 dense_tag, dense_tag,
115 typedef boost::mpl::true_ type;
119 struct optimized_dot_detail<
120 dense_tag, dense_tag,
121 std::complex<double>, std::complex<double>, std::complex<double>
123 typedef boost::mpl::true_ type;
126 struct optimized_dot_detail<
127 dense_tag, dense_tag,
128 std::complex<float>, std::complex<float>, std::complex<float>
130 typedef boost::mpl::true_ type;
133 template<
class V1,
class V2,
class result_type>
134 struct has_optimized_dot
135 :
public optimized_dot_detail<
136 typename V1::storage_category,
137 typename V2::storage_category,
138 typename V1::value_type,
139 typename V2::value_type,