All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
viennacl::matrix< SCALARTYPE, F, ALIGNMENT > Class Template Reference

A dense matrix class. More...

`#include <forwards.h>`

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

## Public Types

typedef base_type::size_type | size_type
Public Types inherited from viennacl::matrix_base< NumericT >
typedef matrix_iterator < row_iteration, self_type > | iterator1
typedef matrix_iterator < col_iteration, self_type > | iterator2
typedef scalar< NumericT > | value_type
typedef NumericT | cpu_value_type
typedef SizeT | size_type
typedef DistanceT | difference_type
typedef viennacl::backend::mem_handle | handle_type

## 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...
| matrix (NumericT *ptr_to_mem, viennacl::memory_types mem_type, size_type rows, size_type cols)
| Wraps a CUDA or host buffer provided by the user. More...
| matrix (NumericT *ptr_to_mem, viennacl::memory_types mem_type, size_type rows, size_type internal_row_count, size_type cols, size_type internal_col_count)
| Wraps a CUDA or host buffer provided by the user including padding of rows and columns. More...
template<typename LHS , typename RHS , typename OP >
| matrix (matrix_expression< LHS, RHS, OP > const &proxy)
| matrix (identity_matrix< NumericT > const &m)
| Creates the matrix from the supplied identity matrix. More...
| matrix (zero_matrix< NumericT > const &m)
| Creates the matrix from the supplied zero matrix. More...
| matrix (scalar_matrix< NumericT > const &m)
| Creates the matrix from the supplied scalar matrix. More...
| matrix (const base_type &other)
| matrix (const self_type &other)
template<typename OtherNumericT , typename F2 >
base_type & | operator= (viennacl::matrix< OtherNumericT, F2 > const &B)
template<typename OtherNumericT , typename F2 >
base_type & | operator= (viennacl::matrix_range< viennacl::matrix< OtherNumericT, F2 > > const &B)
template<typename OtherNumericT , typename F2 >
base_type & | operator= (viennacl::matrix_slice< viennacl::matrix< OtherNumericT, F2 > > const &B)
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 viennacl::matrix_base< NumericT >
| matrix_base ()
| The default constructor. Does not allocate any memory. More...
| matrix_base (bool is_row_major)
| The layout constructor. Does not allocate any memory. More...
| matrix_base (size_type rows, size_type columns, bool is_row_major, 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, size_type mat_stride1, size_type mat_internal_size1, size_type mat_size2, size_type mat_start2, size_type mat_stride2, size_type mat_internal_size2, bool is_row_major)
| 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)
| Constructor for creating a matrix_range or matrix_stride from some other matrix/matrix_range/matrix_stride. More...
| matrix_base (NumericT *ptr_to_mem, viennacl::memory_types mem_type, size_type mat_size1, size_type mat_start1, size_type mat_stride1, size_type mat_internal_size1, size_type mat_size2, size_type mat_start2, size_type mat_stride2, size_type mat_internal_size2, bool is_row_major)
| matrix_base (const self_type &other)
| matrix_base (const matrix_base< OtherNumericT, SizeT, DistanceT > &other)
self_type & | operator= (const self_type &other)
self_type & | operator= (const matrix_base< OtherNumericT, SizeT, DistanceT > &other)
self_type & | operator= (const matrix_expression< const LHS, const RHS, OP > &proxy)
| Implementation of the operation m1 = m2 @ alpha, where @ denotes either multiplication or division, and alpha is either a CPU or a GPU scalar. More...
self_type & | operator= (const matrix_expression< const self_type, const self_type, op_trans > &proxy)
self_type & | operator= (identity_matrix< NumericT > const &m)
| Assigns the supplied identity matrix to the matrix. More...
self_type & | operator= (zero_matrix< NumericT > const &m)
| Assigns the supplied zero matrix to the matrix. More...
self_type & | operator= (scalar_matrix< NumericT > const &m)
| Assigns the supplied scalar vector to the matrix. More...
self_type & | operator+= (const matrix_expression< const LHS, const RHS, OP > &proxy)
self_type & | operator+= (const self_type &other)
self_type & | operator-= (const matrix_expression< const LHS, const RHS, OP > &proxy)
self_type & | operator-= (const self_type &other)
entry_proxy< NumericT > | 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< NumericT > | 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_type & | operator*= (char val)
| Scales the matrix by a char (8-bit integer) More...
self_type & | operator*= (short val)
| Scales the matrix by a short integer. More...
self_type & | operator*= (int val)
| Scales the matrix by an integer. More...
self_type & | operator*= (long val)
| Scales the matrix by a long integer. More...
self_type & | operator*= (float val)
| Scales the matrix by a single precision floating point value. More...
self_type & | operator*= (double val)
| Scales the matrix by a double precision floating point value. More...
self_type & | operator/= (char val)
| Scales the matrix by a char (8-bit integer) More...
self_type & | operator/= (short val)
| Scales the matrix by a short integer. More...
self_type & | operator/= (int val)
| Scales the matrix by an integer. More...
self_type & | operator/= (long val)
| Scales the matrix by a long integer. More...
self_type & | operator/= (float val)
| Scales the matrix by a single precision floating point value. More...
self_type & | operator/= (double val)
| Scales the matrix by a double precision floating point value. More...
matrix_expression< const self_type, const NumericT, 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(NumericT) More...
handle_type & | handle ()
| Returns the OpenCL handle, non-const-version. More...
const handle_type & | handle () const
| Returns the OpenCL handle, const-version. More...
viennacl::memory_types | memory_domain () const
bool | row_major () const
void | switch_memory_context (viennacl::context new_ctx)

