This class represents a single scalar value on the GPU and behaves mostly like a built-in scalar type like float or double.
More...
|
| scalar () |
| Creates the scalar object, but does not yet allocate memory. Thus, scalar<> can also be a global variable (if really necessary). More...
|
|
| scalar (NumericT val, viennacl::context ctx=viennacl::context()) |
| Allocates the memory for the scalar and sets it to the supplied value. More...
|
|
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. More...
|
|
| scalar (const scalar &other) |
| Copy constructor. Allocates new memory for the scalar and copies the value of the supplied scalar. More...
|
|
| operator NumericT () const |
| Reads the value of the scalar from the GPU and returns the float or double value. More...
|
|
self_type & | operator= (entry_proxy< NumericT > const &other) |
| Assigns a vector entry. More...
|
|
self_type & | operator= (scalar< NumericT > const &other) |
| Assigns the value from another scalar. More...
|
|
self_type & | operator= (float cpu_other) |
|
self_type & | operator= (double cpu_other) |
|
self_type & | operator= (long cpu_other) |
|
self_type & | operator= (unsigned long cpu_other) |
|
self_type & | operator= (int cpu_other) |
|
self_type & | operator= (unsigned int cpu_other) |
|
template<typename T1 , typename T2 > |
self_type & | operator= (scalar_expression< T1, T2, op_inner_prod > const &proxy) |
| Sets the scalar to the result of supplied inner product expression. More...
|
|
template<typename T1 , typename T2 > |
self_type & | operator= (scalar_expression< T1, T2, op_norm_1 > const &proxy) |
| Sets the scalar to the result of supplied norm_1 expression. More...
|
|
template<typename T1 , typename T2 > |
self_type & | operator= (scalar_expression< T1, T2, op_norm_2 > const &proxy) |
| Sets the scalar to the result of supplied norm_2 expression. More...
|
|
template<typename T1 , typename T2 > |
self_type & | operator= (scalar_expression< T1, T2, op_norm_inf > const &proxy) |
| Sets the scalar to the result of supplied norm_inf expression. More...
|
|
template<typename T1 , typename T2 > |
self_type & | operator= (scalar_expression< T1, T2, op_max > const &proxy) |
| Sets the scalar to the result of supplied max expression. More...
|
|
template<typename T1 , typename T2 > |
self_type & | operator= (scalar_expression< T1, T2, op_min > const &proxy) |
| Sets the scalar to the result of supplied min expression. More...
|
|
template<typename T1 , typename T2 > |
self_type & | operator= (scalar_expression< T1, T2, op_sum > const &proxy) |
| Sets the scalar to the result of supplied sum expression. More...
|
|
template<typename T1 , typename T2 > |
self_type & | operator= (scalar_expression< T1, T2, op_norm_frobenius > const &proxy) |
| Sets the scalar to the result of supplied norm_frobenius expression. More...
|
|
template<typename T1 , typename T2 > |
self_type & | operator= (scalar_expression< T1, T2, op_flip_sign > const &proxy) |
| Sets the scalar to the inverse with respect to addition of the supplied sub-expression. More...
|
|
self_type & | operator+= (scalar< NumericT > const &other) |
| Inplace addition of a ViennaCL scalar. More...
|
|
self_type & | operator+= (NumericT other) |
| Inplace addition of a host scalar (float or double) More...
|
|
self_type & | operator-= (scalar< NumericT > const &other) |
| Inplace subtraction of a ViennaCL scalar. More...
|
|
self_type & | operator-= (NumericT other) |
| Inplace subtraction of a host scalar (float or double) More...
|
|
self_type & | operator*= (scalar< NumericT > const &other) |
| Inplace multiplication with a ViennaCL scalar. More...
|
|
self_type & | operator*= (NumericT other) |
| Inplace multiplication with a host scalar (float or double) More...
|
|
self_type & | operator/= (scalar< NumericT > const &other) |
| Inplace division with a ViennaCL scalar. More...
|
|
self_type & | operator/= (NumericT other) |
| Inplace division with a host scalar (float or double) More...
|
|
self_type | operator+ (scalar< NumericT > const &other) |
| Addition of two ViennaCL scalars. More...
|
|
template<typename T1 , typename T2 , typename OP > |
self_type | operator+ (scalar_expression< T1, T2, OP > const &proxy) const |
| Addition of a ViennaCL scalar with a scalar expression. More...
|
|
self_type | operator+ (NumericT other) |
| Addition of a ViennaCL scalar with a host scalar (float, double) More...
|
|
scalar_expression< const self_type, const self_type, op_flip_sign > | operator- () const |
| Sign flip of the scalar. Does not evaluate immediately, but instead returns an expression template object. More...
|
|
self_type | operator- (scalar< NumericT > const &other) const |
| Subtraction of two ViennaCL scalars. More...
|
|
template<typename T1 , typename T2 , typename OP > |
self_type | operator- (scalar_expression< T1, T2, OP > const &proxy) const |
| Subtraction of a ViennaCL scalar from a scalar expression. More...
|
|
scalar< NumericT > | operator- (NumericT other) const |
| Subtraction of a host scalar (float, double) from a ViennaCL scalar. More...
|
|
self_type | operator* (scalar< NumericT > const &other) const |
| Multiplication of two ViennaCL scalars. More...
|
|
template<typename T1 , typename T2 , typename OP > |
self_type | operator* (scalar_expression< T1, T2, OP > const &proxy) const |
| Multiplication of a ViennaCL scalar with a scalar expression. More...
|
|
self_type | operator* (NumericT other) const |
| Multiplication of a host scalar (float, double) with a ViennaCL scalar. More...
|
|
self_type | operator/ (scalar< NumericT > const &other) const |
| Division of two ViennaCL scalars. More...
|
|
template<typename T1 , typename T2 , typename OP > |
self_type | operator/ (scalar_expression< T1, T2, OP > const &proxy) const |
| Division of a ViennaCL scalar by a scalar expression. More...
|
|
self_type | operator/ (NumericT other) const |
| Division of a ViennaCL scalar by a host scalar (float, double) More...
|
|
handle_type & | handle () |
| Returns the memory handle, non-const version. More...
|
|
const handle_type & | handle () const |
| Returns the memory handle, const version. More...
|
|
template<class NumericT>
class viennacl::scalar< NumericT >
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
-
NumericT | Either float or double. Checked at compile time. |
- Examples:
- blas1.cpp, blas2.cpp, and custom-context.cpp.
Definition at line 227 of file forwards.h.