dotc.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_BLAS_DOTC_H_
36 #define _BLAZE_MATH_BLAS_DOTC_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 (DOTC)
60 //
61 //=================================================================================================
62 
63 //*************************************************************************************************
66 #if BLAZE_BLAS_MODE
67 
68 BLAZE_ALWAYS_INLINE float dotc( int n, const float* x, int incX, const float* y, int incY );
69 
70 BLAZE_ALWAYS_INLINE double dotc( int n, const double* x, int incX, const double* y, int incY );
71 
72 BLAZE_ALWAYS_INLINE complex<float> dotc( int n, const complex<float>* x, int incX,
73  const complex<float>* y, int incY );
74 
75 BLAZE_ALWAYS_INLINE complex<double> dotc( 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> dotc( 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 dotc( 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 dotc( 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 
151 BLAZE_ALWAYS_INLINE complex<float> dotc( int n, const complex<float>* x, int incX,
152  const complex<float>* y, int incY )
153 {
154  complex<float> tmp;
155  cblas_cdotc_sub( n, x, incX, y, incY, &tmp );
156  return tmp;
157 }
158 #endif
159 //*************************************************************************************************
160 
161 
162 //*************************************************************************************************
163 #if BLAZE_BLAS_MODE
164 
179 BLAZE_ALWAYS_INLINE complex<double> dotc( int n, const complex<double>* x, int incX,
180  const complex<double>* y, int incY )
181 {
182  complex<double> tmp;
183  cblas_zdotc_sub( n, x, incX, y, incY, &tmp );
184  return tmp;
185 }
186 #endif
187 //*************************************************************************************************
188 
189 
190 //*************************************************************************************************
191 #if BLAZE_BLAS_MODE
192 
204 template< typename VT1, bool TF1, typename VT2, bool TF2 >
205 ElementType_<VT1> dotc( const DenseVector<VT1,TF1>& x, const DenseVector<VT2,TF2>& y )
206 {
207  using boost::numeric_cast;
208 
211 
214 
217 
218  const int n( numeric_cast<int>( (~x).size() ) );
219 
220  return dotc( n, (~x).data(), 1, (~y).data(), 1 );
221 }
222 #endif
223 //*************************************************************************************************
224 
225 } // namespace blaze
226 
227 #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.