Blaze 3.9
dotc.h
Go to the documentation of this file.
1//=================================================================================================
33//=================================================================================================
34
35#ifndef _BLAZE_MATH_BLAS_CBLAS_DOTC_H_
36#define _BLAZE_MATH_BLAS_CBLAS_DOTC_H_
37
38
39//*************************************************************************************************
40// Includes
41//*************************************************************************************************
42
44#include <blaze/system/BLAS.h>
45#include <blaze/util/Complex.h>
47
48
49namespace blaze {
50
51//=================================================================================================
52//
53// BLAS DOT PRODUCT (DOTC)
54//
55//=================================================================================================
56
57//*************************************************************************************************
60#if BLAZE_BLAS_MODE
61
62float dotc( blas_int_t n, const float* x, blas_int_t incX, const float* y, blas_int_t incY );
63
64double dotc( blas_int_t n, const double* x, blas_int_t incX, const double* y, blas_int_t incY );
65
67 const complex<float>* y, blas_int_t incY );
68
70 const complex<double>* y, blas_int_t incY );
71
72#endif
74//*************************************************************************************************
75
76
77//*************************************************************************************************
78#if BLAZE_BLAS_MODE
97inline float dotc( blas_int_t n, const float* x, blas_int_t incX, const float* y, blas_int_t incY )
98{
99 return cblas_sdot( n, x, incX, y, incY );
100}
101#endif
102//*************************************************************************************************
103
104
105//*************************************************************************************************
106#if BLAZE_BLAS_MODE
125inline double dotc( blas_int_t n, const double* x, blas_int_t incX, const double* y, blas_int_t incY )
126{
127 return cblas_ddot( n, x, incX, y, incY );
128}
129#endif
130//*************************************************************************************************
131
132
133//*************************************************************************************************
134#if BLAZE_BLAS_MODE
153inline complex<float> dotc( blas_int_t n, const complex<float>* x, blas_int_t incX,
154 const complex<float>* y, blas_int_t incY )
155{
156 BLAZE_STATIC_ASSERT( sizeof( complex<float> ) == 2UL*sizeof( float ) );
157
158 complex<float> tmp;
159
160#ifdef OPENBLAS_VERSION
161 cblas_cdotc_sub( n, reinterpret_cast<const float*>( x ), incX,
162 reinterpret_cast<const float*>( y ), incY,
163 reinterpret_cast<openblas_complex_float*>( &tmp ) );
164#else
165 cblas_cdotc_sub( n, reinterpret_cast<const float*>( x ), incX,
166 reinterpret_cast<const float*>( y ), incY, &tmp );
167#endif
168
169 return tmp;
170}
171#endif
172//*************************************************************************************************
173
174
175//*************************************************************************************************
176#if BLAZE_BLAS_MODE
196 const complex<double>* y, blas_int_t incY )
197{
198 BLAZE_STATIC_ASSERT( sizeof( complex<double> ) == 2UL*sizeof( double ) );
199
200 complex<double> tmp;
201
202#ifdef OPENBLAS_VERSION
203 cblas_zdotc_sub( n, reinterpret_cast<const double*>( x ), incX,
204 reinterpret_cast<const double*>( y ), incY,
205 reinterpret_cast<openblas_complex_double*>( &tmp ) );
206#else
207 cblas_zdotc_sub( n, reinterpret_cast<const double*>( x ), incX,
208 reinterpret_cast<const double*>( y ), incY, &tmp );
209#endif
210
211 return tmp;
212}
213#endif
214//*************************************************************************************************
215
216} // namespace blaze
217
218#endif
Header file for the complex data type.
Compile time assertion.
Complex data type of the Blaze library.
ElementType_t< VT1 > dotc(const DenseVector< VT1, TF1 > &x, const DenseVector< VT2, TF2 > &y)
BLAS kernel for a dense vector complex conjugate dot product ( ).
Definition: dotc.h:93
int32_t blas_int_t
Signed integer type used in the BLAS/LAPACK wrapper functions.
Definition: Types.h:64
#define BLAZE_STATIC_ASSERT(expr)
Compile time assertion macro.
Definition: StaticAssert.h:112
Header file for basic BLAS type definitions.
System settings for the BLAS mode.