## Additional Inherited Members

Protected Member Functions inherited from viennacl::matrix_base< NumericT >
void | set_handle (viennacl::backend::mem_handle const &h)
void | resize (size_type rows, size_type columns, bool preserve=true)

## 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

  NumericT | The underlying scalar type (either float or double)
  F | Storage layout: Either row_major or column_major
  AlignmentV | The internal memory size is given by (size()/AlignmentV + 1) * AlignmentV. AlignmentV must be a power of two. Best values or usually 4, 8 or 16, higher values are usually a waste of memory.

Examples:
  blas2.cpp, blas3.cpp, custom-context.cpp, eigen-with-viennacl.cpp, fft.cpp, lanczos.cpp, least-squares.cpp, matrix-range.cpp, mtl4-with-viennacl.cpp, nmf.cpp, qr.cpp, qr_method.cpp, and tql2.cpp.

Definition at line 375 of file forwards.h.

## Member Typedef Documentation

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

typedef base_type::size_type viennacl::matrix< SCALARTYPE, F, ALIGNMENT >::size_type

Definition at line 701 of file matrix.hpp.

## Constructor & Destructor Documentation

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

viennacl::matrix< SCALARTYPE, F, ALIGNMENT >::matrix | ( |  | ) |

inline explicit

The default constructor. Does not allocate any memory.

Definition at line 704 of file matrix.hpp.

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

viennacl::matrix< SCALARTYPE, F, ALIGNMENT >::matrix | ( | size_type | rows,
|  | size_type | columns,
|  | viennacl::context | ctx = `viennacl::context()`
| ) |  |

inline explicit

Creates the matrix with the given dimensions.

Parameters

  rows | Number of rows
  columns | Number of columns
  ctx | Optional context in which the matrix is created (one out of multiple OpenCL contexts, CUDA, host)

Definition at line 712 of file matrix.hpp.

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

viennacl::matrix< SCALARTYPE, F, ALIGNMENT >::matrix | ( | NumericT * | ptr_to_mem,
|  | viennacl::memory_types | mem_type,
|  | size_type | rows,
|  | size_type | cols
| ) |  |

inline explicit

Wraps a CUDA or host buffer provided by the user.

Parameters

  ptr_to_mem | The pointer to existing memory
  mem_type | Type of the memory (either viennacl::CUDA_MEMORY if available, or viennacl::HOST_MEMORY)
  rows | Number of rows of the matrix
  cols | Number of columns of the matrix

Definition at line 721 of file matrix.hpp.

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

