A dense matrix class. More...
#include <matrix.hpp>
Public Types | |
| typedef matrix_iterator < row_iteration, matrix < SCALARTYPE, F, ALIGNMENT > > | iterator1 |
| typedef matrix_iterator < col_iteration, matrix < SCALARTYPE, F, ALIGNMENT > > | iterator2 |
| typedef scalar< typename viennacl::tools::CHECK_SCALAR_TEMPLATE_ARGUMENT < SCALARTYPE >::ResultType > | value_type |
Public Member Functions | |
| matrix () | |
| The default constructor. Does not allocate any memory. | |
| matrix (unsigned int rows, unsigned int columns) | |
| Creates the matrix with the given dimensions. | |
| matrix (cl_mem mem, unsigned int rows, unsigned int columns) | |
| template<typename LHS , typename RHS , typename OP > | |
| matrix (matrix_expression< LHS, RHS, OP > const &proxy) | |
| matrix (const matrix< SCALARTYPE, F, ALIGNMENT > &mat) | |
| matrix< SCALARTYPE, F, ALIGNMENT > & | operator= (const matrix< SCALARTYPE, F, ALIGNMENT > &mat) |
| matrix< SCALARTYPE, F, ALIGNMENT > & | operator= (const matrix_expression< const matrix< SCALARTYPE, F, ALIGNMENT >, const matrix< SCALARTYPE, F, ALIGNMENT >, op_trans > &proxy) |
| void | resize (unsigned int rows, unsigned int columns, bool preserve=true) |
| Resizes the matrix. Existing entries can be preserved, but. | |
| entry_proxy< SCALARTYPE > | operator() (unsigned int row_index, unsigned int col_index) |
| Read-write access to a single element of the vector. | |
| scalar< SCALARTYPE > | operator() (unsigned int row_index, unsigned int col_index) const |
| Read access to a single element of the vector. | |
| matrix_expression< const matrix< SCALARTYPE, F, ALIGNMENT >, const matrix < SCALARTYPE, F, ALIGNMENT > , op_add > | operator+ (const matrix< SCALARTYPE, F, ALIGNMENT > &other) |
| matrix< SCALARTYPE, F, ALIGNMENT > & | operator+= (const matrix< SCALARTYPE, F, ALIGNMENT > &other) |
| matrix_expression< const matrix< SCALARTYPE, F, ALIGNMENT >, const matrix < SCALARTYPE, F, ALIGNMENT > , op_sub > | operator- (const matrix< SCALARTYPE, F, ALIGNMENT > &other) |
| matrix< SCALARTYPE, F, ALIGNMENT > & | operator-= (const matrix< SCALARTYPE, F, ALIGNMENT > &other) |
| template<unsigned int A1, unsigned int A2> | |
| matrix< SCALARTYPE, F, ALIGNMENT > & | operator+= (const matrix_expression< const vector< SCALARTYPE, A1 >, const vector< SCALARTYPE, A2 >, op_prod > &proxy) |
| template<unsigned int A1, unsigned int A2> | |
| matrix< SCALARTYPE, F, ALIGNMENT > & | operator-= (const matrix_expression< const vector< SCALARTYPE, A1 >, const vector< SCALARTYPE, A2 >, op_prod > &proxy) |
| template<unsigned int A1, unsigned int A2> | |
| matrix< SCALARTYPE, F, ALIGNMENT > & | operator+= (const matrix_expression< const matrix_expression< const vector< SCALARTYPE, A1 >, const vector< SCALARTYPE, A2 >, op_prod >, const SCALARTYPE, op_prod > &proxy) |
| template<unsigned int A1, unsigned int A2> | |
| matrix< SCALARTYPE, F, ALIGNMENT > & | operator-= (const matrix_expression< const matrix_expression< const vector< SCALARTYPE, A1 >, const vector< SCALARTYPE, A2 >, op_prod >, const SCALARTYPE, op_prod > &proxy) |
| matrix< SCALARTYPE, F, ALIGNMENT > & | operator*= (SCALARTYPE val) |
| matrix< SCALARTYPE, F, ALIGNMENT > & | operator*= (scalar< SCALARTYPE > const &val) |
| matrix< SCALARTYPE, F, ALIGNMENT > & | operator/= (SCALARTYPE val) |
| matrix< SCALARTYPE, F, ALIGNMENT > & | operator/= (scalar< SCALARTYPE > const &val) |
| template<typename MatrixType1 , typename MatrixType2 > | |
| matrix< SCALARTYPE, F, ALIGNMENT > & | operator= (const matrix_expression< MatrixType1, MatrixType2, op_prod > &proxy) |
| matrix< SCALARTYPE, F, ALIGNMENT > & | operator= (const matrix_expression< const matrix< SCALARTYPE, F, ALIGNMENT >, const matrix< SCALARTYPE, F, ALIGNMENT >, op_add > &proxy) |
| matrix< SCALARTYPE, F, ALIGNMENT > & | operator= (const matrix_expression< const matrix< SCALARTYPE, F, ALIGNMENT >, const matrix< SCALARTYPE, F, ALIGNMENT >, op_sub > &proxy) |
| const unsigned int & | size1 () const |
| Returns the number of rows. | |
| const unsigned int & | size2 () const |
| Returns the number of columns. | |
| void | clear () |
| Resets all entries to zero. | |
| const unsigned int | internal_size1 () const |
| Returns the internal number of rows. Usually required for launching OpenCL kernels only. | |
| const unsigned int | internal_size2 () const |
| Returns the internal number of columns. Usually required for launching OpenCL kernels only. | |
| const unsigned int | internal_size () const |
| Returns the total amount of allocated memory in multiples of sizeof(SCALARTYPE). | |
| const viennacl::ocl::handle < cl_mem > & | handle () const |
| Returns the OpenCL handle. | |
Friends | |
| template<typename CPU_MATRIX , typename SCALARTYPE2 , typename F2 , unsigned int ALIGNMENT2> | |
| void | copy (const CPU_MATRIX &cpu_matrix, matrix< SCALARTYPE2, F2, ALIGNMENT2 > &gpu_matrix) |
| template<typename SCALARTYPE2 , typename A1 , typename A2 , typename F2 , unsigned int ALIGNMENT2> | |
| void | copy (const std::vector< std::vector< SCALARTYPE2, A1 >, A2 > &cpu_matrix, matrix< SCALARTYPE2, F2, ALIGNMENT2 > &gpu_matrix) |
| template<typename SCALARTYPE2 , typename F2 , unsigned int ALIGNMENT2> | |
| void | fast_copy (SCALARTYPE2 *cpu_matrix_begin, SCALARTYPE2 *cpu_matrix_end, matrix< SCALARTYPE2, F2, ALIGNMENT2 > &gpu_matrix) |
A dense matrix class.
| SCALARTYPE | The underlying scalar type (either float or double) | |
| F | Storage layout: Either row_major or column_major (at present only row_major is supported) | |
| ALIGNMENT | The internal memory size is given by (size()/ALIGNMENT + 1) * ALIGNMENT. ALIGNMENT must be a power of two. Best values or usually 4, 8 or 16, higher values are usually a waste of memory. |
| typedef matrix_iterator<row_iteration, matrix<SCALARTYPE, F, ALIGNMENT> > iterator1 |
| typedef matrix_iterator<col_iteration, matrix<SCALARTYPE, F, ALIGNMENT> > iterator2 |
| typedef scalar<typename viennacl::tools::CHECK_SCALAR_TEMPLATE_ARGUMENT<SCALARTYPE>::ResultType> value_type |
| matrix | ( | ) | [inline] |
The default constructor. Does not allocate any memory.
| matrix | ( | unsigned int | rows, | |
| unsigned int | columns | |||
| ) | [inline, explicit] |
Creates the matrix with the given dimensions.
| rows | Number of rows | |
| columns | Number of columns |
| matrix | ( | cl_mem | mem, | |
| unsigned int | rows, | |||
| unsigned int | columns | |||
| ) | [inline, explicit] |
| matrix | ( | matrix_expression< LHS, RHS, OP > const & | proxy | ) | [inline] |
| void clear | ( | ) | [inline] |
Resets all entries to zero.
| const viennacl::ocl::handle<cl_mem>& handle | ( | ) | const [inline] |
Returns the OpenCL handle.
| const unsigned int internal_size | ( | ) | const [inline] |
Returns the total amount of allocated memory in multiples of sizeof(SCALARTYPE).
| const unsigned int internal_size1 | ( | ) | const [inline] |
Returns the internal number of rows. Usually required for launching OpenCL kernels only.
| const unsigned int internal_size2 | ( | ) | const [inline] |
Returns the internal number of columns. Usually required for launching OpenCL kernels only.
| entry_proxy<SCALARTYPE> operator() | ( | unsigned int | row_index, | |
| unsigned int | col_index | |||
| ) | [inline] |
Read-write access to a single element of the vector.
| scalar<SCALARTYPE> operator() | ( | unsigned int | row_index, | |
| unsigned int | col_index | |||
| ) | const [inline] |
Read access to a single element of the vector.
| matrix<SCALARTYPE, F, ALIGNMENT>& operator*= | ( | SCALARTYPE | val | ) | [inline] |
| matrix_expression< const matrix<SCALARTYPE, F, ALIGNMENT>, const matrix<SCALARTYPE, F, ALIGNMENT>, op_add > operator+ | ( | const matrix< SCALARTYPE, F, ALIGNMENT > & | other | ) | [inline] |
| matrix<SCALARTYPE, F, ALIGNMENT>& operator+= | ( | const matrix_expression< const vector< SCALARTYPE, A1 >, const vector< SCALARTYPE, A2 >, op_prod > & | proxy | ) | [inline] |
| matrix<SCALARTYPE, F, ALIGNMENT>& operator+= | ( | const matrix_expression< const matrix_expression< const vector< SCALARTYPE, A1 >, const vector< SCALARTYPE, A2 >, op_prod >, const SCALARTYPE, op_prod > & | proxy | ) | [inline] |
| matrix<SCALARTYPE, F, ALIGNMENT>& operator+= | ( | const matrix< SCALARTYPE, F, ALIGNMENT > & | other | ) | [inline] |
| matrix_expression< const matrix<SCALARTYPE, F, ALIGNMENT>, const matrix<SCALARTYPE, F, ALIGNMENT>, op_sub > operator- | ( | const matrix< SCALARTYPE, F, ALIGNMENT > & | other | ) | [inline] |
| matrix<SCALARTYPE, F, ALIGNMENT>& operator-= | ( | const matrix< SCALARTYPE, F, ALIGNMENT > & | other | ) | [inline] |
| matrix<SCALARTYPE, F, ALIGNMENT>& operator-= | ( | const matrix_expression< const vector< SCALARTYPE, A1 >, const vector< SCALARTYPE, A2 >, op_prod > & | proxy | ) | [inline] |
| matrix<SCALARTYPE, F, ALIGNMENT>& operator-= | ( | const matrix_expression< const matrix_expression< const vector< SCALARTYPE, A1 >, const vector< SCALARTYPE, A2 >, op_prod >, const SCALARTYPE, op_prod > & | proxy | ) | [inline] |
| matrix<SCALARTYPE, F, ALIGNMENT>& operator/= | ( | SCALARTYPE | val | ) | [inline] |
| matrix<SCALARTYPE, F, ALIGNMENT>& operator= | ( | const matrix_expression< const matrix< SCALARTYPE, F, ALIGNMENT >, const matrix< SCALARTYPE, F, ALIGNMENT >, op_add > & | proxy | ) | [inline] |
| matrix<SCALARTYPE, F, ALIGNMENT>& operator= | ( | const matrix_expression< MatrixType1, MatrixType2, op_prod > & | proxy | ) | [inline] |
| matrix<SCALARTYPE, F, ALIGNMENT>& operator= | ( | const matrix_expression< const matrix< SCALARTYPE, F, ALIGNMENT >, const matrix< SCALARTYPE, F, ALIGNMENT >, op_sub > & | proxy | ) | [inline] |
| matrix<SCALARTYPE, F, ALIGNMENT>& operator= | ( | const matrix_expression< const matrix< SCALARTYPE, F, ALIGNMENT >, const matrix< SCALARTYPE, F, ALIGNMENT >, op_trans > & | proxy | ) | [inline] |
| matrix<SCALARTYPE, F, ALIGNMENT>& operator= | ( | const matrix< SCALARTYPE, F, ALIGNMENT > & | mat | ) | [inline] |
| void resize | ( | unsigned int | rows, | |
| unsigned int | columns, | |||
| bool | preserve = true | |||
| ) | [inline] |
Resizes the matrix. Existing entries can be preserved, but.
| rows | New number of rows | |
| columns | New number of columns | |
| preserve | If true, existing values are preserved. |
| const unsigned int& size1 | ( | ) | const [inline] |
Returns the number of rows.
| const unsigned int& size2 | ( | ) | const [inline] |
Returns the number of columns.
| void copy | ( | const CPU_MATRIX & | cpu_matrix, | |
| matrix< SCALARTYPE2, F2, ALIGNMENT2 > & | gpu_matrix | |||
| ) | [friend] |
| void copy | ( | const std::vector< std::vector< SCALARTYPE2, A1 >, A2 > & | cpu_matrix, | |
| matrix< SCALARTYPE2, F2, ALIGNMENT2 > & | gpu_matrix | |||
| ) | [friend] |
| void fast_copy | ( | SCALARTYPE2 * | cpu_matrix_begin, | |
| SCALARTYPE2 * | cpu_matrix_end, | |||
| matrix< SCALARTYPE2, F2, ALIGNMENT2 > & | gpu_matrix | |||
| ) | [friend] |
1.7.1