ViennaCL - The Vienna Computing Library  1.5.1
Public Types | Public Member Functions
matrix< SCALARTYPE, F, ALIGNMENT > Class Template Reference

A dense matrix class. More...

#include <forwards.h>

Inheritance diagram for matrix< SCALARTYPE, F, ALIGNMENT >:
matrix_base< SCALARTYPE, F >

Public Types

typedef base_type::size_type size_type
 
- Public Types inherited from matrix_base< SCALARTYPE, F >
typedef matrix_iterator
< row_iteration, self_type
iterator1
 
typedef matrix_iterator
< col_iteration, self_type
iterator2
 
typedef scalar< SCALARTYPE > value_type
 
typedef SCALARTYPE cpu_value_type
 
typedef vcl_size_t size_type
 
typedef vcl_ptrdiff_t difference_type
 
typedef
viennacl::backend::mem_handle 
handle_type
 
typedef F orientation_functor
 
typedef F::orientation_category orientation_category
 

Public Member Functions

 matrix ()
 The default constructor. Does not allocate any memory. More...
 
 matrix (size_type rows, size_type columns, viennacl::context ctx=viennacl::context())
 Creates the matrix with the given dimensions. More...
 
template<typename LHS , typename RHS , typename OP >
 matrix (matrix_expression< LHS, RHS, OP > const &proxy)
 
 matrix (identity_matrix< SCALARTYPE > const &m)
 Creates the matrix from the supplied identity matrix. More...
 
 matrix (zero_matrix< SCALARTYPE > const &m)
 Creates the matrix from the supplied zero matrix. More...
 
 matrix (scalar_matrix< SCALARTYPE > const &m)
 Creates the matrix from the supplied scalar matrix. More...
 
 matrix (const base_type &other)
 
 matrix (const self_type &other)
 
void resize (size_type rows, size_type columns, bool preserve=true)
 Resizes the matrix. Existing entries can optionally be preserved. More...
 
- Public Member Functions inherited from matrix_base< SCALARTYPE, F >
 matrix_base ()
 The default constructor. Does not allocate any memory. More...
 
 matrix_base (size_type rows, size_type columns, viennacl::context ctx=viennacl::context())
 Creates the matrix with the given dimensions. More...
 
 matrix_base (viennacl::backend::mem_handle &h, size_type mat_size1, size_type mat_start1, difference_type mat_stride1, size_type mat_internal_size1, size_type mat_size2, size_type mat_start2, difference_type mat_stride2, size_type mat_internal_size2)
 Constructor for creating a matrix_range or matrix_stride from some other matrix/matrix_range/matrix_stride. More...
 
 matrix_base (matrix_expression< const LHS, const RHS, OP > const &proxy)
 
 matrix_base (SCALARTYPE *ptr_to_mem, viennacl::memory_types mem_type, size_type mat_size1, size_type mat_start1, difference_type mat_stride1, size_type mat_internal_size1, size_type mat_size2, size_type mat_start2, difference_type mat_stride2, size_type mat_internal_size2)
 
self_typeoperator= (const self_type &other)
 
self_typeoperator= (const matrix_expression< const LHS, const RHS, OP > &proxy)
 Creates the matrix from the supplied random matrix. More...
 
self_typeoperator= (const matrix_expression< const self_type, const self_type, op_trans > &proxy)
 
self_typeoperator= (identity_matrix< SCALARTYPE > const &m)
 Assigns the supplied identity matrix to the matrix. More...
 
self_typeoperator= (zero_matrix< SCALARTYPE > const &m)
 Assigns the supplied zero matrix to the matrix. More...
 
self_typeoperator= (scalar_matrix< SCALARTYPE > const &m)
 Assigns the supplied scalar vector to the matrix. More...
 
self_typeoperator+= (const matrix_expression< const LHS, const RHS, OP > &proxy)
 
self_typeoperator+= (const self_type &other)
 
self_typeoperator-= (const matrix_expression< const LHS, const RHS, OP > &proxy)
 
