Data Structures | Namespaces | Functions

/data/development/ViennaCL/dev/viennacl/vector.hpp File Reference

The vector type with operator-overloads and proxy classes is defined here. Linear algebra operations such as norms and inner products are located in linalg/vector_operations.hpp. More...

#include "viennacl/forwards.h"
#include "viennacl/ocl/backend.hpp"
#include "viennacl/scalar.hpp"
#include "viennacl/tools/tools.hpp"
#include "viennacl/tools/entry_proxy.hpp"
#include "viennacl/linalg/vector_operations.hpp"

Go to the source code of this file.

Data Structures

class  vector_expression< LHS, RHS, OP >
 An expression template class that represents a binary operation that yields a vector. More...
class  const_vector_iterator< SCALARTYPE, ALIGNMENT >
 A STL-type const-iterator for vector elements. Elements can be accessed, but cannot be manipulated. VERY SLOW!! More...
class  vector_iterator< SCALARTYPE, ALIGNMENT >
 A STL-type iterator for vector elements. Elements can be accessed and manipulated. VERY SLOW!! More...
class  vector< SCALARTYPE, ALIGNMENT >
 A vector class representing a linear memory sequence on the GPU. Inspired by boost::numeric::ublas::vector. More...

Namespaces

namespace  viennacl

Functions

template<typename SCALARTYPE , unsigned int ALIGNMENT, typename CPU_ITERATOR >
void copy (const const_vector_iterator< SCALARTYPE, ALIGNMENT > &gpu_begin, const const_vector_iterator< SCALARTYPE, ALIGNMENT > &gpu_end, CPU_ITERATOR cpu_begin)
 STL-like transfer for the entries of a GPU vector to the CPU. The cpu type does not need to lie in a linear piece of memory.
template<typename SCALARTYPE , unsigned int ALIGNMENT, typename CPU_ITERATOR >
void copy (const vector_iterator< SCALARTYPE, ALIGNMENT > &gpu_begin, const vector_iterator< SCALARTYPE, ALIGNMENT > &gpu_end, CPU_ITERATOR cpu_begin)
 STL-like transfer for the entries of a GPU vector to the CPU. The cpu type does not need to lie in a linear piece of memory.
template<typename SCALARTYPE , unsigned int ALIGNMENT, typename CPUVECTOR >
void copy (vector< SCALARTYPE, ALIGNMENT > const &gpu_vec, CPUVECTOR &cpu_vec)
 Transfer from a gpu vector to a cpu vector. Convenience wrapper for viennacl::linalg::copy(gpu_vec.begin(), gpu_vec.end(), cpu_vec.begin());.
template<typename SCALARTYPE , unsigned int ALIGNMENT, typename CPU_ITERATOR >
void fast_copy (const const_vector_iterator< SCALARTYPE, ALIGNMENT > &gpu_begin, const const_vector_iterator< SCALARTYPE, ALIGNMENT > &gpu_end, CPU_ITERATOR cpu_begin)
 STL-like transfer of a GPU vector to the CPU. The cpu type is assumed to reside in a linear piece of memory, such as e.g. for std::vector.
template<typename SCALARTYPE , unsigned int ALIGNMENT, typename CPUVECTOR >
void fast_copy (vector< SCALARTYPE, ALIGNMENT > const &gpu_vec, CPUVECTOR &cpu_vec)
 Transfer from a gpu vector to a cpu vector. Convenience wrapper for viennacl::linalg::fast_copy(gpu_vec.begin(), gpu_vec.end(), cpu_vec.begin());.
template<typename SCALARTYPE , unsigned int ALIGNMENT, typename CPU_ITERATOR >
void copy (CPU_ITERATOR const &cpu_begin, CPU_ITERATOR const &cpu_end, vector_iterator< SCALARTYPE, ALIGNMENT > gpu_begin)
 STL-like transfer for the entries of a GPU vector to the CPU. The cpu type does not need to lie in a linear piece of memory.
