Blaze 3.9
axpy.h
Go to the documentation of this file.
1//=================================================================================================
33//=================================================================================================
34
35#ifndef _BLAZE_MATH_BLAS_CBLAS_AXPY_H_
36#define _BLAZE_MATH_BLAS_CBLAS_AXPY_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 SCALED VECTOR ADDITION (AXPY)
54//
55//=================================================================================================
56
57//*************************************************************************************************
60#if BLAZE_BLAS_MODE
61
62void axpy( blas_int_t n, float alpha, const float* x, blas_int_t incX,
63 float* y, blas_int_t incY );
64
65void axpy( blas_int_t n, double alpha, const double* x, blas_int_t incX,
66 double* y, blas_int_t incY );
67
68void axpy( blas_int_t n, complex<float> alpha, const complex<float>* x, blas_int_t incX,
69 complex<float>* y, blas_int_t incY );
70
71void axpy( blas_int_t n, complex<double> alpha, const complex<double>* x, blas_int_t incX,
72 complex<double>* y, blas_int_t incY );
73
74#endif
76//*************************************************************************************************
77
78
79//*************************************************************************************************
80#if BLAZE_BLAS_MODE
100inline void axpy( blas_int_t n, float alpha, const float* x, blas_int_t incX,
101 float* y, blas_int_t incY )
102{
103 cblas_saxpy( n, alpha, x, incX, y, incY );
104}
105#endif
106//*************************************************************************************************
107
108
109//*************************************************************************************************
110#if BLAZE_BLAS_MODE
130inline void axpy( blas_int_t n, double alpha, const double* x, blas_int_t incX,
131 double* y, blas_int_t incY )
132{
133 cblas_daxpy( n, alpha, x, incX, y, incY );
134}
135#endif
136//*************************************************************************************************
137
138
139//*************************************************************************************************
140#if BLAZE_BLAS_MODE
160inline void axpy( blas_int_t n, complex<float> alpha, const complex<float>* x, blas_int_t incX,
161 complex<float>* y, blas_int_t incY )
162{
163 BLAZE_STATIC_ASSERT( sizeof( complex<float> ) == 2UL*sizeof( float ) );
164
165 cblas_caxpy( n, reinterpret_cast<const float*>( &alpha ),
166 reinterpret_cast<const float*>( x ), incX, reinterpret_cast<float*>( y ), incY );
167}
168#endif
169//*************************************************************************************************
170
171
172//*************************************************************************************************
173#if BLAZE_BLAS_MODE
193inline void axpy( blas_int_t n, complex<double> alpha, const complex<double>* x, blas_int_t incX,
194 complex<double>* y, blas_int_t incY )
195{
196 BLAZE_STATIC_ASSERT( sizeof( complex<double> ) == 2UL*sizeof( double ) );
197
198 cblas_zaxpy( n, reinterpret_cast<const double*>( &alpha ),
199 reinterpret_cast<const double*>( x ), incX, reinterpret_cast<double*>( y ), incY );
200}
201#endif
202//*************************************************************************************************
203
204} // namespace blaze
205
206#endif
Header file for the complex data type.
Compile time assertion.
Complex data type of the Blaze library.
void axpy(DenseVector< VT1, TF1 > &x, const DenseVector< VT2, TF2 > &y, ST alpha)
BLAS kernel for a dense vector axpy product ( ).
Definition: axpy.h:90
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.