1 #ifndef VIENNACL_LINALG_SCALAR_OPERATIONS_HPP
2 #define VIENNACL_LINALG_SCALAR_OPERATIONS_HPP
35 #ifdef VIENNACL_WITH_OPENCL
39 #ifdef VIENNACL_WITH_CUDA
60 typename S2,
typename ScalarType1>
66 S2
const &
s2, ScalarType1
const & alpha,
vcl_size_t len_alpha,
bool reciprocal_alpha,
bool flip_sign_alpha)
73 #ifdef VIENNACL_WITH_OPENCL
78 #ifdef VIENNACL_WITH_CUDA
105 template<
typename S1,
106 typename S2,
typename ScalarType1,
107 typename S3,
typename ScalarType2>
115 S2
const &
s2, ScalarType1
const & alpha,
vcl_size_t len_alpha,
bool reciprocal_alpha,
bool flip_sign_alpha,
116 S3
const & s3, ScalarType2
const & beta,
vcl_size_t len_beta,
bool reciprocal_beta,
bool flip_sign_beta)
122 s2, alpha, len_alpha, reciprocal_alpha, flip_sign_alpha,
123 s3, beta, len_beta, reciprocal_beta, flip_sign_beta);
125 #ifdef VIENNACL_WITH_OPENCL
128 s2, alpha, len_alpha, reciprocal_alpha, flip_sign_alpha,
129 s3, beta, len_beta, reciprocal_beta, flip_sign_beta);
132 #ifdef VIENNACL_WITH_CUDA
135 s2, alpha, len_alpha, reciprocal_alpha, flip_sign_alpha,
136 s3, beta, len_beta, reciprocal_beta, flip_sign_beta);
161 template<
typename S1,
162 typename S2,
typename ScalarType1,
163 typename S3,
typename ScalarType2>
171 S2
const &
s2, ScalarType1
const & alpha,
vcl_size_t len_alpha,
bool reciprocal_alpha,
bool flip_sign_alpha,
172 S3
const & s3, ScalarType2
const & beta,
vcl_size_t len_beta,
bool reciprocal_beta,
bool flip_sign_beta)
178 s2, alpha, len_alpha, reciprocal_alpha, flip_sign_alpha,
179 s3, beta, len_beta, reciprocal_beta, flip_sign_beta);
181 #ifdef VIENNACL_WITH_OPENCL
184 s2, alpha, len_alpha, reciprocal_alpha, flip_sign_alpha,
185 s3, beta, len_beta, reciprocal_beta, flip_sign_beta);
188 #ifdef VIENNACL_WITH_CUDA
191 s2, alpha, len_alpha, reciprocal_alpha, flip_sign_alpha,
192 s3, beta, len_beta, reciprocal_beta, flip_sign_beta);
209 template<
typename S1,
typename S2>
220 #ifdef VIENNACL_WITH_OPENCL
225 #ifdef VIENNACL_WITH_CUDA
Simple enable-if variant that uses the SFINAE pattern.
viennacl::enable_if< viennacl::is_scalar< S1 >::value &&viennacl::is_scalar< S2 >::value &&viennacl::is_any_scalar< ScalarType1 >::value >::type as(S1 &s1, S2 const &s2, ScalarType1 const &alpha, vcl_size_t len_alpha, bool reciprocal_alpha, bool flip_sign_alpha)
Interface for the generic operation s1 = s2 @ alpha, where s1 and s2 are GPU scalars, @ denotes multiplication or division, and alpha is either a GPU or a CPU scalar.
Implementations of scalar operations using OpenCL.
Exception class in case of memory errors.
Generic size and resize functionality for different vector and matrix types.
viennacl::enable_if< viennacl::is_scalar< ScalarT1 >::value &&viennacl::is_scalar< ScalarT2 >::value >::type swap(ScalarT1 &s1, ScalarT2 &s2)
Swaps the contents of two scalars, data is copied.
Extracts the underlying OpenCL start index handle from a vector, a matrix, an expression etc...
viennacl::enable_if< viennacl::is_scalar< ScalarT1 >::value &&viennacl::is_scalar< ScalarT2 >::value >::type swap(ScalarT1 &s1, ScalarT2 &s2)
Swaps the contents of two scalars, data is copied.
Implementations of scalar operations using CUDA.
This file provides the forward declarations for the main types used within ViennaCL.
Determines row and column increments for matrices and matrix proxies.
Implementations of scalar operations using a plain single-threaded or OpenMP-enabled execution on CPU...
viennacl::scalar< int > s2
viennacl::scalar< float > s1
viennacl::enable_if< viennacl::is_scalar< ScalarT1 >::value &&viennacl::is_scalar< ScalarT2 >::value &&viennacl::is_scalar< ScalarT3 >::value &&viennacl::is_any_scalar< NumericT1 >::value &&viennacl::is_any_scalar< NumericT2 >::value >::type asbs(ScalarT1 &s1, ScalarT2 const &s2, NumericT1 const &alpha, vcl_size_t len_alpha, bool reciprocal_alpha, bool flip_sign_alpha, ScalarT3 const &s3, NumericT2 const &beta, vcl_size_t len_beta, bool reciprocal_beta, bool flip_sign_beta)
viennacl::enable_if< viennacl::is_scalar< ScalarT1 >::value &&viennacl::is_scalar< ScalarT2 >::value &&viennacl::is_scalar< ScalarT3 >::value &&viennacl::is_any_scalar< NumericT2 >::value &&viennacl::is_any_scalar< NumericT3 >::value >::type asbs_s(ScalarT1 &s1, ScalarT2 const &s2, NumericT2 const &alpha, vcl_size_t len_alpha, bool reciprocal_alpha, bool flip_sign_alpha, ScalarT3 const &s3, NumericT3 const &beta, vcl_size_t len_beta, bool reciprocal_beta, bool flip_sign_beta)
viennacl::enable_if< viennacl::is_scalar< S1 >::value &&viennacl::is_scalar< S2 >::value >::type swap(S1 &s1, S2 &s2)
Swaps the contents of two scalars.
Helper struct for checking whether the provided type represents a scalar (either host, from ViennaCL, or a flip-sign proxy)
viennacl::enable_if< viennacl::is_scalar< ScalarT1 >::value &&viennacl::is_scalar< ScalarT2 >::value &&viennacl::is_scalar< ScalarT3 >::value &&viennacl::is_any_scalar< FactorT2 >::value &&viennacl::is_any_scalar< FactorT3 >::value >::type asbs(ScalarT1 &s1, ScalarT2 const &s2, FactorT2 const &alpha, vcl_size_t, bool reciprocal_alpha, bool flip_sign_alpha, ScalarT3 const &s3, FactorT3 const &beta, vcl_size_t, bool reciprocal_beta, bool flip_sign_beta)
viennacl::enable_if< viennacl::is_scalar< ScalarT1 >::value &&viennacl::is_scalar< ScalarT2 >::value &&viennacl::is_any_scalar< FactorT >::value >::type as(ScalarT1 &s1, ScalarT2 const &s2, FactorT const &alpha, vcl_size_t, bool reciprocal_alpha, bool flip_sign_alpha)
viennacl::enable_if< viennacl::is_scalar< S1 >::value &&viennacl::is_scalar< S2 >::value &&viennacl::is_scalar< S3 >::value &&viennacl::is_any_scalar< ScalarType1 >::value &&viennacl::is_any_scalar< ScalarType2 >::value >::type asbs(S1 &s1, S2 const &s2, ScalarType1 const &alpha, vcl_size_t len_alpha, bool reciprocal_alpha, bool flip_sign_alpha, S3 const &s3, ScalarType2 const &beta, vcl_size_t len_beta, bool reciprocal_beta, bool flip_sign_beta)
Interface for the generic operation s1 = s2 @ alpha + s3 @ beta, where s1, s2 and s3 are GPU scalars...
viennacl::enable_if< viennacl::is_scalar< ScalarT1 >::value &&viennacl::is_scalar< ScalarT2 >::value &&viennacl::is_scalar< ScalarT3 >::value &&viennacl::is_any_scalar< NumericT2 >::value &&viennacl::is_any_scalar< NumericT3 >::value >::type asbs(ScalarT1 &s1, ScalarT2 const &s2, NumericT2 const &alpha, vcl_size_t len_alpha, bool reciprocal_alpha, bool flip_sign_alpha, ScalarT3 const &s3, NumericT3 const &beta, vcl_size_t len_beta, bool reciprocal_beta, bool flip_sign_beta)
viennacl::enable_if< viennacl::is_scalar< ScalarT1 >::value &&viennacl::is_scalar< ScalarT2 >::value >::type swap(ScalarT1 &s1, ScalarT2 &s2)
Swaps the contents of two scalars, data is copied.
viennacl::enable_if< viennacl::is_scalar< ScalarT1 >::value &&viennacl::is_scalar< ScalarT2 >::value &&viennacl::is_scalar< ScalarT3 >::value &&viennacl::is_any_scalar< NumericT1 >::value &&viennacl::is_any_scalar< NumericT2 >::value >::type asbs_s(ScalarT1 &s1, ScalarT2 const &s2, NumericT1 const &alpha, vcl_size_t len_alpha, bool reciprocal_alpha, bool flip_sign_alpha, ScalarT3 const &s3, NumericT2 const &beta, vcl_size_t len_beta, bool reciprocal_beta, bool flip_sign_beta)
viennacl::enable_if< viennacl::is_scalar< ScalarT1 >::value &&viennacl::is_scalar< ScalarT2 >::value &&viennacl::is_any_scalar< NumericT >::value >::type as(ScalarT1 &s1, ScalarT2 const &s2, NumericT const &alpha, vcl_size_t len_alpha, bool reciprocal_alpha, bool flip_sign_alpha)
All the predicates used within ViennaCL. Checks for expressions to be vectors, etc.
viennacl::enable_if< viennacl::is_scalar< S1 >::value &&viennacl::is_scalar< S2 >::value &&viennacl::is_scalar< S3 >::value &&viennacl::is_any_scalar< ScalarType1 >::value &&viennacl::is_any_scalar< ScalarType2 >::value >::type asbs_s(S1 &s1, S2 const &s2, ScalarType1 const &alpha, vcl_size_t len_alpha, bool reciprocal_alpha, bool flip_sign_alpha, S3 const &s3, ScalarType2 const &beta, vcl_size_t len_beta, bool reciprocal_beta, bool flip_sign_beta)
Interface for the generic operation s1 += s2 @ alpha + s3 @ beta, where s1, s2 and s3 are GPU scalars...
Helper struct for checking whether a type is a viennacl::scalar<>
viennacl::enable_if< viennacl::is_scalar< ScalarT1 >::value &&viennacl::is_scalar< ScalarT2 >::value &&viennacl::is_any_scalar< NumericT >::value >::type as(ScalarT1 &s1, ScalarT2 const &s2, NumericT const &alpha, vcl_size_t len_alpha, bool reciprocal_alpha, bool flip_sign_alpha)
Extracts the underlying OpenCL handle from a vector, a matrix, an expression etc. ...
viennacl::backend::mem_handle & handle(T &obj)
Returns the generic memory handle of an object. Non-const version.
Simple enable-if variant that uses the SFINAE pattern.
viennacl::enable_if< viennacl::is_scalar< ScalarT1 >::value &&viennacl::is_scalar< ScalarT2 >::value &&viennacl::is_scalar< ScalarT3 >::value &&viennacl::is_any_scalar< FactorT2 >::value &&viennacl::is_any_scalar< FactorT3 >::value >::type asbs_s(ScalarT1 &s1, ScalarT2 const &s2, FactorT2 const &alpha, vcl_size_t, bool reciprocal_alpha, bool flip_sign_alpha, ScalarT3 const &s3, FactorT3 const &beta, vcl_size_t, bool reciprocal_beta, bool flip_sign_beta)