template<typename SCALARTYPE , unsigned int ALIGNMENT, typename CPU_ITERATOR >
void copy (CPU_ITERATOR const &cpu_begin, CPU_ITERATOR const &cpu_end, const_vector_iterator< SCALARTYPE, ALIGNMENT > gpu_begin)
template<typename SCALARTYPE , unsigned int ALIGNMENT, typename CPUVECTOR >
void copy (const CPUVECTOR &cpu_vec, vector< SCALARTYPE, ALIGNMENT > &gpu_vec)
 Transfer from a cpu vector to a gpu vector. Convenience wrapper for viennacl::linalg::copy(cpu_vec.begin(), cpu_vec.end(), gpu_vec.begin());.
template<typename SCALARTYPE , unsigned int ALIGNMENT, typename CPU_ITERATOR >
void fast_copy (CPU_ITERATOR const &cpu_begin, CPU_ITERATOR const &cpu_end, vector_iterator< SCALARTYPE, ALIGNMENT > gpu_begin)
 STL-like transfer of a CPU vector to the GPU. The cpu type is assumed to reside in a linear piece of memory, such as e.g. for std::vector.
template<typename SCALARTYPE , unsigned int ALIGNMENT, typename CPUVECTOR >
void fast_copy (const CPUVECTOR &cpu_vec, vector< SCALARTYPE, ALIGNMENT > &gpu_vec)
 Transfer from a cpu vector to a gpu vector. Convenience wrapper for viennacl::linalg::fast_copy(cpu_vec.begin(), cpu_vec.end(), gpu_vec.begin());.
template<typename SCALARTYPE , unsigned int ALIGNMENT_SRC, unsigned int ALIGNMENT_DEST>
void copy (const_vector_iterator< SCALARTYPE, ALIGNMENT_SRC > const &gpu_src_begin, const_vector_iterator< SCALARTYPE, ALIGNMENT_SRC > const &gpu_src_end, vector_iterator< SCALARTYPE, ALIGNMENT_DEST > gpu_dest_begin)
 Copy (parts of a) GPU vector to another GPU vector.
template<typename SCALARTYPE , unsigned int ALIGNMENT_SRC, unsigned int ALIGNMENT_DEST>
void copy (const_vector_iterator< SCALARTYPE, ALIGNMENT_SRC > const &gpu_src_begin, const_vector_iterator< SCALARTYPE, ALIGNMENT_SRC > const &gpu_src_end, const_vector_iterator< SCALARTYPE, ALIGNMENT_DEST > gpu_dest_begin)
 Copy (parts of a) GPU vector to another GPU vector.
template<typename SCALARTYPE , unsigned int ALIGNMENT_SRC, unsigned int ALIGNMENT_DEST>
void copy (vector< SCALARTYPE, ALIGNMENT_SRC > const &gpu_src_vec, vector< SCALARTYPE, ALIGNMENT_DEST > &gpu_dest_vec)
 Transfer from a ViennaCL vector to another ViennaCL vector. Convenience wrapper for viennacl::linalg::copy(gpu_src_vec.begin(), gpu_src_vec.end(), gpu_dest_vec.begin());.
template<class SCALARTYPE , unsigned int ALIGNMENT>
std::ostream & operator<< (std::ostream &s, vector< SCALARTYPE, ALIGNMENT > const &val)
 Output stream. Output format is ublas compatible.
template<class SCALARTYPE , unsigned int ALIGNMENT>
void swap (viennacl::vector< SCALARTYPE, ALIGNMENT > &vec1, viennacl::vector< SCALARTYPE, ALIGNMENT > &vec2)
 Swaps the contents of two vectors, data is copied.
template<typename SCALARTYPE , unsigned int ALIGNMENT>
vector< SCALARTYPE, ALIGNMENT > & fast_swap (vector< SCALARTYPE, ALIGNMENT > &v1, vector< SCALARTYPE, ALIGNMENT > &v2)
 Swaps the content of two vectors by swapping OpenCL handles only, NO data is copied.
template<typename SCALARTYPE , unsigned int A>
vector_expression< const
vector< SCALARTYPE, A >, const
SCALARTYPE, op_prod > 
operator* (SCALARTYPE const &value, vector< SCALARTYPE, A > const &vec)
 Operator overload for the expression alpha * v1, where alpha is a host scalar (float or double) and v1 is a ViennaCL vector.
