File view_matrix_dense.hpp

template<typename T>
class DenseMatrix : public Matrix
#include <view_matrix_dense.hpp>

A two-dimensional view that provides access to values stored in a dense matrix of a specific size.

Template Parameters:

T – The type of the values, the view provides access to

Subclassed by CContiguousView< T >, FortranContiguousView< T >

Public Types

typedef T value_type

The type of the values, the view provides access to.

typedef View<value_type>::const_iterator value_const_iterator

An iterator that provides read-only access to the values in the view.

typedef View<value_type>::iterator value_iterator

An iterator that provides access to the values in the view and allows to modify them.

Public Functions

inline DenseMatrix(T *array, uint32 numRows, uint32 numCols)
Parameters:
  • array – A pointer to an array of template type T that stores the values, the view should provide access to

  • numRows – The number of rows in the view

  • numCols – The number of columns in the view

inline DenseMatrix(const DenseMatrix<T> &other)
Parameters:

other – A const reference to an object of type DenseMatrix that should be copied

inline DenseMatrix(DenseMatrix<T> &&other)
Parameters:

other – A reference to an object of type DenseMatrix that should be moved

inline virtual ~DenseMatrix() override
inline void clear()

Sets all values stored in the matrix to zero.

inline value_type *release()

Releases the ownership of the array that stores the values, the view provides access to. As a result, the behavior of this view becomes undefined and it should not be used anymore. The caller is responsible for freeing the memory that is occupied by the array.

Returns:

A pointer to the array that stores the values, the view provides access to

Public Members

T *array

A pointer to the array that stores the values, the view provides access to.

template<typename Matrix>
class DenseMatrixAllocator : public Matrix
#include <view_matrix_dense.hpp>

Allocates the memory, a two-dimensional dense view provides access to.

Template Parameters:

Matrix – The type of the view

Public Functions

inline DenseMatrixAllocator(uint32 numRows, uint32 numCols, bool init = false)
Parameters:
  • numRows – The number of rows in the view

  • numCols – The number of columns in the view

  • init – True, if all elements in the view should be value-initialized, false otherwise

inline DenseMatrixAllocator(const DenseMatrixAllocator<Matrix> &other)
Parameters:

other – A reference to an object of type DenseMatrixAllocator that should be copied

inline DenseMatrixAllocator(DenseMatrixAllocator<Matrix> &&other)
Parameters:

other – A reference to an object of type DenseMatrixAllocator that should be moved

inline virtual ~DenseMatrixAllocator() override
template<typename Matrix>
class IterableDenseMatrixDecorator : public Matrix
#include <view_matrix_dense.hpp>

Provides row- or column-wise access via iterators to the values stored in a dense matrix.

Template Parameters:

Matrix – The type of the matrix

Subclassed by CContiguousMatrix< T >, DensePredictionMatrix< T >

Public Types

typedef Matrix::view_type::value_const_iterator value_const_iterator

An iterator that provides read-only access to the values stored in the matrix.

typedef Matrix::view_type::value_iterator value_iterator

An iterator that provides access to the values stored in the matrix and allows to modify them.

Public Functions

inline IterableDenseMatrixDecorator(typename Matrix::view_type &&view)
Parameters:

view – The view, the matrix should be backed by

inline virtual ~IterableDenseMatrixDecorator() override
inline value_const_iterator values_cbegin(uint32 index) const

Returns a value_const_iterator to the beginning of a specific row or column in the matrix, depending on the memory layout of the view, the matrix is backed by.

Parameters:

index – The index of the row or column

Returns:

A value_const_iterator to the beginning of the row or column

inline value_const_iterator values_cend(uint32 index) const

Returns a value_const_iterator to the end of a specific row or column in the matrix, depending on the memory layout of the view, the matrix is backed by.

Parameters:

index – The index of the row or column

Returns:

A value_const_iterator to the end of the row or column

inline value_iterator values_begin(uint32 index)

Returns a value_iterator to the beginning of a specific row or column in the matrix, depending on the memory layout of the view, the memory is backed by.

Parameters:

index – The index of the row or column

Returns:

A value_iterator to the beginning of the row or column

inline value_iterator values_end(uint32 index)

Returns a value_iterator to the end of a specific row or column in the matrix, depending on the memory layout of the view, the memory is backed by.

Parameters:

index – The index of the row or column

Returns:

A value_iterator to the end of the row or column