axpy.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_BLAS_AXPY_H_
36 #define _BLAZE_MATH_BLAS_AXPY_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <boost/cast.hpp>
44 #include <blaze/math/Aliases.h>
50 #include <blaze/system/BLAS.h>
51 #include <blaze/system/Inline.h>
52 #include <blaze/util/Complex.h>
53 
54 
55 namespace blaze {
56 
57 //=================================================================================================
58 //
59 // BLAS WRAPPER FUNCTIONS (AXPY)
60 //
61 //=================================================================================================
62 
63 //*************************************************************************************************
66 #if BLAZE_BLAS_MODE
67 
68 BLAZE_ALWAYS_INLINE void axpy( int n, float alpha, const float* x, int incX, float* y, int incY );
69 
70 BLAZE_ALWAYS_INLINE void axpy( int n, double alpha, const double* x, int incX, double* y, int incY );
71 
72 BLAZE_ALWAYS_INLINE void axpy( int n, complex<float> alpha, const complex<float>* x,
73  int incX, complex<float>* y, int incY );
74 
75 BLAZE_ALWAYS_INLINE void axpy( int n, complex<double> alpha, const complex<double>* x,
76  int incX, complex<double>* y, int incY );
77 
78 template< typename VT1, bool TF1, typename VT2, bool TF2, typename ST >
79 BLAZE_ALWAYS_INLINE void axpy( const DenseVector<VT1,TF1>& x, const DenseVector<VT2,TF2>& y, ST alpha );
80 
81 #endif
82 
83 //*************************************************************************************************
84 
85 
86 //*************************************************************************************************
87 #if BLAZE_BLAS_MODE
88 
103 BLAZE_ALWAYS_INLINE void axpy( int n, float alpha, const float* x,
104  int incX, float* y, int incY )
105 {
106  cblas_saxpy( n, alpha, x, incX, y, incY );
107 }
108 #endif
109 //*************************************************************************************************
110 
111 
112 //*************************************************************************************************
113 #if BLAZE_BLAS_MODE
114 
129 BLAZE_ALWAYS_INLINE void axpy( int n, double alpha, const double* x,
130  int incX, double* y, int incY )
131 {
132  cblas_daxpy( n, alpha, x, incX, y, incY );
133 }
134 #endif
135 //*************************************************************************************************
136 
137 
138 //*************************************************************************************************
139 #if BLAZE_BLAS_MODE
140 
155 BLAZE_ALWAYS_INLINE void axpy( int n, complex<float> alpha, const complex<float>* x,
156  int incX, complex<float>* y, int incY )
157 {
158  cblas_caxpy( n, &alpha, x, incX, y, incY );
159 }
160 #endif
161 //*************************************************************************************************
162 
163 
164 //*************************************************************************************************
165 #if BLAZE_BLAS_MODE
166 
181 BLAZE_ALWAYS_INLINE void axpy( int n, complex<double> alpha, const complex<double>* x,
182  int incX, complex<double>* y, int incY )
183 {
184  cblas_zaxpy( n, &alpha, x, incX, y, incY );
185 }
186 #endif
187 //*************************************************************************************************
188 
189 
190 //*************************************************************************************************
191 #if BLAZE_BLAS_MODE
192 
205 template< typename VT1, bool TF1, typename VT2, bool TF2, typename ST >
206 void axpy( DenseVector<VT1,TF1>& y, const DenseVector<VT2,TF2>& x, ST alpha )
207 {
208  using boost::numeric_cast;
209 
212 
215 
218 
219  const int n( numeric_cast<int>( (~x).size() ) );
220 
221  axpy( n, alpha, (~x).data(), 1, (~y).data(), 1 );
222 }
223 #endif
224 //*************************************************************************************************
225 
226 } // namespace blaze
227 
228 #endif
Constraint on the data type.
Header file for auxiliary alias declarations.
#define BLAZE_CONSTRAINT_MUST_HAVE_MUTABLE_DATA_ACCESS(T)
Constraint on the data type.In case the given data type T does not provide low-level data access to m...
Definition: MutableDataAccess.h:61
#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
Constraint on the data type.
System settings for the BLAS mode.
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.