All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | List of all members
blaze::DenseMatrixProxy< PT, MT > Class Template Reference

Proxy backend for dense matrix types.The DenseMatrixProxy class serves as a backend for the Proxy class. It is used in case the data type represented by the proxy is a dense matrix and augments the Proxy interface by the complete interface required of dense matrices. More...

#include <DenseMatrixProxy.h>

Inherits blaze::DenseMatrix< PT, IsColumnMajorMatrix< MT >::value >.

Public Types

typedef MT::Reference Reference
 Reference to a non-constant matrix value.
 
typedef MT::ConstReference ConstReference
 Reference to a constant matrix value.
 
typedef MT::Pointer Pointer
 Pointer to a non-constant matrix value.
 
typedef MT::ConstPointer ConstPointer
 Pointer to a constant matrix value.
 
typedef MT::Iterator Iterator
 Iterator over non-constant elements.
 
typedef MT::ConstIterator ConstIterator
 Iterator over constant elements.
 
typedef MT MatrixType
 Type of the matrix.
 

Public Member Functions

BLAZE_ALWAYS_INLINE MatrixTypeoperator~ ()
 Conversion operator for non-constant matrices. More...
 
BLAZE_ALWAYS_INLINE const
MatrixType
operator~ () const
 Conversion operator for constant matrices. More...
 
Data access functions
Reference operator() (size_t i, size_t j) const
 Function call operator for the direct access to matrix elements. More...
 
Pointer data () const
 Low-level data access to matrix elements. More...
 
Pointer data (size_t i) const
 Low-level data access to matrix elements of row/column i. More...
 
Iterator begin (size_t i) const
 Returns an iterator to the first element of row/column i of the represented matrix. More...
 
ConstIterator cbegin (size_t i) const
 Returns an iterator to the first element of row/column i of the represented matrix. More...
 
Iterator end (size_t i) const
 Returns an iterator just past the last element of row/column i of the represented matrix. More...
 
ConstIterator cend (size_t i) const
 Returns an iterator just past the last element of row/column i of the represented matrix. More...
 
Utility functions
size_t rows () const
 Returns the current number of rows of the represented matrix. More...
 
size_t columns () const
 Returns the current number of columns of the represented matrix. More...
 
size_t spacing () const
 Returns the spacing between the beginning of two rows/columns of the represented matrix. More...
 
size_t capacity () const
 Returns the maximum capacity of the represented matrix. More...
 
size_t capacity (size_t i) const
 Returns the current capacity of the specified row/column of the represented matrix. More...
 
size_t nonZeros () const
 Returns the number of non-zero elements in the represented matrix. More...
 
size_t nonZeros (size_t i) const
 Returns the number of non-zero elements in the specified row/column of the represented matrix. More...
 
void reset () const
 Reset to the default initial value. More...
 
void reset (size_t i) const
 Reset the specified row/column to the default initial values. More...
 
void clear () const
 Clearing the represented matrix. More...
 
void resize (size_t m, size_t n, bool preserve=true) const
 Changing the size of the represented matrix. More...
 
void extend (size_t m, size_t n, bool preserve=true) const
 Extending the size of the represented matrix. More...
 
void reserve (size_t n) const
 Setting the minimum capacity of the represented matrix. More...
 
void transpose () const
 Transposing the represented matrix. More...
 
template<typename Other >
void scale (const Other &scalar) const
 Scaling of the matrix by the scalar value scalar ( $ A=B*s $). More...
 

Detailed Description

template<typename PT, typename MT>
class blaze::DenseMatrixProxy< PT, MT >

Proxy backend for dense matrix types.

The DenseMatrixProxy class serves as a backend for the Proxy class. It is used in case the data type represented by the proxy is a dense matrix and augments the Proxy interface by the complete interface required of dense matrices.

Member Function Documentation

template<typename PT , typename MT >
DenseMatrixProxy< PT, MT >::Iterator blaze::DenseMatrixProxy< PT, MT >::begin ( size_t  i) const
inline

Returns an iterator to the first element of row/column i of the represented matrix.

Parameters
iThe row/column index.
Returns
Iterator to the first element of row/column i.

This function returns a row/column iterator to the first element of row/column i. In case the storage order is set to rowMajor the function returns an iterator to the first element of row i, in case the storage flag is set to columnMajor the function returns an iterator to the first element of column i.

template<typename PT , typename MT >
size_t blaze::DenseMatrixProxy< PT, MT >::capacity ( ) const
inline

