ViennaCL - The Vienna Computing Library  1.7.1
Free open-source GPU-accelerated linear algebra and solver library.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
viennacl::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 <forwards.h>

Public Types

typedef
viennacl::backend::mem_handle 
handle_type
 

Public Member Functions

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

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
NumericTEither float or double

Definition at line 233 of file forwards.h.

Member Typedef Documentation

template<typename SCALARTYPE>
typedef viennacl::backend::mem_handle viennacl::entry_proxy< SCALARTYPE >::handle_type

Definition at line 44 of file entry_proxy.hpp.

Constructor & Destructor Documentation

template<typename SCALARTYPE>
viennacl::entry_proxy< SCALARTYPE >::entry_proxy ( vcl_size_t  mem_offset,
handle_type 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(NumericT) relative to the memory pointed to by the handle
mem_handleA viennacl::ocl::handle for the memory buffer on the GPU.

Definition at line 51 of file entry_proxy.hpp.

Member Function Documentation

template<typename SCALARTYPE>
handle_type const& viennacl::entry_proxy< SCALARTYPE >::handle ( ) const
inline

Returns the memory viennacl::ocl::handle.

Definition at line 142 of file entry_proxy.hpp.

template<typename SCALARTYPE>
vcl_size_t viennacl::entry_proxy< SCALARTYPE >::index ( ) const
inline

Returns the index of the represented element.

Definition at line 138 of file entry_proxy.hpp.

template<typename SCALARTYPE>
viennacl::entry_proxy< SCALARTYPE >::operator NumericT ( ) 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.

Definition at line 130 of file entry_proxy.hpp.

template<typename SCALARTYPE>
entry_proxy& viennacl::entry_proxy< SCALARTYPE >::operator*= ( NumericT  value)
inline

Inplace multiplication with a CPU floating point value.

Definition at line 79 of file entry_proxy.hpp.

template<typename SCALARTYPE>
entry_proxy& viennacl::entry_proxy< SCALARTYPE >::operator+= ( NumericT  value)
inline

Inplace addition of a CPU floating point value.

Definition at line 59 of file entry_proxy.hpp.

template<typename SCALARTYPE>
entry_proxy& viennacl::entry_proxy< SCALARTYPE >::operator-= ( NumericT  value)
inline

Inplace subtraction of a CPU floating point value.

Definition at line 69 of file entry_proxy.hpp.

template<typename SCALARTYPE>
entry_proxy& viennacl::entry_proxy< SCALARTYPE >::operator/= ( NumericT  value)
inline

Inplace division by a CPU floating point value.

Definition at line 89 of file entry_proxy.hpp.

template<typename SCALARTYPE>
entry_proxy& viennacl::entry_proxy< SCALARTYPE >::operator= ( NumericT  value)
inline

Assignment of a CPU floating point value.

Definition at line 99 of file entry_proxy.hpp.

template<typename SCALARTYPE>
entry_proxy& viennacl::entry_proxy< SCALARTYPE >::operator= ( scalar< NumericT > const &  value)
inline

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

Definition at line 107 of file entry_proxy.hpp.

template<typename SCALARTYPE>
entry_proxy& viennacl::entry_proxy< SCALARTYPE >::operator= ( entry_proxy< SCALARTYPE > const &  other)
inline

Assignment of another GPU value.

Definition at line 115 of file entry_proxy.hpp.


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