viennacl::matrix< SCALARTYPE, F, ALIGNMENT >::matrix | ( | NumericT * | ptr_to_mem,
|  | viennacl::memory_types | mem_type,
|  | size_type | rows,
|  | size_type | internal_row_count,
|  | size_type | cols,
|  | size_type | internal_col_count
| ) |  |

inline explicit

Wraps a CUDA or host buffer provided by the user including padding of rows and columns.

Parameters

  ptr_to_mem | The pointer to existing memory
  mem_type | Type of the memory (either viennacl::CUDA_MEMORY if available, or viennacl::HOST_MEMORY)
  rows | Number of rows of the matrix
  internal_row_count | Number of rows including padding the buffer by e.g. zeros.
  cols | Number of columns of the matrix
  internal_col_count | Number of columns including padding the buffer by e.g. zeros.

Definition at line 737 of file matrix.hpp.

template<class SCALARTYPE, typename F = row_major, unsigned int ALIGNMENT = 1>
template<typename LHS , typename RHS , typename OP >

viennacl::matrix< SCALARTYPE, F, ALIGNMENT >::matrix | ( | matrix_expression< LHS, RHS, OP > const & | proxy | ) |

inline

Definition at line 750 of file matrix.hpp.

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

viennacl::matrix< SCALARTYPE, F, ALIGNMENT >::matrix | ( | identity_matrix< NumericT > const & | m | ) |

inline

Creates the matrix from the supplied identity matrix.

Definition at line 753 of file matrix.hpp.

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

viennacl::matrix< SCALARTYPE, F, ALIGNMENT >::matrix | ( | zero_matrix< NumericT > const & | m | ) |

inline

Creates the matrix from the supplied zero matrix.

Definition at line 760 of file matrix.hpp.

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

viennacl::matrix< SCALARTYPE, F, ALIGNMENT >::matrix | ( | scalar_matrix< NumericT > const & | m | ) |

inline

Creates the matrix from the supplied scalar matrix.

Definition at line 767 of file matrix.hpp.

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

viennacl::matrix< SCALARTYPE, F, ALIGNMENT >::matrix | ( | const base_type & | other | ) |

inline

Definition at line 773 of file matrix.hpp.

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

viennacl::matrix< SCALARTYPE, F, ALIGNMENT >::matrix | ( | const self_type & | other | ) |

inline

Definition at line 780 of file matrix.hpp.

## Member Function Documentation

template<class SCALARTYPE, typename F = row_major, unsigned int ALIGNMENT = 1>
template<typename OtherNumericT , typename F2 >

base_type& viennacl::matrix< SCALARTYPE, F, ALIGNMENT >::operator= | ( | viennacl::matrix< OtherNumericT, F2 > const & | B | ) |

inline

Definition at line 798 of file matrix.hpp.

template<class SCALARTYPE, typename F = row_major, unsigned int ALIGNMENT = 1>
template<typename OtherNumericT , typename F2 >

base_type& viennacl::matrix< SCALARTYPE, F, ALIGNMENT >::operator= | ( | viennacl::matrix_range< viennacl::matrix< OtherNumericT, F2 > > const & | B | ) |

inline

Definition at line 801 of file matrix.hpp.

template<class SCALARTYPE, typename F = row_major, unsigned int ALIGNMENT = 1>
template<typename OtherNumericT , typename F2 >

base_type& viennacl::matrix< SCALARTYPE, F, ALIGNMENT >::operator= | ( | viennacl::matrix_slice< viennacl::matrix< OtherNumericT, F2 > > const & | B | ) |

inline

Definition at line 804 of file matrix.hpp.

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

void viennacl::matrix< SCALARTYPE, F, ALIGNMENT >::resize | ( | size_type | rows,
|  | size_type | columns,
|  | bool | preserve = `true`
| ) |  |

inline

Resizes the matrix. Existing entries can optionally be preserved.

Parameters

  rows | New number of rows
  columns | New number of columns
  preserve | If true, existing values are preserved.

Definition at line 813 of file matrix.hpp.

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

- viennacl/forwards.h
- viennacl/matrix.hpp