Returns the maximum capacity of the represented matrix.

Returns
The capacity of the matrix.
template<typename PT , typename MT >
size_t blaze::DenseMatrixProxy< PT, MT >::capacity ( size_t  i) const
inline

Returns the current capacity of the specified row/column of the represented matrix.

Parameters
iThe index of the row/column.
Returns
The current capacity of row/column i.

This function returns the current capacity of the specified row/column. In case the storage order is set to rowMajor the function returns the capacity of row i, in case the storage flag is set to columnMajor the function returns the capacity of column i.

template<typename PT , typename MT >
DenseMatrixProxy< PT, MT >::ConstIterator blaze::DenseMatrixProxy< PT, MT >::cbegin ( size_t  i) const
inline

Returns an iterator to the first element of row/column i of the represented matrix.

Parameters
iThe row/column index.
Returns
Iterator to the first element of row/column i.

This function returns a row/column iterator to the first element of row/column i. In case the storage order is set to rowMajor the function returns an iterator to the first element of row i, in case the storage flag is set to columnMajor the function returns an iterator to the first element of column i.

template<typename PT , typename MT >
DenseMatrixProxy< PT, MT >::ConstIterator blaze::DenseMatrixProxy< PT, MT >::cend ( size_t  i) const
inline

Returns an iterator just past the last element of row/column i of the represented matrix.

Parameters
iThe row/column index.
Returns
Iterator just past the last element of row/column i.

This function returns an row/column iterator just past the last element of row/column i. In case the storage order is set to rowMajor the function returns an iterator just past the last element of row i, in case the storage flag is set to columnMajor the function returns an iterator just past the last element of column i.

template<typename PT , typename MT >
void blaze::DenseMatrixProxy< PT, MT >::clear ( ) const
inline

Clearing the represented matrix.

Returns
void

This function clears the matrix to its default initial state.

template<typename PT , typename MT >
size_t blaze::DenseMatrixProxy< PT, MT >::columns ( ) const
inline

Returns the current number of columns of the represented matrix.

Returns
The number of columns of the matrix.
template<typename PT , typename MT >
DenseMatrixProxy< PT, MT >::Pointer blaze::DenseMatrixProxy< PT, MT >::data ( ) const
inline

Low-level data access to matrix elements.

Returns
Pointer to the internal element storage.

This function returns a pointer to the internal storage of the dense matrix. Note that you can NOT assume that all matrix elements lie adjacent to each other! The matrix may use techniques such as padding to improve the alignment of the data. Whereas the number of elements within a row/column are given by the rows() and columns() member functions, respectively, the total number of elements including padding is given by the spacing() member function.

template<typename PT , typename MT >
DenseMatrixProxy< PT, MT >::Pointer blaze::DenseMatrixProxy< PT, MT >::data ( size_t  i) const
inline

Low-level data access to matrix elements of row/column i.

Returns
Pointer to the internal element storage.

This function returns a pointer to the internal storage for the elements in row/column i.

template<typename PT , typename MT >
DenseMatrixProxy< PT, MT >::Iterator blaze::DenseMatrixProxy< PT, MT >::end ( size_t  i) const
inline

Returns an iterator just past the last element of row/column i of the represented matrix.

Parameters
iThe row/column index.
Returns
Iterator just past the last element of row/column i.

This function returns an row/column iterator just past the last element of row/column i. In case the storage order is set to rowMajor the function returns an iterator just past the last element of row i, in case the storage flag is set to columnMajor the function returns an iterator just past the last element of column i.

template<typename PT , typename MT >
void blaze::DenseMatrixProxy< PT, MT >::extend ( size_t  m,
size_t  n,
bool  preserve = true 
) const
inline

Extending the size of the represented matrix.

Parameters
mNumber of additional rows.
nNumber of additional columns.
preservetrue if the old values of the matrix should be preserved, false if not.
Returns
void

This function increases the matrix size by m rows and n columns. Depending on the type of the matrix, during this operation new dynamic memory may be allocated in case the capacity of the matrix is too small. Therefore this function potentially changes all matrix elements. In order to preserve the old matrix values, the preserve flag can be set to true. However, note that depending on the type of the matrix new matrix elements may not initialized!

template<typename PT , typename MT >
size_t blaze::DenseMatrixProxy< PT, MT >::nonZeros ( ) const
inline

Returns the number of non-zero elements in the represented matrix.

