ViennaCL - The Vienna Computing Library  1.2.0
Public Member Functions
entry_proxy< SCALARTYPE > Class Template Reference

A proxy class for a single element of a vector or matrix. This proxy should not be noticed by end-users of the library. More...

#include <entry_proxy.hpp>

Public Member Functions

 entry_proxy (unsigned int mem_offset, viennacl::ocl::handle< cl_mem > const &mem_handle)
 The constructor for the proxy class. Declared explicit to avoid any surprises created by the compiler.
entry_proxyoperator+= (SCALARTYPE value)
 Inplace addition of a CPU floating point value.
entry_proxyoperator-= (SCALARTYPE value)
 Inplace subtraction of a CPU floating point value.
entry_proxyoperator*= (SCALARTYPE value)
 Inplace multiplication with a CPU floating point value.
entry_proxyoperator/= (SCALARTYPE value)
 Inplace division by a CPU floating point value.
entry_proxyoperator= (SCALARTYPE value)
 Assignment of a CPU floating point value.
entry_proxyoperator= (scalar< SCALARTYPE > const &value)
 Assignment of a GPU floating point value. Avoids unnecessary GPU->CPU->GPU transfers.
entry_proxyoperator= (entry_proxy const &other)
 Assignment of another GPU value.
 operator SCALARTYPE () const
 Conversion to a CPU floating point value.
unsigned int index () const
 Returns the index of the represented element.
viennacl::ocl::handle< cl_mem >
const & 
handle () const
 Returns the memory viennacl::ocl::handle.

Detailed Description

template<typename SCALARTYPE>
class viennacl::entry_proxy< SCALARTYPE >

A proxy class for a single element of a vector or matrix. This proxy should not be noticed by end-users of the library.

This proxy provides access to a single entry of a vector. If the element is assigned to a GPU object, no unnecessary transfers to the CPU and back to GPU are initiated.

Template Parameters
SCALARTYPEEither float or double

Constructor & Destructor Documentation

entry_proxy ( unsigned int  mem_offset,
viennacl::ocl::handle< cl_mem > const &  mem_handle 
)
inlineexplicit

The constructor for the proxy class. Declared explicit to avoid any surprises created by the compiler.

Parameters
mem_offsetThe memory offset in multiples of sizeof(SCALARTYPE) relative to the memory pointed to by the handle
mem_handleA viennacl::ocl::handle for the memory buffer on the GPU.

Member Function Documentation

viennacl::ocl::handle<cl_mem> const& handle ( ) const
inline

Returns the memory viennacl::ocl::handle.

unsigned int index ( ) const
inline

Returns the index of the represented element.

operator SCALARTYPE ( ) const
inline

Conversion to a CPU floating point value.

This conversion allows to write something like double test = vector(4); However, one has to keep in mind that CPU<->GPU transfers are very slow compared to CPU<->CPU operations.

entry_proxy& operator*= ( SCALARTYPE  value)
inline

Inplace multiplication with a CPU floating point value.

entry_proxy& operator+= ( SCALARTYPE  value)
inline

Inplace addition of a CPU floating point value.

entry_proxy& operator-= ( SCALARTYPE  value)
inline

Inplace subtraction of a CPU floating point value.

entry_proxy& operator/= ( SCALARTYPE  value)
inline

Inplace division by a CPU floating point value.

entry_proxy& operator= ( SCALARTYPE  value)
inline

Assignment of a CPU floating point value.

entry_proxy& operator= ( scalar< SCALARTYPE > const &  value)
inline

Assignment of a GPU floating point value. Avoids unnecessary GPU->CPU->GPU transfers.

entry_proxy& operator= ( entry_proxy< SCALARTYPE > const &  other)
inline

Assignment of another GPU value.


The documentation for this class was generated from the following file: