dotu.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_BLAS_DOTU_H_
36 #define _BLAZE_MATH_BLAS_DOTU_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <boost/cast.hpp>
44 #include <blaze/math/Aliases.h>
49 #include <blaze/system/BLAS.h>
50 #include <blaze/system/Inline.h>
51 #include <blaze/util/Assert.h>
52 #include <blaze/util/Complex.h>
53 
54 
55 namespace blaze {
56 
57 //=================================================================================================
58 //
59 // BLAS WRAPPER FUNCTIONS (DOTU)
60 //
61 //=================================================================================================
62 
63 //*************************************************************************************************
66 #if BLAZE_BLAS_MODE
67 
68 BLAZE_ALWAYS_INLINE float dotu( int n, const float* x, int incX, const float* y, int incY );
69 
70 BLAZE_ALWAYS_INLINE double dotu( int n, const double* x, int incX, const double* y, int incY );
71 
72 BLAZE_ALWAYS_INLINE complex<float> dotu( int n, const complex<float>* x, int incX,
73  const complex<float>* y, int incY );
74 
75 BLAZE_ALWAYS_INLINE complex<double> dotu( int n, const complex<double>* x, int incX,
76  const complex<double>* y, int incY );
77 
78 template< typename VT1, bool TF1, typename VT2, bool TF2 >
79 BLAZE_ALWAYS_INLINE ElementType_<VT1> dotu( const DenseVector<VT1,TF1>& x, const DenseVector<VT2,TF2>& y );
80 
81 #endif
82 
83 //*************************************************************************************************
84 
85 
86 //*************************************************************************************************
87 #if BLAZE_BLAS_MODE
88 
102 BLAZE_ALWAYS_INLINE float dotu( int n, const float* x, int incX, const float* y, int incY )
103 {
104  return cblas_sdot( n, x, incX, y, incY );
105 }
106 #endif
107 //*************************************************************************************************
108 
109 
110 //*************************************************************************************************
111 #if BLAZE_BLAS_MODE
112 
126 BLAZE_ALWAYS_INLINE double dotu( int n, const double* x, int incX, const double* y, int incY )
127 {
128  return cblas_ddot( n, x, incX, y, incY );
129 }
130 #endif
131 //*************************************************************************************************
132 
133 
134 //*************************************************************************************************
135 #if BLAZE_BLAS_MODE
136 
150 BLAZE_ALWAYS_INLINE complex<float> dotu( int n, const complex<float>* x, int incX,
151  const complex<float>* y, int incY )
152 {
153  complex<float> tmp;
154  cblas_cdotu_sub( n, x, incX, y, incY, &tmp );
155  return tmp;
156 }
157 #endif
158 //*************************************************************************************************
159 
160 
161 //*************************************************************************************************
162 #if BLAZE_BLAS_MODE
163 
177 BLAZE_ALWAYS_INLINE complex<double> dotu( int n, const complex<double>* x, int incX,
178  const complex<double>* y, int incY )
179 {
180  complex<double> tmp;
181  cblas_zdotu_sub( n, x, incX, y, incY, &tmp );
182  return tmp;
183 }
184 #endif
185 //*************************************************************************************************
186 
187 
188 //*************************************************************************************************
189 #if BLAZE_BLAS_MODE
190 
202 template< typename VT1, bool TF1, typename VT2, bool TF2 >
203 ElementType_<VT1> dotu( const DenseVector<VT1,TF1>& x, const DenseVector<VT2,TF2>& y )
204 {
205  using boost::numeric_cast;
206 
209 
212 
215 
216  const int n( numeric_cast<int>( (~x).size() ) );
217 
218  return dotu( n, (~x).data(), 1, (~y).data(), 1 );
219 }
220 #endif
221 //*************************************************************************************************
222 
223 } // namespace blaze
224 
225 #endif
Constraint on the data type.
Header file for auxiliary alias declarations.
#define BLAZE_CONSTRAINT_MUST_HAVE_CONST_DATA_ACCESS(T)
Constraint on the data type.In case the given data type T does not provide low-level data access to c...
Definition: ConstDataAccess.h:61
BLAZE_ALWAYS_INLINE size_t size(const Vector< VT, TF > &vector) noexcept
Returns the current size/dimension of the vector.
Definition: Vector.h:258
#define BLAZE_CONSTRAINT_MUST_NOT_BE_COMPUTATION_TYPE(T)
Constraint on the data type.In case the given data type T is a computational expression (i...
Definition: Computation.h:81
Header file for the DenseVector base class.
Constraint on the data type.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
System settings for the BLAS mode.
Header file for run time assertion macros.
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_BE_BLAS_COMPATIBLE_TYPE(T)
Constraint on the data type.In case the given data type T is not a BLAS compatible data type (i...
Definition: BLASCompatible.h:61
Header file for the complex data type.
System settings for the inline keywords.