Returns
The number of non-zero elements in the matrix.
template<typename PT , typename MT >
size_t blaze::DenseMatrixProxy< PT, MT >::nonZeros ( size_t  i) const
inline

Returns the number of non-zero elements in the specified row/column of the represented matrix.

Parameters
iThe index of the row/column.
Returns
The number of non-zero elements of row/column i.

This function returns the current number of non-zero elements in the specified row/column. In case the storage order is set to rowMajor the function returns the number of non-zero elements in row i, in case the storage flag is set to columnMajor the function returns the number of non-zero elements in column i.

template<typename PT , typename MT >
DenseMatrixProxy< PT, MT >::Reference blaze::DenseMatrixProxy< PT, MT >::operator() ( size_t  i,
size_t  j 
) const
inline

Function call operator for the direct access to matrix elements.

Parameters
iAccess index for the row. The index has to be in the range $[0..M-1]$.
jAccess index for the column. The index has to be in the range $[0..N-1]$.
Returns
Reference to the accessed value.
template<typename , bool >
BLAZE_ALWAYS_INLINE MatrixType& blaze::Matrix< typename, bool >::operator~ ( )
inlineinherited

Conversion operator for non-constant matrices.

Returns
Reference of the actual type of the matrix.
template<typename , bool >
BLAZE_ALWAYS_INLINE const MatrixType& blaze::Matrix< typename, bool >::operator~ ( ) const
inlineinherited

Conversion operator for constant matrices.

Returns
Constant reference of the actual type of the matrix.
template<typename PT , typename MT >
void blaze::DenseMatrixProxy< PT, MT >::reserve ( size_t  n) const
inline

Setting the minimum capacity of the represented matrix.

Parameters
nThe new minimum capacity of the matrix.
Returns
void

This function increases the capacity of the dense matrix to at least n elements. The current values of the matrix elements are preserved.

template<typename PT , typename MT >
void blaze::DenseMatrixProxy< PT, MT >::reset ( ) const
inline

Reset to the default initial value.

Returns
void

This function resets all elements of the matrix to the default initial values.

template<typename PT , typename MT >
void blaze::DenseMatrixProxy< PT, MT >::reset ( size_t  i) const
inline

Reset the specified row/column to the default initial values.

Parameters
iThe index of the row/column.
Returns
void

This function resets the values in the specified row/column to their default value. In case the storage order is set to rowMajor the function resets the values in row i, in case the storage order is set to columnMajor the function resets the values in column i. Note that the capacity of the row/column remains unchanged.

template<typename PT , typename MT >
void blaze::DenseMatrixProxy< PT, MT >::resize ( size_t  m,
size_t  n,
bool  preserve = true 
) const
inline

Changing the size of the represented matrix.

Parameters
mThe new number of rows of the matrix.
nThe new number of columns of the matrix.
preservetrue if the old values of the matrix should be preserved, false if not.
Returns
void

This function resizes the matrix using the given size to $ m \times n $. Depending on the type of the matrix, during this operation new dynamic memory may be allocated in case the capacity of the matrix is too small. Note that this function may invalidate all existing views (submatrices, rows, columns, ...) on the matrix if it is used to shrink the matrix. Additionally, the resize operation potentially changes all matrix elements. In order to preserve the old matrix values, the preserve flag can be set to true. However, note that depending on the type of the matrix new matrix elements may not initialized!

template<typename PT , typename MT >
size_t blaze::DenseMatrixProxy< PT, MT >::rows ( ) const
inline

Returns the current number of rows of the represented matrix.

Returns
The number of rows of the matrix.
template<typename PT , typename MT >
template<typename Other >
void blaze::DenseMatrixProxy< PT, MT >::scale ( const Other &  scalar) const
inline

Scaling of the matrix by the scalar value scalar ( $ A=B*s $).

Parameters
scalarThe scalar value for the matrix scaling.
Returns
void
template<typename PT , typename MT >
size_t blaze::DenseMatrixProxy< PT, MT >::spacing ( ) const
inline

Returns the spacing between the beginning of two rows/columns of the represented matrix.

Returns
The spacing between the beginning of two rows/columns.

This function returns the spacing between the beginning of two rows/columns, i.e. the total number of elements of a row/column. In case the storage order is set to rowMajor the function returns the spacing between two rows, in case the storage flag is set to columnMajor the function returns the spacing between two columns.

template<typename PT , typename MT >
void blaze::DenseMatrixProxy< PT, MT >::transpose ( ) const
inline

Transposing the represented matrix.

Returns
Reference to the transposed matrix.

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