Namespaces | |
namespace | io |
namespace | linalg |
namespace | ocl |
namespace | tools |
namespace | traits |
Data Structures | |
class | compressed_matrix |
A sparse square matrix in compressed sparse rows format. More... | |
class | coordinate_matrix |
A sparse square matrix, where entries are stored as triplets (i,j, val), where i and j are the row and column indices and val denotes the entry. More... | |
struct | tag_none |
struct | tag_mtl4 |
struct | tag_eigen |
struct | tag_ublas |
struct | tag_stl |
struct | tag_viennacl |
struct | is_mtl4 |
Meta function which checks whether a tag is tag_mtl4. More... | |
struct | is_mtl4< viennacl::tag_mtl4 > |
struct | is_eigen |
Meta function which checks whether a tag is tag_eigen. More... | |
struct | is_eigen< viennacl::tag_eigen > |
struct | is_ublas |
Meta function which checks whether a tag is tag_ublas. More... | |
struct | is_ublas< viennacl::tag_ublas > |
struct | is_stl |
Meta function which checks whether a tag is tag_ublas. More... | |
struct | is_stl< viennacl::tag_stl > |
struct | is_viennacl |
Meta function which checks whether a tag is tag_viennacl. More... | |
struct | is_viennacl< viennacl::tag_viennacl > |
struct | row_major |
A tag for row-major storage of a dense matrix. More... | |
struct | column_major |
class | matrix_expression |
struct | row_iteration |
A tag indicating iteration along increasing row index of a matrix. More... | |
struct | col_iteration |
A tag indicating iteration along increasing columns index of a matrix. More... | |
class | matrix_iterator |
class | matrix |
A dense matrix class. More... | |
class | scalar_expression |
A proxy for scalar expressions (e.g. from inner vector products). More... | |
class | scalar |
This class represents a single scalar value on the GPU and behaves mostly like a built-in scalar type like float or double. More... | |
class | entry_proxy |
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... | |
class | vector_expression |
An expression template class that represents a binary operation that yields a vector. More... | |
class | const_vector_iterator |
A STL-type const-iterator for vector elements. Elements can be accessed, but cannot be manipulated. VERY SLOW!! More... | |
class | vector_iterator |
A STL-type iterator for vector elements. Elements can be accessed and manipulated. VERY SLOW!! More... | |
class | vector |
A vector class representing a linear memory sequence on the GPU. Inspired by boost::numeric::ublas::vector. More... | |
Typedefs | |
typedef std::size_t | vcl_size_t |
typedef std::ptrdiff_t | vcl_ptrdiff_t |
Functions | |
template<typename CPU_MATRIX , typename SCALARTYPE , unsigned int ALIGNMENT> | |
void | copy (const CPU_MATRIX &cpu_matrix, compressed_matrix< SCALARTYPE, ALIGNMENT > &gpu_matrix) |
Copies a sparse matrix from the host to the OpenCL device (either GPU or multi-core CPU). | |
template<typename SCALARTYPE , unsigned int ALIGNMENT> | |
void | copy (const std::vector< std::map< unsigned int, SCALARTYPE > > &cpu_matrix, compressed_matrix< SCALARTYPE, ALIGNMENT > &gpu_matrix) |
Copies a sparse matrix in the std::vector< std::map < > > format to an OpenCL device. | |
template<typename CPU_MATRIX , typename SCALARTYPE , unsigned int ALIGNMENT> | |
void | copy (const compressed_matrix< SCALARTYPE, ALIGNMENT > &gpu_matrix, CPU_MATRIX &cpu_matrix) |
Copies a sparse matrix from the OpenCL device (either GPU or multi-core CPU) to the host. | |
template<typename SCALARTYPE , unsigned int ALIGNMENT> | |
void | copy (const compressed_matrix< SCALARTYPE, ALIGNMENT > &gpu_matrix, std::vector< std::map< unsigned int, SCALARTYPE > > &cpu_matrix) |
Copies a sparse matrix from an OpenCL device to the host. The host type is the std::vector< std::map < > > format . | |
template<typename CPU_MATRIX , typename SCALARTYPE , unsigned int ALIGNMENT> | |
void | copy (const CPU_MATRIX &cpu_matrix, coordinate_matrix< SCALARTYPE, ALIGNMENT > &gpu_matrix) |
Copies a sparse matrix from the host to the OpenCL device (either GPU or multi-core CPU). | |
template<typename SCALARTYPE , unsigned int ALIGNMENT> | |
void | copy (const std::vector< std::map< unsigned int, SCALARTYPE > > &cpu_matrix, coordinate_matrix< SCALARTYPE, ALIGNMENT > &gpu_matrix) |
Copies a sparse matrix in the std::vector< std::map < > > format to an OpenCL device. | |
template<typename CPU_MATRIX , typename SCALARTYPE , unsigned int ALIGNMENT> | |
void | copy (const coordinate_matrix< SCALARTYPE, ALIGNMENT > &gpu_matrix, CPU_MATRIX &cpu_matrix) |
Copies a sparse matrix from the OpenCL device (either GPU or multi-core CPU) to the host. | |
template<typename SCALARTYPE , unsigned int ALIGNMENT> | |
void | copy (const coordinate_matrix< SCALARTYPE, ALIGNMENT > &gpu_matrix, std::vector< std::map< unsigned int, SCALARTYPE > > &cpu_matrix) |
Copies a sparse matrix from an OpenCL device to the host. The host type is the std::vector< std::map < > > format . | |
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_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<class SCALARTYPE , typename F , unsigned int ALIGNMENT> | |
std::ostream & | operator<< (std::ostream &s, const matrix< SCALARTYPE, F, ALIGNMENT > &gpu_matrix) |
Prints the matrix. Output is compatible to boost::numeric::ublas. | |
template<typename LHS , typename RHS , typename OP > | |
std::ostream & | operator<< (std::ostream &s, const matrix_expression< LHS, RHS, OP > &expr) |
Prints the matrix. Output is compatible to boost::numeric::ublas. | |
template<class SCALARTYPE , typename F , unsigned int ALIGNMENT> | |
matrix_expression< const matrix< SCALARTYPE, F, ALIGNMENT >, const matrix < SCALARTYPE, F, ALIGNMENT > , op_trans > | trans (const matrix< SCALARTYPE, F, ALIGNMENT > &mat) |
Returns an expression template class representing a transposed matrix. | |
template<typename CPU_MATRIX , typename SCALARTYPE , typename F , unsigned int ALIGNMENT> | |
void | copy (const CPU_MATRIX &cpu_matrix, matrix< SCALARTYPE, F, ALIGNMENT > &gpu_matrix) |
Copies a dense matrix from the host (CPU) to the OpenCL device (GPU or multi-core CPU). | |
template<typename SCALARTYPE , typename A1 , typename A2 , typename F , unsigned int ALIGNMENT> | |
void | copy (const std::vector< std::vector< SCALARTYPE, A1 >, A2 > &cpu_matrix, matrix< SCALARTYPE, F, ALIGNMENT > &gpu_matrix) |
Copies a dense STL-type matrix from the host (CPU) to the OpenCL device (GPU or multi-core CPU). | |
template<typename SCALARTYPE , typename F , unsigned int ALIGNMENT> | |
void | fast_copy (SCALARTYPE *cpu_matrix_begin, SCALARTYPE *cpu_matrix_end, matrix< SCALARTYPE, F, ALIGNMENT > &gpu_matrix) |
Copies a dense matrix from the host (CPU) to the OpenCL device (GPU or multi-core CPU) without temporary. Matrix-Layout on CPU must be equal to the matrix-layout on the GPU. | |
template<typename CPU_MATRIX , typename SCALARTYPE , typename F , unsigned int ALIGNMENT> | |
void | copy (const matrix< SCALARTYPE, F, ALIGNMENT > &gpu_matrix, CPU_MATRIX &cpu_matrix) |
Copies a dense matrix from the OpenCL device (GPU or multi-core CPU) to the host (CPU). | |
template<typename SCALARTYPE , typename A1 , typename A2 , typename F , unsigned int ALIGNMENT> | |
void | copy (const matrix< SCALARTYPE, F, ALIGNMENT > &gpu_matrix, std::vector< std::vector< SCALARTYPE, A1 >, A2 > &cpu_matrix) |
Copies a dense matrix from the OpenCL device (GPU or multi-core CPU) to the host (CPU). | |
template<typename SCALARTYPE , typename F , unsigned int ALIGNMENT> | |
void | fast_copy (const matrix< SCALARTYPE, F, ALIGNMENT > &gpu_matrix, SCALARTYPE *cpu_matrix_begin) |
Copies a dense matrix from the OpenCL device (GPU or multi-core CPU) to the host (CPU). | |
template<typename CPU_SCALAR , typename SCALARTYPE , unsigned int VECTOR_ALIGNMENT> | |
viennacl::matrix_expression < const viennacl::matrix_expression < const viennacl::vector < SCALARTYPE, VECTOR_ALIGNMENT > , const viennacl::vector < SCALARTYPE, VECTOR_ALIGNMENT > , op_prod >, const SCALARTYPE, op_prod > | operator* (const viennacl::matrix_expression< const viennacl::vector< SCALARTYPE, VECTOR_ALIGNMENT >, const viennacl::vector< SCALARTYPE, VECTOR_ALIGNMENT >, op_prod > &proxy, CPU_SCALAR val) |
template<typename CPU_SCALAR , typename SCALARTYPE , unsigned int VA1, unsigned int VA2> | |
viennacl::matrix_expression < const viennacl::matrix_expression < const viennacl::vector < SCALARTYPE, VA1 >, const viennacl::vector< SCALARTYPE, VA2 >, op_prod >, const SCALARTYPE, op_prod > | operator* (CPU_SCALAR val, viennacl::matrix_expression< const viennacl::vector< SCALARTYPE, VA1 >, const viennacl::vector< SCALARTYPE, VA2 >, op_prod > const &proxy) |
template<class SCALARTYPE > | |
std::ostream & | operator<< (std::ostream &s, const scalar< SCALARTYPE > &val) |
Allows to directly print the value of a scalar to an output stream. | |
template<class SCALARTYPE > | |
std::istream & | operator>> (std::istream &s, const scalar< SCALARTYPE > &val) |
Allows to directly read a value of a scalar from an input stream. | |
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, 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 (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. |
typedef std::ptrdiff_t vcl_ptrdiff_t |
typedef std::size_t vcl_size_t |
void viennacl::copy | ( | const CPU_MATRIX & | cpu_matrix, | |
compressed_matrix< SCALARTYPE, ALIGNMENT > & | gpu_matrix | |||
) |
Copies a sparse matrix from the host to the OpenCL device (either GPU or multi-core CPU).
There are some type requirements on the CPU_MATRIX type (fulfilled by e.g. boost::numeric::ublas):
cpu_matrix | A sparse matrix on the host. | |
gpu_matrix | A compressed_matrix from ViennaCL |
void viennacl::copy | ( | const std::vector< std::map< unsigned int, SCALARTYPE > > & | cpu_matrix, | |
compressed_matrix< SCALARTYPE, ALIGNMENT > & | gpu_matrix | |||
) |
Copies a sparse matrix in the std::vector< std::map < > > format to an OpenCL device.
cpu_matrix | A sparse matrix on the host. | |
gpu_matrix | A compressed_matrix from ViennaCL |
void viennacl::copy | ( | const compressed_matrix< SCALARTYPE, ALIGNMENT > & | gpu_matrix, | |
std::vector< std::map< unsigned int, SCALARTYPE > > & | cpu_matrix | |||
) |
Copies a sparse matrix from an OpenCL device to the host. The host type is the std::vector< std::map < > > format .
gpu_matrix | A compressed_matrix from ViennaCL | |
cpu_matrix | A sparse matrix on the host. |
void viennacl::copy | ( | const coordinate_matrix< SCALARTYPE, ALIGNMENT > & | gpu_matrix, | |
std::vector< std::map< unsigned int, SCALARTYPE > > & | cpu_matrix | |||
) |
Copies a sparse matrix from an OpenCL device to the host. The host type is the std::vector< std::map < > > format .
gpu_matrix | A coordinate_matrix from ViennaCL | |
cpu_matrix | A sparse matrix on the host. |
void viennacl::copy | ( | const std::vector< std::vector< SCALARTYPE, A1 >, A2 > & | cpu_matrix, | |
matrix< SCALARTYPE, F, ALIGNMENT > & | gpu_matrix | |||
) |
Copies a dense STL-type matrix from the host (CPU) to the OpenCL device (GPU or multi-core CPU).
cpu_matrix | A dense matrix on the host of type std::vector< std::vector<> >. cpu_matrix[i][j] returns the element in the i-th row and j-th columns (both starting with zero) | |
gpu_matrix | A dense ViennaCL matrix |
void viennacl::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());.
gpu_src_vec | A gpu vector | |
gpu_dest_vec | The cpu vector. Type requirements: Output iterator can be obtained via member function .begin() |
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.
cpu_begin | CPU iterator pointing to the beginning of the gpu vector (STL-like) | |
cpu_end | CPU iterator pointing to the end of the vector (STL-like) | |
gpu_begin | Output iterator for the gpu vector. The gpu vector must be at least as long as the cpu vector! |
void viennacl::copy | ( | const matrix< SCALARTYPE, F, ALIGNMENT > & | gpu_matrix, | |
CPU_MATRIX & | cpu_matrix | |||
) |
Copies a dense matrix from the OpenCL device (GPU or multi-core CPU) to the host (CPU).
gpu_matrix | A dense ViennaCL matrix | |
cpu_matrix | A dense memory on the host. Must have at least as many rows and columns as the gpu_matrix! Type requirement: Access to entries via operator() |
void viennacl::copy | ( | const matrix< SCALARTYPE, F, ALIGNMENT > & | gpu_matrix, | |
std::vector< std::vector< SCALARTYPE, A1 >, A2 > & | cpu_matrix | |||
) |
Copies a dense matrix from the OpenCL device (GPU or multi-core CPU) to the host (CPU).
gpu_matrix | A dense ViennaCL matrix | |
cpu_matrix | A dense memory on the host using STL types, typically std::vector< std::vector<> > Must have at least as many rows and columns as the gpu_matrix! Type requirement: Access to entries via operator() |
void viennacl::copy | ( | const CPU_MATRIX & | cpu_matrix, | |
coordinate_matrix< SCALARTYPE, ALIGNMENT > & | gpu_matrix | |||
) |
Copies a sparse matrix from the host to the OpenCL device (either GPU or multi-core CPU).
For the requirements on the CPU_MATRIX type, see the documentation of the function copy(CPU_MATRIX, compressed_matrix<>)
cpu_matrix | A sparse matrix on the host. | |
gpu_matrix | A compressed_matrix from ViennaCL |
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.
gpu_src_begin | GPU iterator pointing to the beginning of the gpu vector (STL-like) | |
gpu_src_end | GPU iterator pointing to the end of the vector (STL-like) | |
gpu_dest_begin | Output iterator for the gpu vector. The gpu_dest vector must be at least as long as the gpu_src vector! |
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.
gpu_src_begin | GPU iterator pointing to the beginning of the gpu vector (STL-like) | |
gpu_src_end | GPU iterator pointing to the end of the vector (STL-like) | |
gpu_dest_begin | Output iterator for the gpu vector. The gpu vector must be at least as long as the cpu vector! |
void viennacl::copy | ( | const compressed_matrix< SCALARTYPE, ALIGNMENT > & | gpu_matrix, | |
CPU_MATRIX & | cpu_matrix | |||
) |
Copies a sparse matrix from the OpenCL device (either GPU or multi-core CPU) to the host.
There are two type requirements on the CPU_MATRIX type (fulfilled by e.g. boost::numeric::ublas):
gpu_matrix | A compressed_matrix from ViennaCL | |
cpu_matrix | A sparse matrix on the host. |
void viennacl::copy | ( | const std::vector< std::map< unsigned int, SCALARTYPE > > & | cpu_matrix, | |
coordinate_matrix< SCALARTYPE, ALIGNMENT > & | gpu_matrix | |||
) |
Copies a sparse matrix in the std::vector< std::map < > > format to an OpenCL device.
cpu_matrix | A sparse matrix on the host. | |
gpu_matrix | A coordinate_matrix from ViennaCL |
void viennacl::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.
gpu_begin | GPU constant iterator pointing to the beginning of the gpu vector (STL-like) | |
gpu_end | GPU constant iterator pointing to the end of the vector (STL-like) | |
cpu_begin | Output iterator for the cpu vector. The cpu vector must be at least as long as the gpu vector! |
void viennacl::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.
gpu_begin | GPU iterator pointing to the beginning of the gpu vector (STL-like) | |
gpu_end | GPU iterator pointing to the end of the vector (STL-like) | |
cpu_begin | Output iterator for the cpu vector. The cpu vector must be at least as long as the gpu vector! |
void viennacl::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());.
gpu_vec | A gpu vector | |
cpu_vec | The cpu vector. Type requirements: Output iterator can be obtained via member function .begin() |
void viennacl::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());.
cpu_vec | A cpu vector. Type requirements: Iterator can be obtained via member function .begin() and .end() | |
gpu_vec | The gpu vector. |
void viennacl::copy | ( | const coordinate_matrix< SCALARTYPE, ALIGNMENT > & | gpu_matrix, | |
CPU_MATRIX & | cpu_matrix | |||
) |
Copies a sparse matrix from the OpenCL device (either GPU or multi-core CPU) to the host.
There are two type requirements on the CPU_MATRIX type (fulfilled by e.g. boost::numeric::ublas):
gpu_matrix | A coordinate_matrix from ViennaCL | |
cpu_matrix | A sparse matrix on the host. |
void viennacl::copy | ( | const CPU_MATRIX & | cpu_matrix, | |
matrix< SCALARTYPE, F, ALIGNMENT > & | gpu_matrix | |||
) |
Copies a dense matrix from the host (CPU) to the OpenCL device (GPU or multi-core CPU).
cpu_matrix | A dense matrix on the host. Type requirements: .size1() returns number of rows, .size2() returns number of columns. Access to entries via operator() | |
gpu_matrix | A dense ViennaCL matrix |
void viennacl::copy | ( | CPU_ITERATOR const & | cpu_begin, | |
CPU_ITERATOR const & | cpu_end, | |||
const_vector_iterator< SCALARTYPE, ALIGNMENT > | gpu_begin | |||
) |
void viennacl::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.
This method is faster than the plain copy() function, because entries are directly read from the cpu vector, starting with &(*cpu.begin()). However, keep in mind that the cpu type MUST represent a linear piece of memory, otherwise you will run into undefined behavior.
cpu_begin | CPU iterator pointing to the beginning of the cpu vector (STL-like) | |
cpu_end | CPU iterator pointing to the end of the vector (STL-like) | |
gpu_begin | Output iterator for the gpu vector. The gpu iterator must be incrementable (cpu_end - cpu_begin) times, otherwise the result is undefined. |
void viennacl::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());.
cpu_vec | A cpu vector. Type requirements: Iterator can be obtained via member function .begin() and .end() | |
gpu_vec | The gpu vector. |
void viennacl::fast_copy | ( | SCALARTYPE * | cpu_matrix_begin, | |
SCALARTYPE * | cpu_matrix_end, | |||
matrix< SCALARTYPE, F, ALIGNMENT > & | gpu_matrix | |||
) |
Copies a dense matrix from the host (CPU) to the OpenCL device (GPU or multi-core CPU) without temporary. Matrix-Layout on CPU must be equal to the matrix-layout on the GPU.
cpu_matrix_begin | Pointer to the first matrix entry. Cf. iterator concept in STL | |
cpu_matrix_end | Pointer past the last matrix entry. Cf. iterator concept in STL | |
gpu_matrix | A dense ViennaCL matrix |
void viennacl::fast_copy | ( | const matrix< SCALARTYPE, F, ALIGNMENT > & | gpu_matrix, | |
SCALARTYPE * | cpu_matrix_begin | |||
) |
Copies a dense matrix from the OpenCL device (GPU or multi-core CPU) to the host (CPU).
gpu_matrix | A dense ViennaCL matrix | |
cpu_matrix_begin | Pointer to the output memory on the CPU. User must ensure that provided memory is large enough. |
void viennacl::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());.
gpu_vec | A gpu vector. | |
cpu_vec | The cpu vector. Type requirements: Output iterator can be obtained via member function .begin() |
void viennacl::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.
This method is faster than the plain copy() function, because entries are directly written to the cpu vector, starting with &(*cpu.begin()) However, keep in mind that the cpu type MUST represent a linear piece of memory, otherwise you will run into undefined behavior.
gpu_begin | GPU iterator pointing to the beginning of the gpu vector (STL-like) | |
gpu_end | GPU iterator pointing to the end of the vector (STL-like) | |
cpu_begin | Output iterator for the cpu vector. The cpu vector must be at least as long as the gpu vector! |
vector<SCALARTYPE, ALIGNMENT>& viennacl::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.
v1 | The first vector | |
v2 | The second vector |
viennacl::vector<SCALARTYPE> viennacl::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.
val | Right hand side scalar | |
proxy | Left hand side vector expression |
vector<SCALARTYPE> viennacl::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.
proxy | Left hand side vector expression | |
val | Right hand side scalar |
vector_expression< const vector<SCALARTYPE, A>, const SCALARTYPE, op_prod> viennacl::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.
value | The host scalar (float or double) | |
vec | A ViennaCL vector |
viennacl::matrix_expression< const viennacl::matrix_expression< const viennacl::vector<SCALARTYPE, VECTOR_ALIGNMENT>, const viennacl::vector<SCALARTYPE, VECTOR_ALIGNMENT>, op_prod>, const SCALARTYPE, op_prod> viennacl::operator* | ( | const viennacl::matrix_expression< const viennacl::vector< SCALARTYPE, VECTOR_ALIGNMENT >, const viennacl::vector< SCALARTYPE, VECTOR_ALIGNMENT >, op_prod > & | proxy, | |
CPU_SCALAR | val | |||
) |
vector_expression< const vector<SCALARTYPE, A>, const scalar<SCALARTYPE>, op_prod> viennacl::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.
value | The ViennaCL scalar | |
vec | A ViennaCL vector |
viennacl::matrix_expression< const viennacl::matrix_expression< const viennacl::vector<SCALARTYPE, VA1>, const viennacl::vector<SCALARTYPE, VA2>, op_prod>, const SCALARTYPE, op_prod> viennacl::operator* | ( | CPU_SCALAR | val, | |
viennacl::matrix_expression< const viennacl::vector< SCALARTYPE, VA1 >, const viennacl::vector< SCALARTYPE, VA2 >, op_prod > const & | proxy | |||
) |
vector<SCALARTYPE> viennacl::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.
val | Right hand side scalar | |
proxy | Left hand side vector expression |
vector<SCALARTYPE, A> viennacl::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.
proxy | Left hand side vector expression | |
vec | Right hand side vector |
vector_expression< LHS1, RHS1, OP1>::VectorType viennacl::operator+ | ( | vector_expression< LHS1, RHS1, OP1 > const & | proxy1, | |
vector_expression< LHS2, RHS2, OP2 > const & | proxy2 | |||
) |
Operator overload for the addition of two vector expressions.
proxy1 | Left hand side vector expression | |
proxy2 | Right hand side vector expression |
vector<SCALARTYPE, A> viennacl::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.
proxy | Left hand side vector expression | |
vec | Right hand side vector |
vector_expression< LHS1, RHS1, OP1>::VectorType viennacl::operator- | ( | vector_expression< LHS1, RHS1, OP1 > const & | proxy1, | |
vector_expression< LHS2, RHS2, OP2 > const & | proxy2 | |||
) |
Operator overload for the subtraction of two vector expressions.
proxy1 | Left hand side vector expression | |
proxy2 | Right hand side vector expression |
vector<SCALARTYPE> viennacl::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.
proxy | Left hand side vector expression | |
val | Right hand side scalar |
std::ostream& viennacl::operator<< | ( | std::ostream & | s, | |
vector< SCALARTYPE, ALIGNMENT > const & | val | |||
) |
Output stream. Output format is ublas compatible.
s | STL output stream | |
val | The vector that should be printed |
std::ostream& viennacl::operator<< | ( | std::ostream & | s, | |
const matrix_expression< LHS, RHS, OP > & | expr | |||
) |
Prints the matrix. Output is compatible to boost::numeric::ublas.
s | STL output stream | |
gpu_matrix | A dense ViennaCL matrix |
std::ostream& viennacl::operator<< | ( | std::ostream & | s, | |
const matrix< SCALARTYPE, F, ALIGNMENT > & | gpu_matrix | |||
) |
Prints the matrix. Output is compatible to boost::numeric::ublas.
s | STL output stream | |
gpu_matrix | A dense ViennaCL matrix |
std::ostream& viennacl::operator<< | ( | std::ostream & | s, | |
const scalar< SCALARTYPE > & | val | |||
) |
Allows to directly print the value of a scalar to an output stream.
std::istream& viennacl::operator>> | ( | std::istream & | s, | |
const scalar< SCALARTYPE > & | val | |||
) |
Allows to directly read a value of a scalar from an input stream.
void viennacl::swap | ( | viennacl::vector< SCALARTYPE, ALIGNMENT > & | vec1, | |
viennacl::vector< SCALARTYPE, ALIGNMENT > & | vec2 | |||
) |
Swaps the contents of two vectors, data is copied.
vec1 | The first vector | |
vec2 | The second vector | |
NUM_THREADS | The number of threads per work group |
matrix_expression< const matrix<SCALARTYPE, F, ALIGNMENT>, const matrix<SCALARTYPE, F, ALIGNMENT>, op_trans> viennacl::trans | ( | const matrix< SCALARTYPE, F, ALIGNMENT > & | mat | ) |
Returns an expression template class representing a transposed matrix.