This class represents a single scalar value on the GPU and behaves mostly like a built-in scalar type like float or double.
More...
Public Member Functions |
| scalar () |
| Allocates the memory for the scalar, but does not set it to zero.
|
| scalar (TYPE val) |
| Allocates the memory for the scalar and sets it to the supplied value.
|
| scalar (cl_mem mem, size_t size) |
| Wraps an existing memory entry into a scalar.
|
template<typename T1 , typename T2 , typename OP > |
| scalar (scalar_expression< T1, T2, OP > const &proxy) |
| Allocates memory for the scalar and sets it to the result of supplied expression.
|
| scalar (const scalar &other) |
| Copy constructor. Allocates new memory for the scalar and copies the value of the supplied scalar.
|
| operator TYPE () const |
| Reads the value of the scalar from the GPU and returns the float or double value.
|
scalar< TYPE > & | operator= (entry_proxy< TYPE > const &other) |
| Assigns a vector entry.
|
scalar< TYPE > & | operator= (scalar< TYPE > const &other) |
| Assigns the value from another scalar.
|
scalar< TYPE > & | operator= (float cpu_other) |
scalar< TYPE > & | operator= (double cpu_other) |
scalar< TYPE > & | operator= (long cpu_other) |
scalar< TYPE > & | operator= (unsigned long cpu_other) |
scalar< TYPE > & | operator= (int cpu_other) |
scalar< TYPE > & | operator= (unsigned int cpu_other) |
template<typename T1 , typename T2 > |
scalar< TYPE > & | operator= (scalar_expression< T1, T2, op_inner_prod > const &proxy) |
| Sets the scalar to the result of supplied inner product expression.
|
template<typename T1 , typename T2 > |
scalar< TYPE > & | operator= (scalar_expression< T1, T2, op_norm_1 > const &proxy) |
| Sets the scalar to the result of supplied norm_1 expression.
|
template<typename T1 , typename T2 > |
scalar< TYPE > & | operator= (scalar_expression< T1, T2, op_norm_2 > const &proxy) |
| Sets the scalar to the result of supplied norm_2 expression.
|
template<typename T1 , typename T2 > |
scalar< TYPE > & | operator= (scalar_expression< T1, T2, op_norm_inf > const &proxy) |
| Sets the scalar to the result of supplied norm_inf expression.
|
scalar< TYPE > & | operator+= (scalar< TYPE > const &other) |
| Inplace addition of a ViennaCL scalar.
|
scalar< TYPE > & | operator+= (TYPE other) |
| Inplace addition of a host scalar (float or double)
|
scalar< TYPE > & | operator-= (scalar< TYPE > const &other) |
| Inplace subtraction of a ViennaCL scalar.
|
scalar< TYPE > & | operator-= (TYPE other) |
| Inplace subtraction of a host scalar (float or double)
|
scalar< TYPE > & | operator*= (scalar< TYPE > const &other) |
| Inplace multiplication with a ViennaCL scalar.
|
scalar< TYPE > & | operator*= (TYPE other) |
| Inplace multiplication with a host scalar (float or double)
|
scalar< TYPE > & | operator/= (scalar< TYPE > const &other) |
| Inplace division with a ViennaCL scalar.
|
scalar< TYPE > & | operator/= (TYPE other) |
| Inplace division with a host scalar (float or double)
|
scalar< TYPE > | operator+ (scalar< TYPE > const &other) |
| Addition of two ViennaCL scalars.
|
template<typename T1 , typename T2 , typename OP > |
scalar< TYPE > | operator+ (scalar_expression< T1, T2, OP > const &proxy) const |
| Addition of a ViennaCL scalar with a scalar expression.
|
scalar< TYPE > | operator+ (TYPE other) |
| Addition of a ViennaCL scalar with a host scalar (float, double)
|
scalar< TYPE > | operator- (scalar< TYPE > const &other) const |
| Subtraction of two ViennaCL scalars.
|
template<typename T1 , typename T2 , typename OP > |
scalar< TYPE > | operator- (scalar_expression< T1, T2, OP > const &proxy) const |
| Subtraction of a ViennaCL scalar from a scalar expression.
|
scalar< TYPE > | operator- (TYPE other) const |
| Subtraction of a host scalar (float, double) from a ViennaCL scalar.
|
scalar< TYPE > | operator* (scalar< TYPE > const &other) const |
| Multiplication of two ViennaCL scalars.
|
template<typename T1 , typename T2 , typename OP > |
scalar< TYPE > | operator* (scalar_expression< T1, T2, OP > const &proxy) const |
| Multiplication of a ViennaCL scalar with a scalar expression.
|
scalar< TYPE > | operator* (TYPE other) const |
| Multiplication of a host scalar (float, double) with a ViennaCL scalar.
|
scalar< TYPE > | operator/ (scalar< TYPE > const &other) const |
| Division of two ViennaCL scalars.
|
template<typename T1 , typename T2 , typename OP > |
scalar< TYPE > | operator/ (scalar_expression< T1, T2, OP > const &proxy) const |
| Division of a ViennaCL scalar by a scalar expression.
|
scalar< TYPE > | operator/ (TYPE other) const |
| Division of a ViennaCL scalar by a host scalar (float, double)
|
const viennacl::ocl::handle
< cl_mem > & | handle () const |
| Returns the OpenCL handle.
|
template<class TYPE>
class viennacl::scalar< TYPE >
This class represents a single scalar value on the GPU and behaves mostly like a built-in scalar type like float or double.
Since every read and write operation requires a CPU->GPU or GPU->CPU transfer, this type should be used with care. The advantage of this type is that the GPU command queue can be filled without blocking read operations.
- Template Parameters
-
TYPE | Either float or double. Checked at compile time. |