self_typeoperator-= (const self_type &other)
 
entry_proxy< SCALARTYPE > operator() (size_type row_index, size_type col_index)
 Read-write access to a single element of the matrix/matrix_range/matrix_slice. More...
 
const_entry_proxy< SCALARTYPE > operator() (size_type row_index, size_type col_index) const
 Read access to a single element of the matrix/matrix_range/matrix_slice. More...
 
self_typeoperator*= (SCALARTYPE val)
 Scales a matrix by a CPU scalar value. More...
 
self_typeoperator/= (SCALARTYPE val)
 Scales this matrix by a CPU scalar value. More...
 
matrix_expression< const
self_type, const SCALARTYPE,
op_mult
operator- () const
 Sign flip for the matrix. Emulated to be equivalent to -1.0 * matrix. More...
 
size_type size1 () const
 Returns the number of rows. More...
 
size_type size2 () const
 Returns the number of columns. More...
 
size_type start1 () const
 Returns the number of rows. More...
 
size_type start2 () const
 Returns the number of columns. More...
 
size_type stride1 () const
 Returns the number of rows. More...
 
size_type stride2 () const
 Returns the number of columns. More...
 
void clear ()
 Resets all entries to zero. More...
 
size_type internal_size1 () const
 Returns the internal number of rows. Usually required for launching OpenCL kernels only. More...
 
size_type internal_size2 () const
 Returns the internal number of columns. Usually required for launching OpenCL kernels only. More...
 
size_type internal_size () const
 Returns the total amount of allocated memory in multiples of sizeof(SCALARTYPE) More...
 
handle_typehandle ()
 Returns the OpenCL handle, non-const-version. More...
 
const handle_typehandle () const
 Returns the OpenCL handle, const-version. More...
 
viennacl::memory_types memory_domain () const
 

Additional Inherited Members

- Static Public Attributes inherited from matrix_base< SCALARTYPE, F >
static const size_type alignment
 
- Protected Member Functions inherited from matrix_base< SCALARTYPE, F >
void set_handle (viennacl::backend::mem_handle const &h)
 
void switch_memory_context (viennacl::context new_ctx)
 
void resize (size_type rows, size_type columns, bool preserve=true)
 Resizes the matrix. Existing entries can be preserved, but. More...
 

Detailed Description

template<class SCALARTYPE, typename F = row_major, unsigned int ALIGNMENT = 1>
class viennacl::matrix< SCALARTYPE, F, ALIGNMENT >

A dense matrix class.

Template Parameters
SCALARTYPEThe underlying scalar type (either float or double)
FStorage layout: Either row_major or column_major (at present only row_major is supported)
ALIGNMENTThe 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.

Member Typedef Documentation

Constructor & Destructor Documentation

matrix ( )
inlineexplicit

The default constructor. Does not allocate any memory.

matrix ( size_type  rows,
size_type  columns,
viennacl::context  ctx = viennacl::context() 
)
inlineexplicit

Creates the matrix with the given dimensions.

Parameters
rowsNumber of rows
columnsNumber of columns
ctxOptional context in which the matrix is created (one out of multiple OpenCL contexts, CUDA, host)
matrix ( matrix_expression< LHS, RHS, OP > const &  proxy)
inline
matrix ( identity_matrix< SCALARTYPE > const &  m)
inline

Creates the matrix from the supplied identity matrix.

matrix ( zero_matrix< SCALARTYPE > const &  m)
inline

Creates the matrix from the supplied zero matrix.

matrix ( scalar_matrix< SCALARTYPE > const &  m)
inline

Creates the matrix from the supplied scalar matrix.

matrix ( const base_type other)
inline
matrix ( const self_type other)
inline

Member Function Documentation

void resize ( size_type  rows,
size_type  columns,
bool  preserve = true 
)
inline

Resizes the matrix. Existing entries can optionally be preserved.

Parameters
rowsNew number of rows
columnsNew number of columns
preserveIf true, existing values are preserved.

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