template<typename SCALARTYPE , unsigned int A>
vector_expression< const
vector< SCALARTYPE, A >, const
scalar< SCALARTYPE >, op_prod > 
operator* (scalar< SCALARTYPE > const &value, vector< SCALARTYPE, A > const &vec)
 Operator overload for the expression alpha * v1, where alpha is a ViennaCL scalar (float or double) and v1 is a ViennaCL vector.
template<typename LHS1 , typename RHS1 , typename OP1 , typename LHS2 , typename RHS2 , typename OP2 >
vector_expression< LHS1, RHS1,
OP1 >::VectorType 
operator+ (vector_expression< LHS1, RHS1, OP1 > const &proxy1, vector_expression< LHS2, RHS2, OP2 > const &proxy2)
 Operator overload for the addition of two vector expressions.
template<typename LHS1 , typename RHS1 , typename OP1 , typename LHS2 , typename RHS2 , typename OP2 >
vector_expression< LHS1, RHS1,
OP1 >::VectorType 
operator- (vector_expression< LHS1, RHS1, OP1 > const &proxy1, vector_expression< LHS2, RHS2, OP2 > const &proxy2)
 Operator overload for the subtraction of two vector expressions.
template<typename SCALARTYPE , unsigned int A, typename LHS , typename RHS , typename OP >
vector< SCALARTYPE, A > operator+ (vector_expression< LHS, RHS, OP > const &proxy, vector< SCALARTYPE, A > const &vec)
 Operator overload for the addition of a vector expression from the left, e.g. alpha * vec1 + vec2. Here, alpha * vec1 is wrapped into a vector_expression and then added to vec2.
template<typename SCALARTYPE , unsigned int A, typename LHS , typename RHS , typename OP >
vector< SCALARTYPE, A > operator- (vector_expression< LHS, RHS, OP > const &proxy, vector< SCALARTYPE, A > const &vec)
 Operator overload for the subtraction of a vector expression from the left, e.g. alpha * vec1 + vec2. Here, alpha * vec1 is wrapped into a vector_expression and then added to vec2.
template<typename SCALARTYPE , typename LHS , typename RHS , typename OP >
vector< SCALARTYPE > operator* (vector_expression< LHS, RHS, OP > const &proxy, scalar< SCALARTYPE > const &val)
 Operator overload for the multiplication of a vector expression with a scalar from the right, e.g. (beta * vec1) * alpha. Here, beta * vec1 is wrapped into a vector_expression and then multiplied with alpha from the right.
template<typename SCALARTYPE , typename LHS , typename RHS , typename OP >
vector< SCALARTYPE > operator/ (vector_expression< LHS, RHS, OP > const &proxy, scalar< SCALARTYPE > const &val)
 Operator overload for the division of a vector expression by a scalar from the right, e.g. (beta * vec1) / alpha. Here, beta * vec1 is wrapped into a vector_expression and then divided by alpha.
template<typename SCALARTYPE , typename LHS , typename RHS , typename OP >
vector< SCALARTYPE > operator* (scalar< SCALARTYPE > const &val, vector_expression< LHS, RHS, OP > const &proxy)
 Operator overload for the multiplication of a vector expression with a ViennaCL scalar from the left, e.g. alpha * (beta * vec1). Here, beta * vec1 is wrapped into a vector_expression and then multiplied with alpha from the left.
template<typename SCALARTYPE , typename LHS , typename RHS , typename OP >
viennacl::vector< SCALARTYPE > operator* (SCALARTYPE val, viennacl::vector_expression< LHS, RHS, OP > const &proxy)
 Operator overload for the multiplication of a vector expression with a host scalar (float or double) from the left, e.g. alpha * (beta * vec1). Here, beta * vec1 is wrapped into a vector_expression and then multiplied with alpha from the left.

Detailed Description

The vector type with operator-overloads and proxy classes is defined here. Linear algebra operations such as norms and inner products are located in linalg/vector_operations.hpp.