ViennaCL - The Vienna Computing Library
1.5.0
|
Implementation of the dense matrix class. More...
#include "viennacl/forwards.h"
#include "viennacl/scalar.hpp"
#include "viennacl/vector.hpp"
#include "viennacl/linalg/matrix_operations.hpp"
#include "viennacl/linalg/sparse_matrix_operations.hpp"
#include "viennacl/tools/tools.hpp"
#include "viennacl/tools/matrix_size_deducer.hpp"
#include "viennacl/meta/result_of.hpp"
#include "viennacl/meta/enable_if.hpp"
#include "viennacl/traits/handle.hpp"
Go to the source code of this file.
Data Structures | |
class | implicit_matrix_base< SCALARTYPE > |
Base class for representing matrices where the individual entries are not all stored explicitly, e.g. identity_matrix<> More... | |
class | identity_matrix< SCALARTYPE > |
Represents a vector consisting of 1 at a given index and zeros otherwise. To be used as an initializer for viennacl::vector, vector_range, or vector_slize only. More... | |
class | zero_matrix< SCALARTYPE > |
Represents a vector consisting of zeros only. To be used as an initializer for viennacl::vector, vector_range, or vector_slize only. More... | |
class | scalar_matrix< SCALARTYPE > |
Represents a vector consisting of scalars 's' only, i.e. v[i] = s for all i. To be used as an initializer for viennacl::vector, vector_range, or vector_slize only. More... | |
class | matrix_expression< LHS, RHS, OP > |
Expression template class for representing a tree of expressions which ultimately result in a matrix. More... | |
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< ROWCOL, MATRIXTYPE > |
uBLAS-like iterator class for iterating over the entries of a dense matrix. More... | |
class | matrix_base< SCALARTYPE, F, SizeType, DistanceType > |
A dense matrix class. More... | |
class | matrix< SCALARTYPE, F, ALIGNMENT > |
A dense matrix class. More... | |
Namespaces | |
namespace | viennacl |
Main namespace in ViennaCL. Holds all the basic types such as vector, matrix, etc. and defines operations upon them. | |
Functions | |
template<class SCALARTYPE , typename F > | |
std::ostream & | operator<< (std::ostream &s, const matrix_base< SCALARTYPE, F > &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<typename NumericT , typename F > | |
matrix_expression< const matrix_base< NumericT, F > , const matrix_base< NumericT, F >, op_trans > | trans (const matrix_base< NumericT, F > &mat) |
Returns an expression template class representing a transposed matrix. | |
template<typename NumericT , typename F > | |
vector_expression< const matrix_base< NumericT, F > , const int, op_matrix_diag > | diag (const matrix_base< NumericT, F > &A, int k=0) |
template<typename NumericT > | |
matrix_expression< const vector_base< NumericT >, const int, op_vector_diag > | diag (const vector_base< NumericT > &v, int k=0) |
template<typename NumericT , typename F > | |
vector_expression< const matrix_base< NumericT, F > , const unsigned int, op_row > | row (const matrix_base< NumericT, F > &A, unsigned int i) |
template<typename NumericT , typename F > | |
vector_expression< const matrix_base< NumericT, F > , const unsigned int, op_column > | column (const matrix_base< NumericT, F > &A, unsigned int j) |
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 LHS1 , typename RHS1 , typename OP1 , typename LHS2 , typename RHS2 , typename OP2 > | |
matrix_expression< const matrix_expression< const LHS1, const RHS1, OP1 >, const matrix_expression< const LHS2, const RHS2, OP2 >, op_add > | operator+ (matrix_expression< const LHS1, const RHS1, OP1 > const &proxy1, matrix_expression< const LHS2, const RHS2, OP2 > const &proxy2) |
Generic 'catch-all' overload, which enforces a temporary if the expression tree gets too deep. | |
template<typename LHS1 , typename RHS1 , typename OP1 , typename NumericT , typename F > | |
matrix_expression< const matrix_expression< const LHS1, const RHS1, OP1 >, const matrix_base< NumericT, F > , op_add > | operator+ (matrix_expression< const LHS1, const RHS1, OP1 > const &proxy1, matrix_base< NumericT, F > const &proxy2) |
template<typename NumericT , typename F , typename LHS2 , typename RHS2 , typename OP2 > | |
matrix_expression< const matrix_base< NumericT, F > , const matrix_expression < const LHS2, const RHS2, OP2 > , op_add > | operator+ (matrix_base< NumericT, F > const &proxy1, matrix_expression< const LHS2, const RHS2, OP2 > const &proxy2) |
template<typename NumericT , typename F > | |
matrix_expression< const matrix_base< NumericT, F > , const matrix_base< NumericT, F >, op_add > | operator+ (const matrix_base< NumericT, F > &m1, const matrix_base< NumericT, F > &m2) |
Operator overload for m1 + m2, where m1 and m2 are either dense matrices, matrix ranges, or matrix slices. No mixing of different storage layouts allowed at the moment. | |
template<typename LHS1 , typename RHS1 , typename OP1 , typename LHS2 , typename RHS2 , typename OP2 > | |
matrix_expression< const matrix_expression< const LHS1, const RHS1, OP1 >, const matrix_expression< const LHS2, const RHS2, OP2 >, op_sub > | operator- (matrix_expression< const LHS1, const RHS1, OP1 > const &proxy1, matrix_expression< const LHS2, const RHS2, OP2 > const &proxy2) |
template<typename LHS1 , typename RHS1 , typename OP1 , typename NumericT , typename F > | |
matrix_expression< const matrix_expression< const LHS1, const RHS1, OP1 >, const matrix_base< NumericT, F > , op_sub > | operator- (matrix_expression< const LHS1, const RHS1, OP1 > const &proxy1, matrix_base< NumericT, F > const &proxy2) |
template<typename NumericT , typename F , typename LHS2 , typename RHS2 , typename OP2 > | |
matrix_expression< const matrix_base< NumericT, F > , const matrix_expression < const LHS2, const RHS2, OP2 > , op_sub > | operator- (matrix_base< NumericT, F > const &proxy1, matrix_expression< const LHS2, const RHS2, OP2 > const &proxy2) |
template<typename NumericT , typename F > | |
matrix_expression< const matrix_base< NumericT, F > , const matrix_base< NumericT, F >, op_sub > | operator- (const matrix_base< NumericT, F > &m1, const matrix_base< NumericT, F > &m2) |
Operator overload for m1 - m2, where m1 and m2 are either dense matrices, matrix ranges, or matrix slices. No mixing of different storage layouts allowed at the moment. | |
template<typename S1 , typename NumericT , typename F > | |
viennacl::enable_if < viennacl::is_any_scalar< S1 > ::value, matrix_expression < const matrix_base< NumericT, F >, const S1, op_mult > >::type | operator* (S1 const &value, matrix_base< NumericT, F > const &m1) |
Operator overload for the expression alpha * m1, where alpha is a host scalar (float or double) and m1 is a ViennaCL matrix. | |
template<typename LHS , typename RHS , typename OP , typename S1 > | |
viennacl::enable_if < viennacl::is_any_scalar< S1 > ::value, matrix_expression < const matrix_expression< LHS, RHS, OP >, const S1, op_mult > >::type | operator* (matrix_expression< LHS, RHS, OP > const &proxy, S1 const &val) |
Operator overload for the multiplication of a matrix expression with a scalar from the right, e.g. (beta * m1) * alpha. Here, beta * m1 is wrapped into a matrix_expression and then multiplied with alpha from the right. | |
template<typename S1 , typename LHS , typename RHS , typename OP > | |
viennacl::enable_if < viennacl::is_any_scalar< S1 > ::value, matrix_expression < const matrix_expression< LHS, RHS, OP >, const S1, op_mult > >::type | operator* (S1 const &val, matrix_expression< LHS, RHS, OP > const &proxy) |
Operator overload for the multiplication of a matrix expression with a ViennaCL scalar from the left, e.g. alpha * (beta * m1). Here, beta * m1 is wrapped into a matrix_expression and then multiplied with alpha from the left. | |
template<typename NumericT , typename F , typename S1 > | |
viennacl::enable_if < viennacl::is_any_scalar< S1 > ::value, matrix_expression < const matrix_base< NumericT, F >, const S1, op_mult > >::type | operator* (matrix_base< NumericT, F > const &m1, S1 const &s1) |
Scales the matrix by a GPU scalar 'alpha' and returns an expression template. | |
template<typename NumericT , typename F , typename S1 > | |
viennacl::enable_if < viennacl::is_scalar< S1 > ::value, matrix_base< NumericT, F > & >::type | operator*= (matrix_base< NumericT, F > &m1, S1 const &gpu_val) |
Scales a matrix by a GPU scalar value. | |
template<typename LHS , typename RHS , typename OP , typename S1 > | |
viennacl::enable_if < viennacl::is_any_scalar< S1 > ::value, matrix_expression < const matrix_expression < const LHS, const RHS, OP > , const S1, op_div > >::type | operator/ (matrix_expression< const LHS, const RHS, OP > const &proxy, S1 const &val) |
Operator overload for the division of a matrix expression by a scalar from the right, e.g. (beta * m1) / alpha. Here, beta * m1 is wrapped into a matrix_expression and then divided by alpha. | |
template<typename NumericT , typename F , typename S1 > | |
viennacl::enable_if < viennacl::is_any_scalar< S1 > ::value, matrix_expression < const matrix_base< NumericT, F >, const S1, op_div > >::type | operator/ (matrix_base< NumericT, F > const &m1, S1 const &s1) |
Returns an expression template for scaling the matrix by a GPU scalar 'alpha'. | |
template<typename NumericT , typename F , typename S1 > | |
viennacl::enable_if < viennacl::is_scalar< S1 > ::value, matrix_base< NumericT, F > & >::type | operator/= (matrix_base< NumericT, F > &m1, S1 const &gpu_val) |
Scales a matrix by a GPU scalar value. | |
template<typename NumericT , typename S1 > | |
viennacl::enable_if < viennacl::is_scalar< S1 > ::value, viennacl::matrix_expression < const viennacl::matrix_expression < const vector_base< NumericT > , const vector_base< NumericT > , op_prod >, const S1, op_mult > >::type | operator* (const viennacl::matrix_expression< const vector_base< NumericT >, const vector_base< NumericT >, op_prod > &proxy, const S1 &val) |
template<typename NumericT , typename S1 > | |
viennacl::enable_if < viennacl::is_scalar< S1 > ::value, viennacl::matrix_expression < const viennacl::matrix_expression < const vector_base< NumericT > , const vector_base< NumericT > , op_prod >, const S1, op_mult > >::type | operator* (const S1 &val, const viennacl::matrix_expression< const vector_base< NumericT >, const vector_base< NumericT >, op_prod > &proxy) |
Implementation of the dense matrix class.